See what the Stackoverflow community is most excited about today.
Date: 2017-10-16
-
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
-
Set a default parameter value for a JavaScript function
tags: javascript, function, parameters, default-parameters
1769 votes, 13 answers and 957445 views
\r\n I would like a JavaScript function to have optional arguments which I set a default on, which gets used if the value isn't defined. In Ruby you can do it like this:\n\ndef read_file(file, delete_after =...\r\n
-
tags: vim, editing
383 votes, 7 answers and 200900 views
\r\n To search forward in vim for cake, I'd type /cake, but the cursor jumps to the first match when I press return. Is there a vim command analogous to "find next"?\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
-
The most elegant way to iterate the words of a string
tags: c++, string, split
2402 votes, 72 answers and 1817020 views
\r\n What is the most elegant way to iterate the words of a string? The string can be assumed to be composed of words separated by whitespace.\n\nNote that I'm not interested in C string functions or that ...\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
-
How to
git clone
including submodules?tags: git, git-submodules
1222 votes, 8 answers and 404738 views
\r\n I'm trying to put a submodule into a repo. \n\nThe problem is that when I clone the parent repo, the submodule folder is entirely empty.\n\nIs there any way to make it so that 'git clone parent' actually ...\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