Highest scored questions

Filter by
Sorted by
Tagged with
5803 votes
28 answers
4.0m views

How do I create a directory at a given path, and also create any missing parent directories along that path? For example, the Bash command mkdir -p /path/to/nested/directory does this.
Parand's user avatar
  • 107k
5800 votes
41 answers
5.5m views

How can I loop through all the entries in an array using JavaScript?
Dante1986's user avatar
  • 60.2k
5791 votes
47 answers
4.7m views

How do I squash my last N commits together into one commit?
markdorison's user avatar
5707 votes
26 answers
5.4m views

I pulled a project with several forks on GitHub, but forgot which fork it was. How do I determine which fork I pulled?
Tim's user avatar
  • 57.4k
5659 votes
28 answers
5.0m views

How do I access the index while iterating over a sequence with a for loop? xs = [8, 23, 45] for x in xs: print("item #{} = {}".format(index, x)) Desired output: item #1 = 8 item #2 = ...
Joan Venge's user avatar
  • 334k
5644 votes
47 answers
2.2m views

I'm using JSLint to go through JavaScript, and it's returning many suggestions to replace == (two equals signs) with === (three equals signs) when doing things like comparing idSele_UNVEHtype.value....
bcasp's user avatar
  • 57.4k
5586 votes
23 answers
2.1m views

After I upgraded to the latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are ...
Fizer Khan's user avatar
  • 93.6k
5515 votes
50 answers
4.6m views

Given a string: string = "Test abc test test abc test test test abc test test abc"; This seems to only remove the first occurrence of abc in the string above: string = string.replace('abc', ...
Ali's user avatar
  • 268k
5509 votes
11 answers
700k views

Moderator note: This question is not a good fit for our question and answer format with the topicality rules which currently apply for Stack Overflow. We normally use a "historical lock" for ...
5506 votes
13 answers
3.3m views

I am stuck and cannot escape. It says: type :quit<Enter> to quit VIM But when I type that it simply appears in the object body.
jclancy's user avatar
  • 53k
5503 votes
37 answers
1.7m views

How do I add an empty directory (that contains no files) to a Git repository?
Laurie Young's user avatar
5489 votes
77 answers
3.3m views

How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around. I'm ...
5485 votes
34 answers
4.7m views

I have a list of lists like [ [1, 2, 3], [4, 5, 6], [7], [8, 9] ] How can I flatten it to get [1, 2, 3, 4, 5, 6, 7, 8, 9]? If your list of lists comes from a nested list ...
Emma's user avatar
  • 55.7k
5469 votes
78 answers
4.9m views

I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?...
5467 votes
35 answers
5.5m views

I know it's possible to match a word and then reverse the matches using other tools (e.g. grep -v). However, is it possible to match lines that do not contain a specific word, e.g. hede, using a ...
5436 votes
37 answers
3.8m views

How do I resolve merge conflicts in my Git repository?
Spoike's user avatar
  • 122k
5399 votes
106 answers
4.6m views

How do I make the first character of a string uppercase if it's a letter, but not change the case of any of the other letters? For example: "this is a test" → "This is a test" &...
Robert Wills's user avatar
  • 54.7k
5396 votes
42 answers
850k views

I'd prefer as little formal definition as possible and simple mathematics.
Arec Barrwin's user avatar
  • 62.1k
5285 votes
26 answers
2.7m views

What is the difference between INNER JOIN and OUTER JOIN? How do LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN fit in?
Chris de Vries's user avatar
5228 votes
68 answers
5.0m views

I need to check the checked property of a checkbox and perform an action based on the checked property using jQuery. For example, if the age checkbox is checked, then I need to show a textbox to enter ...
5157 votes
67 answers
3.1m views

What is the most efficient way to clone a JavaScript object? I've seen obj = eval(uneval(o)); being used, but that's non-standard and only supported by Firefox. I've done things like obj = JSON.parse(...
5135 votes
24 answers
851k views

What is this? This is a collection of questions that come up now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list. This ...
5098 votes
127 answers
5.0m views

How can I horizontally center a <div> within another <div> using CSS? <div id="outer"> <div id="inner">Foo foo</div> </div>
5097 votes
28 answers
2.6m views

How can I delete a Git tag that has already been pushed?
markdorison's user avatar
5021 votes
31 answers
1.4m views

What is the difference between a URL, a URI, and a URN?
Sean McMains's user avatar
  • 59.4k
5003 votes
63 answers
3.7m views

What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) { for (var i = 0; i < a.length; i++...
brad's user avatar
  • 75.8k
4978 votes
35 answers
3.5m views

I accidentally ran git merge some_other_branch on my local master branch. I haven't pushed the changes to origin master. How do I undo the merge? After merging, git status says: # On branch master # ...
Matt Huggins's user avatar
  • 83.7k
4926 votes
38 answers
4.6m views

I want a single number that represents the current date and time, like a Unix timestamp.
Pablo Fernandez's user avatar
4833 votes
50 answers
1.9m views

My master and development branches are tracked remotely on GitHub. How do I clone both these branches?
Peter Coulton's user avatar
4807 votes
32 answers
1.4m views

I forked a project, made changes, and created a pull request which was accepted. New commits were later added to the repository. How do I get those commits into my fork?
Lea Hayes's user avatar
  • 64.5k
4792 votes
9 answers
957k views

We have an employee whose surname is Null. Our employee lookup application is killed when that last name is used as the search term (which happens to be quite often now). The error received is: <...
bill's user avatar
  • 27.2k
4779 votes
36 answers
1.2m views

What is the difference between a method decorated with @staticmethod and one decorated with @classmethod?
Daryl Spitzer's user avatar
4771 votes
67 answers
2.8m views

If you have a java.io.InputStream object, how should you process that object and produce a String? Suppose I have an InputStream that contains text data, and I want to convert it to a String, so for ...
Johnny Maelstrom's user avatar
4741 votes
43 answers
2.0m views

How do I remove a Git submodule? Why can't I do git submodule rm module_name?
R. Martinho Fernandes's user avatar
4694 votes
38 answers
3.2m views

How does Python's slice notation work? That is: when I write code like a[x:y:z], a[:], a[::2] etc., how can I understand which elements end up in the slice? See Why are slice and range upper-bound ...
Simon's user avatar
  • 81.2k
4607 votes
44 answers
3.9m views

I'd like to do something like this to tick a checkbox using jQuery: $(".myCheckBox").checked(true); or $(".myCheckBox").selected(true); Does such a thing exist?
tpower's user avatar
  • 57k
4548 votes
35 answers
3.5m views

What command checks if a directory exists or not within a Bash shell script?
Grundlefleck's user avatar
4510 votes
8 answers
605k views

Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response while turning a calendar on and off in Google Calendar: while (1); [ ['u', [ ['smsSentFlag', ...
Jess's user avatar
  • 43k
4500 votes
15 answers
857k views

Suppose I'm familiar with developing client-side applications in jQuery, but now I'd like to start using AngularJS. Can you describe the paradigm shift that is necessary? Here are a few questions that ...
Mark Rajcok's user avatar
4498 votes
42 answers
5.7m views

How do I delete a commit from my branch history? Should I use git reset --hard HEAD?
hap497's user avatar
  • 165k
4498 votes
26 answers
951k views

I keep rereading the Docker documentation to try to understand the difference between Docker and a full VM. How does it manage to provide a full filesystem, isolated networking environment, etc. ...
zslayton's user avatar
  • 53k
4484 votes
47 answers
6.7m views

Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index 1?
Eugene M's user avatar
  • 49.2k
4459 votes
22 answers
2.4m views

How do I easily undo a git rebase? A lengthy manual method is: checkout the commit parent to both of the branches create and checkout a temporary branch cherry-pick all commits by hand reset the ...
webmat's user avatar
  • 61.1k
4459 votes
56 answers
2.5m views

The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.? ...
4439 votes
73 answers
1.5m views

I use x != null to avoid NullPointerException. Is there an alternative? if (x != null) { // ... }
4420 votes
17 answers
6.1m views

d = {'x': 1, 'y': 2, 'z': 3} for key in d: print(key, 'corresponds to', d[key]) How does Python recognize that it needs only to read the key from the dictionary? Is key a special keyword, or is ...
TopChef's user avatar
  • 45.9k
4419 votes
35 answers
1.1m views

How can you enumerate an enum in C#? E.g., the following code does not compile: public enum Suit { Spades, Hearts, Clubs, Diamonds } public void EnumerateAllSuitsDemoMethod() { ...
Ian Boyd's user avatar
  • 259k
4418 votes
42 answers
2.1m views

Chrome v4 supports the placeholder attribute on input[type=text] elements (others probably do too). However, the following CSS doesn't do anything to the placeholder's value: input[placeholder], [...
4374 votes
132 answers
1.9m views

I have an EditText and a Button in my layout. After writing in the edit field and clicking on the Button, I want to hide the virtual keyboard when touching outside the keyboard. Can someone provide a ...
4347 votes
35 answers
1.8m views

What are the differences between a HashMap and a Hashtable in Java? Which is more efficient for non-threaded applications?
dmanxiii's user avatar
  • 52.3k

15 30 50 per page