Hard reset of a single file

You can use the following command: … which will update both the working copy of my-file.txt and its state in the index with that from HEAD. — basically means: treat every argument after this point as a file name. More details in this answer. Thanks to VonC for pointing this out.

When should I use the new keyword in C++?

Method 1 (using new) Allocates memory for the object on the free store (This is frequently the same thing as the heap) Requires you to explicitly delete your object later. (If you don’t delete it, you could create a memory leak) Memory stays allocated until you delete it. (i.e. you could return an object that you created using new) The example in the question will leak memory unless … Read more

Can’t connect to docker from docker-compose

The Docker machine is running. But you need to export some environment to connect to the Docker machine. By default, the docker CLI client is trying to communicate to the daemon using http+unix://var/run/docker.sock (as shown in the error message). Export the correct environment variables using eval $(docker-machine env dev) and then try again. You can also just run docker-machine env dev to see … Read more

Eclipse: Java was started but returned error code=13

This error occurs because your Eclipse version is 64-bit. You should download and install 64-bit JRE and add the path to it in eclipse.ini. For example: Note: The -vm parameter should be just before -vmargs and the path should be on a separate line. It should be the full path to the javaw.exe file. Do not enclose the path in double quotes (“). … Read more

How do you create vectors with specific intervals in R?

In R the equivalent function is seq and you can use it with the option by: In addition to by you can also have other options such as length.out and along.with. length.out: If you want to get a total of 10 numbers between 0 and 1, for example: along.with: It takes the length of the vector you supply as input and provides a … Read more

Categories R

Start with pyglet or pygame?

pygame is richly active, witness the Aug release of 1.9 with nokia s60 support, enhanced py2app/py2exe support, and a bevvy of experimental features (support for Python 3.1, webcams, gfx, …). Books like Hello World and periodic, fun competitions like ludumdare and pyweek bear witness to the vitality of its community and ecosystem. pyglet has a neat, newer API, and is convenient … Read more

3-dimensional array in numpy

New at Python and Numpy, trying to create 3-dimensional arrays. My problem is that the order of the dimensions are off compared to Matlab. In fact the order doesn’t make sense at all. Creating a matrix: In my world this should result in 2 rows, 3 columns and 4 depth dimensions and it should be … Read more