Most Popular
1500 questions
1434
votes
19 answers
How do I remove a single file from the staging area (undo git add)?
Situation: I have a Git repository with files already in the index. I make changes to several files, open Git and add these files to my staging area with "git add ."
Question: How do I remove one of those files from the staging area but not remove…
PHLAK
- 22,023
- 18
- 49
- 52
1433
votes
11 answers
How do I move a file in Python?
How can I do the equivalent of mv in Python?
mv "path/to/current/file.foo" "path/to/new/destination/for/file.foo"
David542
- 104,438
- 178
- 489
- 842
1431
votes
24 answers
What is the difference between MVC and MVVM?
Is there a difference between the standard "Model View Controller" pattern and Microsoft's Model/View/ViewModel pattern?
Bjorn Reppen
- 22,007
- 9
- 64
- 88
1430
votes
23 answers
What is the use of "assert" in Python?
What does assert mean? How is it used?
Hossein
- 40,161
- 57
- 141
- 175
1429
votes
29 answers
How to align content of a div to the bottom
Say I have the following CSS and HTML code:
#header {
height: 150px;
}
The header section is fixed height, but the header content may change.
I…
Header title
Header content (one or multiple lines)
kristof
- 52,923
- 24
- 87
- 110
1429
votes
24 answers
How to compare a local Git branch with its remote branch
How can I see the diff between a local branch and a remote branch?
mrblah
- 99,669
- 140
- 310
- 420
1428
votes
23 answers
How to do case insensitive string comparison?
How do I perform case insensitive string comparison in JavaScript?
flybywire
- 261,858
- 191
- 397
- 503
1425
votes
20 answers
How to extend an existing JavaScript array with another array, without creating a new array
There doesn't seem to be a way to extend an existing JavaScript array with another array, i.e. to emulate Python's extend method.
I want to achieve the following:
>>> a = [1, 2]
[1, 2]
>>> b = [3, 4, 5]
[3, 4, 5]
>>> SOMETHING HERE
>>> a
[1, 2, 3,…
Dzinx
- 55,586
- 10
- 60
- 78
1424
votes
28 answers
Difference between require, include, require_once and include_once?
In PHP:
When should I use require vs. include?
When should I use require_once vs. include_once?
Scott B
- 38,833
- 65
- 160
- 266
1422
votes
33 answers
Maintain the aspect ratio of a div with CSS
I want to create a responsive div that can change its width/height as the window's width changes.
Are there any CSS rules that would allow the height to change according to the width, while maintaining its aspect ratio?
I know I can do this via…
jackb
- 14,241
- 3
- 17
- 7
1421
votes
20 answers
.gitignore exclude folder but include specific subfolder
I have a folder application/, which I add to the .gitignore.
Inside the application/-folder there is a folder application/language/gr.
How can I include this folder?
I've tried this:
application/
!application/language/gr/
chchrist
- 18,854
- 11
- 48
- 82
1421
votes
5 answers
What are the -Xms and -Xmx parameters when starting JVM?
Please explain the use of the Xms and Xmx parameters in JVMs. What are the default values for them?
Pankaj
- 14,638
- 3
- 17
- 23
1420
votes
57 answers
pg_config executable not found
I am having trouble installing psycopg2. I get the following error when I try to pip install psycopg2:
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the…
user1448207
- 14,335
- 3
- 14
- 5
1419
votes
12 answers
Tab key == 4 spaces and auto-indent after curly braces in Vim
How do I make vi-Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does?
Also, how do I save these settings so I never have to input them…
mmcdole
- 91,488
- 60
- 186
- 222
1418
votes
12 answers
How do I diff the same file between two different commits on the same branch?
In Git, how could I compare the same file between two different commits (not contiguous) on the same branch (master for example)?
I'm searching for a compare feature like the one in Visual SourceSafe (VSS) or Team Foundation Server (TFS).
Is it…
systempuntoout
- 71,966
- 47
- 171
- 241