Most Popular

1500 questions
2760
votes
16 answers

What is the difference between the 'COPY' and 'ADD' commands in a Dockerfile?

What is the difference between the COPY and ADD commands in a Dockerfile, and when would I use one over the other? COPY The COPY instruction will copy new files from and add them to the container's filesystem at path ADD…
Steve
  • 49,845
  • 30
  • 92
  • 138
2758
votes
19 answers

How do you clone a Git repository into a specific folder?

Executing the command git clone git@github.com:whatever creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder: /httpdocs/whatever/public My problem is that I need the contents of the…
David Smith
  • 35,646
  • 10
  • 43
  • 61
2751
votes
40 answers

How to change the author and committer name and e-mail of multiple commits in Git?

I was writing a simple script on the school computer, and committing the changes to Git (in a repo that was in my pen drive, cloned from my computer at home). After several commits, I realized I was committing stuff as the root user. Is there any…
2745
votes
32 answers

How can I create an executable JAR with dependencies using Maven?

I want to package my project in a single executable JAR for distribution. How can I make a Maven project package all dependency JARs into my output JAR?
soemirno
  • 28,004
  • 3
  • 18
  • 14
2737
votes
13 answers

Find the current directory and file's directory

In Python, what commands can I use to find: the current directory (where I was in the terminal when I ran the Python script), and where the file I am executing is?
John Howard
  • 55,887
  • 22
  • 47
  • 65
2729
votes
21 answers

HTTP GET with request body

I'm developing a new RESTful webservice for our application. When doing a GET on certain entities, clients can request the contents of the entity. If they want to add some parameters (for example sorting a list) they can add these parameters in the…
Evert
  • 83,661
  • 18
  • 106
  • 170
2729
votes
34 answers

Find the version of an installed npm package

How to find the version of an installed node.js/npm package? This prints the version of npm itself: npm -v This prints a cryptic error: npm version This prints the package version on the registry (i.e. the latest…
Laurent Couvidou
  • 30,206
  • 3
  • 28
  • 43
2725
votes
21 answers

Encode URL in JavaScript?

How do you safely encode a URL using JavaScript such that it can be put into a GET string? var myUrl = "http://example.com/index.html?param=1&anotherParam=2"; var myOtherUrl = "http://example.com/index.html?url=" + myUrl; I assume that you need to…
nickf
  • 520,029
  • 197
  • 633
  • 717
2719
votes
11 answers

Why is "1000000000000000 in range(1000000000000001)" so fast in Python 3?

It is my understanding that the range() function, which is actually an object type in Python 3, generates its contents on the fly, similar to a generator. This being the case, I would have expected the following line to take an inordinate amount of…
Rick supports Monica
  • 38,813
  • 14
  • 65
  • 113
2703
votes
34 answers

ssh "permissions are too open" error

I had a problem with my mac where I couldn't save any kind of file on the disk anymore. I had to reboot OSX lion and reset the permissions on files and acls. But now when I want to commit a repository I get the following error from ssh: Permissions…
Yannick Schall
  • 29,203
  • 6
  • 28
  • 42
2703
votes
21 answers

Ignore files that have already been committed to a Git repository

I have an already initialized Git repository that I added a .gitignore file to. How can I refresh the file index so the files I want ignored get ignored?
trobrock
  • 45,269
  • 11
  • 36
  • 45
2695
votes
73 answers

How can I get query string values in JavaScript?

Is there a plugin-less way of retrieving query string values via jQuery (or without)? If so, how? If not, is there a plugin which can do so?
Subliminal Hash
  • 13,465
  • 20
  • 71
  • 101
2685
votes
40 answers

How can I install pip on Windows?

pip is a replacement for easy_install. But should I install pip using easy_install on Windows? Is there a better way?
mit
  • 10,728
  • 10
  • 45
  • 74
2684
votes
32 answers

How do I get a YouTube video thumbnail from the YouTube API?

If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?
CodeOverload
  • 45,400
  • 52
  • 128
  • 215
2679
votes
16 answers

Check if a given key already exists in a dictionary

I wanted to test if a key exists in a dictionary before updating the value for the key. I wrote the following code: if 'key1' in dict.keys(): print "blah" else: print "boo" I think this is not the best way to accomplish this task. Is there a…
Mohan Gulati
  • 28,179
  • 5
  • 21
  • 20