It's not easy being green.

Dec 21, 2005 / 0 comments


Dec 21, 2005 / 0 comments

When I had a real job I used to hate having to iron shirts every week. While I'll occasionally wear one when I go out it's not something I'd choose to wear to code in, so it grated that I had to expend effort in order to be able to wear something I didn't really want to.

These days I'm a lazy layabout who largely works from home and I can wear what I like. However I still have to deal with socks. Now, at least I like wearing socks, but they're still a PITA. Pairing them up in particular. I think the problem is that almost all my socks are plain black and while you think that would make things easy it really doesn't. They're different shades of black for starters. Or different shapes. Or feel different. Or are lost for months and then suddenly turn up and the other half of the pair that kept annoying you out of the corner of your eye has suddenly disappeared. Gah.

X11 Programming

Dec 17, 2005 / 0 comments

I'm feeling somewhat stupid. I sat down tonight to have a look at writing a basic fire/flame demo thing under X (the sort of thing people used to write in 3 bytes of x86 assembly 10 years ago). See, I'd quite like a funky xdm/login thingy for my laptop, so random people who see me use it on the train think "Woah, cool". I'm sad like that. Anyway, my idea is a ring of fire with the login prompt in the middle. This seems simple. Except when I try to get involved with programming X.

Now, I'm not a graphics programmer by any stretch of the imagination. But all I want is a nice simple framebuffer I can store pixels of 24 bit colour into. Or 8 bits with a colourmap is fine too. If the functions for dealing with the colourmaps are decently documented. This isn't much to ask, is it?

Perhaps the issue was that I assumed Xlib would just provide me something that could do this. Or that I'd be able to find decent docs easily. Or that I had more than 2 braincells to rub together. But I've given up now. I really don't understand how to get Xlib to just let me XSetForeground to a 24 bit colour and then XDrawPoint. I tried to fight XAllocColor. I even accepted defeat and had a quick look for a simple X framebuffer library. No joy.

So, can someone point me at the right docs to inhale for this sort of thing? Or a really lightweight C library that'll make it all really easy?


Dec 16, 2005 / 0 comments

Today I'm a cube. 33 to be precise. It's probably the last time I'll be a number raised to itself; I'd like to reach 256, but can't see it happening.

If you're in or around Norwich I'll be in the Fat Cat from 7:30ish onwards. Do feel free to drop by.

Grabbing LJ posts via OpenID authentication

Dec 15, 2005 / 0 comments

Sometimes I love Perl. Thanks to Chris Ball, whose article on WWW::Mechanize I always seem to come back to for this sort of thing.


use strict;
use warnings;

use Data::Dumper;
use HTML::TokeParser;
use WWW::Mechanize;

my $openid_server_url = '';
my $openid_username = 'noodles';
my $openid_password = 'password';
my $openid_url = '';
my @ljusers = ('beccus', 'brrm', 'dpash', 'karen2205', 'lnr', 'padzor');

my $agent = WWW::Mechanize->new();
$agent->field("username", $openid_username);
$agent->field("password", $openid_password);

print "Logged into OpenID server.\n";

$agent->field("openid_url", $openid_url);

print "Logged into LiveJournal.\n";

foreach my $user (@ljusers) {
        print "Fetching feed for $user.\n";

        open(RSSFILE, ">$user.xml");
        print RSSFILE $agent->content;

subscribe via RSS