Most Popular

1500 questions
6018
votes
66 answers

How do I execute a program or call a system command?

How do I call an external command within Python as if I had typed it in a shell or command prompt?
freshWoWer
  • 61,969
  • 10
  • 36
  • 35
5649
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,397
  • 4
  • 19
  • 15
5642
votes
18 answers

What is the maximum length of a URL in different browsers?

What is the maximum length of a URL for each browser? Is a maximum URL length part of the HTTP specification?
Sander Versluys
  • 72,737
  • 23
  • 84
  • 91
5639
votes
36 answers

How do I reset or revert a file to a specific revision?

How do I revert a modified file to its previous revision at a specific commit hash (which I determined via git log and git diff)?
Hates_
  • 66,613
  • 6
  • 32
  • 37
5616
votes
41 answers

Loop (for each) over an array in JavaScript

How can I loop through all the entries in an array using JavaScript?
Dante1986
  • 58,291
  • 13
  • 39
  • 54
5551
votes
27 answers

How do I create a directory, and any missing parent directories?

How do I create a directory at a given path, and also create any missing parent directories along that path? For example, the Bash command mkdir -p /path/to/nested/directory does this.
Parand
  • 102,950
  • 48
  • 151
  • 186
5550
votes
18 answers

How do I push a new local branch to a remote Git repository and track it too?

How do I: Create a local branch from another branch (via git branch or git checkout -b). Push the local branch to the remote repository (i.e. publish), but make it trackable so that git pull and git push will work.
Roni Yaniv
  • 57,651
  • 5
  • 19
  • 16
5537
votes
27 answers

Reset local repository branch to be just like remote repository HEAD

How do I reset my local branch to be just like the branch on the remote repository? I tried: git reset --hard HEAD But git status claims I have modified files: On branch master Changes to be committed: (use "git reset HEAD ..." to unstage) …
hap497
  • 154,439
  • 43
  • 83
  • 99
5518
votes
11 answers

The definitive guide to form-based website authentication

Moderator note: This question is not a good fit for our question and answer format with the topicality rules which currently apply for Stack Overflow. We normally use a "historical lock" for such questions where the content still has value.…
Michiel de Mare
  • 41,982
  • 29
  • 103
  • 134
5476
votes
79 answers

How can I validate an email address in JavaScript?

I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?
pix0r
  • 31,139
  • 18
  • 86
  • 102
5404
votes
78 answers

How do I replace all occurrences of a string in JavaScript?

Given a string: s = "Test abc test test abc test test test abc test test abc"; This seems to only remove the first occurrence of abc in the string above: s = s.replace('abc', ''); How do I replace all occurrences of it?
Ali
  • 261,656
  • 265
  • 575
  • 769
5342
votes
43 answers

What is a plain English explanation of "Big O" notation?

I'd prefer as little formal definition as possible and simple mathematics.
5331
votes
36 answers

How do I resolve merge conflicts in a Git repository?

How do I resolve merge conflicts in my Git repository?
Spoike
  • 119,724
  • 44
  • 140
  • 158
5310
votes
27 answers

How to determine the URL that a local Git repository was originally cloned from

I pulled a project with several forks on GitHub, but forgot which fork it was. How do I determine which fork I pulled?
Tim
  • 53,399
  • 3
  • 19
  • 19
5275
votes
34 answers

Regular expression to match a line that doesn't contain a word

I know it's possible to match a word and then reverse the matches using other tools (e.g. grep -v). However, is it possible to match lines that do not contain a specific word, e.g. hede, using a regular…
knaser
  • 1,421
  • 7
  • 19
  • 16