Most Popular

1500 questions
2358
votes
17 answers

What is the difference between CMD and ENTRYPOINT in a Dockerfile?

In Dockerfiles there are two commands that look similar to me: CMD and ENTRYPOINT. But I guess that there is a (subtle?) difference between them - otherwise it would not make any sense to have two commands for the very same thing. The documentation…
Golo Roden
  • 127,345
  • 89
  • 282
  • 404
2357
votes
49 answers

How can I delete all Git branches which have been merged?

I have many Git branches. How do I delete branches which have already been merged? Is there an easy way to delete them all instead of deleting them one by one?
Nyambaa
  • 35,091
  • 9
  • 28
  • 35
2355
votes
10 answers

What is JSONP, and why was it created?

I understand JSON, but not JSONP. Wikipedia's document on JSON is (was) the top search result for JSONP. It says this: JSONP or "JSON with padding" is a JSON extension wherein a prefix is specified as an input argument of the call itself. Huh?…
Cheeso
  • 184,848
  • 97
  • 460
  • 704
2355
votes
40 answers

How do I parse command line arguments in Bash?

Say, I have a script that gets called with this line: ./myscript -vfd ./foo/bar/someFile -o /fizz/someOtherFile or this one: ./myscript -v -f -d -o /fizz/someOtherFile ./foo/bar/someFile What's the accepted way of parsing this such that in each…
Lawrence Johnston
  • 62,938
  • 41
  • 120
  • 182
2352
votes
26 answers

Static class variables and methods in Python

How do I create static class variables or methods in Python?
Andrew Walker
  • 39,138
  • 7
  • 58
  • 82
2352
votes
85 answers

Get all unique values in a JavaScript array (remove duplicates)

I have an array of numbers that I need to make sure are unique. I found the code snippet below on the internet and it works great until the array has a zero in it. I found this other script here on Stack Overflow that looks almost exactly like it,…
Mottie
  • 79,894
  • 29
  • 121
  • 237
2351
votes
19 answers

How to get the children of the $(this) selector?

I have a layout similar to this:
and would like to use a jQuery selector to select the child img inside the div on click. To get the div, I've got this selector: $(this) How can I get the child img using a…
Alex
  • 25,896
  • 5
  • 28
  • 36
2349
votes
24 answers

How can I delete a file from a Git repository?

I have added a file named "file1.txt" to a Git repository. After that, I committed it, added a couple of directories called dir1 and dir2, and committed them to the Git repository. Now the current repository has "file1.txt", dir1, and dir2. How can…
webminal.org
  • 41,614
  • 36
  • 89
  • 125
2345
votes
50 answers

How can I guarantee that my enums definition doesn't change in JavaScript?

Would the following make the objects fulfil all characteristics that enums have in JavaScript? Something like: my.namespace.ColorEnum = { RED : 0, GREEN : 1, BLUE : 2 } // later on if(currentColor == my.namespace.ColorEnum.RED) { //…
David Citron
  • 42,409
  • 20
  • 61
  • 71
2338
votes
1 answer

See what's in a stash without applying it

I see here you can apply/unapply a stash and even create a new branch off of a stash. Is it possible to simply see what is inside the stash without actually applying it?
Chris Abrams
  • 36,184
  • 19
  • 50
  • 56
2331
votes
39 answers

Generating random whole numbers in JavaScript in a specific range

How can I generate random whole numbers between two specified variables in JavaScript, e.g. x = 4 and y = 8 would output any of 4, 5, 6, 7, 8?
zacharyliu
  • 23,944
  • 4
  • 18
  • 15
2319
votes
20 answers

Get the size of the screen, current web page and browser window

How can I get windowWidth, windowHeight, pageWidth, pageHeight, screenWidth, screenHeight, pageX, pageY, screenX, screenY which will work in all major browsers?
turtledove
  • 24,474
  • 3
  • 20
  • 20
2316
votes
40 answers

How do I get a consistent byte representation of strings in C# without manually specifying an encoding?

How do I convert a string to a byte[] in .NET (C#) without manually specifying a specific encoding? I'm going to encrypt the string. I can encrypt it without converting, but I'd still like to know why encoding comes to play here. Also, why should…
Agnel Kurian
  • 56,037
  • 41
  • 141
  • 214
2313
votes
17 answers

Difference between decimal, float and double in .NET?

What is the difference between decimal, float and double in .NET? When would someone use one of these?
Tom
2313
votes
33 answers

Indent multiple lines quickly in vi

It should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do I indent multiple lines quickly in vi?
Allain Lalonde
  • 88,763
  • 69
  • 182
  • 238