The Haiku Machine

I found this awesome cut-up poetry generator , which takes the text of famous poets and builds structured poetry out of it. The guy that made it even developed the underlying algorithm as a research project. I have put a version of a free Amazon EC2 instance, wrote a little twitter bot in node.js, and wired the poetry generator with the twitter bot, and now I have this: https://twitter.com/haikumachine - a twitter bot that posts a haiku every five minutes, derived from Dylan Thomas’s poetry. ...

July 27, 2013 · 1 min · David Craddock

256 Color VIM on Crunchbang Waldorf

To get 256 colors working within terminator in Crunchbang Waldorf, I had to do the following: Add to ~/.bashrc export TERM=xterm-256color Install a 256 color VIM colorcheme, see desert256 for example . Add the following to ~/.vimrc: set t_Co=256 set t_AB=^[[48;5;%dm set t_AF=^[[38;5;%dm ’t_Co’ specifies exactly how many colours VIM can use. The other two lines seem to be Debian-specific color code escape sequences. If you want 256 color VIM for your root user when you sudo edit, then edit /usr/share/vim/vimrc and copy across your settings from your local ~/.vimrc and ~/.vim to this global environment. ...

June 20, 2013 · 1 min · David Craddock

Subversion 1.7 on Crunchbang Waldorf

I use the excellent http://www.smartsvn.com/ client from WANdisco. WANdisco have been releasing new open-source versions of SVN to the public with new improved reliability, and the client uses one of these versions, 1.7, to offer better performance. Unfortunately if you choose to upgrade your entire repository to 1.7, this breaks compatibility with the default commandline SVN client on Waldorf which I like to use as well as Smart SVN, for quick ‘svn up’s and other commandline magic. ...

June 16, 2013 · 1 min · David Craddock

iTerm for OSX for a Colourful Terminal Experience

iTerm is much better than the standard OSX terminal client, not least because it has compatiablity with xterm256-color terminal emulation. xterm256-color emulation will give your terminal access to 256 colours instead of the usual 16. Much better, not just for looking pretty, but for distinguishing between different types of data in an editor like VIM or even in Cucumber output (see picture above). It’s also free. ...

June 11, 2013 · 1 min · David Craddock

Tailing a log file and Running an Application at the Same Time

A quick tip this, but a useful one. You can tail a log file in the background while running a script in the foreground. So for example, I frequently execute the following commands: 1. tail -f /var/log/httpd.log & /etc/init.d/apache restart 2. (The log file will spool onto the terminal as Apache is restarted.) 3. Once you are finished viewing the log file, foreground the log file process and kill it: fg Then terminate the foregrounded log tail with a control-c. ...

June 11, 2013 · 1 min · David Craddock

Monitoring a Slow Internet Connection in OSX

I am currently on holiday in Tenerife, and although I really like it here, one thing I do not like is the internet connection we have in our resort. Sometimes networked applications will just hang with no warning and there will be minutes where it’s not clear what is going on. Here are some ways you can find a little bit more about what is happening when an application is slow or seems to hang when you have a poor internet connection. Execute the following commands each in a separate terminal window. ...

March 1, 2013 · 3 min · David Craddock

TDD Talk

Recently, myself and two colleagues from the BBC, ran a session on Test Driven Development at the Manchester University ‘Ultimate Programming’ society. The society is a gathering where students discuss cool things they have done with programming, and occasionally have guest speakers from industry. I found the society online and thought it would be great to get the BBC more involved in the local university happenings. It is the first outreach project that I have undertaken, and it required a lot of preparation. Our initial idea was to get students to implement the A* search algorithm in a practical session, using TDD. However after we had all implemented our own copy of the algorithm, and realised it had taken several hours each, we realised we’d not have enough time in the 2 hour slot that we had. ...

March 1, 2013 · 2 min · David Craddock

Converting a single M2V frame into JPEG under OSX

I needed to view a single frame of a m2v file that had been encoded by our designers for playing out on TV. The file name was .mpg but in actuality it was a single .m2v frame renamed to be a .mpg. Windows Media Player classic used to display the frame fine when I opened the file normally, under Windows XP. However now I have switched to a Mac, I have found that Quicktime and VLC refused to display the single frame. I couldn’t find a video player that would open the single frame. So I resorted to the command line version of ffmpeg, which I installed via macports, to convert this single frame to a jpg file to view as normal. This line worked a treat: ...

April 12, 2012 · 1 min · David Craddock

Java 1.6 on RHEL4

After I wrote a Java application in JDK 1.6, I was stuck for a while when I realised that the target deployment machine was Red Hat Enterprise Linux 4. RHEL4 does not support Java 1.6 in its default configuration. Luckily I found this article on the CentOS wiki which included instructions on how to install Java 1.6 on CentOS 4. Remembering that RHEL4 and CentOS 4 are almost identical, I tried the method supplied, and it worked. This is the page with the method: ...

February 11, 2012 · 1 min · David Craddock

Test Driven Systems Development with Nagios

Nagios can be seen as a automated test tool for systems, just as you would have automated tests for software projects. In test driven development (TDD), you write the tests first, and then use those tests to build up a software project that you can have confidence that it works. We can use this method to build up systems, or networks of systems. Plan out which services and processes should be running on your new systems, and then implement Nagios tests for every one. You can check the progress of your build by checking Nagios. I have been doing this at the BBC. It is a simple idea but one that seems to work.

February 7, 2012 · 1 min · David Craddock