See what the Stackoverflow community is most excited about today.
Date: 2017-10-17
-
Convert Linq Query Result to Dictionary
tags: c#, linq, linq-to-sql, todictionary
229 votes, 4 answers and 210236 views
\r\n I want to add some rows to a database using Linq to SQL, but I want to make a "custom check" before adding the rows to know if I must add, replace or ignore the incomming rows.\nI'd like to keep the ...\r\n
-
tags: javascript, jquery, json, arrays
274 votes, 6 answers and 705989 views
\r\n I have an Array (var cars = []) which holds a few integers.\nI've added a few values to the array, but I now need to send this array to a page via jQuery's .get method. How can I convert it to a JSON ...\r\n
-
Why does parseInt yield NaN with Array#map?
tags: javascript
205 votes, 7 answers and 27135 views
\r\n From the Mozilla Developer Network:\n\n[1,4,9].map(Math.sqrt)\r\nwill yield:\n\n[1,2,3]\r\nWhy then does this:\n\n['1','2','3'].map(parseInt)\r\nyield this:\n\n[1, NaN, NaN]\r\nI have tested in Firefox 3.0.1 and ...\r\n
-
Using cURL with a username and password?
tags: curl, credentials
238 votes, 10 answers and 347709 views
\r\n I want to access a URL which requires a username/password. I'd like to try accessing it with curl. Right now I'm doing something like:\n\ncurl http://api.somesite.com/test/blah?something=123\r\nI get an ...\r\n
-
Why does this code, written backwards, print “Hello World!”
tags:
223 votes, 4 answers and 11614 views
\r\n Here is some code that I found on the Internet:\n\nclass M{public static void main(String[]a){System.out.print(new char[]\n{'H','e','l','l','o',' ','W','o','r','l','d','!'});}} \r\nThis code prints ...\r\n
-
How to ignore a property in class if null, using json.net
tags: c#, json.net
249 votes, 8 answers and 147430 views
\r\n I am using Json.NET to serialize a class to JSON.\n\nI have the class like this:\n\nclass Test1\n{\n [JsonProperty("id")]\n public string ID { get; set; }\n [JsonProperty("label")]\n public string ...\r\n
-
Angular/RxJs When should I unsubscribe from
Subscription
tags: angular, rxjs, angular2-observables
225 votes, 11 answers and 46996 views
\r\n What is the best practice for uses Subscription.unsubscribe() in Angular apps?\n\nWhen should I store Subscriptions and call unsubscribe() on destroy event and when can I ignore them. Saving all ...\r\n
-
Mercurial stuck “waiting for lock”
tags: mercurial
239 votes, 11 answers and 64726 views
\r\n Got a bluescreen in windows while cloning a mercurial repository.\n\nAfter reboot, I now get this message for almost all hg commands:\r\nc:\src>hg commit\nwaiting for lock on repository c:\src\McVrsServer ...\r\n
-
Passing environment-dependent variables in webpack
tags: javascript, webpack
202 votes, 12 answers and 130579 views
\r\n I'm trying to convert an angular app from gulp to webpack. in gulp I use gulp-preprocess to replace some variables in the html page (e.g. database name) depending on the NODE_ENV. What is the best way ...\r\n
-
Differences between C++ string == and compare()?
tags: c++, string
207 votes, 10 answers and 236438 views
\r\n I just read some recommendations on using \n\nstd::string s = get_string();\nstd::string t = another_string();\n\nif( !s.compare(t) ) \n{\r\ninstead of \n\nif( s == t )\n{\r\nI'm almost always using the last one ...\r\n