Most Popular
1500 questions
1307
votes
25 answers
Which @NotNull Java annotation should I use?
I'm looking to make my code more readable as well as use tooling like IDE code inspection and/or static code analysis (FindBugs and Sonar) to avoid NullPointerExceptions. Many of the tools seem incompatible with each others'…
jaxzin
- 13,471
- 4
- 19
- 19
1306
votes
18 answers
How does Python's super() work with multiple inheritance?
How does super() work with multiple inheritance? For example, given:
class First(object):
def __init__(self):
print "first"
class Second(object):
def __init__(self):
print "second"
class Third(First, Second):
def…
Callisto
- 13,071
- 3
- 16
- 4
1305
votes
15 answers
Why does comparing strings using either '==' or 'is' sometimes produce a different result?
Two string variables are set to the same value. s1 == s2 always returns True, but s1 is s2 sometimes returns False.
If I open my Python interpreter and do the same is comparison, it succeeds:
>>> s1 = 'text'
>>> s2 = 'text'
>>> s1 is s2
True
Why is…
jottos
- 20,098
- 9
- 30
- 27
1304
votes
18 answers
What is a race condition?
When writing multithreaded applications, one of the most common problems experienced is race conditions.
My questions to the community are:
What is the race condition?
How do you detect them?
How do you handle them?
Finally, how do you prevent them…
bmurphy1976
- 29,564
- 11
- 33
- 24
1303
votes
15 answers
Difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio?
What is the difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio?
When is the appropriate time to use each one of these?
Fawa
- 13,055
- 3
- 16
- 3
1303
votes
20 answers
master branch and 'origin/master' have diverged, how to 'undiverge' branches'?
Somehow my master and my origin/master branch have diverged.
I actually don't want them to diverge.
How can I view these differences and merge them?
Frank
- 18,432
- 9
- 30
- 30
1303
votes
19 answers
Where is the global git config data stored?
When using git config --global to set things up, to which file will it write?
Example:
git config --global core.editor "blah"
I can't find it at these places:
C:\Program Files\Git\etc\gitconfig
C:\myapp\.git\config
I have not set an ENV?
My Git…
Ian Vaughan
- 20,211
- 13
- 59
- 79
1303
votes
13 answers
'Must Override a Superclass Method' Errors after importing a project into Eclipse
Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error:
The method must override a superclass…
Tim H
- 13,513
- 3
- 17
- 9
1302
votes
27 answers
What is HEAD in Git?
You see the Git documentation saying things like
The branch must be fully merged in HEAD.
But what is Git HEAD exactly?
bobobobo
- 64,917
- 62
- 258
- 363
1301
votes
19 answers
performSelector may cause a leak because its selector is unknown
I'm getting the following warning by the ARC compiler:
"performSelector may cause a leak because its selector is unknown".
Here's what I'm doing:
[_controller performSelector:NSSelectorFromString(@"someMethod")];
Why do I get this warning? I…
Eduardo Scoz
- 24,653
- 6
- 47
- 62
1301
votes
14 answers
Call one constructor from another
I have two constructors which feed values to readonly fields.
public class Sample
{
public Sample(string theIntAsString)
{
int i = int.Parse(theIntAsString);
_intField = i;
}
public Sample(int theInt) => _intField =…
Avi
- 15,696
- 9
- 39
- 54
1301
votes
3 answers
Negative matching using grep (match lines that do not contain foo)
How do I match all lines not matching a particular pattern using grep? I tried this:
grep '[^foo]'
jerrygarciuh
- 21,158
- 26
- 82
- 139
1301
votes
4 answers
Open link in new tab or window
Is it possible to open an a href link in a new tab instead of the same tab?
Link
Rene
- 13,299
- 5
- 19
- 28
1300
votes
11 answers
Using Node.js require vs. ES6 import/export
In a project I am collaborating on, we have two choices on which module system we can use:
Importing modules using require, and exporting using module.exports and exports.foo.
Importing modules using ES6 import, and exporting using ES6 export
Are…
kpimov
- 13,632
- 3
- 12
- 18
1300
votes
24 answers
How to reformat JSON in Notepad++?
I need Notepad++ to take a json string from this
{"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick":…
Donny V.
- 22,248
- 13
- 65
- 79