Most Popular
1500 questions
6939
votes
33 answers
How do I remove a property from a JavaScript object?
Say I create an object as follows:
let myObject = {
"ircEvent": "PRIVMSG",
"method": "newURI",
"regex": "^http://.*"
};
How should I remove the property regex to end up with new myObject as follows?
let myObject = {
"ircEvent": "PRIVMSG",
…

johnstok
- 90,972
- 12
- 52
- 76
6653
votes
24 answers
What are metaclasses in Python?
In Python, what are metaclasses and what do we use them for?

e-satis
- 544,085
- 107
- 288
- 324
6545
votes
42 answers
How do I check whether a file exists without exceptions?
How do I check whether a file exists or not, without using the try statement?

spence91
- 71,957
- 8
- 26
- 19
6528
votes
53 answers
How do I find all files containing specific text on Linux?
I'm trying to find a way to scan my entire Linux system for all files containing a specific string of text. Just to clarify, I'm looking for text within the file, not in the file name.
When I was looking up how to do this, I came across this…

Nathan
- 71,851
- 11
- 33
- 50
6298
votes
42 answers
How to return the response from an asynchronous call
I have a function foo which makes an asynchronous request. How can I return the response/result from foo?
I am trying to return the value from the callback, as well as assigning the result to a local variable inside the function and returning that…

Felix Kling
- 745,407
- 169
- 1,045
- 1,099
6178
votes
36 answers
What is the difference between "px", "dip", "dp" and "sp"?
What is the difference between Android units of measure?
px
dip
dp
sp

capecrawler
- 65,707
- 7
- 30
- 34
6165
votes
56 answers
How do I merge two dictionaries in a single expression (take union of dictionaries)?
I have two Python dictionaries, and I want to write a single expression that returns these two dictionaries, merged (i.e. taking the union). The update() method would be what I need, if it returned its result instead of modifying a dictionary…

Carl Meyer
- 112,704
- 19
- 103
- 114
5922
votes
38 answers
What is the difference between POST and PUT in HTTP?
According to RFC 2616, § 9.5, POST is used to create a resource:
The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the…

alex
- 70,381
- 9
- 48
- 57
5905
votes
68 answers
How do I include a JavaScript file in another JavaScript file?
Is there something in JavaScript similar to @import in CSS that allows you to include a JavaScript file inside another JavaScript file?

Alec Smart
- 89,078
- 36
- 118
- 180
5861
votes
20 answers
Move the most recent commit(s) to a new branch with Git
I'd like to move the last several commits I've committed to master to a new branch and take master back to before those commits were made. Unfortunately, my Git-fu is not strong enough yet, any help?
I.e. How can I go from this
master A - B - C - D…

Mark A. Nicolosi
- 76,625
- 10
- 43
- 46
5771
votes
50 answers
How to disable text selection highlighting
For anchors that act like buttons (for example Questions, Tags, Users, etc. which are located on the top of the Stack Overflow page) or tabs, is there a CSS standard way to disable the highlighting effect if the user accidentally selects the text?
I…
anon
5658
votes
72 answers
How can I get the source directory of a Bash script from within the script itself?
How do I get the path of the directory in which a Bash script is located, inside that script?
I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I…

Jiaaro
- 70,248
- 39
- 160
- 186
5656
votes
48 answers
Which equals operator (== vs ===) should be used in JavaScript comparisons?
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.length == 0 inside of an if statement.
Is there a…

bcasp
- 57,427
- 4
- 18
- 14
5648
votes
39 answers
What's the difference between using "let" and "var"?
ECMAScript 6 introduced the let statement.
I've heard that it's described as a local variable, but I'm still not quite sure how it behaves differently than the var keyword.
What are the differences? When should let be used instead of var?

TM.
- 101,338
- 30
- 121
- 127
5622
votes
63 answers
How to execute a program or call a system command?
How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?

freshWoWer
- 57,869
- 10
- 34
- 33