Mercurial/TortoiseHg: Move Files or Directories

A move is called a rename in Mercurial. So, to move a tracked file/directory called Foobar into FooDir use:

$ hg rename Foobar FooDir\Foobar

The UI of TortoiseHg does not seem to be as mature as TortoiseSVN right now (v0.9.3). One cannot move a file/directory by keeping the right mouse button pressed while moving the picked items across to the destination directory. To move a file or directory, right-click and choose TortoiseHg β†’ Rename File.


Mercurial: Import Subversion Project

Mercurial is a distributed VCS (DVCS). If you are planning to migrate from Subversion to Mercurial, it might be better to do this on a per-project basis. Due to the nature of a DVCS, it is better to spin off each of your Subversion projects in the repository as separate Mercurial repositories. Here is how:

  1. If you have not already done so, make a copy of the Mercurial configuration file (Mercurial.ini) and add your username. See this post on how to do this.
  2. The command to convert repositories is hg convert. It will not work unless the convert extension is enabled. To do this, open your Mercurial.ini and in the [extensions] section uncomment the convert = line. It should read:
    convert =
  3. The default Windows binaries of Mercurial cannot import from Subversion. If you attempt a hg convert using this binary, you will see an error:
    $ hg convert file:///C:/SVNRep/FoobarProject
    Subversion python bindings could not be loaded

    You will need the Python bindings of Subversion and Mercurial installed on top of a standalone Python to be able to do this. That is too messy! But, there is an easier alternative to this. Install TortoiseHg, the Explorer extension to Hg. Its hg.exe has been built with all the necessary bindings. Issue the convert command using its hg.exe:

    $ "C:\Program Files\TortoiseHg\hg.exe" convert file:///C:/SVNRep/FoobarProject
  4. This should work. If your Subversion project has been cleanly maintained with the canonical trunks, branches and tags structure hg convert can import all of that correctly into the Mercurial structure of tags.

Mercurial: No username supplied

The first error you might face while using Mercurial might be this:

$ hg commit
abort: no username supplied (see "hg help config")

Mercurial needs a username and email for almost all its operations. It looks for this in a Mercurial configuration file.

For Windows:Β The Mercurial configuration file is named Mercurial.ini. You will find a copy of this file in the Mercurial installation directory. Copy it to your %HOMEDRIVE%%HOMEPATH% directory (C:\Users\AverageJoe\ on Windows 7).

For Linux: The Mercurial configuration file is named .hgrc. Create a file with this name in the home directory of the user if not already there.

Add these two lines to the Mercurial configuration file:

username = Average Joe <>

Mercurial commands should work fine after this.

Tried with: Windows 7 Enterprise, Ubuntu 12.04 and Mercurial 2.0.2

Ipe: Import Ipe Figures

Ipe is the editor of choice to draw figures for Computational Geometry papers and presentations. It is common to create a Ipe figure composed of other Ipe figures (stored in different .ipe files). But, there is no straightforward way to accomplish this import operation.

One way to achieve this is:

  1. Open the source and destination Ipe figures in separate Ipe instances.
  2. In the source Ipe instance, do a Select All to select the complete source Ipe figure. Copy it.
  3. Switch back to the destination Ipe and Paste.

CDBurnerXP: Copy a Bootable Disc

A little care is needed when making a copy of OS installation discs. Making a normal data copy does not copy the boot data and renders the new disc un-bootable. To create a bootable disc copy of a bootable disc using CDBurnerXP:

  1. Put the original bootable disc in the drive. Use Copy Data Disc with the destination as your harddisk. This creates a bootable ISO copy of the disc.
  2. Put a blank disc in the drive. Choose the Burn ISO Image option and use the bootable ISO created in the above step.

OpenVPN: Route Add Failure on Windows Vista


OpenVPN (and OpenVPN GUI) on Windows Vista fails silently if executed without Administrator privileges. The error is almost not noticeable since VPN succeeds in obtaining an IP address (see the green OpenVPN icon in the screenshot). But, the VPN is not established due to the error:

ERROR: Windows route add command failed: system() returned error code 1
The requested operation requires elevation.


Run OpenVPN as Administrator or if this is a frequent used application change its shortcut to always run as Administrator.

Windows Vista: Service Pack 2 Cleanup

I am using a LG C1 Express Dual tablet PC for a few weeks. It came with a fresh Vista image, which on connecting to the Internet underwent long hours of Windows updates, pulling itself through Vista SP1 (Service Pack 1) and later Vista SP2.

After these updates, I saw that the free space on C: had reduced quite a bit and ran Treesize Free to check out the situation. I found the C:\Windows\WinSxS directory occupying a lot of space!

It turns out that the WinSxS directory keeps components from all old updates so that uninstall (and rollback) of updates can be supported. Since, SP2 is a pretty significant update, I am not interested in keeping the files from the updates older than SP2. If you are sure of this, you can recover a lot of space by running the Windows Component Clean Tool (compcln.exe).

compcln.exe resides in a super-long-name directory inside C:\Windows\WinSxS, but it is hardlinked to the C:\Windows\Sytem32 directory. So, to execute it, open cmd and type:

$ C:\Windows\System32\compcln

Press Y when it asks for confirmation of cleanup. Running compcln.exe recovered ~1GB of disk space on this tablet PC.

How to do image animation in Beamer

Beamer makes it very easy to include a series of images and display them in a serial animated style in separate frames (slides).

For example, to display the images foobar-0.png, foobar-1.png and foobar-2.png in a serial fashion use:


xmpmulti is a package that ships along with the Beamer package. \multiinclude is the command that takes care of putting the foobar-x.png into different frames. Make sure that the files are named as basename-number.format, i.e., the basename and the number are separated by a hyphen. The format option is the extension of the files.

\multiinclude starts from file number 0. To start from a different number, say 9:


\multiinclude inserts all files that are in the above format. To make it stop at a certain number, say 7:


Typically, images are inserted using the \includegraphics command. The settings passed to \includegraphics can be passed to \multiinclude using its graphics option. For example, to set the scale of the image to 0.3:


By default, the images are placed one on top of another. To replace each image by the next image try:


IrfanView: Replicate Crop on Multiple Images

I had a series of images of the same dimensions and wanted to crop all of them with the same bounds. Eyeballing the original crop and approximating the same on the rest of the images was out of the question, since the crops had to match to the very last pixel.

I tried to note down the crop parameters and redo the same on the rest of the images. When a crop rectangle is drawn on the image, its parameters can be seen on the Irfanview titlebar. The first 2 numbers are the coordinates of the origin (top left) and the next two numbers are the dimensions of the crop rectangle.

Redoing this crop manually on many images turned out bad since it was tiring to draw the rectangle with a mouse correctly to match the parameters.

Thankfully, the swiss army knife that is IrfanView has a better solution. Choose Edit β†’ Create custom crop selection. If you have chosen a crop rectangle its parameters will already be displayed. Click on Save current values, click on Apply to image and crop the image. Open the rest of the images and do the same.