Start drinking HomeBrew

(Image from maubrowncow @ flikrcc)

A few people have persuaded me to move from MacPorts to HomeBrew and for a while it’s been bugging me with messages about how it might be incompatible with ports. I finally got round to uninstalling ports and found this link on the mac ports site a great help. Now I just have to re-install all the ports.


Current git branch and git autocompletion in bash

First put the following script somewhere, like ~/ and chmod +x it.

Then add this line to your ~/.bash_profile:

. ~/

Finally, if you want to pretty up your prompt as above, then add this:

export PS1=’\h:\W \[\e[1;32m\]$(__git_ps1 “[%s]“)\[\e[0m\] > ‘

You can also install git from (Thanks Jon)

Or on ubuntu install a package called “git-completion” (Thanks Juan)


Using TextMate with R


I’ve been using the R language for some years now but didn’t have it installed on my current machine.

TextMate is a great editor to use as it has a custom bundle that gives you syntax highlighting and executes commands for you in the R console.

To install the R bundle:

cd ~/Library/Application\ Support/TextMate/Bundles/
svn co

Then in TextMate choose Bundles->Bundle Editor->Reload Bundles.

There is one tweak I make which is that I like to press ⌘ + RETURN to execute the current selection in the R console. So edit the bundle and find in the commands and change the key. Also I like it to return back to text mate afterwards, so I add the following to the script:

-e ‘tell application “TextMate” to activate’ \

I also removed the line about setting the current dir. This was a little fiddly – I found that I had to make sure I selected the entire line and cut it then delete, making sure there are no end of line characters. So it looks like this:

# input is selection or document
if [[ ${#TM_DIRECTORY} -gt 0 ]]; then
osascript -e ‘on run(theCode)’ \
		  -e ‘tell application “R” to activate’ \
		  -e ‘tell application “R” to cmd (item 1 of theCode)’ \
		  -e ‘tell application “TextMate” to activate’ \
		  -e ‘end run’ — “$rawText” “$curDir”

All good.

UPDATE: 07/02/2011 – R now comes with a 64bit version so if you are on a macbook you can replace “R” in the code above with “R64″


Oracle Jdbc Driver fails to render Euro (€) when db is set to WE8MSWIN1252 encoding

We just spent a few glorious hours or so trawling the internet and writing old skool jdbc code, to discover this little beauty. Simply upgrade to of the jdbc driver and it goes away.

Thanks to this post we discovered our problem.

For the full details on the euro….

And if your really bored:


Visualise your ANT build with Grand

Ever had the feeling that your build file was a tad complex?

The above is a visualisation provided by the excellent program grand. This particular build script utilises the ASL ant library. I think it might need some love.

Producing the visualisation is very easy. Simply download the jar file and then some ant scripting…

You need to have GraphViz installed which should give you a command line program called “dot”. You can simply try :

dot –help

On the command line to see if you have it installed.

I have a working version on github