Most Popular
1500 questions
1049
votes
18 answers
What's the difference between git reset --mixed, --soft, and --hard?
I'm looking to split a commit up and not sure which reset option to use.
I was looking at the page In plain English, what does "git reset" do?, but I realized I don't really understand what the git index or staging area is and thus the explanations…

Michael Chinen
- 16,787
- 5
- 32
- 45
1049
votes
17 answers
Difference between HashMap, LinkedHashMap and TreeMap
What is the difference between HashMap, LinkedHashMap and TreeMap in Java?
I don't see any difference in the output as all the three has keySet and values. What are Hashtables?
Map m1 = new HashMap();
m1.put("map", "HashMap");
m1.put("schildt",…

Kevin
- 22,694
- 25
- 78
- 110
1049
votes
23 answers
When to use static methods
I am wondering when to use static methods? Say if I have a class with a few getters and setters, a method or two, and I want those methods only to be invokable on an instance object of the class. Does this mean I should use a static…

KP65
- 13,095
- 12
- 44
- 46
1048
votes
10 answers
How do I put an already-running process under nohup?
I have a process that is already running for a long time and don't want to end it.
How do I put it under nohup (that is, how do I cause it to continue running even if I close the terminal?)

flybywire
- 250,866
- 188
- 393
- 498
1048
votes
24 answers
Angular HTML binding
I am writing an Angular application and I have an HTML response I want to display.
How do I do that? If I simply use the binding syntax {{myVal}} it encodes all HTML characters (of course).
I need somehow to bind the innerHTML of a div to the…

Aviad P.
- 31,181
- 13
- 104
- 119
1047
votes
11 answers
What is the correct way to check for string equality in JavaScript?
What is the correct way to check for equality between Strings in JavaScript?

JSS
- 10,487
- 3
- 15
- 3
1047
votes
38 answers
Use jQuery to hide a DIV when the user clicks outside of it
I am using this code:
$('body').click(function() {
$('.form_wrapper').hide();
});
$('.form_wrapper').click(function(event){
event.stopPropagation();
});
And this HTML:

Scott Yu - builds stuff
- 11,485
- 8
- 41
- 54
1047
votes
21 answers
Bash - Get Current Directory or Folder Name (Without Full Path) In Bash Script
How could I retrieve the current working directory/folder name in a bash script, or even better, just a terminal command.
pwd gives the full path of the current working directory, e.g. /opt/local/bin but I only want bin
Thanks.

Derek Dahmer
- 14,145
- 6
- 34
- 33
1046
votes
8 answers
What's the difference between event.stopPropagation and event.preventDefault?
They seem to be doing the same thing...
Is one modern and one old? Or are they supported by different browsers?
When I handle events myself (without framework) I just always check for both and execute both if present. (I also return false, but I…

Rudie
- 50,281
- 41
- 129
- 172
1046
votes
20 answers
What is the difference between JDK and JRE?
What is the difference between JDK and JRE?
What are their roles and when should I use one or the other?

i2ijeya
- 15,582
- 18
- 61
- 72
1044
votes
6 answers
How do I redirect with JavaScript?
How do you redirect to a page from another page with JavaScript?

Lucky13
- 11,245
- 7
- 23
- 36
1044
votes
11 answers
How to copy commits from one branch to another?
I've got two branches from my master:
v2.1: (version 2) I've been working on for several months
wss: that I created yesterday to add one specific feature to my master (in production)
Is there a way to copy yesterday's commits from wss to v2.1?

Bob Walsh
- 11,851
- 4
- 23
- 21
1043
votes
24 answers
Make body have 100% of the browser height
I want to make body have 100% of the browser height. Can I do that using CSS?
I tried setting height: 100%, but it doesn't work.
I want to set a background color for a page to fill the entire browser window, but if the page has little content I get…

bodyofheat
- 10,433
- 3
- 14
- 5
1043
votes
14 answers
Constants in Objective-C
I'm developing a Cocoa application, and I'm using constant NSStrings as ways to store key names for my preferences.
I understand this is a good idea because it allows easy changing of keys if necessary.
Plus, it's the whole 'separate your data from…

Allyn
- 20,121
- 16
- 56
- 68
1043
votes
10 answers
How do I check file size in Python?
How do I get the size of a file in Python?

5YrsLaterDBA
- 31,950
- 42
- 129
- 207