Monthly Archives: September 2011

Decentralized development workflow with Bazaar and DVCS in general

Many of my friends are getting into Bazaar or other distributed version control these days.

Bazaar is in the same class as git and mercurial = distributed version control software or DVCS. This class is significantly more powerful compared to traditional version control software (VCS) such as Subversion. The feature set of DVCS is often a superset of VCS, so usually you can do everything with DVCS that you could do with VCS, and a whole lot more.

The most significant consequence of being “distributed” is that a “checkout” is never “just a checkout”, it’s a whole repository, with full history.

There are two checkout commands in Bazaar, “checkout” and “branch”, for two different workflows.

You use “bzr checkout” for a centralized workflow, like the one used with Subversion. That is, there is a central repository that all developers commit to, they checkout the project with “bzr checkout”, and when they commit with “bzr commit” it gets written to the central repository. To merge the changes by other developers, you do “bzr update”. And when you commit, if other developers had commits while you were working, then you have to do “bzr update” first before you can do “bzr commit”. In this workflow bazaar works exactly the same way as Subversion, with the added benefits of having the entire history on your computer, so you can do diff and log without hitting the network.

You use “bzr branch” for a de-centralized workflow, radically different from Subversion. The repository you branched from is called the “parent” branch and is remembered for reference, but your local branch is not bound to it in any way. Practically it means that all your commits will be local only, to your local branch, and not to the parent. And since your local branch is its own master, “bzr update” will do nothing, because you are in fact always up to date ūüėČ To merge changes done by other developers in the parent, use “bzr rebase”. This will basically rewind your local branch to the revision that you branched from, replay the changes made by others in the parent, and finally replay your own changes. The same way as with “svn update” (or “bzr update”), conflicts may happen during this operation. After resolving conflicts, you can continue with “bzr rebase-continue”.

Side note: the “rebase” command is not a standard command in Bazaar, it is in the “rewrite” plugin. If you don’t have the plugin you can accomplish basically the same with “bzr merge”, but “bzr rebase” is a tad bit cleaner.

When your changes are ready to be merged into the parent branch, you push your branch to a place where your team can access it, and the manager of the parent branch can merge from it and commit into the parent branch. In the end, there is no practical difference between the “checkout” and “branch” workflows, the end result is the same. As such, with a DVCS there is little reason to use the “checkout” workflow.

Being disconnected from a central branch gives you a lot of freedom, for example you can create experimental branches of your own without affecting your team members, you can hack and commit even when you don’t have internet, and of course have the entire project history with you at all times. There is also no central repository server that may crash, no need to setup one, no need to manage user accounts and authentication. Backup is almost unnecessary, if you have enough developers in your team, somebody will always have a copy of the repository so you could lose a few latest revisions only. Once you get comfortable with a DVCS, you will find that the tool doesn’t get in your way, you can happily slice and dice repositories. Branching and merging of branches is straightforward and perfectly natural with any DVCS, there is none of the black magic Subversion needs to have that working.

You can read more about this and other variations of the decentralized workflow in the Bazaar documentation. I use mainly Bazaar for its intuitive simplicity, Git with Eclipse projects due to a lack of a good Bazaar plugin. The various DVCS certainly have some differences, but the essence is the same, and whichever you use, it will make you a happier developer with less stress.

Email forwarding option missing on newly setup google hosted domains

My internet hosting company has a nice feature to make it really easy to use Gmail for all my hosted domains. I’ve been using this for several domains, and I typically create an account and have it forward all incoming emails to my personal email account. Usually you do this in Mail settings / Forwarding and POP/IMAP¬†but recently this option disappeared on the the google hosted domains,¬†there is only POP/IMAP Download¬†instead. Google Help pages are useless, there is nothing written about why the option is was removed.

But guess what, the feature is actually still there! You just have to wait! It seems there is a delay, and the email forwarding option is not available soon after you setup the domain. I don’t know why, I haven’t found relevant documentation. I just experienced with several domains already that I just need to wait a couple of days, and eventually the option appears.

You can tell it’s a bug, because if you try to create a filter, you will find a link “Manage your forwarding addresses” which takes you to the POP/IMAP Download¬†page, where in fact it is impossible to setup forwarding addresses.

In short, it’s a gotcha. If you are experiencing this, give it a few days, hopefully the option will appear eventually.

Mirror a Bazaar repository to Subversion on Google Code

In this example I use the “bashoneliners” project, replace the project name appropriately for your case.

1. Create a new empty Subversion repository on Google Code

2. Checkout from Google with bzr co

3. Pull from the original Bazaar repository:

bzr pull path_to_branch --overwrite

To keep the Subversion repository up to date on Google Code, simply run bzr pull without other arguments.

Remember that you must never commit on the mirror Subversion repository by other methods, that will mess things up. But that is normal for a “mirror” repository isn’t it.

ssh connection multiplexing

Aaaaaaaah. So good I finally tried this.

I knew about ssh multiplexing for a while, and that it can speed up your ssh connections when you ssh to a server in several terminal windows in parallel. However, I typically use just one terminal window per server, and a screen session right after I login, so I normally don’t have more than one connection. But, my software repositories happen to be on the same remote server I use a lot, and since my new internet provider is pretty slow, the long delays after every commit/push quickly became annoying.

Not anymore! ssh multiplexing is just the thing I needed, enabling it is as easy as adding this to your ~/.ssh/config:

Host *
 ControlMaster auto
 ControlPath ~/.ssh/master-%r@%h:%p

Binaural Beats – hacking your own brain

I hesitated for a second whether this belongs to a journal of hacks. But hey, it’s actually hacking my own brain, so sure it is a hack!

Binaural beats are sound patterns that are supposed to induce brain activity, such as make you more productive or put you to sleep. Let’s keep it real, there is no scientific evidence that it actually works beyond a common placebo effect. But I tried it anyway. And… It works for me!

The free Binaural Beats application for iphone has several preset patterns. The “Busy thinking” preset with thunderstorm in the background seems to help me focus and work efficiently, especially in the morning. The “Pre-sleep induction” preset with ocean waves and seagulls in the background seem to help me sleep. The “Quick relaxation” preset with river trickling and birds chirping is also pleasant and helps working.

Is it just placebo effect? I don’t know, but it’s really pleasant. I might be getting addicted to the sounds. I recommend anyone to give it a try!

How to browse JMX mbeans

Sun has a free tool for this called VisualVM. Simply download and run it. In the Applications tab you should see the various Java virtual machines currently running.

By default many plugins are not installed, for example to view MBeans you need to first install the plugin using the Tools / Plugins menu.

Also, some Java libraries may have MBeans off by default. For example with Ehcache (a cache library) you need to set monitoring=”on” attribute on the root element in the xml configuration.

Finally, to figure out the JMX service URL of some remote process, it’s easiest to look in the log of the service. An example URL:


How to watch Orange TV on your computer without decoder

Orange is my internet provider in France. It seems Free is cheaper, but for now I’m stuck with Orange. My package includes TV, but it’s not officially documented nor straightforward to watch TV using a PC and without the decoder. I have a Livebox 2.

First of all, if you can read French you should check first this article:

Probably because I cannot read French well, the article was only a little help, in my case this is how it worked.

1. If you have already used the Orange decoder and watched TV, you can skip this step. Otherwise, you need to connect the decoder at least once to activate your subscription. First of all, confirm on http://livebox/¬†the ethernet ports that provide TV. With Livebox 2 the only configuration that worked for me is when port yellow (jaune) and green (vert) provide TV exclusively (no internet). You can set this up in Configuration / Services / TV numerique, Option multi-decoders must be checked. After this, connect your decoder to your screen (with HDMI), and go through the initial setup, where you have to enter your TV access codes. After this you won’t need the decoder anymore.

2. Download the playlist file from:

3. Connect your computer to port yellow or green with an ethernet cable. It does not work for me over wifi. In fact, I have to disconnect wifi first before I can watch TV. Then, while watching TV I reconnect wifi and browse internet, but cannot change TV channels. Probably this can be fixed by setting up network routes properly. If this is the first time you will watch TV, it’s safer to disconnect wifi now.

4. Open the playlist file with a movie player, it works fine for me with VLC. Many channels might not work, but for example these should be ok: TF1, NRJ 12, Direct 8, TMC.

It would be great if I could use both TV and internet with wifi at the same time, I would be very interested to know how. Proper documentation of the channel list by Orange would also be great, since I’m sure the playlist is incomplete or out of date.

How to clean up Windows roaming profile

I hate it when it takes a long time to log in/out of Windows XP. Very often the slowness is due to using too much disk space in the roaming profile, combined with a slow network. You can check the disk usage of your profile in: My Computer properties (shortcut: Windows + Pause) / Advanced / User Profiles – Settings. The user profile folder is typically: c:/Documents and Settings/your_username/. If there are large files under this folder that you don’t really need in your roaming profile, it’s good to move them somewhere else. Typical space eaters in my case are:

  • Desktop – I sometimes inadvertently drop large files here, especially files downloaded by browsers.
  • 3rd party software. Some software may store large data here too, for example Maven stores its repositories here by default.
  • Application Data (hidden folder) – if too large it might be suspicious, but in general you should not mess with this folder.
Exception: the Local Settings (hidden folder) is not counted in your roaming profile, so you can ignore even if it’s huge, in fact don’t mess with this folder.
After some cleaning up, check the result again in My Computers properties. Happy cleaning!