Most Popular
1500 questions
4816
votes
35 answers
Undo a Git merge that hasn't been pushed yet
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
# Your branch is ahead of 'origin/master' by 5…

Matt Huggins
- 81,398
- 36
- 149
- 218
4772
votes
43 answers
How do I get a timestamp in JavaScript?
I want a single number that represents the current date and time, like a Unix timestamp.

Pablo Fernandez
- 279,434
- 135
- 377
- 622
4764
votes
9 answers
How to pass "Null" (a real surname!) to a SOAP web service in ActionScript 3
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
- 26,883
- 3
- 17
- 13
4732
votes
48 answers
How do I clone all remote branches?
My master and development branches are tracked remotely on GitHub. How do I clone both these branches?

Peter Coulton
- 54,789
- 12
- 54
- 72
4693
votes
29 answers
How can I delete a remote tag?
How can I delete a Git tag that has already been pushed?

markdorison
- 139,374
- 27
- 55
- 71
4673
votes
64 answers
How do I read / convert an InputStream into a String in Java?
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 example I can write that to a log file.
What is…

Johnny Maelstrom
- 47,581
- 5
- 21
- 18
4643
votes
31 answers
How do I update or sync a forked repository on GitHub?
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
- 62,536
- 16
- 62
- 111
4574
votes
36 answers
@staticmethod vs @classmethod in Python
What is the difference between a method decorated with @staticmethod and one decorated with @classmethod?

Daryl Spitzer
- 143,156
- 76
- 154
- 173
4554
votes
44 answers
Setting "checked" for a checkbox with jQuery
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
- 56,100
- 19
- 68
- 100
4512
votes
38 answers
How slicing in Python works
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? Please include references where appropriate.
See Why are slice and range upper-bound…

Simon
- 78,655
- 25
- 88
- 118
4507
votes
15 answers
"Thinking in AngularJS" if I have a jQuery background?
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 might help you frame an answer:
How do I…

Mark Rajcok
- 362,217
- 114
- 495
- 492
4461
votes
8 answers
Why does Google prepend while(1); to their JSON responses?
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', 'false'],
['hideInvitations', 'false'],
…

Jess
- 42,368
- 6
- 37
- 51
4430
votes
37 answers
How do I remove a submodule?
How do I remove a Git submodule?
Why can't I do
git submodule rm module_name?

R. Martinho Fernandes
- 228,013
- 71
- 433
- 510
4407
votes
56 answers
Which "href" value should I use for JavaScript links, "#" or "javascript:void(0)"?
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.?
function myJsFunc() {
alert("myJsFunc");
}

2cBGj7vsfp
- 2,737
- 3
- 17
- 5
4393
votes
24 answers
How is Docker different from a virtual machine?
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. without being as heavy?
Why is deploying software to a…

zslayton
- 51,416
- 9
- 35
- 50