xGoat
More tea please.

Dealing with whitespace

How to use whitespace is a contentious issue amongst programmers. If they spent their time arguing about software architecture instead, I’m sure software would be years ahead. I guess it’s because whitespace is a conceptually easy thing to argue about and be “creative” with… *sigh*.

When editing prose in things like LaTeX files, I use long lines. Each paragraph that I write is on a single line (avec emacs visual-line-mode). This is of course irritating if one just uses normal diff. The solution I used to use was dwdiff. However, `git diff` has recently developed a “--word-diff” option.

--word-diff turns an output like this:

-The cat sat on the hat.
+The cat sat on the mat.

into this:

The cat sat on the [-hat.-]{+mat.+}

(and if you have git’s color.ui config option set to true, it looks even better.)

Posted at 2:40 am on Friday 21st October 2011

Introduction to Git

I presented an introduction to Git at last week’s Student Robotics doing. You’ll find the slides here. Its main purpose was to be a high-level introduction to both version control and Git.


Posted at 1:02 pm on Tuesday 9th March 2010

logger: ‘Decentralised’ no-hassle logbook app

When I started my electronic engineering degree, ECS presented me and my fellow coursemates with a logbook each. We were told these things would become invaluable assets. I remember that I was initially sceptical. As I started to follow roads that were more undocumented and experimental (i.e. everything I like to do these days…), I found the logbook more and more valuable. I don’t think I would have survived the final year of my course without it.

There are few places that I’ll go for more than a few hours without my logbook now. It’s a place to writes notes and thoughts about what I’m doing. If I go home to visit my parents for a weekend, it’ll go with me. It’ll go with me on holiday. Everywhere.

The Itch

So that experience has been good. However, there are a few things about my physical logbook that have been aggravating me for a few years now. You may have noticed that computers have become a significant part of our lives. Physical, paper logbooks are absolutely perfect for projects that involve limited interaction with computers (and those that don’t involve copying of lots of data). Writing notes on paper about projects that involve software is painful. It’s quite challenging to annotate source code that’s on a PC screen by writing in a logbook.

Getting copies of software configuration, source code and other bits of data into a logbook entry typically involves lots of printing, cutting and gluing. It’s tiresome and results in a logbook that’s twice as thick as it once was. The increased effort that one has to invest to write notes about these projects makes it much less likely that one will write them to start with. There are more problems from here on. Getting source code out of the logbook back into the PC is not going to happen.

I believe the solution to this problem is to move the logbook onto the machine.

Solution attempt 1

A few months ago, I decided to try a first quick and easy solution to this problem. I set up a git repository on a server, and put a text file called ‘log’ in it. For the next week or so, I wrote notes into it. This was OK, but I had to be very careful of keeping the machines I use it from in sync to avoid conflicts.

Solution 2

A couple of evenings ago, I started hacking away on a new solution to this problem. The result is a small tool called ‘logger’. This logbook-like application managed a chronologically-ordered list of entries. This list of entries can be synchronised between machines.

“That sounds like a versioning tool” I hear you say. Yes, Logger does use git as its backend. However, it tacks on some limitations about what you’re allowed to do to the stuff that’s in the repository once you’ve put it in. Once something’s in the log, it’s there for good. Logger doesn’t provide any features for editing things that are already in the log. There’s a good reason for this. By making log entries that already exist immutable, synchronisation between machines becomes a doddle.

You can get logger from the gitorious project I’ve set up for it:

git clone git://gitorious.org/logger/logger.git

Logger stores all log messages in a git repository, accessing it using GitPython. This means that it can use all of Git’s goodies to simplify its job.

The README file that comes with logger provides a short tutorial on its use.

(If you want gitpython for Fedora, I quickly hacked together an rpm for it. This contains the required patch to support empty commits. May submit it to the repos at some point, but not now.)

The future

I haven’t been using this situation very long yet, but it already feels like it’s a good solution. My housemate Tobias and I have been discussing how we might extend this tool. Introducing better search capabilities is something we’re both interested in. I’m also quite interested in doing “partial clones” of git repositories — so that some machines don’t have to have all of the log on them. Logger’s a command line application right now. A GUI for it would definitely be interesting.

Patches are most welcome.

Logger’s still very much an experimental tool. I’m still working out whether it fully meets my needs. We’ll see.

p.s. Oh yes, there are probably some who will say there’s some stuff to do with logbooks being legal documents. This might be soluble using something like the service I heard the Post Office provides for signing digital documents.

Posted at 11:16 pm on Sunday 22nd November 2009

Formica Community Site

I’d really like to get a development community around the Formica robots. I really enjoyed seeing Toshaan and colleagues build upon and develop the Formica designs for themselves. From the response we got from Jeff’s 25C3 talk, we know that there are quite a few people interested in building these tiny robots.

So we’ve set up formica.srobo.org; a wiki to act as a hub for Formica robot development. We would like to invite everyone who’s involved in Formica related projects to get involved with it and use it as a repository for information. This site is generously hosted by Student Robotics. Our thanks go to everyone in SR for that.

We’ve also opened up the mailing list that we used whilst the project was part of our degree. We hope this will become a place for people to publicly discuss projects relating to the Formica robots.

In moving to formica.srobo.org, I also transmogrified our subversion repository into a git repository. Details of this can be found on the software page of the Formica wiki.

Posted at 7:30 am on Tuesday 10th March 2009
2 Comments

Site by Robert Spanton. © 2008 - 2011