Golden Rule 3 Use a Version Control System

A few years ago I used to run around with an USB-Stick for my projects: if I worked at my office I copied the files at the end of the day and took them with me to keep working on the project at home or at my other office. Getting tired of that (especially of me forgetting to copy all the files or taking the stick with me) I changed to a synchronization software that kept my files at the same state everywhere I worked. That was a great improvement, although it did not solve my second problem: Keeping track of all the versions of my project. I used to keep numbered subdirectories, but the main problem was to keep track of the changes.
Finally I switched to a version control system. This keeps track of all the versions, the changes and I can even work together with other people on the same files. I can download the actual version to any computer, update the project or commit changes as long as I have internet.
I use subversion (http://subversion.tigris.org/). It is free and there is a nice extension for the Windows Explorer to manage all your files called Tortoise (http://tortoisesvn.tigris.org/).
Now I only have one version of a project on my notebook. If I want to go back I can scroll through the logs and search for the version I am looking for and see the differences with the actual version of a file. It even integrates with Emacs.
If I work in a team with people at the other end of the world, we don’t have to email the projects but everybody can log in and download the files.
In the next few weeks I will show how it works.
Once you start working with a version control system you will not understand that you could have lived without it.
 

Formatted code in Word using Emacs

Sometimes I have to write some documentation using Word instead of LaTeX. In LaTeX you have some nice options for typesetting code be it R, Stata or Gams. In Word, however, there is no easy way to format your code. I found a nice way to get my code nicely formatted (in color) using Emacs: I installed the Windows version of Emacs and there I can “Quick Print” – “Preview with Web Browser”. This opens the file as htm in my browser. I now just save this file somewhere on my computer and open it in Word. The text is nicely formatted.
For example some R-Code would look like this in Word: