Categories
Uncategorized

Nutters

I used to work with Tony Finch. Great guy. But the chap’s clearly got a few screws loose: Signal Mishandling.

Categories
Uncategorized

MultiTail

I used to use tail -f a lot to follow the end of a logfile, as it was written to. Nowadays I tend to use less +F instead, as it can highlight search terms for you as well.

But I’ve just seen multitail. It splits the screen and lets you follow as many log files as you like. Very handy. And it can nicely colorise the log entries if it recognises the format.

Categories
Uncategorized

BitTorrent

I finally relented. After missing the second part of CSI: A Bullet Runs Through It, I turned to BitTorrent to try and catch it. I hate cliffhangers.

I spent a little while trying to get the official client to work. This involved setting up port forwarding on my router, and didn’t really end up working very well. It’s far too much like sysadmin work and I try to minimise that these days.

So on a hunch, I switched to Azureus. The initial impressions are somewhat overwhelming (never let programmers design UIs!), but it’s obvious the functionality is all there. Most importantly it supports UPNP which means that it can explicitly ask the router to open up any holes as and when needed. Fantastic! Now my downloads are performing at the speed they should be, and with minimal involvement on my behalf.

Overall, I’m very impressed. I shouldn’t have put off looking at BitTorrent for so long.

Oh, and the episode itself? Well, I’m still waiting to see it. It’s hard to schedule time for both of us to sit down in front of the computer…

Categories
Uncategorized

london.pm tech meet

I went to the London.pm tech meet last night. There was an excellent selection of talks, but the one that really caught my eye was Tom Hukins talk on Aspect.pm. Now, I’ve looked at AOP before, mostly in the context of Java and AspectJ.

But every time I read about AOP, I came away with my head spinning. The idea should be simple: provide a way to interleave your own code into other methods that you don’t necessarily control. But the frameworks in existence just don’t seem to be that simple.

So, Tom’s talk, Tracing code with Aspect.pm was really useful. It clearly and simply ushowed how to use Aspect.pm to intercept function calls in a nice, practical manner. You can use it to insert tracing into code that you might not control. What’s very nice is that you can also modify parameters on the way in and out. Tom demonstrated how to redirect all HTTP calls to localhost for testing.

Funnily enough, I first came across this behaviour some years ago inside Emacs: Advising Emacs Lisp Functions. It’s quite simple to use…

Categories
Uncategorized

Broken Bikes

I’ve been going through yet another round of enforced bike maintenance.

  • On Friday morning, my Brompton had a flat when I was leaving for work. Luckily, I had a spare inner tube, and could switch them quickly.
  • Over the weekend, I managed to snap my front derailleur on the mountain bike. Thankfully, it just locked my chainset into a specific gear, meaning I could finish the ride.
  • Which ended with a puncture out near Lewes. Again, I always carry a spare inner tube, so it’s not catastrophic (although it was cold enough to make the change difficult because my hands were so cold).
  • Yesterday morning, I took the mountain bike to the lovely people at Freedom Bikes, who fitted a new derailleur for me.
  • And this morning I’m just leaving for work when I find that the Brompton has a second flat in the same place. This time, I managed to find the stone stuck in the tyre. More worryingly, I also noticed a rust spot that’s gone through the frame in one place. It’s only a pinhole, but still…

I do love cycling, but I hate having to maintain the damned things. Like computers, I just have a hate/hate relationship with hardware.

Categories
Uncategorized

Google Sitemaps

This morning, I used google sitemaps for the first time. Now, I’d heard of google sitemaps before, and I thought I knew what it was about—getting extra links to appear when your site appears in the search results.

Wrong!

That’s one part of it, but I had completely missed the more interesting bit: you can get to see inside Google for information about your site! When you sign up to sitemaps, Google tells you:

  • What searches lead to your site (and what position in the results). Although I have no idea why I’m #29 for “debug_client” (apparently).
  • What searches people clicked on to get to your site.
  • Errors that googlebot found whilst crawling your site.
  • Page analysis (I didn’t realise I was still serving lots of stuff as us-ascii instead of UTF-8 for example).
  • “and more…”

It’s incredibly easy to get going as well. Just login using your google account, add your sites URL in, and then touch the filename that they tell you in order to verify you control the site. It’s about a minutes work (ok, I already have a google account, so I didn’t have to register).

If you haven’t already done so, go and do this now. It’ll give you a much better understanding of your site.

Next up: Getting typo to generate a sitemaps file. I’ve started so I’ll finish!

Categories
Uncategorized

Rails gets sane

Some time ago, I wrote about The Wrong Defaults, explaining how nearly all templating systems for the web default to “insecure”.

Well, it looks like some rails people are paying attention: Auto sanitized templates with Erubis

Categories
Uncategorized

Quote of the day

From the mod_ssl configure script:

Programming in Bourne-Shell is a higher form of masochism.

No known attribution.

This still doesn’t explain why I enjoy shell scripting so much. :-)

Categories
Uncategorized

Solaris Runtime Linker Fun

Most of the last week at work has been spent trying to coerce my way around the Solaris runtime linker (ld.so.1). The original task is to install a bunch of stuff like OpenSSL, PostgreSQL and Perl into a directory structure ($prefix) on the box. But where the task involves shared libraries, things get tricky…

Compiling and installing the shared library itself is easy. Compiling and installing a dependency on that shared library is just as simple. You have to specify that the include files and libraries are in the right place. You have to do this to get the program to compile, so it gets done anyway, usually by supplying CFLAGS=-I$prefix/include and LDFLAGS=-L$prefix/lib.

Where it starts to get hard is when you run the program afterwards. Because under Solaris, the program doesn’t remember where it found the shared library. So it goes off hunting in a number places, none of which are the ones you want, and then gives up.

The answer is to add in -R$prefix/lib to LDFLAGS. That records the correct place for the shared libraries in the program, and then everything works as expected.

Needless to say, this is exactly what Linux does by default.

Anyway, the end result is that I’ve spent far longer inside the Solaris Linker and Libraries Guide than I really care for. But I do have some working code.

Oh, I almost forgot the most irritating thing that happened during all this: teaching Perl to not look in /usr/local for includes and libraries. There were a few things in there (e.g. gdbm) that I didn’t want to link Perl to because they wouldn’t be on the target machine. But teaching Perl to exclude stuff from its Configure routine is byzantine to say the least. I ended up having to patch the solaris_2.sh hints file, which is (to say the very least) a bit sucky.

Here’s hoping next week will be looking up a bit.

Categories
Uncategorized

Deleting a session item

A few days ago, I spent a little while attempting to work out how to delete an item from a session (in Rails). I wanted to remove session[:user_id] when a user logged out.

After nosing around for a bit, it turns out that you can’t actually do this. You can set the value of :user_id to nil, which is probably “good enough” most of the time. It’s still a little bit irritating however.

The reason that you can’t do this is not because of poor design in Rails though. Rails reuses part of the standard Ruby distribution. And look at CGI::Session.delete. It takes no arguments and deletes the entire session. Contrast this with Hash.delete. To my mind, they both implement the same interface.

It would probably have made more sense to have CGI::Session.destroy, but I doubt that’s going to change now after the code has been in the wild for such a long time.