Drop the BOM

[Update 2011-12-20-120457: see end of post]

I sometimes get issues with files that come in from another source, that have the BOM – usually from some other web developer who’s using Windows.

It’s not a massive issue, but often introduces space that you can’t see except in the browser where it can break some designs.

One problem is that vim and most (all?) graphical editors don’t show it to you so you can remove it, so you usually have to shove it through perl or something. Another method that’s extremely easy to use is to edit the file in nano. I’m not a massive fan of nano, but what it gives you in this case is the ability to see the BOM as what looks like a single space at the start of the file, so you can delete it very easily. Handy.

Update:

There’s an even easier way, just in vim; not sure what from version this became available.

Check to see if you have a BOM:

:set bomb?

Get rid of it:

:set nobomb

Something I always forget when setting up the post-receive hook for a new git repo

Catchy title for a blog post, huh?

Anyway, something I always (or almost always) forget to do every time when I set up a new git repo and set up the hook to send everyone an email on each `git push` is to edit `description` so the first email always starts “UNNAMED PROJECT” which drives me mad!

The full list of steps for setting this up I take are:

cd {git dir}/hooks
mv post-receive post-receive.bak
ln -s /usr/share/doc/git-core/contrib/hooks/post-receive-email post-receive
vi config # edit the config to give the hook an email address (see below)
vi description # *that* step – edit this to have your project name

The config should have something like this in it:

[hooks]
mailinglist = bunch-o-gits@example.com
emailprefix = “[URA git] ”

which will send it to a list you need to set up and give you something by which to filter the emails.

Later, gits!

[Update: that line linking to the post-receive-email script might be a bit Debian-specific, not sure…]

Amazon Web Services

I’m suddenly working with a few different AWS setups. I definitely like the flexibility and sheer scope of it. But that’s where its biggest problem comes from: the learning curve is considerable, just based on the massive number of services Amazon offer in AWS. Once up the curve, it’s actually all very simple to work with.

FWIW, I’m using a RightScale Debian AMI which Just Works. And lets me not have to change the chip on apt vs. yum and so on.

I have a feeling I’m going to posting more on the subject of AWS…

Adding extra IP addresses to Debian

I was just asked to add a new IP address to a Debian cloud host. It’s a simple thing, but depending on how often – or how seldom – you do it, you often still need to look it up to remind yourself. So, having previously decided to do a post every time I do something like this (for my own benefit as much as anything) here’s what I did…

Edit `/etc/network/interfaces` – obviously you’ll need to be root or `sudo` it.

There will probably something like this in there:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

The first chunk is the [loopback interface](http://en.wikipedia.org/wiki/Loopback), but the second chunk is the ethernet (`eth0`). The final line might be `dhcp` or it might be `static`, followed by more lines to describe the IP, like this:

iface eth0 inet static
address 209.85.147.147
netmask 255.255.255.255

To add a new IP – let’s imagine it’s ‘209.85.147.148’ – to the same ethernet interface, just add something like this:

iface eth0:0 inet static
address 209.85.147.148
netmask 255.255.255.255

The “`:0`” is the extra bit we added. Then restart your networking:

/etc/init.d/networking restart

(keeping your fingers crossed you didn’t make any mistakes that might then lock you out of your host completely, of course ;)

Bluetooth headphone adaptor

This has been one of my better buying decisions recently. I was looking at Sennheiser Bluetooth headphones, but as I have a few pretty decent ear-canal phones, Sennheiser headphones and others it seemed a little wasteful. So I started looking for a BT adaptor. Sony devices were getting good reviews, so I looked at the MW-600. Reduced from 50 squid on Amazon to 35, it was surely worth a punt… And it was. I’m loving it.

I was expecting the included earphones to be a throwaway, but actually, they’re pretty good. They’re certainly not accurate, per se, but tuned to be enjoyable, rather than precise. They’re on a very short cable which is good for not getting it wrapped around you or snagged on anything. (It’s so short I can barely focus on the screen at full stretch!) Pretty cool being able to put the iPad back in my bag and keep playing, with full control as well.

You can have it paired with 3 devices, so you can switch between them without any drama. I’ve got it on iPad, iPod touch and Macbook, and it’s seamless.

The only thing that’s a bit annoying is that the volume control – a touch-sensitive affair – is a little bit fussy. Sometimes I struggle to make it change, and sometimes it shoots to maximum or minimum volume almost instantly.

Like I said, this has been a good buying decision, and cheap as chips.

Ooh, nice digs!

[Update: removed.]

Hmm, maybe I’ve found that house with a garden I’ve been looking for…? Er, no. Very nice, but 2 megaeuros is a bit much for my bank manager – I made a new year’s resolution not to give him another break-down!

Nice though, if you have the wedge, and you fancy living near the sea, near the mountain, with a pool, underfloor heating, sob, sob…

Themetastical

So I’ve finally – FINALLY! – moved from the WordPress theme I’ve had on this site for nearly FIVE years. For now I’ve just got a very standard Thematic-based child theme, but I’ll be working on that shortly. At least I can move some widgets around now!

Watch, as they say, this space…

exim vulnerability fun

Lots of fun over weekend for admins with not-quite-latest exim… I’m getting emails from various services saying their user information databases were compromised, which I assumes related to the rootkits that the vulnerability allows you to install. Which makes me wonder: how many sites are storing passwords unencrypted? If a user database is compromised, and the passwords are encrypted, it would only *really* affect people with stupid passwords. Anyway, here we go again, changing logins on god-knows-how-many systems…