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 = 'https://the.earth.li/openid/';
my $openid_username = 'noodles';
my $openid_password = 'password';
my $openid_url = 'http://www.earth.li/~noodles/blog/';
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;

Car Keys

Dec 15, 2005 / 0 comments

I have a remote control doofer for my car, to lock/unlock the doors. Why is it, even if there are hundreds of miles between me and my car, that if I knock the buttons on it pulling my keys out of my pocket I worry I've accidently unlocked the car?

Looking for RSS reader advice

Dec 14, 2005 / 0 comments

I currently use Google Reader to read most of the blogs I track. It seems to work in a way I like.

However I'd like to be able to aggregate in Livejournal using my OpenID so I can read friends-locked posts. I don't think it's appropriate to use a public service like Google or Bloglines for this, which means running something myself.

I've had a look around but not found anything that's close to Google Reader. I like just having all the posts in chronological order, not listed under each source feed. Most things I could find give you a sidebar of a tree for each feed and then you have to look at each feed in turn. I just want my content splurged at me goddamit! Planet does this, but I also want content I've read to go away by default, which Planet doesn't handle (being a generator of a static web page).

So, any suggestions? I'm using Firefox under Linux, but I'm not tied to an in browser solution (I've a feeling it would be easier to get my OpenID stuff working that way though). So far I've tried Sage and Wizz. I've also looked at Straw but not installed it as it looks a little unmaintained. Liferea looks like it could be an option, so I think I'll go play with that for the moment.

subscribe via RSS