Small change: the economics of charging for trivial things

I got thinking about this subject because Fred Baker Cycles had the temerity to charge me 50p for the use of their bike pump.

This was definitely adding insult to injury as I was confronted with a flat tyre after having visited the dentist. No problem, I thought, I’ll just go to a local friendly bike shop and at least be able to ride the damn thing home.

Maybe I’m too sensitive to petty things, but charging 50p for this service (I grudgingly handed over my equilateral curve heptagon – I had no other choice) generated a huge amount of badwill (the opposite of goodwill) towards this shop.

Contrast this approach with Orange retail stores (disclaimer, I once worked for them), who will charge your mobile phone, gratis – you don’t even have to be a customer.

Maybe it’s something specific to bike shops. So many of them have a reputation for being rude and unhelpful, and if these Google reviews are anything to go by, this one is no different.

Posted in Uncategorized | 1 Comment

Emacs: how to search and replace newlines

I can’t remember where I learnt this, but I use it all the time and it’s not at all obvious.

When in the minibuffer (at the prompt for replace-string or replace-regexp, for example), enter C-q C-j for a newline (0x0D, NL).

Depending on the coding system for the buffer (DOS mode for example), you may also need to use C-q C-m for carriage return (0x0D, CR) – suddenly it makes sense where all those ^Ms come from!

Posted in Uncategorized | 3 Comments

C++: Mixing containers and inheritance

This is the sort of thing in C++ which catches me out as a recovering former Java programmer.

Amongst the very good advice I was given whilst learning C++ was:

  1. Use the STL containers
  2. Only use pointers when you really need to

The first point is sound advice, after all, why re-invent the wheel? There are plenty of useful containers like std::vector in the library.

The second point is about memory management. It’s much better to let scoping and destructors do the work for you, rather than keeping track of pointers and calling delete().

With this in mind, here’s a sample program:

#include <iostream>
#include <vector>

class Animal
    virtual void hello();

class Dog : public Animal
    virtual void hello();

void Animal::hello()
    std::cout << "<Generic Animal Noise>" << std::endl;

void Dog::hello()
    std::cout << "Woof" << std::endl;

int main()
    // store the object directly
    std::vector<Animal> animals;

    // store the pointer
    std::vector<Animal*> animalPtrs;
    animalPtrs.push_back(new Dog);

What’s it supposed to print? Well I thought it should print


but instead it prints

<Generic Animal Noise>

I was genuinely surprised by the result – the lesson here is to use pointers if you don’t want your class to lose its identity.

This was also discussed in this forum post and (in great detail) in “STL and OO Don’t Easily Mix”.

Update: Apparently this behaviour is called slicing. Well I really have learnt something today.

Posted in Uncategorized | Leave a comment

Fame at last!

Check out this review of Sacha’s Morbid Atrophy album Grist ‘n’ Grind (warning: contains Flash).

My favourite excerpt: “‘A Porter Too (Blench mix)’ is seriously an amazing piece of work”

Posted in Uncategorized | 2 Comments

IE 9 – doesn’t like console.log()

Turns out you can use console.log in IE 9, but it only works in developer mode.

Fine, so the sensible thing in “not developer” mode would be for console.log to by turned into a NOP. This doesn’t seem to happen and random things were breaking until I commented out the console.log lines. It looks like trying to do anything with the console object throws an exception – not even

alert("console null?"+console==null);

is allowed (no alert gets shown).

Just another one of those annoying “it’s works in the debug version” things, and everyone the world over has to build their own console.log wrappers.

Posted in Uncategorized | 6 Comments

ROCK (part 2)

Another remix for Sacha’s Morbid Atrophy project:

Story There (Distortion Mix) by Tom Blench

Posted in Music, Uncategorized | Leave a comment

ROCK \m/

Had great fun doing this remix for Sacha’s Morbid Atrophy project. Hopefully I managed to get this somewhere between metal and drill n bass!

A Porter Too (Remix for Sacha, bounce 2) by Tom Blench

Posted in Music, Uncategorized | 1 Comment

Getting data off a Holux GPSport 245 (Mac OS X/Linux)

The problem: I have a Holux GPSport, which although it’s a nice device, requires me to use their fairly nasty Windows software to get the data off it.

The solution? Well there seems to be lots of software out there for this sort of thing, but getting it to work is tricky. In the end I went for GPSBabel, which is GPL and works on the Mac. It also appeared to support my device.

But I couldn’t get it to work. Maybe there is something in the documentation that I haven’t found, but the solution is to install these USB to UART Bridge Drivers from Silicon Labs. Basically the GPS device is serial, and the Silicon Labs chip bridges this across USB.

Thanks to this blogger who came to a similar conclusion with a different device.

The Mac driver seems pretty solid, and once installed you can use the



An example of using this with GPSBabel would be

gpsbabel -t -i m241 -f /dev/cu.SLAB_USBtoUART -o kml,lines,points,floating,track,trackdata,labels -F out.kml

Or you can use the GUI front end to do the same thing.

Note that if invoked from the command line, the current directory has to be writable so it can write its “data.bin” file – this seems like a bit of a failing as this should really be written to /tmp.

Other current issues include:
– It’s slow. There seems to be some baud rate setting going on in mtk_logger.c, and I guess they haven’t chosen a higher one because it isn’t supported by the chipset used in the GPSport.
– I can’t get useful KML out of it. It just comes out as one massive track, but this might be user error.

Posted in Uncategorized | Leave a comment

bash: how to retain history across multiple shells

I like to have lots of shells open, some inside emacs and some in stand-alone terminals. With the default settings, it seems that the last shell to exit saves its history to the file:

If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten

(from the bash man page)

It’s nice to be able to dig out some obscure shell command issued ages ago when you need it.

So stick the following lines in your .profile at amend this:

shopt -s histappend
export HISTFILESIZE=1000000

Posted in Uncategorized | Leave a comment

Japan – Days 12 and 13: Tokyo (again)


Posted in Uncategorized | Leave a comment