Most Popular
1500 questions
1717
votes
36 answers
Random string generation with upper case letters and digits
How do I generate a string of size N, made of numbers and uppercase English letters such as:
6U1S75
4Z4UKK
U911K4
Hellnar
- 62,315
- 79
- 204
- 279
1716
votes
52 answers
Getting Chrome to accept self-signed localhost certificate
I have created a self-signed SSL certificate for the localhost CN. Firefox accepts this certificate after initially complaining about it, as expected. Chrome and IE, however, refuse to accept it, even after adding the certificate to the system…
pjohansson
- 17,796
- 3
- 17
- 18
1716
votes
10 answers
How are parameters sent in an HTTP POST request?
In an HTTP GET request, parameters are sent as a query string:
http://example.com/page?parameter=value&also=another
In an HTTP POST request, the parameters are not sent along with the URI.
Where are the values? In the request header? In the request…
Camilo Martin
- 37,236
- 20
- 111
- 154
1715
votes
29 answers
How does the Java 'for each' loop work?
Consider:
List someList = new ArrayList();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
System.out.println(item);
}
What would the equivalent for loop look like without using the for each…
Jay R.
- 31,911
- 17
- 52
- 61
1715
votes
9 answers
Hard reset of a single file
How do I discard the changes to a single file and overwrite it with a fresh HEAD copy? I want to do git reset --hard to only a single file.
Emiliano
- 22,232
- 11
- 45
- 59
1715
votes
14 answers
How can I delete using INNER JOIN with SQL Server?
I want to delete using INNER JOIN in SQL Server 2008.
But I get this error:
Msg 156, Level 15, State 1, Line 15
Incorrect syntax near the keyword 'INNER'.
My code:
DELETE
FROM WorkRecord2
INNER JOIN Employee
ON…
nettoon493
- 17,733
- 7
- 30
- 45
1715
votes
12 answers
Differences between Lodash and Underscore.js
Why would someone prefer either the Lodash or Underscore.js utility library over the other?
Lodash seems to be a drop-in replacement for underscore, the latter having been around longer.
I think both are brilliant, but I do not know enough about how…
Brian M. Hunt
- 81,008
- 74
- 230
- 343
1714
votes
63 answers
Get the values from the "GET" parameters (JavaScript)
I have a URL with some GET parameters as follows:
www.test.com/t.html?a=1&b=3&c=m2-m3-m4-m5
I need to get the whole value of c. I tried to read the URL, but I got only m2. How do I do this using JavaScript?
joe
- 34,529
- 29
- 100
- 137
1714
votes
27 answers
What is the difference between an abstract method and a virtual method?
What is the difference between an abstract method and a virtual method? In which cases is it recommended to use abstract or virtual methods? Which one is the best approach?
Moran Helman
- 18,432
- 4
- 23
- 26
1711
votes
21 answers
How can I make a dictionary (dict) from separate lists of keys and values?
I want to combine these:
keys = ['name', 'age', 'food']
values = ['Monty', 42, 'spam']
Into a single dictionary:
{'name': 'Monty', 'age': 42, 'food': 'spam'}
Guido
- 46,642
- 28
- 120
- 174
1710
votes
36 answers
Find all tables containing column with specified name - MS SQL Server
Is it possible to query for table names which contain columns being
LIKE '%myName%'
?
gruber
- 28,739
- 35
- 124
- 216
1710
votes
23 answers
How do you access the matched groups in a JavaScript regular expression?
I want to match a portion of a string using a regular expression and then access that parenthesized substring:
var myString = "something format_abc"; // I want "abc"
var arr = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(myString);
console.log(arr); //…
nickf
- 537,072
- 198
- 649
- 721
1710
votes
30 answers
How to measure time taken by a function to execute
I need to get execution time in milliseconds.
I originally asked this question back in 2008. The accepted answer then was to use new Date().getTime() However, we can all agree now that using the standard performance.now() API is more appropriate.…
Julius A
- 38,062
- 26
- 74
- 96
1707
votes
2 answers
Difference between == and === in JavaScript
What is the difference between == and === in JavaScript? I have also seen != and !== operators. Are there more such operators?
Shiva
- 18,235
- 4
- 20
- 9
1706
votes
9 answers
How does the vim "write with sudo" trick work?
Many of you have probably seen the command that allows you to write on a file that needs root permission, even when you forgot to open vim with sudo:
:w !sudo tee %
The thing is that I don't get what is exactly happening here.
I have already…
Doppelganger
- 20,114
- 8
- 31
- 29