texts
sequence
tags
sequence
[ "What is the best way to utilize nth-child in CSS to make it cleaner?", "I wrote this code out but it is very messy and long. I was wondering if there is a better way to use the nth-child in CSS? Or anytime you use nth-child it is always going to be messy and tedious?\n\nIs there a better way to go about what I am doing using CSS? I am not trying to use and javascript. Thanks!\n\nHere is the HTML:\n\n<table class=\"agenda\">\n <thead>\n <tr>\n <th>August 4</th>\n <th>August 5</th>\n <th>August 6</th>\n <th>August 7</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Day 1 Morning</td>\n <td>Day 2 Morning</td>\n <td>Day 3 Morning</td>\n <td>Day 4 Morning</td>\n </tr>\n <tr>\n <td>Day 1 Afternoon</td>\n <td>Day 2 Afternoon</td>\n <td>Day 3 Afternoon</td>\n <td>Day 4 Afternoon</td>\n </tr>\n <tr>\n <td>Day 1 Evening</td>\n <td>Day 2 Evening</td>\n <td>Day 3 Evening</td>\n <td>Day 4 Evening</td>\n </tr>\n </tbody>\n</table>\n\n\nHere is the CSS:\n\ntable.agenda {\n font-family: \"Trebuchet MS\", Arial, Helvetica, sans-serif;\n border-collapse: collapse;\n width: 100%;\n}\n\ntable.agenda td,\ntable.agenda th {\n border: 1px solid #fff;\n padding: 8px;\n text-align: center;\n}\n\ntable.agenda td {\n padding-top: 12px;\n padding-bottom: 12px;\n background-color: rgb(193, 212, 174);\n color: black;\n}\n\nth:nth-child(1) {\n background: rgb(16, 69, 150);\n color: white;\n}\n\nth:nth-child(2) {\n background: rgb(16, 169, 150);\n color: white;\n}\n\nth:nth-child(3) {\n background: rgb(200, 190, 150);\n color: white;\n}\n\nth:nth-child(4) {\n background: rgb(16, 19, 75);\n color: white;\n}\n\ntable.agenda tr:nth-child(1) td:nth-child(1) {\n background: rgb(16, 20, 50);\n color: white;\n}\n\ntable.agenda tr:nth-child(2) td:nth-child(1) {\n background: rgb(16, 69, 150);\n color: white;\n}\n\ntable.agenda tr:nth-child(3) td:nth-child(1) {\n background: rgb(16, 20, 50);\n color: white;\n}\n\ntable.agenda tr:nth-child(1) td:nth-child(2) {\n background: rgb(16, 200, 50);\n color: white;\n}\n\ntable.agenda tr:nth-child(2) td:nth-child(2) {\n background: rgb(16, 169, 150);\n color: white;\n}\n\ntable.agenda tr:nth-child(3) td:nth-child(2) {\n background: rgb(16, 200, 50);\n color: white;\n}\n\ntable.agenda tr:nth-child(1) td:nth-child(3) {\n background: rgb(116, 50, 50);\n color: white;\n}\n\ntable.agenda tr:nth-child(2) td:nth-child(3) {\n background: rgb(200, 190, 150);\n color: white;\n}\n\ntable.agenda tr:nth-child(3) td:nth-child(3) {\n background: rgb(116, 50, 50);\n color: white;\n}\n\ntable.agenda tr:nth-child(1) td:nth-child(4) {\n background: rgb(116, 50, 200);\n color: white;\n}\n\ntable.agenda tr:nth-child(2) td:nth-child(4) {\n background: rgb(16, 19, 75);\n color: white;\n}\n\ntable.agenda tr:nth-child(3) td:nth-child(4) {\n background: rgb(116, 50, 200);\n color: white;\n}\n\n\njsfiddle" ]
[ "css" ]
[ "SQL query to find min and & max value for a user who has at least one day with a row count of > threshold", "I have records for a user base, and I am trying to identify a kind of user who has at least 100 records per day and then determine that user's life span by finding the user's max and min time stamp. I have not been able to do that in a single query. Here's how I identify users who meet the threshold:\n\nSELECT COUNT(*) count, userid, recorddate::date \nFROM data \nWHERE datatype = 0 \nGROUP BY userid, recorddate::date \nHAVING COUNT(userid) > 100\n\n\nHowever, this only returns data for days where the count was > 100. I am interested in the max and min date for a user who had at least one day with the count > 100. Is there a way to modify this query above to get what I want or must I use a second query?" ]
[ "sql", "postgresql", "aggregate" ]
[ "Parsing PCAP file into XML file using Perl", "I'm trying to get Perl to read an offline pcap file and save the output into XML file so I can work with it in PHP.\n\nI can't use PHP because its not my server but I can Perl. So my aim is to convert the PCAP file into XML so I have fun with it.\n\nI have no idea where to start and have looked at the Perl Net::Pcap but I just don't understand the language.\n\nAny ideas on what I should do?\nThank-you\nPaul" ]
[ "php", "xml", "perl", "libpcap" ]
[ "Safety of using token claims in Firestore client side and grouping notifications", "I have already and app which is developed by Ionic-Angular and have a REST API which is developed by Nodejs and Mongodb. After hearing about Firebase, I decided to redevelop it by that.\n\nIn my old app, I used a single DB for all customers and seperate them and their data that they can read and write by a groupId. \n\nI save their groupId in their jwt token and send it in the request header to the backend. In the backend I will get this groupId and filter requested data by that groupId, or when they post or put data, I also check and use this groupId. In this case they are able just to see or change the data of their group. Also I send message by Socket.io to that specific group to update their data and have real time data.\n\nMy questions about the new app (Firebase) are:\n\n\nIs it safe to set and get data by the group_id which I get from user token in Firestore client side? (I don't like to use API because I don't have real time data anymore). Is user able to change the group_id and get the data of other groups?\nFirebase notifies all users about the changes and refresh their data to get the updates and they have real time data. In my case, I need to update the data of the specific group which its data is changed. Is it possible to do that or all users in all groups always refresh their data when changes occur in DB? \n\n\nEDITED:\n\nHere is the code sample. \nI need to know if a malicious user can change the value I send in \"where\".\nIf yes, how can I secure if with firebase rules for reading data? \n\n loadAllUnits(): Observable<Unit[]> { \n return this.db.collection(\n 'units',\n ref => ref.orderBy(\"name\")\n .where('groupId', '==', this.authService.currentUser.value.groupId)\n ) \n .snapshotChanges()\n .pipe(\n map(snaps => convertSnaps<Unit>(snaps)));\n }" ]
[ "angular", "firebase", "ionic-framework", "google-cloud-firestore", "firebase-authentication" ]
[ "Use array to pass arguments to methods", "I use this code to create db records. How I can shrink the code and use array to call one method only?\n\ncreate_acquirers(args[:count_to_create].to_i)\ncreate_companies(args[:count_to_create].to_i)\ncreate_merchant_users(args[:count_to_create].to_i)\n\ndef create_acquirers(n)\n puts \">> Creating acquirers...\"\n n.times { create(:acquirer) }\n end\n\n def create_companies(n)\n puts \">> Creating companies...\"\n n.times { create(:fake_company) }\n end\n\n def create_merchant_users(n)\n puts \">> Creating merchant users...\"\n n.times { create(:fake_merchant_user) }\n end" ]
[ "ruby" ]
[ "Find computed columns in SQL Server views", "A colleague asked me to help them to identify the views in a database that have one or more computed columns. The database has hundreds of views so they're trying to find an automated way to accomplish this task. I am not seeing the results in the database that I was expecting. Here is an example:\n\n--DROP TABLE dbo.Products\n\nCREATE TABLE dbo.Products \n( \n ProductID int IDENTITY (1,1) NOT NULL \n , QtyAvailable smallint \n , UnitPrice money \n); \n\n--DROP VIEW dbo.uvw_Products\nCREATE VIEW dbo.uvw_Products\nAS\n SELECT ProductID\n , QtyAvailable\n , UnitPrice\n , (QtyAvailable * UnitPrice) AS InventoryValue\n FROM dbo.Products;\n\n-- Look at the view and find the computed column\nSELECT OBJECT_SCHEMA_NAME(T.[object_id],DB_ID()) AS [Schema], \n T.[name] AS [table_name], AC.[name] AS [column_name], \n TY.[name] AS system_data_type, AC.[max_length], \n AC.[precision], AC.[scale], AC.[is_nullable], AC.[is_ansi_padded], AC.[is_computed]\nFROM sys.[views] AS T \n INNER JOIN sys.[all_columns] AC ON T.[object_id] = AC.[object_id] \n INNER JOIN sys.[types] TY ON AC.[system_type_id] = TY.[system_type_id] AND AC.[user_type_id] = TY.[user_type_id] \nWHERE T.[is_ms_shipped] = 0\nAND T.[name] = 'uvw_Products'\nORDER BY T.[name], AC.[column_id]\n\n\n-- Pulls up no results - no entries in sys.computed_columns\nSELECT TOP 10 * \nFROM sys.computed_columns C\nINNER JOIN sys.views V ON C.[object_id] = V.[object_id]\nWHERE V.[name] = 'uvw_Products'\n\n\nAs you can see from this simple example, SQL Server does not seem to be storing the value in the is_computed column.\n\nWhat am I missing? How can we find the computed columns in views?" ]
[ "sql-server" ]
[ "Dynamically build html table rows and columns ngrepeat", "I'm very new to angular js and I have a problem with building a html table with ngrepeat. I have to build a html table for roles and permission and in this I have to list all actions on the header part like (show, Add, Edit, Delete, Print, Email .. ) and each row I have to display the module and a check box under each action if that module has that actions. for example some module will not have a email option and for that we should not display the checkbox under that action. Please help me with this and it will be useful for my learning purpose as well. \n\n*------------------------------------------------------------* \n| Module | Show | Add | Edit | Delete | Print | Email |\n+--------------|------|------|------|--------|-------|-------+\n| Purchase | * | * | * | * | * | * |\n|--------------|------|------|------|--------|-------|-------|\n| Sales | * | * | * | * | * | * |\n|--------------|------|------|------|--------|-------|-------|\n| XXXXXX | * | * | * | * | | |\n|--------------|------|------|------|--------|-------|-------|\n| xxx-Reports | * | | | | * | * |\n*------------------------------------------------------------* \n\n* reperesents checkboxes\n\n\nI'm getting two json from the webservice, once for header and the other for Modules and actions.\n\nHeader \n\n{\"Headers\":[{\"action_id\":0,\"name\":\"list\"},{\"action_id\":1,\"name\":\"Add\"},{\"action_id\":2,\"name\":\"Edit\"},{\"action_id\":3,\"name\":\"Delete\"},{\"action_id\":4,\"name\":\"Email\"},{\"action_id\":4,\"name\":\"Print\"}]}\n\nBody\n\n{\"Purchase\":[{\"name\":\"list\",\"action_id\":0,\"status\":1},{\"name\":\"Add\",\"action_id\":1,\"status\":1},{\"name\":\"Edit\",\"action_id\":2,\"status\":0},{\"name\":\"Delete\",\"action_id\":3,\"status\":0}],\"Sales\":[{\"name\":\"list\",\"action_id\":0,\"status\":1},{\"name\":\"Add\",\"action_id\":1,\"status\":1},{\"name\":\"Edit\",\"action_id\":2,\"status\":0},{\"name\":\"Delete\",\"action_id\":3,\"status\":0}],\"DC\":[{\"name\":\"Add\",\"action_id\":1,\"status\":1},{\"name\":\"Edit\",\"action_id\":2,\"status\":0},{\"name\":\"Delete\",\"action_id\":3,\"status\":0},{\"name\":\"Email\",\"action_id\":4,\"status\":0},{\"name\":\"Print\",\"action_id\":5,\"status\":0}]}\n\n\nIf we click show check box, all other corresponding action checkbox should be checked. \n\nI have no problem in building the columns but I have no idea on how to build the rows and place checkbox on appropriate columns." ]
[ "angularjs", "html-table", "angularjs-ng-repeat" ]
[ "jQuery currency convert on checkbox click using google finance api", "I want my amount field to get updated with the converted value of the total amount (with amount I mean the sum of amount received from all checkboxes checked). For example, I have the following checkboxes.\n\n<input type=\"checkbox\" value=\"10\">\n<input type=\"checkbox\" value=\"20\">\n<input type=\"checkbox\" value=\"30\">\n\n\nThese 10, 20 and 30 (total 60) values are in USD. I want it to be converted to INR and be displayed in a div like say <div class=\"convertedAmount\">Rs.0.00</div>. For conversion I am using Google Finance API here as shown below.\n\n<?php\n$from_Currency = \"USD\";\n$to_Currency = \"INR\";\n$encode_amount = 1;\n$get = file_get_contents(\"https://www.google.com/finance/converter?a=$encode_amount&from=$from_Currency&to=$to_Currency\");\n$get = explode(\"<span class=bld>\",$get);\n$get = explode(\"</span>\",$get[1]);\n$converted_currency = preg_replace(\"/[^0-9\\.]/\", null, $get[0]);\necho $converted_currency;\n?>\n\n\nNow the problem is that I want the div value to be updated each time when checkboxes are checked or unchecked using jquery. But I have weak hands on jQuery so I am having trouble. I would be grateful if helped. Please help me." ]
[ "javascript", "php", "jquery", "html", "checkbox" ]
[ "How to pull all records from a given id in mongoDB", "I stored few data structure in the mongoDB.\nwhile storing the objects i let the mongoDB to generate the ID for me.\n\nI want to pull all the new recorded / modified ones from a given ID.\n\nBy the following i'm getting the last record in the db:\n\ndbcursor = (DBCursor) dbcollection.find().sort(new BasicDBObject(\"_id\",-1)).limit(1);\n\n\nhow i should modify the query ?" ]
[ "mongodb", "mongodb-query" ]
[ "Unity3D: Resource.Load defined AudioClip ends up Null going into the AudioSource", "What I'm trying to do is contain an audio file in a folder (under Resources) where I can drop any qualifying audio file in the specified folder and have the numerous triggers in my program read from that single point (which is why my AudioClip below is public static so I can reference it). Currently, the same audio file works throughout the program, but to change the file requires manual redefining in the Inspector which my eventual client won't have access to, and besides is tedious due to the numerous reference points that exist.\n\nHere's what I have so far:\n\npublic static AudioClip BGM;\npublic AudioSource BGMSource;\nprivate string formatted1;\n\nvoid Start()\n{\n foreach(string file in System.IO.Directory.GetFiles(Application.dataPath+\"/Resources/Audio/BGM\"))\n {\n if(file.EndsWith(System.IO.Patch.GetExtension(\".mp3\")))\n {\n formatted1 = file.Replace(\".mp3\",string.Empty);\n BGM = Resources.Load<AudioClip>(formatted1); \n //BGM = (AudioClip)Resources.Load(formatted1,typeof(AudioClip)); <--same result with this\n Debug.Log(\"found: \"+formatted1);\n }\n\n }\n if(BGM == null)\n {\n Debug.Log(\"Yeah, its null\");\n }\n\n BGMSource.PlayOneShot(BGM, .9f);\n\n if(BGMSource.isPlaying != true)\n {\n Debug.Log(\"I'm not playing\");\n }\n}\n\n\nSo as is, this just doesn't play, no error messages. Turns out BGM is null. The Debug says as so, but if I were to add a Debug call for BGMSource.clip.name, it will fully error out with a NullReferenceException on that Debug.\n\nThe Debug for the formatted1 string (File path and name), it does present the correct file called Test.mp3 (\"C:/...Resources/Audio/BGM\\Test\") formatted without the \".mp3\" as was recommended from another site. I did try with the .mp3 extension on, didn't seem to matter, still didn't play. I also tried with a .wav file and .ogg file, same result (note: all files were fine if I attached as a public AudioClip manually as also the AudioSource as written above would play in that case, but as I lead with, we don't want that for this case). Yes, all test audio files were in the directory /Resources/Audio/BGM. \n\nAnother site said something about adding to the top of the file [RequireComponent(typeof(AudioClip))] or [RequireComponent(typeof(AudioSource))]but that did nothing.\n\nLastly, this program will eventually be given to a group that won't have source access so they MUST be able to swap the audio file by dropping any .mp3 in Resources/Audio/BGM for auto play.\n\nAny help is welcome, thanks!" ]
[ "unity3d", "audio", "getfiles", "audioclip" ]
[ "Undefined index from POST form to controller in Laravel", "I have a small issue that is frustrating me a bit. \n\nIn my request that I am posting, I have the following fields, of which there are multiple rows of:\n\n<input type=\"text\" name=\"invoiceables[{{$id}}][id]\">\n<input type=\"text\" name=\"invoiceables[{{$id}}][amount]\">\n<input type=\"text\" name=\"invoiceables[{{$id}}][notes]\">\n\n\nAnd if I pull up the exception, this is how it looks as an example return:\n\ninvoiceables (array (2)):\n-- 3127 (array(3):\n---\"id\" => \"3127\"\n---\"amount\" => \"15.00\"\n---\"notes\" => \"test1\"\n\n-- 3082 (array(3):\n---\"id\" => \"3082\"\n---\"amount\" => \"25.00\"\n---\"notes\" => \"test2\"\n\n\nBut when I go to use the following in my controller, I get a \"Undefined Index: amount\" error:\n\nforeach($request->invoiceables['amount'] as $key => $val){\n $manifest = Carrier_Manifest::findOrFail($key);\n $manifest->invoices()->save($invoice,['amount'=>$request->invoiceables['amount'][$key],'notes'=>$request->invoiceables['notes'][$key]]);\n }" ]
[ "php", "laravel" ]
[ "F# - GroupBy and apply function to each property inside second tuple item", "I have a an F# list of classes for which I am using properties to access data (i'm using a library developed in C#). I would like to group by one property then apply a separate function to each property in the second item of the resulting tuple.\n\nExample:\n\nlet grouped = list |> Seq.groupBy (fun x -> x.Year) //group by the year property. Results in Seq<int * seq<myClass>>\n |> Seq.map (fun (a, b) -> (a, //How to map generic functions to each remaining property in the second tuple? \n\n\nHopefully this will make sense to someone. My second tuple item is a seq resulting from the groupBy. Each remaining property in MyClass needs to have a different function applying to it. In the past to sum a property i have just done something like:\n\n|> Seq.map (fun (a, b) -> (a, b |> Seq.SumBy (fun x -> x.myProperty)))\n\n\nI'd like to do something like this using Seq.map for several properties.\n\nMany Thanks for any help at all,\nRichard" ]
[ "map", "f#", "group-by", "seq" ]
[ "Vagrant how to force libvirt to use a different network interface", "I'm using Vagrant to define a Fedora machine with a static IP address.\n\nVagrant.configure(\"2\") do |config|\n config.vm.network :public_network, :bridge => 'enp0s25', :dev => 'enp0s25'\n config.vm.network \"private_network\", ip: \"192.168.122.1\"\n config.vm.provision \"shell\", inline: \"ifconfig\"\n config.vm.define \"fedora1\" do |fedora1|\n fedora1.vm.box = \"fedora/23-cloud-base\"\n end\nend\n\n\nThe problem is that if I try to provision the VM an error is raised:\n\n\n Call to virDomainCreateWithFlags failed: Unable to get index for\n interface eth0: No such device\n\n\nAs a matter of fact I don't have eth0 on my Fedora 21 but\n\nenp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500\n inet 10.1.71.85 netmask 255.255.255.0 broadcast 10.1.71.255\n inet6 fe80::6af7:28ff:fef3:b97d prefixlen 64 scopeid 0x20<link>\n ether 68:f7:28:f3:b9:7d txqueuelen 1000 (Ethernet)\n RX packets 1753807 bytes 1271298509 (1.1 GiB)\n RX errors 0 dropped 26 overruns 0 frame 0\n TX packets 771439 bytes 73736761 (70.3 MiB)\n TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0\n device interrupt 20 memory 0xe1200000-e1220000 \n\nlo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536\n inet 127.0.0.1 netmask 255.0.0.0\n inet6 ::1 prefixlen 128 scopeid 0x10<host>\n loop txqueuelen 0 (Local Loopback)\n RX packets 1450325 bytes 565140300 (538.9 MiB)\n RX errors 0 dropped 0 overruns 0 frame 0\n TX packets 1450325 bytes 565140300 (538.9 MiB)\n TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0\n\nvirbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500\n inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255\n ether 52:54:00:5f:e6:70 txqueuelen 0 (Ethernet)\n RX packets 0 bytes 0 (0.0 B)\n RX errors 0 dropped 0 overruns 0 frame 0\n TX packets 0 bytes 0 (0.0 B)\n TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0\n\nvirbr1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500\n inet 192.168.121.1 netmask 255.255.255.0 broadcast 192.168.121.255\n ether 52:54:00:fe:98:b5 txqueuelen 0 (Ethernet)\n RX packets 3673 bytes 403458 (394.0 KiB)\n RX errors 0 dropped 0 overruns 0 frame 0\n TX packets 2367 bytes 381415 (372.4 KiB)\n TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0\n\n\nAdding the line:\n\nconfig.vm.network :public_network, :bridge => 'enp0s25', :dev => 'enp0s25'\n\ndidn't produce any effect. Is there any solution (besides restoring the old eth0 interface) ?" ]
[ "vagrant", "libvirt" ]
[ "Automapper: Individual Member Mapping Shared Across Multiple Object Maps?", "I have a number of objects that all have a CreatedDt property. Each of these objects needs to be mapped to a matching DTO that has a Created_dt property.\n\nUsing AutoMapper, how do I set up a generic configuration to map CreatedDt to Created_dt (and vise versa) without having to do it manually for each map?" ]
[ "c#", "asp.net", ".net", "automapper" ]
[ "Reactive choice parameter to read from workspace file", "I am trying to implement active reactive choice parameter .\nIn reactive parameter basically I am hard coding the different options based on the active parameter \n\nBelow is the sample code \n\nif (Target_Environment.equals(\"Dev01\")) {\n return [\"test_DEV\"]\n} else if (Target_Environment.equals(\"Dev02\")) {\n return [\"test3_DEV02\",\"test2_DEV02\"]\n} else if (Target_Environment.equals(\"Dev03\")) {\n return [\"test3_DEV03\"]\n} else if (Target_Environment.equals(\"Sit03\")) {\n return [\"test3_SIT03\"]\n}else if (Target_Environment.equals(\"PPTE\")) {\n return [\"test3_PPTE\"]\n} \n\nelse {\n return [\"Please Select Target Environment\"]\n}\n\n\nInstead hard coding the choices I want to read from a file in jenkins workspace and show the content as the choices , what would be an ideal way to go with that ?\nThe readFile is not working under return function \n\nI am also trying with extended choice parameter but \nthere I am passing a property file with filename however how can I pass the property file with if else condition" ]
[ "jenkins" ]
[ "Get list of all intersections in a city", "What is the best source and way to get a list of all intersections in a major city?" ]
[ "google-maps", "maps", "openstreetmap", "google-places-api", "google-places" ]
[ "How do I set the chunkname of a Lua chunk?", "I'm currently using the C API call luaL_loadstring() to load a chunk, but this call doesn't have a way of naming the chunk.\n\nIs there a way of naming a chunk after it's loaded?\n\nAlternatively, I see the lua_load() function takes a chunkname parameter, but I haven't found any examples of how to use it: How can I replace a luaL_loadstring() call with lua_load()?" ]
[ "lua", "chunks" ]
[ "Elisp: Symbol's value as variable is void with let* and (lambda)", "Disclaimer: I started to hack around with elisp today.\n\nI am really wondering what I am getting the following error:\n\nSymbol's value as variable is void: response\n\n\nwith the following code:\n\n(let* ((response (cons 'dict nil)))\n (nrepl-request:eval\n code \n (lambda (resp) \n (print resp (get-buffer \"*sub-process*\"))\n (nrepl--merge response resp))\n (cider-current-connection) \n (cider-current-session)))\n\n\nMy understanding is that response is in the scope of the let* clause when called from the lambda function... but apparently that it is not.\n\nThis also seem to be working in this code\n\nSo I am a bit lost about why I am getting this error and what I should do about it." ]
[ "debugging", "emacs", "elisp", "lexical-scope" ]
[ "Merge two columns with Factors and NAs", "I have two columns with factors, I wanted to merge. As I have a lot of observations I wonder if there's a quick option with dplyr or tidyr.\n\nCol1 Col2\n A NA\n B NA\n NA C\n A A\n NA B\n A NA\n B B\n\n\nI know that this shouldn't be difficult but I'm clearly missing something here. I've tried several options but as I want to keep the factors, all the ones I know didn't work.\n\nNote that when both columns have a result, they will always be the same. But this is part of the data characteristics I have.\nI expect to have something such as:\n\nCol1 Col2 Col3\n A NA A\n B NA B\n NA C C\n A A A\n NA B B\n A NA A\n B B B" ]
[ "r", "dplyr", "tidyr" ]
[ "Importing Thawte trial certificates into a Java keystore", "I'm trying to configure a Tomcat server with SSL. I've generated a keypair thus:\n\n$ keytool -genkeypair -alias tomcat -keyalg RSA -keystore keys\n\n\nNext I generate a certificate signing request:\n\n$ keytool -certreq -keyalg RSA -alias tomcat -keystore keys -file tomcat.csr\n\n\nThen I copy-paste the contents of tomcat.csr into a form on Thawte's website, asking for a trial SSL certificate. In return I get two certificates delimited with -----BEGIN ... -----END, that I save under tomcat.crt and thawte.crt. (Thawte calls the second certificate a 'Thawte Test CA Root' certificate).\n\nWhen I try to import either of them it fails:\n\n$ keytool -importcert -alias tomcat -file tomcat.crt -keystore keys\nEnter keystore password:\nkeytool error: java.lang.Exception: Failed to establish chain from reply\n\n$ keytool -importcert -alias thawte -file thawtetest.crt -keystore keys\nEnter keystore password:\nkeytool error: java.lang.Exception: Input not an X.509 certificate\n\n\nAdding the -trustcacerts option to either of these commands doesn't change anything either.\n\nAny idea what I am doing wrong here?" ]
[ "tomcat", "ssl", "pki", "thawte" ]
[ "max and min values that can be represented with a 5-digit", "How do I find max and min values that can be represented with \na 5-digit number that is in base 13 assuming only positive integers \nare represented? then the answer needs to be in base 10. \n\ndoes 5 digit number mean 5bits? Isn't the smallest number that\ncan be represented a zero and largest is 2^(N-1)?" ]
[ "ieee-754", "data-representation" ]
[ "array.slice() to copy a new array", "var arr = [ ['hello', 'and', 'hi'], [2,3,4] ],\n arr2 = arr.slice();\narr2[1].push(44);\narr[0] = \"new value\";\n\nconsole.log(arr, arr2);\n\n//[\"new value\", [2, 3, 4, 44]]\n//[[\"hello\", \"and\", \"hi\"], [2, 3, 4, 44]]\n\n\nIsn't arr2 = arr.slice() supposed to create a new copy of arr? Therefore, arr2[1].push(44) won't effect the original arr\n\nCan anyone tell me why the console logged arr has number 44 in its second element?" ]
[ "javascript" ]
[ "mix ecto.create can't connect to Postgres even though Postgres is running and the credentials are correct", "I created a new Phoenix project and checked the credentials in config/dev.exs, which are:\nconfig :blog, Blog.Repo,\n adapter: Ecto.Adapters.Postgres,\n username: "postgres",\n password: "postgres",\n database: "blog_dev",\n hostname: "localhost",\n pool_size: 10\n\nNow, the database blog_dev does not exist, but it's my (total beginner level) understanding that mix ecto.create should create it if it does not already exist. So I ran:\nmix ecto.create\nWhich gave me the error\nlocalhost:blog alex$ mix ecto.create\nwarning: found quoted keyword "test" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes\n mix.exs:57\n\n\n18:04:24.675 [error] GenServer #PID<0.212.0> terminating\n** (DBConnection.ConnectionError) tcp recv: closed\n (db_connection) lib/db_connection/connection.ex:163: DBConnection.Connection.connect/2\n (connection) lib/connection.ex:622: Connection.enter_connect/5\n (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3\nLast message: nil\nState: Postgrex.Protocol\n** (Mix) The database for Blog.Repo couldn't be created: an exception was raised:\n ** (DBConnection.ConnectionError) tcp recv: closed\n (db_connection) lib/db_connection/connection.ex:163: DBConnection.Connection.connect/2\n (connection) lib/connection.ex:622: Connection.enter_connect/5\n (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3\n\nThis answer on StackOverflow suggests that this kind of error usually occurs when Postgres is not running. So I checked like so:\nlocalhost:blog alex$ brew services list\nName Status User Plist\npostgresql started\n\nI also considered that my credentials were incorrect, so I tried manually logging into Postgres with the credentials in config/dev.exs like so:\nlocalhost:blog alex$ psql postgres postgres -W\nPassword: \npsql (11.3)\nType "help" for help.\n\npostgres=#\n\nThe password I typed was 'postgres'. Does anyone have any suggestions about what could be going on here? Thanks!" ]
[ "postgresql", "elixir", "phoenix-framework", "ecto" ]
[ "Create a Lambda Expression With 3 conditions", "I want to create a lambda expression dynamically for this:\n\n(o => o.Year == year && o.CityCode == cityCode && o.Status == status)\n\n\nand I write this:\n\nvar body = Expression.AndAlso(\n Expression.Equal(\n Expression.PropertyOrField(param, \"Year\"),\n Expression.Constant(year)\n ),\n Expression.Equal(\n Expression.PropertyOrField(param, \"CityCode\"),\n Expression.Constant(cityCode)\n )\n ,\n Expression.Equal(\n Expression.PropertyOrField(param, \"Status\"),\n Expression.Constant(status)\n )\n );\n\n\nbut for this chunk of code:\n\nExpression.Equal(\n Expression.PropertyOrField(param, \"Status\"),\n Expression.Constant(status)\n )\n\n\nI got an error:\n\n\n Cannot convert from 'System.Linq.Expressions.BinaryExpression' to 'System.Reflection.MethodInfo'\n\n\nHow I can add 3 conditions to a lambda expression?" ]
[ "c#", "linq", "c#-4.0", "lambda", "expression-trees" ]
[ "Change hover state jQuery without using hover function?", "I have assigned a hover state to certain element using css. After a particular event I want to change that hover state using jQuery. I want to change :hover class selector that i have mentioned in css file. I knwo i can implement using .hover function but I don't want to use that because this is not suitable with my application. In my application this change in hover state is for certain time that means after that certain time I have to unbind the hover event. But in my app there are many conditional module where i need to call this unbind event. Many inefficient calls to unbind what I don't want. \n\nelem {\n width:10px;\n}\nelem:hover {\n width:20px;\n}\n\n\nI want to change width of the hover state from say 20px to 40px. I want to use something simple like .css('width','100px') but how to call this function on :hover selector." ]
[ "jquery", "css", "events", "hover" ]
[ "Method with Optional return type returns null value", "I have the two methods as defined below.\n\n public Optional<String> getSomething(final String input) throws ContainerException {\n try{\n return Optional.of(globals.getParam(GlobalsClass.Keys.SOME_ID).strict().stringValue());\n } catch(ContainerException e) {\n log.error(e);\n throw e;\n }\n }\n\n\n @Test\n public void test_get_something() {\n try {\n final Optional<String> something = client.getSomething(\"24430881\");\n if(something.isPresent()) {\n System.out.println(something.get());\n }\n } catch (ContainerException e) {\n Assert.fail(\"Should not have thrown any exception\");\n }\n }\n\n\nThe problem is that I am getting a NullPointerException for something.isPresent() as something is null. Shouldn't it be Optional.empty()? Can't get why a null value is returned by getSomething()." ]
[ "java", "nullpointerexception", "optional" ]
[ "pjax - forward and back buttons. Force full page reload?", "I'm pretty new with ajax and history states. And now I'm doing this site where I load blog posts with pjax. Something like codrops medium style transitions. Because I recreated the same effect and didn't use any of codrop's code, I can't get the back and forward buttons to work out. Or maybe I've set up the events all wrong. Or generally thought about it all wrong. \n\n// Function to refresh the .current and .next elements\nfunction refreshSelectors(){\n $blogpost_current = $('.current');\n $blogpost_next = $('.next');\n};\n\n\n$_(document).on(\"click\", \"*[data-pjax]\", function(e) {\n e.preventDefault();\n\n // Get url\n var href = $(this).attr('href');\n\n // Fade out current post\n $blogpost_current.addClass('fade-up-out');\n\n // Get the difference in height between .next and top of window\n var translateValue = $blogpost_next.get(0).getBoundingClientRect().top;\n\n // Add easing class on .next to move it to the top.\n $blogpost_next.addClass('easing-upward').css({\"transform\": \"translate3d(0, -\" + translateValue + \"px, 0\"});\n\n // Remove .next class and set it as current\n $blogpost_next.removeClass('next').addClass('current');\n\n // After 450ms\n setTimeout(function(){\n // Remove old .current post\n $blogpost_current.remove();\n\n // Remove easing-upward class on .next\n $blogpost_next.removeClass('easing-upward');\n\n // Snap it in place\n $blogpost_next.css({\"transform\": \"\"});\n\n // Scroll to top\n $body.scrollTop(0);\n $html.scrollTop(0);\n\n // Refersh selectorer\n refreshSelectors();\n\n // Create new .next section, to fill the ajax content into\n $blogpost_current.after('<section class=\"page next\"></section>')\n\n // Refersh selectorer\n refreshSelectors();\n\n // Make the pjax call\n $.pjax({url: href, container: $blogpost_next, fragment: \".next\", timeout: 2000});\n\n }, 450)\n});\n\n\nSo basically, both current and next entries are loaded on the page initially. And the content inside .next is hidden. And is only visible when the class is changed to .current. Notice that it's only when the animation is complete that the new .next is created and filled in by pjax. Maybe I should have used other events instead? And that timer in there could possibly have been put in an actual event or?\n\nOr, maybe it's easiest to have the back and forward buttons actually reload the page.\n\n$(document).on('pjax:popstate', function(event) { \n location.reload();\n});\n\n\nWhat would be the best solution? Is this handled by pjax when done correctly? Or would I have to listen to the popstate event to get the correct content? And possibly animate it the other way around?" ]
[ "history.js", "pjax", "popstate" ]
[ "C++ repeating codes with a loops", "Im not sure if this is a stupid question, so shoot me if it is!\n\nI am having this \"dilemna\" which I encounter very often. I have say two overloaded functions in C++\n\nsay we have this two overloads of F (just a pseudocode below)\n\nvoid F(A a, .../*some other parameters*/)\n{ \n //some code part\n //loop Starts here\n G1(a,.../* some other parameter*/)\n //loop ends here\n //some code part\n}\n\n\nvoid F(B b, .../*some other parameters*/)\n{\n //some code part\n //loop Starts here\n G2(b,.../* some other parameter*/)\n //loop ends here\n //some code part\n}\n\n\nwhere A and B are different types and G1 and G2 are different functions doing different things. The code part of the overloads except for G1 and G2 lines are the same and they are sometimes very long and extensive. Now the question is.. how can I write my code more efficiently. Naturally I want NOT to repeat the code (even if it's easy to do that, because its just a copy paste routine). A friend suggested macro... but that would look dirty. Is this simple, because if it is Im quite stupid to know right now. Would appreciate any suggestions/help.\n\nEdit: Im sorry for those wanting a code example. The question was really meant to be abstract as I encounter different \"similar\" situation in which I ask myself how I am able to make the code shorter/cleaner. In most cases codes are long otherwise I wouldn't bother asking this in the first place. As KilianDS pointed out, it's also good to make sure that the function itself isn't very long. But sometimes this is just unavoidable. Many cases where I encounter this, the loop is even nested (i.e. several loops within each other) and the beginning of F we have the start of a loop and the end of F we end that loop.\n\nJose" ]
[ "c++", "performance", "loops", "macros", "overloading" ]
[ "jQuery selector: this.parent, is there such a thing?", "I have a lot of div boxes with nested div .titles, with a button inside. Is there a way in jQuery to select the parent of the button? \n\nSomething like:\n\n$(\"#button\").click(function(){ \n $(\"this.parent\").css({'border-bottom' : 'none'});\n }); \n\n\nOr am I going to have to rename all of my title classes to unique classes?" ]
[ "jquery", "html", "css" ]
[ "How to use ls() correctly in specified environment?", "OK, I'm feeling stupid this AM. Consider:\n\nppenv<-new.env(parent=.GlobalEnv)\nassign('.dirhist','/Users/cgw/Rgames',ppenv)\nls(envir=ppenv)\ncharacter(0)\n exists('.dirhist',envir=ppenv)\n[1] TRUE\n get('.dirhist',envir=ppenv)\n[1] \"/Users/cgw/Rgames\"\n\n\nSo my question is: how do I determine the contents of my environment ppenv , i.e. what objects exist there?" ]
[ "r", "environment" ]
[ "how to find graph nodes based on a function?", "I'm trying to build a d3 sankey graph\nI have an array of nodes and links, but rather than using array indexes to define the links 0->1, 0->2 etc , I wanted to define links using named IDs. \nhttps://github.com/d3/d3-sankey#sankey_nodeId\n\nI've got the link names all working, however, the d3 render fails with Uncaught Error: missing: welcome. It cannot find links by id\n\nD3 graph docs talk about specifying a 'custom accessor' \nhttps://github.com/d3/d3-sankey#sankey_nodeId \n\nBut I can't figure out how to define this or pass it in.\n\nI'm using some react code to generate the graph vis\n\nhttps://codesandbox.io/s/m9vy7mr5k8?from-embed=&file=/src/MysteriousSankey.js\n\n return (\n <g style={{ mixBlendMode: \"multiply\" }}>\n {nodes.map((node, i) => (\n <SankeyNode\n {...node}\n color={color(colorScale(i)).hex()}\n key={node.name}\n />\n ))}\n {links.map((link, i) => (\n <SankeyLink\n link={link}\n key={'link-' + i}\n color={color(colorScale(link.source.index)).hex()}\n />\n ))}\n </g>\n\n\nGiven that each node does have the id defined, I'm wondering how to tell the sankey renderer the way to find node for links by ID not default offset.\nIt seems this is also used in other D3 types of graph, and is referenced in this force graph\nhttps://bl.ocks.org/mbostock/f584aa36df54c451c94a9d0798caed35\n\nvar simulation = d3.forceSimulation()\n .force(\"link\", d3.forceLink().id(function(d) { return d.id; }))\n .force(\"charge\", d3.forceManyBody())\n .force(\"center\", d3.forceCenter());" ]
[ "d3.js", "charts", "sankey-diagram" ]
[ "How to spped up a nested loop where the second loop depend on the first?", "Consider the following code:\nn = 20000\n\n\ndef f(i, j):\n\n return (i+1j*j)/(i-1j*j+1) # a sample function, not necessary this form\n\n\nlst = []\nfor i in range(n):\n for j in range(i, n):\n lst.append((i, j, f(i, j)))\n\nsince the loop is very large, I want to vectorize or speed it up. Reading other post, it seems that itertools.product can speed up loop, but in my case the second loop depend on the first, it seems I can't simply use it. Then how to speed it up?\nI can, for example, use 4 processors." ]
[ "python", "python-3.x", "numpy", "loops", "parallel-processing" ]
[ "How to use BlobStorage for Azure Web App Diagnostics logs (using SDK)", "I'm deploying an Azure Web App using the Microsoft.Azure.Management.Websites SDK. \n\nI can create the web app fine with WebSiteManagementClient.Sites.CreateOrUpdateSite(). However one element that I can't seem to configure is the Diagnostics logging. \n\nIn the new Azure Portal, I can open \"Diagnostics logs\" and define both the \"Application Logging\" and \"Web server logging\" to use Blob storage.\n\nI'm unable to see any options in the SDK libraries for configuring this - anyone have any ideas? I'm open to using ARM Templates if need be.\n\nThanks in advance" ]
[ "azure", "azure-web-app-service", "azure-storage-blobs", "diagnostics", "azure-diagnostics" ]
[ "how to change back narrow and change color in actionbar", "i want to change color in action bar and change the back narrow icon. its work when i just change the back narrow, but when i'm styling the color in actionbar, icon is gone. i want to change color of actionbar to blue color.\n\nthis is my code in xml :\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n\n\n\n<!--\n Base application theme, dependent on API level. This theme is replaced\n by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n\n\n-->\n<style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">\n <!--\n Theme customizations available in newer API levels can go in\n res/values-vXX/styles.xml, while customizations related to\n backward-compatibility can go here.\n\n -->\n</style>\n\n<style name=\"AppBaseAlternativeTheme\" parent=\"android:Theme.Holo.Light\">\n <item name=\"android:actionBarStyle\">@style/MyActionBar</item>\n</style>\n\n<!-- Application theme. -->\n<style name=\"AppTheme\" parent=\"AppBaseTheme\">\n <!-- All customizations that are NOT specific to a particular API-level can go here. -->\n</style>\n\n<style name=\"AppAlternativeTheme\" parent=\"AppBaseAlternativeTheme\">\n <!-- All customizations that are NOT specific to a particular API-level can go here. -->\n</style>\n\n<style name=\"CustomUpIndicatorTheme\" parent=\"AppAlternativeTheme\">\n <item name=\"android:homeAsUpIndicator\">@drawable/ic_up_indicator</item>\n</style>\n\n <!-- ActionBar styles -->\n<style name=\"MyActionBar\" parent=\"@android:style/Widget.Holo.Light.ActionBar.Solid\">\n <item name=\"android:background\">@color/action_bar</item>\n</style>" ]
[ "android", "android-actionbar", "styling" ]
[ "first m3u8 ts segment not working after mp4 to m3u8 conversion by node js", "index.js\nconst ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;\nconst ffmpeg = require('fluent-ffmpeg');\nconst process = require('process');\n\n\nconst args = process.argv.slice(2);\nif (args.length !== 4) {\n console.error('Incorrect number of arguments');\n process.exit(1);\n }\nconst startTime = args[0];\nconst timeDuration = args[1];\nconst inputFile = args[2];\nconst outputFile=args[3];\n\nffmpeg.setFfmpegPath(ffmpegPath);\n\nffmpeg(inputFile)\n .setStartTime(startTime)\n .setDuration(timeDuration)\n .output(outputFile)\n .outputOptions('-hls_list_size 0')\n .on('end', function(err) {\n if(!err) { console.log('conversion Done') }\n })\n .on('error', function(err){\n console.log('error: ', err)\n }).run();\n\n\n\nHere is the index.js and I'm running it by hitting the command on the terminal\nnode index.js 5 40 ./input.mp4 ./output.m3u8\nHere 5 is for starting time and 40 is the time duration in seconds. The process creates m3u8 with ts files but the first ts file isn't getting created properly. It's been created in kb format while all the other files in mb format.\n\n\n\nthe output_test0 isn't getting generated properly and so that's why while playing the m3u8 file, the first few seconds is just static picture. This issue has been happening with the first ts output only. Any trick on how to fix it?" ]
[ "node.js", "express", "ffmpeg", "fluent-ffmpeg" ]
[ "How to Play Background Music using MonoTouch While App Running", "What would be the easiest way to have a music file included in the App as looped background music while the app is running and the music pauses if the app is suspended and starts up again when the app is brought back to foreground. Don't care about playing for the devices iTunes/Music catalog just one or more included music files within the App bundle." ]
[ "c#", "ios5", "xamarin.ios", "background-music" ]
[ "JavaFX is there anyway to set the two colors of a selected treeview item using css", "Is there any way to change the color of a selected TreeView item, instead of the default red and blue color that shows when a TreeItem is selected" ]
[ "java", "javafx", "scenebuilder", "jfoenix" ]
[ "Why are my loop-generated Keras sequential models all exactly the same?", "I would like to train multiple models all with the same hyper-parameters until I get one that is is sufficiently accurate. I expect slight deviations in performance due to the initial weights being randomly set when the model is created.\n\nEach time I ru my program the first CNN has a different accuracy, as I would expect. However subsequent CNNs all perform exactly the same as the first CNN. I am clearing the keras session, and 'deleting' the model at every iteration. I am not setting any random seeds to fixed values.\n\nHere is the section of code where I generate the networks (in Python 3.6)\n\ndef reset_weights(model):\n session = keras.backend.get_session()\n for layer in model.layers: \n for v in layer.__dict__:\n v_arg = getattr(layer,v)\n if hasattr(v_arg,'initializer_run'):\n initializer_method = getattr(v_arg, 'initializer')\n initializer_method.run(session=session)\n print('reinitializing layer {}.{}'.format(layer.name, v))\n\ndef train_models(input_dir, output_dir, roi_file):\n error = 1.0\n roi_info = read_ROI_file(roi_file)\n x_data, y_data = generate_data_set(input_dir, roi_info)\n\n while (error > 0.001):\n keras.backend.clear_session()\n the_net = define_model()\n reset_weights(the_net)\n the_history = train_model(the_net, x_data, y_data, num_epochs=100)\n error = the_history.history['val_loss'][-1]\n print(\"Model accuracy : {:7.5f}\".format(error))\n if error < 0.002:\n the_time = datetime.now()\n net_name = os.path.join(output_dir, \"bayer_net_{:s}_acc={:7.5f}\".format(\n the_time.strftime(\"%Y-%m-%d_%H-%M-%S\"), error))\n print(\"Saved as: {:s}\\n\\n\".format(net_name))\n\n the_net.save(\"{:s}.h5\".format(net_name))\n plot_history(the_history, \"{:s}.png\".format(net_name)) \n else:\n print (\"Not saving the model.\\n\\n\")\n the_net = None" ]
[ "python", "keras", "neural-network", "conv-neural-network" ]
[ "Delay spring xml imports", "I have an application where I have to read all application properties from properties files. Then override them from a external cache framework. Then initialize spring beans.\n\nI am using Java Config of spring to read properties and override them. And using @import to load xml files. But xml files import as soon as context starts loading, resulting all the xml beans being initialized.\n\nSo is there a way I can delay xml files import until I load all the properties first?" ]
[ "spring", "spring-java-config" ]
[ "No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation", "I'm running Ubuntu 15.10.\n\nSo, I just uploaded the Android Studio from the site. \nAfter that I unpacked the zip file.\nWent to android-studio/bin and found studio.sh.\nSit permission to be executed chmod +x studio.sh.\nRan the file to install with this line: ./studio.sh.\nThen I had the error \n\nNo JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.\n\n\nI have already netbeans installed. I just ran the instalation package file JDK + Netbeans, so it was supposed to have java environments variables sit.\n\nIf I run pintenv the PATH environment variable do not hold the path to java. This is what I have:\n\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games \n\n\nSo, how can I find the location where Java was installed? I could set the PATH variable manually.\n\nAny idea how to solve this issue?" ]
[ "java", "linux", "ubuntu", "path", "environment-variables" ]
[ "gitlab cloud CI: how to increase memory for shared runner", "My Gitlab CI jobs fail because of RAM limitations.\nPage https://docs.gitlab.com/ee/user/gitlab_com/index.html says:\n\nAll your CI/CD jobs run on n1-standard-1 instances with 3.75GB of RAM, CoreOS and the latest Docker Engine installed.\n\nBelow it says:\n\nThe gitlab-shared-runners-manager-X.gitlab.com fleet of runners are dedicated for GitLab projects as well as community forks of them. They use a slightly larger machine type (n1-standard-2) and have a bigger SSD disk size. They don’t run untagged jobs and unlike the general fleet of shared runners, the instances are re-used up to 40 times.\n\nSo, how do I enable these n1-standard-2 runners (which have 7.5 GB RAM)? I've read the docs over and over but can't seem to find any instructions." ]
[ "gitlab", "gitlab-ci" ]
[ "Windows Phone 8 / Cordova / jQuery .find()", "Has anyone had problems with Corodova 2.5.0 and jQuery 1.8.x / 1.9.1 when using jQuery.find() ? It seems that find() returns empty objects.\n\nThis was my starting point:\n\nhtml\n\n...\n\n<ul id=\"here\">\n</ul>\n\n\njavascript\n\n ..\n\n$('#here').append('<li data-test=\"test1\">first</li>');\n$('#here').append('<li data-test=\"test2\">second</li>');\n$('#here').append('<li data-test=\"test3\">third</li>');\n\nvar lis = $('#here').find('li');\nconsole.log(lis);\n$.each(lis, function (ind, rec) {\n console.log(rec);\n});\n\n\nconsole displays: \n\nlog: {}\nlog: {}\nlog: {}\n\n\nSame code is fully functional in desktop browsers - without cordova :)" ]
[ "jquery", "cordova", "windows-phone-8" ]
[ "Arrow and tab keys not working in sbt 1.0.3 console", "When running sbt console with Scala 2.12.4, sbt 1.0.3, MacOS 10.13.1, the arrow keys output codes like ^[[A rather than retrieving the last command and tab outputs a tab character rather than autocompete. If I directly run the Scala REPL or run sbt and then from the sbt command line enter console, then these keys operate as expected. So I can work around this issue, it's just annoying. I suspect there is some piece of configuration that I'm missing I just haven't been able to find it yet." ]
[ "sbt" ]
[ "Error while configuring routes in Angular 2", "i have been working with a product list Project and while configuring routes to navigate between different views, I get a red squiggly under the '@Routes' decorator and when i hover over the Routes, it says 'Routes only refers to a type, but is being used as a value here'. I researched in so many sights including here and tried many different ways to resolve this but I could not find out the issue.\n\napp.component.ts \n\n\n\nimport { Component } from '@angular/core';\nimport { ProductListComponent } from './products/product-list.Component';\nimport { ProductService } from './products/product.service'\nimport { Routes } from '@angular/router';\nimport 'rxjs/Rx'; // Load all features\nimport { WelcomeComponent } from './home/welcome.component'\n@Component({\nselector: 'pm-app',\ntemplate: `\n <div>\n <nav class='navbar navbar-default'>\n <div class='container-fluid'>\n <a class='navbar-brand'>{{pageTitle}}</a>\n <ul class='nav navbar-nav'>\n <li><a>Home</a></li>\n <li><a>Product List</a></li>\n </ul>\n </div>\n </nav>\n </div> \n ` , \n entryComponents : [ProductListComponent],\n providers: [ProductService]\n})\n\n@Routes([\n{ path: '/welcome' , name: 'Welcome' , component: WelcomeComponent, useAsDefault: true},\n{ path: '/products' , name: 'Products' , component: ProductListComponent }\n\n])\n\nexport class AppComponent {\n\npageTitle:string = 'Acme Product Management';\n}\n\n\napp.module.ts\n\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { FormsModule } from '@angular/forms';\nimport { ProductListComponent } from './products/product-list.Component';\nimport { HttpModule } from \"@angular/http\";\nimport { RouterModule } from '@angular/router'\n\nimport { ProductFilterPipe } from './products/product-filter.pipe';\nimport { StarComponent } from './shared/star.component';\n\nimport { AppComponent } from './app.component';\n\n@NgModule({\nimports: [ BrowserModule,FormsModule,HttpModule,RouterModule],\ndeclarations: [ AppComponent,ProductListComponent,ProductFilterPipe,StarComponent],\nbootstrap: [ AppComponent ]\n})\nexport class AppModule { }\n\n\nwelcome.compnent.ts\n\nimport { Component } from '@angular/core';\n\n@Component({\ntemplateUrl: 'app/home/welcome.component.html'\n})\nexport class WelcomeComponent {\npublic pageTitle: string = 'Welcome';\n}\n\n\nI think my coding is fine. But unable to get the expected result. Please Help!" ]
[ "angular2-routing" ]
[ "open .sql file in jupyter text editor", "I'm using a jupyter server and for some reason any .sql that I open is downloaded instead of opened in the text editor. As far as I can tell it's only .sql files that are treated this way, any other file extension is opened by the text editor. Changing the file extension from .sql to anything else will solve the problem, but I want to keep the file extension for syntax highlighting in jupyter and other text editors. Is there a config file somewhere that controls the default file open action?\n\nI'm using jupyter 1.0.0\nUbuntu 16.04 (server and client)\nbehavior observed in chrome and firefox\n\nupdate:\nit looks related to this issue https://github.com/jupyter/notebook/issues/1408\nAlso upgrading the notebook package to 5.0.0 adds an edit button to the options effectively fixing the issue. But the underlying problem is still there, you can see that by inspecting the .sql link, it's still a file link not an edit link.\n\nto upgrade your notebook use conda update notebook" ]
[ "jupyter" ]
[ "Module not found error in Jenkins while trying to run wdio from docker image", "I am using webdriverio . My package.json is having all my dependency. I have created a docker image for my project throught Jenkins using a docker file. Now I am trying run the scripts from Jenkins. It is failing saying module not found. For example in config file I have used var json=require('cjson') . Same has been installed in docker image . But when I run through Jenkins it fails saying module cjson not found" ]
[ "docker", "jenkins", "package.json", "wdio-v5" ]
[ "TargetInvocationException when serializeing with sharpSerializer", "I am trying to serialize with sharpSerializer. But i get TargetInvocationException and InnerException as UnauthorizedAccessException: Invalid cross-thread access.\n\nHere my code for serializing\n\npublic static async Task Save<T>(this T obj, string file)\n{\n await Task.Run(() =>\n {\n IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();\n IsolatedStorageFileStream stream = null;\n\n try\n {\n stream = storage.CreateFile(file);\n var serializer = new SharpSerializer();\n serializer.Serialize(obj, stream); // Exception occurs here\n }\n catch (Exception)\n {\n }\n finally\n {\n if (stream != null)\n {\n stream.Close();\n stream.Dispose();\n }\n }\n });\n}\n\n\nI'm serializing in App.xaml.cs \n\nprivate void Application_Closing(object sender, ClosingEventArgs e)\n{\n hs_layout.Save(\"layout.xml\");\n}\n\n\nType of hs_layout\n\npublic static List<Homescreen> hs_layout = new List<Homescreen>();\n\n\nHomescreen class\n\npublic class Homescreen \n {\n public List<UIElement>[ , ] Main { get; set; }\n public List<UIElement>[ ] Dock { get; set; }\n\n public Homescreen()\n {\n Main = new List<UIElement>[5, 4];\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n Main[i, j] = new List<UIElement>();\n }\n }\n\n Dock = new List<UIElement>[5]; \n for (int j = 0; j < 5; j++)\n {\n Dock[j] = new List<UIElement>();\n }\n }\n }" ]
[ "c#", "serialization", "windows-phone-8" ]
[ "Java OpenCSV How to edit specific cells from csv file", "I have a CSV file which looks like this:\nhttp://gyazo.com/5dcfb8eca4e133cbeac87f514099e320.png\n\nI need to figure out how I can read specific cells and update them in the file.\n\nThis is the code I am using:\n\nimport java.util.List;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\nimport com.opencsv.*;\n\npublic class ReadCSV {\n\n private static final char SEPARATOR = ';';\n\n public static void updateCSV(String input, String output, String replace, int row, int col) throws IOException { \n\n CSVReader reader = new CSVReader(new FileReader(input),SEPARATOR);\n List<String[]> csvBody = reader.readAll();\n csvBody.get(row)[col]=replace;\n reader.close();\n\n CSVWriter writer = new CSVWriter(new FileWriter(output),SEPARATOR,' ');\n writer.writeAll(csvBody);\n writer.flush();\n writer.close();\n }\n\n\n public static void main(String[] args) throws IOException {\n\n String source = \"townhall_levels.csv\";\n String destiantion=\"output.csv\";\n ReadCSV.updateCSV(source, destiantion, \"lol\", 1, 1);\n\n }\n\n}\n\n\nIn this code I am just trying to change A1 to \"lol\" as an example test to see if it works but I get the following error:\n\nException in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: 1\n at ReadCSV.updateCSV(ReadCSV.java:16)\n at ReadCSV.main(ReadCSV.java:30)\n\n\nHow should I go about achieving my goal and fixing the error?\n\nCSV File: www.forumalliance.net/townhall_levels.csv" ]
[ "java", "opencsv" ]
[ "How to get that the limit exceeded when I use limit() on a range of items from stream using Java 8 lambda?", "How should I know without using another condition to compare the map.size() with limitValue, that the limit was exceeding when my stream iterated?\nHere,\n for limitValue = 3, it should return false.\n for limitValue = 4, it should return true.\nI can not use an outside int field as it must be final to be used inside lambda.\n\nimport java.util.*;\nimport java.util.stream.*;\npublic class Test {\n\n public static void main(String[] args) throws Exception {\n Map<Integer, String> map = new HashMap<>();\n map.put(1, \"foo\");\n map.put(2, \"bar\");\n map.put(3, \"baz\");\n int limitValue = 3;\n\n String result = map.entrySet()\n .stream()\n .limit(limitValue)\n .map(entry -> entry.getKey() + \" - \" + entry.getValue())\n .collect(Collectors.joining(\", \"));\n System.out.println(result);\n }\n}" ]
[ "java-8" ]
[ "Add user id and password to edmx", "I have added edmx file using my windows credentials. Latter I wanted to change the connection string to a specific user ID and password. I have updated the web.Config and updated the emdx file. When I look at SQL profiler its still using windows credentials rather than connect with the userid and password. \nAm I missing something." ]
[ "entity-framework", "asp.net-mvc-4", "visual-studio-2013", "web-config", "edmx" ]
[ "Redirect to some page using AngularJs while closing bootstrap modal", "I am using bootstrap modal. \n\n<div class=\"modal fade\" id=\"myModal\" role=\"dialog\">\n <div class=\"modal-dialog\">\n\n <!-- Modal content-->\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button>\n <h4 class=\"modal-title\">Login History</h4>\n </div>\n <div class=\"modal-body\">\n <fieldset class=\"scheduler-border\">\n <legend class=\"scheduler-border\" style=\"color: #4682B4\">Message</legend>\n <div>\n Total Unsuccessful login attempts : 0\n <br>\n <br>\n Last Successful login attempt : <br />\n Datetime : 27-7-2015 10:25:52<br />\n Access IP Address ::1<br />\n User Name : {{UserName}}<br />\n <br>\n Last Unsuccessful login attempt : <br />\n NONE\n </div>\n </fieldset>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n </div>\n </div>\n\n\nOn click of login button I open the modal using Jquery.\n\nNow once modal is hide(either by clicking on Close button or by clicking outside modal) I need to redirect to some other page\n\nHow can I do that.\n\nBelow is my code.\n\nJITManagementApp.controller('AuthenticationController',\nfunction AuthenticationController($scope, $location) {\n $scope.UserName = \"amit\";\n\n $scope.Login = function() {\n $('#myModal').modal('show');\n $('#myModal').on('hidden.bs.modal', function () {\n $location.path(\"/manageSite\");\n })\n }\n\n\n});\n\nCode to redirect is \n\n $location.path(\"/manageSite\");\n\n\nbut still it is not redirecting to manageSite ?" ]
[ "angularjs", "twitter-bootstrap" ]
[ "SSIS 2012 - Package deployment: CreateDeploymentUtility property not visible in project properties", "I have a SSIS 2012 project with many packages to deploy to a server.\nAs written here I have to create a Deployment Utility but in my project properties there is no Deployment Utility submenu..." ]
[ "ssis", "ssis-2012" ]
[ "how to read/write file from hard disk using firefox addon?", "Is it possible to develop a Firefox addon that can read/write a file from hard disk? What code should I use?" ]
[ "javascript", "firefox-addon" ]
[ "Write filter condition in StrongLoop with [and] and [or] conditions together", "I'm trying to filter data using \"and\" and \"or\" conditions. I would like to get this mySql query:\n\nSELECT * FROM `data` WHERE ((`property1`=11) OR (`property1`=13)) AND (`property2`=6)\n\n\nThe rest api filter that I wrote is like this:\n\nfilter[where][and][0][or][0][property1]=11&filter[where][and][0][or][1][propert‌​y1]=13&filter[where][and][1][property2]=6\n\n\nI have an error like this:\n\nER_BAD_FIELD_ERROR: Unknown column '[property1]' in 'where clause'\n\n\nWhy i have an error?" ]
[ "mysql", "node.js", "loopbackjs", "strongloop" ]
[ "how to optimize windows phone nested list box?", "here is my data source type\n\npublic class Part\n{\n public int PartNumber { get; set; }\n public string ar_PartNumber { get; set; }\n public List<PartSuras> PartSuras { get; set; }\n public int PageNumber { get; set; }\n public string ar_PageNumber { get; set; }\n\n}\n\npublic class PartSuras\n{\n public int SuraID { get; set; }\n public string ar_SuraID { get; set; }\n\n public string SuraTitle { get; set; }\n public string SuraTitleEn { get; set; }\n public int StartVerseID { get; set; }\n public int PageNumber { get; set; }\n public string ar_PageNumber { get; set; }\n}\n\n\nand here is the nested listboxs\n\n <ListBox Loaded=\"list_Index_Loaded\" Name=\"list_Index\" HorizontalAlignment=\"Stretch\" Margin=\"-12,-40,-12,0\" VerticalAlignment=\"Top\" ScrollViewer.VerticalScrollBarVisibility=\"Disabled\">\n <ListBox.ItemTemplate >\n <DataTemplate>\n <StackPanel HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Top\">\n <Button HorizontalAlignment=\"Stretch\" Width=\"480\" BorderBrush=\"#FFCADBBD\" Margin=\"0,-12\" BorderThickness=\"0,0,0,2\" Background=\"#FFD2BC70\" Foreground=\"Black\" Name=\"bt_part\" Tag=\"{Binding PageNumber}\" Tap=\"bt_part_Tap\" >\n <TextBlock HorizontalAlignment=\"Stretch\" TextAlignment=\"Center\">\n <Run Text=\"الجزء \"></Run>\n <Run Text=\"{Binding ar_PartNumber}\"></Run>\n </TextBlock>\n </Button>\n <ListBox Name=\"list_sura\" ItemsSource=\"{Binding PartSuras}\" ScrollViewer.VerticalScrollBarVisibility=\"Disabled\">\n <ListBox.ItemTemplate>\n <DataTemplate>\n <Button HorizontalAlignment=\"Stretch\" Width=\"480\" Margin=\"0,-12\" BorderThickness=\"0,0,0,2\" Background=\"#FFE5DCAA\" Foreground=\"Black\" Name=\"bt_part\" Tag=\"{Binding PageNumber}\" Tap=\"bt_part_Tap\" >\n <Grid Width=\"430\" HorizontalAlignment=\"Stretch\">\n <Grid.ColumnDefinitions>\n <ColumnDefinition></ColumnDefinition>\n <ColumnDefinition></ColumnDefinition>\n </Grid.ColumnDefinitions>\n <TextBlock Grid.Column=\"0\" HorizontalAlignment=\"Stretch\" TextAlignment=\"Left\">\n <Run Text=\"{Binding ar_SuraID}\"></Run>\n <Run Text=\"-\"></Run>\n <Run Text=\"{Binding SuraTitle}\"></Run>\n </TextBlock>\n <TextBlock Grid.Column=\"1\" HorizontalAlignment=\"Stretch\" TextAlignment=\"Right\" Text=\"{Binding ar_PageNumber}\"></TextBlock>\n </Grid>\n\n </Button>\n </DataTemplate>\n </ListBox.ItemTemplate>\n </ListBox>\n\n\nthis is kind of slow it takes almost 3 secs to only build the listboxes -i meseured the time of build the data source and it's okay- in Lumia 920 (1 GB ram) device, how can i optimize that?\n\nwould the performance be better if i removed the listboxes and created the controls in code behind?" ]
[ "windows-phone-8", "windows-phone" ]
[ "Hive: Extract Data From Nested JSON and Append", "I have a hive table with IDs and JSON such as below:\n\nid json\n----------\n21 | {\"temp\":\"3\",\"list\":[{\"url\":\"aaa.com\"},{\"url\":\"bbb.com\"}]}\n42 | {\"temp\":\"2\",\"list\":[{\"url\":\"qqq.com\"},{\"url\":\"vvv.com\"}]}\n\n\nThe desired output is such as below:\n\nid url\n----------\n21 | aaa.com\n21 | bbb.com\n42 | qqq.com\n42 | vvv.com\n\n\nWould anyone help with this hive query?\n\nApplying explode() directly does not work as json column is a string." ]
[ "sql", "json", "hive", "hql", "cross-join" ]
[ "Wcf time out exception, occurs irregularly on one server", "Error code:\"\nThe request channel timed out while waiting for a reply after 00:09:59.6320000. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding.\"\n\nThis error occurs infrequently when calling a Wcf service methods. It doesn't matter what method is. I have created test methods that returns simple strings. Sometimes it times out, sometimes it works perfectly. The strange thing is that when the WCF service is published on one server(for testing purposes)- there is no timeout. When I publish it on another server(live/public) there occurs these timeouts infrequently. I have set the timeout to 10 min as you could see above.\n\nThe webconfig setting should be correct, because it works for the one server. The only change made is the ip address. I know this is very difficult to answer and a bit ambiguous.\nI'm sure this problem is too high level for me to solve, or maybe I'm making a simple mistake and it is too obvious for me to notice. If you could give me a pointer or just friendly advice on this problem I would really really appreciate it. I am shooting in the dark here. I thank you for your interest, proved by you reading up to here." ]
[ "wcf", "timeout" ]
[ "dynamically created table doesn't recognize unordred list tags", "when i try to place an unorderd list fetched from the database column, into a dynamically created row of a table(using createElement) it shows the list tags along with the data. but doesn't appear formatted.\n\nhere is the code\n\nvar table1 = document.getElementById('pc');\n\nfor (var x = 1; x < len; x++) {\n var vals = result[x];\n var row = document.createElement('tr');\n row.textContent = vals;\n table.appendChild(row);\n\n}\n\n\nresult is from ajax and it has the lists." ]
[ "javascript", "php", "html", "mysql", "ajax" ]
[ "How to update cell Data using Hibernate SQL query", "I have a table 'users', with many columns, among them two are 'Username' and 'Password'\nusername is primary key column\n\nI want to update password for a username. here is my code it is working fine (no error or exception) but not updating password.\n\nI am new to Hibernate and do not know much of its syntax. please help me\n\n String query = \"UPDATE users SET Password = '\"+ newPassword +\"' WHERE Username = '\"+ login.getUsername() + \"'\";\n\n session.createSQLQuery(query);\n\n\nlogin.getUsername() is getting required username correctly\n\nRest of code is working fine problem is in above code." ]
[ "sql", "hibernate", "hql" ]
[ "How do I select values of an object two levels deep using LINQ?", "I have the following classes:\n\nForm\n\npublic class Form\n {\n public string id { get; set; }\n public IEnumerable<Section> sections { get; set; }\n }\n\n\nSection\n\npublic class Section\n {\n public int id { get; set; }\n public string name { get; set; }\n public bool validated { get; set; }\n public IEnumerable<Question> questions { get; set; }\n }\n\n\nQuestion\n\npublic class Question\n{\n public int id { get; set; }\n public int required { get; set; }\n}\n\n\nI want to be able to search through the questions found in each section held within the form, check whether or not Required is set to 1 or 0, and pull back each question that is required.\n\nI'm really not sure how to do this. At the moment I have this:\n\nList<Question> requiredQuestions = \n root.form.sections\n .Where(x => x.questions.Where(y => y.required == 1))\n\n\nBut this code above is giving syntax errors. I'm still finding Linq somewhat confusing, can someone help with this please." ]
[ "c#", "linq" ]
[ "Virtualized TreeView - Unstable behaviour while scrolling", "Following this question and this question, now I have a TreeView with Hierarchical Data like the picture below:\n\n\n\nBecause of the big amount of data, I have turned Virtualization property of the TreeView on (VirtualizingPanel.IsVirtualizing=\"True\").\n\nNow the problem is: scrolling the tree is very unstable. I try to explain the unexplainable behaviour:\n\n\nWhile scrolling, the items get just disappeared / unloaded. With WPF Inspector, I actually see, that they get continously unloaded and loaded again.\nWhile scrolling through items of level3, the tree doesn't load the items which are still not loaded (as expected), but the next level2 item jumps up, on top of the visible levels 3 items. \n\n\nNotes:\n\n\nScrolling works normal, when all Level2 Items are collapsed. \nTurning off virtualization solves the scrolling problem (but of course I have loading problem in this case)\nI have read here, that this bug is fixed in .Net 4.5.2. I even tried .Net 4.7.1. The behaviour remained the same. \n\n\nIs there any way that I can avoid this behaviour?" ]
[ ".net", "wpf", "treeview", "virtualization", "smooth-scrolling" ]
[ "Glide throwing 'java.lang.SecurityException' while loading profile picture URL from Firebase", "I am getting following error message while loading profile picture of a firebase user from firebaseUser.getPhotoUrl() method (Note: Im using Glide to load picture from URI).\n\nCaused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{ccece88 5351:joseph.benton.viqua/u0a122} (pid=5351, uid=10122) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs\n\n\nI checked the return vale of firebase.getPhotoUrl() method and its vale is\n\n\n content://com.android.providers.media.documents/document/image%3A10337\n\n\nThis is my code snippet\n\nFirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();\n\nif(user!=null){\n try {\n Glide.with(context)\n .load(user.getPhotoUrl())\n .apply(new RequestOptions()\n .placeholder(R.drawable.ic_account_circle_white_48dp)\n .diskCacheStrategy(DiskCacheStrategy.NONE)\n .skipMemoryCache(true))\n .into(imgAccount);\n } catch (IOException e) {\n e.printStackTrace();\n }\n}" ]
[ "android", "firebase", "firebase-authentication", "android-glide", "storage-access-framework" ]
[ "VirtualPath in AspNetCompiler MSBuild Task - does it have to be equal to the final deployed Virtual Path?", "This is VS 2008 and .Net 3.5.\n\nI use a custom deployment project script which is similar to the publish right-click menu, but which I have customised to do file renaming and various other bits and pieces. It works really well and has drastically simplified the release procedure.\n\nI was made aware of an issue on one of our live sites this weekend that would have been prevented had the site been precompiled (long story).\n\nSo I've been playing around with injecting the AspNetCompiler MSBuild Task (using the PhysicalPath attribute to direct towards the intermediate publish folder) into the deployment script and I have a question regarding the 'VirtualPath' option.\n\nDespite the fact that the website is not in IIS at this pre-deploy stage, you are still required to provide a value for the 'VirtualPath' attribute. I have seen here that the associated -v switch on aspnet_compiler.exe uses this value in resolving '~' rooted virtual paths used throughout the site during the compilation.\n\nSo, I take this to mean that whatever you pass here must be the virtual root of the application when deployed otherwise it won't work. \n\nHowever, I've tried this out, passing something like '/fake/fake' in this option and then changing one of my master pages to reference a css via an app-rooted url instead of relative, and it still worked even when deployed to a virtual path of '/site' and not '/fake/fake'.\n\nSo what's the definitive answer on this? Do I need to worry about this VirtualPath value being exactly equal to the eventual deployed location of a site in IIS? I hope not, because I don't really want my deploy project to have any knowledge of the virtual hierarchy of the target web server, in case it needs to change." ]
[ ".net", "asp.net", ".net-3.5", "web-deployment" ]
[ "MKMapKit Framework in iOS I need pay?", "Hi I need develop an iOS app that use MKMapKit Framework and I need add Annotations and the question is, this has any cost? I don't know if I need buy a key for use this framework." ]
[ "ios", "mapkit" ]
[ "How to run J2ME application directly on the mobile from NetBeans?", "Can I run J2ME application on mobile directly the way we can run an Android application directly on the mobile from eclipse? I just want to avoid to run it on the emulator. As in the emulator it is giving some error and I can't solve it.\n\nAnd also which is the best suitable emulator and NetBeans version to develop J2ME application?\n\nPN: I am new to J2ME as I am Android Developer." ]
[ "android", "netbeans", "mobile", "java-me", "emulation" ]
[ "Show specific attachment using json api for Wordpress", "When I go to:\n example.com/api/get_tag_posts/?dev=2&slug=ME3022&include=attachments\n\nI see: \n\n{\n status: \"ok\",\n count: 1,\n pages: 1,\n tag: {\n id: 17,\n slug: \"me3022\",\n title: \"ME3022\",\n description: \"\",\n post_count: 1\n},\nposts: [\n {\n id: 181,\n attachments: [\n{\nid: 397,\nurl: \"http://example.com/files/2012/10/WebInstruction_TCH.pdf\",\nslug: \"webinstruction_tch-3\",\ntitle: \"Traditional Chinese\",\ndescription: \"\",\ncaption: \"Traditional Chinese\",\nparent: 181,\nmime_type: \"application/pdf\"\n },\n{\nid: 398,\nurl: \"http://example.com/files/2012/10/WebInstruction_SCH.pdf\",\nslug: \"webinstruction_sch-3\",\ntitle: \"Simplified Chinese\",\ndescription: \"\",\ncaption: \"Simplified Chinese\",\nparent: 181,\nmime_type: \"application/pdf\"\n},\n\n\nWhat I want to show is a specific attachment instead of all of the attachments. How can I do that?" ]
[ "json", "wordpress" ]
[ "How to hide circular compass icon on MKMapview in iOS", "I want to hide the circular compass icon on MKMapview which appears when a user rotates the map. I have attached a screen shot for reference. I don't want to display the circular compass icon but I do want to allow rotation on the map." ]
[ "ios", "mkmapview" ]
[ "Copy consolidated row data from multiple worksheets where a specific column is populated", "I'm looking to copy a range of data from multiple worksheets to a single Summary sheet based upon a specific column being populated.\n\nI'm using the code found on the link :\nhttps://msdn.microsoft.com/en-us/library/cc793964(v=office.12).aspx\nunder the section entitled 'Copying All Data Except Column Headers from Multiple Worksheets'\n\nIt works although I've been trying to modify the code so that instead of copying the whole sheet, it copies only rows in which column 'N' is populated.\n\nI disabled the line of code that sets CopyRng to the whole sheet and introduced a For loop to check the N column - I got the program to return any values which were present inside Column N across all the sheets but I need to return the entire rows of these instances.\n\nHere is my modified code for the section in question :\n\n ' If source worksheet is not empty and if the last\n ' row >= StartRow, copy the range.\n If shLast > 0 And shLast >= StartRow Then\n\n 'Set the range that you want to copy\n 'Set CopyRng = sh.Range(sh.Rows(StartRow), sh.Rows(shLast))\n\n\n For Each cell In sh.Range(\"N4:N4\")\n If (cell.Value <> \"\") Then\n\n Set CopyRng = '(trying to copy the entire row here..)\n\n End If\n Next\n\n\nCould anyone help in regard to how I would go about setting CopyRng return the entire row?\n\nthanks" ]
[ "vba", "excel" ]
[ "Error IM004 when using ODBC to access SQL Server", "I'm developing an MFC project and using ODBC to connect to a SQL Server 2008 server. Each time when I'm about to read from or write to the database, I always construct a CXXX (as a class derived from CRecordset and have bound all useful fields by RDX) object, open it, operate the database, and close it.\nHowever, after about 1000 such operations, the ODBC driver reports error, which has a SQLSTATE:IM004 in it, and refuse to work from then on.\nFrom the error string, I learned that it is due to environment handle allocation error. But I don't know what it is, or why it is.\nPlease explain this to me and give me some advice about how to pinpoint the problem. Thank you." ]
[ "sql-server", "mfc", "odbc" ]
[ "add a new column in Impala to update complex type", "I have a table with complex types in it's schema for instance:\naddress ARRAY<STRUCT<street:STRING, state:STRING, names:ARRAY<STRING>, zip:INT>>\n\nI wonder how I can change it to\naddress ARRAY<STRUCT<street:STRING, city:STRING, state:STRING, names:ARRAY<STRING>, zip:INT>>\n\nwith an alter query?" ]
[ "sql", "hadoop", "hive", "impala" ]
[ "convert large values of string to number laravel. (int) gives wrong value", "When I do:\n\n$var = (int)('5000');\ndd($var); //outputs 5000\n\n\n$query = Mymodel::find($id);\ndd($query->loan_amount); //outputs \"1,040,000.00\"\n\n\nAlso:\n\n$var = (int)($query->loan_amount);\ndd($var); //outputs 1\n\n\nAnd finally:\n\n$query = Mymodel::find($id);\ndd($query->loan_amount); //outputs the picture below\n\n\n\n\nMay I know why? And how do I fix the large numbers?" ]
[ "php", "laravel", "numbers" ]
[ "Best Approach for Cloning database records using SPs", "I have to write code to clone a database entry with associated data in other tables and assign it a new ID. Simplified I have a MAIN Table with a key of ID and sub table say SUB1 with FK of ID and multiple records for each entry in MAIN.\nI want to copy the data for a specific ID in MAIN to new records updating the ID to a new value to allow the existing entry to remain as a snapshot in time and the new entry to be a new work in progress. \n\nI am looking to use Stored Procedures and am wondering if its possible/advisable to have a highlevel SP that invokes other SP's to carry out the work?\n\ne.g.\n\n\n CREATE PROCEDURE CopyNewVersion (IN oldID)\n ...\n BEGIN\n --copy main record details for passed in oldID, \n --return the new ID thats been allocated\n CALL CopyNewMainRecord(IN oldID, OUT newID )\n --copy all SUB1 records for oldID to newID\n CALL CopyNewSub1Records(IN oldID, IN newID)\n --Declare a cursor to return the details in MAIN for newID\n END\n\n\nI'm seeing the CopyNewSub1Records as something like\n\n\n CREATE PROCEDURE CopyNewSub1Records (IN oldID, IN NewID)\n ...\n BEGIN\n --select all records in SUB1 with FK oldID\n --sp opens a cursor for return \n CALL GetSUB1Records(oldID)\n for each returned record in the cursor resultset\n --insert into SUB1 values(newID, other data for this row,....)\n CALL CreateSUB1Record(row details)\n END\n\n\nSo my question is, is it OK to have the OUT of newID from CopyNewMainRecord as in IN to CopyNewSub1Records and can I use the resultset with multiple rows from the Get SP in CopyNewSub1Records to loop through while calling the insert SP? \n\nI am currently awaiting being granted rights to create SP's on our DB2 environment by the DB Admin so thats why I'm asking rather than attempting this." ]
[ "java", "sql", "stored-procedures", "db2" ]
[ "append new row for each run of function", "I am trying to append a new row to a matrix for each time I run a function. I reckon, the first time the function is run a matrix is created and the succeeding times, a new row with values is appended. \n\nHere is some dummy data. Lets say x and y are sides of rectangle and z some sort of ID. In reality, these are not known in advance, but outputted by the function. The real function takes a species directory as argument, reads shapefiles, merges polygons and does a bunch of other things, but outputs the surface area. For each species (i.e. run of function) I would like to store each outputted area in a matrix or a data.frame for further analysis instead of outputting it to individual variables.\n\nmyfunc <- function(x, y, z){\n area <- x*y\n id <- z\n tmp <- cbind(area,id)\n assign(as.matrix('mtrx'), rbind(tmp), envir=.GlobalEnv)\n\n}\n\n\nThe above obviously only creates the matrix and overwrites it each time the function is run.\n\nAny pointers would be very much appreciated!" ]
[ "r", "append" ]
[ "System.NullReferenceException during OnElementChanged() in CustomMapRenderer", "I am writing an app using Xamarin. Part of the app includes a map that displays tracking points. Everything works perfectly, except when the app in run on a Xiaomi Redmi 4A using Android 6.0.1. \n\nI get a System.NullReferenceException: Object reference not set to an instance of an object when I try to run my OnElementChanged(ElementChangedEventArgs e).\n\nMy code:\n\n protected override void OnElementChanged(ElementChangedEventArgs<View> e)\n {\n base.OnElementChanged(e);\n\n if (e.NewElement != null)\n {\n _customMap = (CustomMap)e.NewElement;\n _unitViewModel = (UnitViewModel)_customMap.BindingContext;\n ((MapView)Control).GetMapAsync(this);\n\n _unitViewModel.TrackingPositions.CollectionChanged += TrackingPositions_CollectionChanged;\n }\n }\n\n\nThe exception is thrown at base.OnElementChanged(e). If this part gets enclosed in a try catch, the same exception is thrown at ((MapView)Control).GetMapAsync(this);" ]
[ "android", "google-maps", "xamarin", "xamarin.android" ]
[ "Do I have to set XMLResolver to null for preventing XXE attacks?", "I am trying to reproduce XXE scenario which is posted in the following link \n\nhttps://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.md\n\nAs I read from the documentation, the following code block should not load the DTD when it is run with 4.5.2+ target framework version when XMLResolver is not set explicitly. However I see the content of the file. If I set XMLResolver to null it doesnt load the content as expected.\n\nWhy the target framework does not affect the result? My aim is to verify this scenario in here and apply the solution in my project.\n\nstatic void LoadXML()\n {\n string xxePayload = \"<!DOCTYPE doc [<!ENTITY win SYSTEM 'file:///C:/Users/testdata2.txt'>]>\" \n + \"<doc>&win;</doc>\";\n string xml = \"<?xml version='1.0' ?>\" + xxePayload;\n\n XmlDocument xmlDoc = new XmlDocument();\n // Setting this to NULL disables DTDs - Its NOT null by default.\n // xmlDoc.XmlResolver = null; \n xmlDoc.LoadXml(xml);\n Console.WriteLine(xmlDoc.InnerText);\n Console.ReadLine();\n }" ]
[ "c#", "xml", "xmldocument", ".net-framework-version", "xxe" ]
[ "Debugging PHP Memory Corruption with Valgrind", "I'm encountering what seems to be a memory corruption issue with PHP. I have a large code base that I am porting to the 5.3 runtime. I get segfaults and \"zend_mm_heap corrupted\" errors, but the backtraces from those points are not useful. The backtraces always lead back to various core PHP functions such as variable assignment or concatenation.\n\nTo the best of my knowledge, PHP's memory is getting corrupted at some point before the segfaults/heap corruption errors occur.\n\nI've followed the instructions at bugs.php.net/bugs-getting-valgrind-log.php and have generated a quite large valgrind log. It's filled with many errors like \"Conditional jump or move depends on uninitialised value\". Because there's so much information in that valgrind log, I'm not sure what is a true defect and what is normal behavior.\n\nHere's a portion of the valgrind output: http://pastie.org/private/exngtften3jeppqyjn4hw" ]
[ "php", "memory", "segmentation-fault", "valgrind" ]
[ "Join More Than 2 Tables", "I have three tables. \n\n\nTable Data contains data for individual parts that come from a\n\"data.txt\" file.\nTable Limits contains the limits for the Data table\nfrom a \"limits.txt\" file.\nTable Files is a listing for\neach individual .txt file above.\n\n\nSo the \"Files\" table looks like this. As you can see it is a listing of each file that exists. The LimitsA file will contain the limits for every Data file of type A.\n\nID File_Name Type Sub-Type\n1 DataA_10 A 10\n2 DataA_20 A 20\n3 DataA_30 A 30\n4 LimitsA A NONE\n5 DataB_10 B 10\n6 DataB_20 B 20\n7 LimitsB B NONE\n\n\nThe \"Data\" table looks like this. The File_ID is the foreign key from the \"Files\" table. Specifically, this would be data for DataA_10 above:\n\nID File_ID Dat1 Dat2 Dat3... Dat20\n1 1 50 52 53 \n2 1 12 43 52 \n3 1 32 42 62 \n\n\nThe \"Limits\" table looks like this. The File_ID is the foreign key from the \"Files\" table. Specifically, this would be data for LimitsA above:\n\nID File_ID Sub-Type Lim1 Lim2\n1 4 10 40 60 \n2 4 20 20 30 \n3 4 30 10 20 \n\n\nSo what I want to do is JOIN the correct limits from the \"Limit\" table to the data from the corresponding \"Data\" table. Each row of DataA_10 would have the limits of \"40\" and \"60\" from the LimitsA table. Unfortunately there is no way to directly link the limits table to the data table. The only way to do this would be to look back to the files table and see that LimitsA and DataA_10 are of type A. Once I link those two together I then need to specifically only grab the Limits for Sub-Type 10.\n\nIn the end I would like to have a result that looks like this.\n\nResult:\n\nID File_ID Dat1 Dat2 Dat3... Dat20 Lim1 Lim2\n1 1 50 52 53 40 60\n2 1 12 43 52 40 60\n3 1 32 42 62 40 60\n\n\nI hope this is clear enough to understand. It seems to me like an issue of joining more than 2 tables, but I have been unable to find a suitable solution online as of yet. If you have a solution or any advice it would be greatly appreciated." ]
[ "sql", "join" ]
[ "phase 3 and 4 are not excecuted in mod_security", "Since Railo/Resin does not allow session cookies to be httpOnly I've been trying to catch them with mod-security 2.7. Normally this would be done in phase:3 I can't seem to process any rules on phase:3 or 4 for that matter...\n\nA simple rule like this:\n\nSecRule RESPONSE_HEADERS:Set-Cookie \".+\" \"id:1005,log,phase:3,msg:%{matched_var}\"\n\n\nLogs this when visiting my rootPage:\n\n[/][4] Initialising transaction (txid UDORCgoUBWsAADDIBB4AAAA-).\n[/][4] Transaction context created (dcfg 324de8).\n[/][4] First phase starting (dcfg 324de8).\n[/][4] Starting phase REQUEST_HEADERS.\n[/][9] This phase consists of 0 rule(s).\n[/][4] Second phase starting (dcfg 324de8).\n[/][4] Input filter: This request does not have a body.\n[/][4] Starting phase REQUEST_BODY.\n[/][9] This phase consists of 0 rule(s).\n[/][4] Hook insert_filter: Adding output filter (r 15b6110).\n[/][4] Initialising logging.\n[/index.cfm][4] Starting phase LOGGING.\n[/index.cfm][9] This phase consists of 0 rule(s).\n[/index.cfm][4] Recording persistent data took 0 microseconds.\n[/index.cfm][4] Audit log: Not configured to run for this request.\n\n\nWhen visiting a static image though, phase 3 and 4 get processed normally:\n\n[/image.png][4] Initialising transaction (txid UDORMgoUBWsAADDIBB8AAAA-).\n[/image.png][4] Transaction context created (dcfg 324de8).\n[/image.png][4] Hook insert_error_filter: Adding output filter (r 15ba120).\n[/image.png][9] Output filter: Receiving output (f 15bba50, r 15ba120).\n[/image.png][4] Starting phase RESPONSE_HEADERS.\n[/image.png][9] This phase consists of 1 rule(s).\n[/image.png][4] Recipe: Invoking rule 347328; [file \"C:/Apache/conf/httpd.conf\"] [line \"525\"] [id \"1005\"].\n[/image.png][5] Rule 347328: SecRule \"RESPONSE_HEADERS:Set-Cookie\" \"@rx .+\" \"phase:3,auditlog,pass,id:1005,log,msg:%{matched_var}\"\n[/image.png][4] Rule returned 0.\n[/image.png][9] No match, not chained -> mode NEXT_RULE.\n[/image.png][4] Output filter: Response body buffering is not enabled.\n[/image.png][9] Content Injection: Not enabled.\n[/image.png][4] Output filter: Completed receiving response body (non-buffering).\n[/image.png][4] Starting phase RESPONSE_BODY.\n[/image.png][9] This phase consists of 0 rule(s).\n[/image.png][4] Output filter: Output forwarding complete.\n[/image.png][9] Output filter: Sending input brigade directly.\n[/image.png][4] Initialising logging.\n[/image.png][4] Starting phase LOGGING.\n[/image.png][9] This phase consists of 0 rule(s).\n[/image.png][4] Recording persistent data took 0 microseconds.\n[/image.png][4] Audit log: Not configured to run for this request.\n\n\nI'm using mod_caucho to connect Apache to Resin" ]
[ "apache", "resin", "mod-security" ]
[ "Adding Search Button to UINavigationBar : Swift", "I have a ViewController1 and ViewController2. ViewController1 has a NavigationController set to it. I have a button (Custom Search Icon) on the NavigationBar. Now I press control+click and drag to ViewController2 and set it to Show. When I press it, it doesn't work. I also tried to drag the button to ViewController1 and set it as an IBAction but that doesn't work either.\n\nWhat I want accomplished:\nI want to create a button on the left side of the NavBar. When clicking it, I want to be add the searchbar and allow the user to search from an array. What is the best way about doing this? The search bar also has the cancel button, and if pressed the user should return back to his previous ViewController. I don't want anyone to the work for me but if you could point me to the right direction, it would be awesome." ]
[ "swift", "uinavigationcontroller", "uinavigationbar", "uinavigationitem" ]
[ "Why is my function returning blank strings, but works as expected in the python console?", "Apologies for the poor title, I don't know how else to describe my situation.\n\nI wrote a small pattern matching function.\n\ndef substrings(input_str):\n '''Generate all leading substrings of an input string'''\n for i in range(len(input_str)):\n return input_str[:i]\n\n\nIt should return a series of slices of a string. If the input was ABCD, it should output ABCD, ABC, AB and A. \n\nWhen I tested this function in the python console (shown below), it behaves correctly and outputs all the expected strings.\n\nfor i in range(len(input_str)):\n print(input_str[:i])\n\n\nBut when used in the body of my program its returning nothing at all. For example;\n\ntest1 = substrings('ABCD')\nprint(test1)\n\n\nOutputs blank lines and I'm struggling to figure out why." ]
[ "python", "python-3.x" ]
[ "Where do I put command arguments in a youtube-dl python script?", "I'm usually using youtube-dl with terminal like this\n\nyoutube-dl -o '%(uploader)s - %(title)s.%(ext)s' URL\n\nTo get my output named like this: \"Channel name - title.mp4\"… and it works great for a single video but if I'd like to use this python script to download my subs provided by Mewfree:\n\n#!/usr/bin/env python3\n\nimport opml\nimport feedparser\nimport youtube_dl\nimport sys\nfrom glob import glob\nfrom pprint import pprint\n\nif sys.version_info[0] < 3:\n raise Exception('Must be using Python 3')\n\nfrom time import time, mktime, strptime\nfrom datetime import datetime\n\nif len(glob('last.txt')) == 0:\n f = open('last.txt', 'w')\n f.write(str(time()))\n print('Initialized a last.txt file with current timestamp.')\n f.close()\n\nelse:\n f = open('last.txt', 'r')\n content = f.read()\n f.close()\n\n outline = opml.parse('subs.xml')\n\n ptime = datetime.utcfromtimestamp(float(content))\n ftime = time()\n\n urls = []\n\n for i in range(0,len(outline[0])):\n urls.append(outline[0][i].xmlUrl)\n\n videos = []\n for i in range(0,len(urls)):\n print('Parsing through channel '+str(i+1)+' out of '+str(len(urls)), end='\\r')\n feed = feedparser.parse(urls[i])\n for j in range(0,len(feed['items'])):\n timef = feed['items'][j]['published_parsed']\n dt = datetime.fromtimestamp(mktime(timef))\n if dt > ptime:\n videos.append(feed['items'][j]['link'])\n\n if len(videos) == 0:\n print('Sorry, no new video found')\n else:\n print(str(len(videos))+' new videos found')\n\n ydl_opts = {'ignoreerrors': True}\n\n with youtube_dl.YoutubeDL(ydl_opts) as ydl:\n ydl.download(videos)\n\n f = open('last.txt', 'w')\n f.write(str(ftime))\n f.close()\n\n\nI have a problem because I don't know anything about python and I can't figure where and how to put my options properly. Of course I've figured it would be somewhere around here:\n\n ydl_opts = {'ignoreerrors': True}\n\n\nSince 'ignoreerrors' from the python script reflects the --ignore-errors or -i option from the youtube-dl doc so I guess I should have something like 'output' around there but I don't know how to add my options '%(uploader)s - %(title)s.%(ext)s' and everything I tried failed, so can someone who actually knows how it works tell me what I should do, please?" ]
[ "python", "youtube-dl" ]
[ "Loading message in Python 2.7?", "I am making a personal assistant in Python 2.7 using the modules 'wikipedia', 'wolframalpha' and 'pyttsx3'. I am making so that the user can ask a question and the computer will then search Wikipedia and Wolfram and speak the answer using Pyttsx. This all works fine but the computer takes a while to fetch the results for the question and I was wondering if it would be possible to add a simple '...loading...' message while is does this. I have added the code below and it would be great if you could respond.\n\nimport wikipedia\nimport wolframalpha\nimport pyttsx3;\nengine = pyttsx3.init();\n\nwhile True:\n my_input = raw_input(\"Question: \")\n try:\n #wolframalpha code here\n app_id = \"Q2HXJ5-GYYYX6PYYP\"\n client = wolframalpha.Client(app_id)\n res = client.query(my_input)\n answer = next(res.results).text \n print(answer)\n engine.say(answer);\n engine.runAndWait();\n\n\n except:\n try:\n #wikipedia code here\n print(wikipedia.summary(my_input))\n except:\n print(\"Sorry nothing can be found from your query\")" ]
[ "python", "wolframalpha", "pyttsx" ]
[ "How can i get Networkx to show both weights on an edge that is going in 2 directions?", "I have a text file with the following data:\n\n192.168.12.22 192.168.12.21 23\n192.168.12.21 192.168.12.22 26\n192.168.12.23 192.168.12.22 56\n\n\nThere are three nodes and two of them are sending packets to each other. I want to be able to show both weights on two different edges, but it only shows one with a single weight.\n\nThis is my code:\n\nimport networkx as nx\nimport matplotlib.pyplot as plt\n\nG = nx.read_weighted_edgelist('test.txt', create_using=nx.DiGraph())\npos = nx.spring_layout(G)\n\nprint(nx.info(G))\n\nnx.draw(G, pos, with_labels=True) \nnx.draw_networkx_edge_labels(G, pos)\nplt.show()" ]
[ "python-3.x", "matplotlib", "networkx" ]
[ "How do I find a single item from a cached observable array", "Been trying to solve this problem for the past few days and i've had no luck.\nHere's what i'm trying to do.\nMy website makes a http get request for a list of projects and using a ngFor loop I display these on the home page. I cache these results using shareReplay on my Observable so that when I view a single item - I won't need to do another network request.\nMy problem is I can't find a way to extract a single item from the array of observables after it's been cached. I am aware of the .find or .filter but those seem like they are used while getting the observable initially and not after it's been cached with shareReplay.\nBelow is my code.\n //service.ts\n\n get allProjects() {\n if (!this.cache$) {\n this.cache$ = this.fetchProjects().pipe(shareReplay(1));\n }\n return this.cache$;\n }\n\n\n fetchProjects() {\n return this.http\n .get<Project[]>(\n 'https://admin.steezy.io/wp-json/wp/v2/posts?categories=5'\n )\n .pipe(\n map((projects) => {\n return projects.map((item) => {\n return new Project(\n item.id,\n item.slug,\n item.title,\n item.content,\n item.better_featured_image,\n new Acf(\n item.acf.projectDescription,\n item.acf.projectTypeOfWork,\n item.acf.sliderLinks\n )\n );\n });\n }),\n );\n }\n\n // component.ts\n\n ngOnInit(): void {\n const slug = this.route.snapshot.params['slug'];\n this.project = this.projectService.singleProject;\n return this.project;\n }\n\nI've tried so many combinations. Adding .find in the service won't work because my projects componenet wont get all the projects. I've tired\n this.project = this.projectService.cache$.find(\n (project) => project.slug == slug\n );\n\nBut it tells me Property 'find' does not exist on type 'Observable<Project[]>'\nI've tried .filter and I get the same issues.\nThis seems like such an easy thing but for some reason i'm stumped. I already have the data cached, all I need to do is pick one object out based on the slug.\nAny ideas?\n\nEdit:\nI resolved this issue based on Adrians answer. I have one minor error now that shows up in my IDE\n<div class="container" *ngIf="project$ | async as project">\n<div class="row my-5">\n <div class="col-sm-12 text-center">\n <h1>\n <!-- {{ project$ | async | json }} -->\n {{ project.title.rendered }}\n\n//project.model.ts\nexport class Project {\nconstructor(\n public id: number,\n public slug: string,\n public title: Title,\n public content: string,\n public better_featured_image: string,\n public acf: Acf\n) {}\n}\nexport class Title {\n constructor(public rendered: string) {}\n}\nexport class Acf {\n constructor(\n public projectDescription: string,\n public projectTypeOfWork: string,\n public sliderLinks: any = null\n ) {}\n }\n\nThe title is underlined in red and the error my ide gives is Identifier 'title' is not defined. 'null' does not contain such a member\nAny idea why?" ]
[ "angular", "rxjs" ]
[ "Cover a specific function with Coverage in Python", "hope you are having a great valentine's day!\nI'm having a problem with the Coverage API in Python. Given a function, I would like to get the covered lines in that function. The coverage api, however, returns the percentage of covered lines in the entire file I am working on. I leave here one example of what I'm trying to do.\nimport coverage\n\nfrom example.transfer import send_money\n\ncov : coverage.Coverage = coverage.Coverage()\ncov.set_option("run:branch", True)\n\n# Run the coverage tool\ncov.start()\n\nsend_money(10, Account(), Account())\n\ncov.stop()\n\ntotal_covered = cov.report(morfs="example/transfer.py", show_missing=True)\n\nThe transfer file contains the send_money function, the class Account and a bunch of other small auxiliary functions. The output of the report provides the total coverage of the transfer file and not only of the function I want.\nI was wondering if there is any setting I am missing, or any other API that can help with my problem.\nThankfully,\nPaulo Santos" ]
[ "python", "code-coverage" ]
[ "Can't we include .c file?", "Today I had an interview there they asked me can we include .c file to a source file?\nI said yes. Because few years back I saw the same in some project where they have include .c file. But just now I was trying the same.\n\nabc.c\n\n#include<stdio.h>\nvoid abc()\n{ printf(\"From ABC() \\n\"); }\n\n\n\n\nmain.c\n\n#include<stdio.h>\n#include \"abc.c\"\nint main()\n{ void abc();\n return 0;\n}\n\n\nGetting an error:\n\n\n D:\\Embedded\\...\\abc.c :- multiple definition of 'abc'\n\n\nWhere is it going wrong?\n\nI wrote an abc.h file (the body of abc.h is { extern void abc(void); }),\nand included the file in abc.c (commenting out #include abc.c). Worked fine." ]
[ "c++", "c", "include" ]
[ "Python requests: \"IndexError: list index out of range\"", "Please do not mark it as a trivial duplicate of: Python requests giving errror: IndexError: list index out of range\n\nI am encountering the said error when trying to send a GET to:\n\nhttp://astat.bugly.qq.com\n\nThe exact line that I use in the code that gives me the request is, maybe I am overlooking something:\n\nr = requests.get(\"http://\"+url, stream=True, timeout=3)\n\n\nwhere astat.bugly.qq.com is passed as url\n\nI am reading the url out of a csv-file but I checked that it reads the appropriate url. \n\nI can even recreate it multiple times the python-REPL, I hope you can too. \n Proof: \n\n\nI dont know what could be causing this." ]
[ "python", "get", "python-requests" ]
[ "When ORA-01830 error occur?", "I need an explanation on the following issue:\nI'm inserting some values in a table and for a TIMESTAMP(6) column the value\n11-JAN-16 03.04.30.944265000 throws the error mentioned in title.\n\nFor some other values it doesn't throw any error as for instance: \n\n10-JAN-16 05.15.15.063826000\n10-JAN-16 05.10.45.039946000\n10-JAN-16 05.09.45.060794000\n\n\nI know i should not rely on implicit cast from varchar to timestamp, that's why i'll use the conversion:\n\nto_timestamp(column, 'DD-Mon-RR HH24.MI.SS.FF)\n\n\nPlease let me know why and when this error occur. Thank you!\nA" ]
[ "oracle" ]
[ "MySql cascade delete from 2 tables", "I have a MySql schema which uses class table inheritance, but I want the child tables to have cascade delete from the parent table, and a foreign table.\n\ncreate table parent (\n _key bigint unsigned not null,\n name varchar(64) unique not null,\n primary key(_key)\n);\n\ncreate table child_a (\n _key bigint unsigned not null,\n foreign_key_a bigint unsigned not null,\n foreign key(_key) references parent(_key) on delete cascade,\n foreign key(foreign_key_a) references a(_key) on delete cascade,\n primary key(_key)\n);\n\ncreate table child_b (\n _key bigint unsigned not null,\n foreign_key_b bigint unsigned not null,\n foreign key(_key) references parent(_key) on delete cascade,\n foreign key(foreign_key_b) references b(_key) on delete cascade,\n primary key(_key)\n);\n\n\nThe issue is when a record is deleted from one of the foreign tables, it will delete the record from the child table, but not from the parent table. I would not like to use a stored procedure / multi-statement as a solution because the foreign tables have cascade deletes of their own, so I would need stored procedures for those as well." ]
[ "mysql", "schema", "sql-delete", "cascade" ]
[ "Test App on Real iPhone", "Possible Duplicate:\n Deploy an iphone app from xcode to iphone \n\n\n\n\nHi I have tested my app using the iOS simulator. How can I test it on my own iphone? I am an Apple developer member." ]
[ "iphone", "xcode", "ios4" ]
[ "React Styled Components: Justify content does not work but align items & flex-direction do?", "I added justify-content: space-evenly to a div in my React app, but I see no change. I have applied, display: flex, align-items: flex-end, and they all work as expected. I also tried flex-direction to check that was working, and it did. I don't understand why justify-content isn't working? I Have tried other values of justify-content such as space-around, space-between and center, but I had the same result, justify-content doesn't seem to work at all. Below is my code for the component and the parent styles the component inherits...\n---- Component ----\n// Libraries\nimport styled from "styled-components";\nimport { useSelector, useDispatch } from "react-redux";\n\n// Components and icons\nimport { StyledTop } from "../Components/styles";\nimport {\n RecentlyPlayedIcon,\n SettingsIcon,\n QuitIcon,\n} from "../Components/icons";\n\nconst RightBarButtons = () => {\n // Grab needed state and set vars\n const theme = useSelector((state) => state.theme);\n const rightBarState = useSelector((state) => state.rightBarSelection);\n const dispatch = useDispatch();\n\n // Handlers\n const buttonHandler = (buttonName) => {\n if (buttonName !== rightBarState) {\n dispatch({\n type: `SET_RIGHT_BAR_${buttonName.toUpperCase()}`,\n });\n }\n };\n return (\n <StyledTopButtons>\n <button>\n <QuitIcon theme={theme} />\n </button>\n <button\n onClick={() => {\n buttonHandler("settings");\n }}\n style={{\n borderLeft: `4px solid ${\n theme === "light" ? "rgba(0,0,0,.05)" : "rgba(255, 255, 255, 0.125)"\n } `,\n borderRight: `4px solid ${\n theme === "light" ? "rgba(0,0,0,.05)" : "rgba(255, 255, 255, 0.125)"\n } `,\n }}\n >\n <SettingsIcon rightBarState={rightBarState} theme={theme} />\n </button>\n <button\n onClick={() => {\n buttonHandler("recently_played");\n }}\n >\n <RecentlyPlayedIcon rightBarState={rightBarState} theme={theme} />\n </button>\n </StyledTopButtons>\n );\n};\nconst StyledTopButtons = styled(StyledTop)`\n margin: 3.9rem 4rem;\n width: calc(100% - 8rem);\n display: flex;\n align-items: flex-end;\n justify-content: space-evenly;\n button {\n transform: translateX(-2.6rem);\n height: 2.2rem;\n cursor: pointer;\n svg {\n height: 100%;\n pointer-events: none;\n }\n }\n`;\n\nexport default RightBarButtons;\n\n---- StyledTop component, that I am inheriting from ----\nexport const StyledTop = styled.div`\n height: 2.8rem;\n width: 100%;\n\n h1 {\n margin: 4rem;\n font-size: 2.8rem;\n font-weight: 600;\n color: ${(props) => (props.theme === "light" ? "black" : "white")};\n cursor: pointer;\n }\n\n span {\n color: #3ca8c9;\n }\n`;\n\nIf someone could help me figure out why this isn't behaving as expected I'd really appreciate it.\nThanks." ]
[ "css", "reactjs", "sass", "styled-components" ]
[ "Working with Relative Paths - Create variable name for path?", "I am working on html/javascript and found these imports prone to confusion:\n\n <link rel=\"stylesheet\" href=\"../../../../_GUI/css/sample.css\">\n <link rel=\"stylesheet\" href=\"../../../../_GUI/css/button.css\">\n\n\nMultiple ../../ in code doesn't really look nice and looks confusing.\n\nIs there any way I can make something like a variable where in:\n\nGUI = ../../../../_GUI ?\n\n\nI also checked absolute paths but that would not be so reliable since root folder may change.\n\nHelp~" ]
[ "javascript", "html", "css", "path" ]
[ "Compare mscrm GUIDs in js", "Is there some better/official way, how to compare CRM 2011 GUIDs in JavaScript\n\n2e9565c4-fc5b-e211-993c-000c29208ee5=={2E9565C4-FC5B-E211-993C-000C29208EE5}\n\n\nwithout using .replace() and .toLowerCase()?\n\nFirst one is got thru XMLHttpRequest/JSON:\n\nJSON.parse(r.responseText).d.results[0].id \n\n\nSecond one is got from form:\n\nXrm.Page.getAttribute(\"field\").getValue()[0].id" ]
[ "javascript", "dynamics-crm-2011", "dynamics-crm", "guid" ]
[ "Multiple iCalendar VEvents or VTODOs for the same meeting", "My application needs to have a feature which would allow the creation of sort of like a project, where you put the total number of hours you need to work on it, the start date, the end date and how long each activity takes(additional constraints might be included as well).\n\nWhat is the best way to create multiple VEvents according to those constraints with an option to change those VEvents? Also what's the best method to check the current iCalendar if the date is busy or not? Can I somehow retrieve all the busy dates from ics file and then just kind of check if the time gap is free or busy?" ]
[ "java", "calendar", "icalendar" ]
[ "VolleyError doesnt give response", "I am using the code below to notify the user about the an error:\n\nnew Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n if (error instanceof TimeoutError || error instanceof NoConnectionError) {\n Toast.makeText(LoginActivity.this,\"Keine Internetverbindung\", Toast.LENGTH_LONG).show();\n } else if (error instanceof AuthFailureError) {\n // TODO\n } else if (error instanceof ServerError) {\n // TODO\n } else if (error instanceof NetworkError) {\n // TODO\n } else if (error instanceof ParseError) {\n // TODO\n }\n }\n}\n\n\nWhen I start the Application and shut down all the connections I don't get the Toast. There should be the NoConnectionError-Toast, but nothing happens." ]
[ "android", "android-volley" ]
[ "Wikidata SPARQL - Countries and their (still existing) neighbours", "I want to query the neighbours to a country with SPARQL from Wikidata like this:\n\nSELECT ?country ?countryLabel WHERE { \n ?country wdt:P47 wd:Q183 . \n FILTER NOT EXISTS{ ?country wdt:P576 ?date } # don't count dissolved country - at least filters German Democratic Republic\n SERVICE wikibase:label {\n bd:serviceParam wikibase:language \"en\" .\n }\n}\n\n\nMy issue is that e.g. in this example for neighbours of germany there are still countries shown which does not exist anymore like: \n\n\nKingdom of Denmark or \nSaarland. \n\n\nAlready tried\n\nI could already reduce the number by the FILTER statement.\n\nQuestion\n\n\nHow to make the statement to reduce it to 9 countries?\n(also dividing in land boarder and sea boarder would be great)\n\n\nAlternative\n\n\nFiltering at this API would be also fine for me https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q35\na database or lists or prepared HashMaps whatever with all countries of the world with neighbours" ]
[ "sparql", "wikidata", "wikidata-api" ]
[ "Marker display in my JavaScript V3 Google Map, but not in Google Live Map", "I am building a google map project, I am using google JavaScript v3 api, everything is fine and markers display in my custom map, but when I want to see direction and click any marker and it takes well to google live map, but there I do not see my marker, my question is all my custom added markers will display at google live map or it is just separate map?" ]
[ "javascript", "java", "spring-boot" ]
[ "angularjs checkboxes show / hide box", "I have some issues to manage checkboxes and \"boxes\" containers. The idea is to have a list of checkboxes pre-checked.\nEach checkboxes controls a \"box\" container, and when check / uncheck the checkbox, it shows / hides the containers.\n\nhere some codes\n\n<div class=\"col-lg-2\">\n <div class=\"btn-group\" uib-dropdown>\n\n <button type=\"button\" class=\"btn btn-primary\" uib-dropdown-toggle>Preferences \n <span class=\"caret\"></span>\n </button>\n\n <ul role=\"menu\" uib-dropdown-menu=\"\">\n <li ng-repeat=\"product in main.products\">\n <input class=\"mycheck\" type=\"checkbox\" id=\"'{{product.id}}'\" checked=\"'{{product.ischeck}}'\"> {{product.name}}</li>\n </ul>\n </div>\n</div>\n\n\nand here is the code for the container boxes\n\n<div class=\"col-sm-3 connectPanels\" ui-sortable=\"sortableOptions\" ng-repeat=\"product in main.products\" id=\"'{{product.id}}Panel'\">\n <div class=\"mybox\">\n <div class=\"mybox-title\">\n <h5>{{product.name}}</h5>\n <div ibox-tools></div>\n </div>\n <div class=\"mybox-content\">\n <h2><img ng-src=\"{{product.images}}\" />\n {{product.type}}\n </h2>\n <p>{{product.description}}</p>\n </div>\n </div>\n</div>\n\n\nI've tried various ways; ng-click, ng-show, ng-hide and ng-change but each time I am block to manage to get the product Id and ischeck values together.\n\nThank you in advance" ]
[ "javascript", "angularjs", "checkboxlist", "ng-show", "ng-hide" ]
[ "Preserve Joins by code in MongoDB", "What are the best solution to preserve left joins in a NoSQL solutions like MongoDB/Norm if you can not modify the complete architecture of one cms. Experiences, Samples, Cost.\n\nThanks." ]
[ "mongodb", "norm", "nosql" ]
[ "View logs for all docker containers simultaneously", "I currently use docker for my backend, and when I first start them up with\n\ndocker-compose up\n\n\nI get log outputs of all 4 dockers at once, so I can see how they are interacting with each other when a request comes in. Looking like this, one request going from nginx to couchdb\n\n\n\nThe issue is now that I am running on GCE with load balancing, when a new VM spins up, it auto starts the dockers and runs normally, I would like to be able to access a load balanced VM and view the live logs, but I can not get docker to allow me this style, when I use logs, it gives me normal all white font with no label of where it came from.\n\nUsing\n\ndocker events \n\n\ndoes nothing, it won't return any info. \n\ntldr; what is the best way to obtain a view, same as the log output you get when running \"docker-compose up\"" ]
[ "docker", "docker-compose" ]