Search Results: "Jonathan McDowell"

17 December 2005

Jonathan McDowell: X11 Programming

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?

16 December 2005

Jonathan McDowell: Noodles<sup>3</sup>

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.

15 December 2005

Jonathan McDowell: Grabbing LJ posts via OpenID authentication

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.
#!/usr/bin/perl
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->get($openid_server_url);
$agent->form(1);
$agent->field("username", $openid_username);
$agent->field("password", $openid_password);
$agent->click();
print "Logged into OpenID server.\n";
$agent->get('http://www.livejournal.com/openid/');
$agent->form(1);
$agent->field("openid_url", $openid_url);
$agent->click();
print "Logged into LiveJournal.\n";
foreach my $user (@ljusers)  
        print "Fetching feed for $user.\n";
        $agent->get('http://www.livejournal.com/users/'.$user.'/data/rss');
        open(RSSFILE, ">$user.xml");
        print RSSFILE $agent->content;
        close(RSSFILE);
 

Jonathan McDowell: Car Keys

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?

14 December 2005

Jonathan McDowell: Looking for RSS reader advice

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.

Jonathan McDowell: It's cool to talk SCMs

It seems everyone is talking SCMs these days, usually touting their favourite option while deriding everyone else's. (I exaggerate for effect.) Years ago we mostly used CVS and were happy. Some people are still happy with it. I still have a bunch of code in it, though migrating it to something else is on my list. Why? Niceties like being able to rename a file. Or atomic changesets. Things that all the new breeds of options can do. For the tress I manage myself distributed working isn't a big issue, so they'll probably just get migrated to Subversion as the easiest option. However I'm not really tied to any SCM. I've used at least Arch (tla), BitKeeper, ClearCase, CVS, Monotone, PVCS and Subversion for both checking out and committing files, and handful more to check out files from things I wanted to look at. The only one that is unusable is PVCS. The rest have all been fine for whatever I've used them for. So, if I don't care about which SCM, why blog about them at all? Because I care about how they get used. I'm a big fan of small granular commits with descriptive commit messages. Not huge big dumps of code with "check in new code" as the comment. Gah. Take, for example, the Linux kernel. Commit messages are fairly descriptive there and if you have enough time you can read through the changelog since the last release and really know what's gone on. This is great. Also the changes are granular enough that if you hit a problem it's likely that you can narrow it down to a single commit that doesn't do a lot other than break things for you. Not all projects I have been part of manage either of these. People often seem to view the SCM as a punishment, using it only under sufferance and as infrequently as possible, leading to large commits of many items at once. Which then means they don't see the advantages of it and are more likely to hit merge problems as the tree has changed under them. Meaning they end up hating it more and avoiding it as much as possible, making it all worse. Not good. Or, you get people who'll commit alright, but without any sanity testing at all. Like, even a compile. What's the point? I know you can roll it back, but if you're not sure it works and haven't even compiled it, what the hell makes you think it's suitable for committing? Bah. I can't see that my desired usage is that unreasonable. Am I missing something?

Uwe Hermann: EU adopts Big Brother data retention directive, ignores industry and civil society [update]

Heise (and many other sources) report that the EU parliament has voted for the abysmal data retention directive, simply ignoring objections from the industry and the civil society. The EU has turned into a police state where more than 450 million citizens are treated as criminals by default now! 1984 is a joke compared to this. We're all fucked! Bigtime! Please, someone go out and sue the shit out of the fucking idiots who are responsible for this kindly remind the responsible politicians that this directive is a really bad idea! Update 2005-12-15: OK, so I might have overreacted. My first answer to the accusations would probably be (abusing an unrelated quote from Jonathan McDowell): "I exaggerate for effect". But honestly, while it's not as bad as 1984, I really do think that this law will bring us all a big step nearer to a 1984-type horror scenario. (via netzpolitik.org)

6 December 2005

Jonathan McDowell: Dubby-Dub-Dublin

Kathy and I had a nice long weekend in Dublin this weekend past, celebrating 10 years of hell together. Was good, except for getting rained on lots on the Friday (solved by buying umbrellas) and Kathy starting the weekend with a cold and me finishing with one. Bah. I realised it's been about 5 years since I was in Dublin itself, rather than just the airport. Various comments:

5 December 2005

Jonathan McDowell: Toshiba++

As I've previously said I bought a http://uk.computers.toshiba-europe.com/ Port g R200 a few months ago. It's lovely and wonderful and makes my old laptop (a Compaq N200) look tiny, but is still quite small. However I discovered it wouldn't hold charge. If I unplugged it and used it I'd quite happily get 3-4 hours use off the battery, but if I charged it up while off, then unplugged it (leaving it off) and didn't touch it for a couple of days it wouldn't power on and needed fully charged again. This is a bit of a bummer, but I hadn't got round to sorting it out as I wasn't finding it too inconvenient. I decided I should really get it dealt with before I go back to my parents' for Christmas, so rang up Toshiba's repair line a few weeks ago. Told them what the problem was and they said they'd ring back in the morning to arrange a pickup time. Except they actually rang back that afternoon. It was too late for collection the next day, but they said they'd pick it up the following day in the afternoon. Also I wasn't to pack it or provide any of the accessories; just the bare laptop. Handy. Lo and behold the nice man from DHL turned up when Toshiba said he would, had a piece of paper with the right reference number on it (though in quite small print) and didn't want the laptop packed up as he had a suitable box already prepared. Time passed and I heard nothing. I was getting a bit worried, but Tosh say it can take 5 working days and it hadn't been that long (and given the nature of the fault I guessed they'd need to charge and discharge to check). But it was a bit weird that they'd not asked me to do any of the stupid things you're normally asked to do. (Have you rebooted? Reinstalled? Repented?) Plus the laptop only has Linux on it, so I was worried they'd be freaked by that (though they'd been fine when I mentioned it on the phone). It came to day 5 and I decided I'd ring them the following day. And then the nice man from DHL turned up with a big, well padded, box containing my laptop. At first glance it appeared to only contain my laptop, but when I opened up the laptop there was an A4 sheet saying that the battery had been replaced and the BIOS upgraded. Since then the laptop has actually held charge, so it looks like they did the job. So, congrats to Toshiba. More communication would have been nice, but it got fixed, you didn't wipe my Linux install (though I'd backed it up and removed any personal data anyway) and it was done within the period you claimed. I've not had to get a laptop fixed before, but iDunno hasn't had fun with Acer in the past, so I was prepared for the worst.

30 November 2005

Jonathan McDowell: OpenWRT on the Netgear DG834G

I spent too much time today reading MIPS disassembly of the ADAM2 bootload, as used on the Netgear DG834G. The problem is that the version used on the Netgear performs a checksum over most of the flash device on every boot. This makes the use of JFFS2, as done by OpenWRT, somewhat problematic. In an ideal world I'd try to compile up a newer, less restrictive version of ADAM2 but there's no JTAG on the Netgear that I've found and the thought of frying the bootloader and bricking the device wasn't appealing. So what I've ended up doing is finding where the checksum is done and changing the branch instruction that aborts the boot to a nop. It's still scary, but it appears to do the job. PLEASE NOTE THE BELOW COULD PERMANENTLY BREAK YOUR ROUTER First, obtain your ADAM2 image. This is 128K and is mtd2 from the bootloader view. It should have an md5sum of 0530bfdf00ec155f4182afd70da028c1. If it doesn't, stop. The version I'm talking about is 0.18.01 as distributed by Netgear. Assuming you have the right md5sum you want to go to offset 0x3944 where the 4 bytes should be 44 09 00 0C (representing a jal 0x90002510 during execution). Replace these 4 bytes with 0 (representing nop) and you should end up with a new image with an md5sum of d8a2f4623bf6f64b7427812f0e849aa7. You'll then need to do something like dd if=adam2-fix.bin of=/dev/mtdblock/2 on the device (I don't believe you'll be able to rewrite the bootloader from the bootloader for some reason...). After that ADAM2 will still checksum the flash, but will continue to boot it after printing a checksum error message. This means you can go off and build yourself an OpenWRT AR7 based image and install it on your Netgear. Rock.

29 November 2005

Jonathan McDowell: X session management

I use evilwm as my window manager. I like it; I mainly end up with a whole bunch of xterms and only a handful of graphical apps (Firefox, Psi, xmms and GKrellM). evilwm's minimal decorations mean I can fit everything nicely on my screen without clutter, and the virtual desktops let me have various separated out bits (eg Firefox gets a full desktop to itself). What I would like however is some form of session management. I'd like to be able to shutdown down my machine and when I restart it have my X setup look similar to when it was shut down, rather than having to start up a dozen apps and position them as I like them. I know I can do software suspend, but that doesn't cover kernel/library upgrades. I had a play with xsm, but although it could start up my xterms it didn't place them correctly. And didn't seem to restart Firefox, but I didn't poke that hard once I realised the xterms weren't getting placed. Am I doing something wrong? Do I need some different window manager setup? I think I'd rather live with having to place stuff myself rather than pull in large amounts of GNOME. I've previously used Window Maker and Fluxbox for prolonged periods of time - can either of those do what I want better?

25 November 2005

Jonathan McDowell: I was a brave boy at the dentist today

My main fear in life is pain. I'm a wuss. Nowhere is this more obvious than when I'm at the dentist. I literally start shaking when I sit in the chair. While he's prodding around inside my mouth I can feel myself tense up more and more until I force myself to relax and then the process repeats. Being 6'1" I don't get a lot of people believing me when I tell them just how nervous the whole thing makes me. Anyway. When I came to Norwich I managed to find a dentist who claimed to be suited to nervous patients. I went and didn't find them that good, but did make an appointment for my next checkup 6 months after my initial appointment. And then they cancelled it and I spent the next 3 years thinking I should really get round to sorting it out again and not doing so. Then several weeks ago I was having a conversation at an ALUG meeting with Becca and she recommended her dentist. So I decided I should give them a go and discovered that Phill also uses the same one and said they were good too. I finally got around to going today (having filled out all the forms last week). The dentist was nice and friendly and took me on board about being shit scared. And said some consoling words about my teeth being in reasonable shape. I got away with a scale and polish (which I have to go back to get completed in a couple of weeks) and no mention of a drill anywhere. Rock. Now let's see if I can manage a regular checkup schedule. :) Oh, it's the Guildhall Dental Practice at 9 Upper Goat Lane, Norwich if anyone else is looking. 01603 760032.

24 November 2005

Jonathan McDowell: Network installing FreeBSD

So, Black Cat Networks have a bunch of nice dedicated servers and I've been working on various network installs for them. Debian was of course easy; there's a nice netboot.tar.gz that has everything you need (including configs for serial consoles). Fedora Core was a bit harder; there's mention about network boots and installs, but not a lot of docs. A pxelinux entry like:
label fedora
	kernel fc4/vmlinuz
	append initrd=fc4/initrd.img ramdisk_size=8192 console=ttyS0,9600n8 serial
does the right thing, with vmlinuz and initrd.img coming from http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/images/pxeboot/. Fedora's a bit annoying in that it doesn't offer you a selection of mirrors to network install from though, so you need to have worked that out for the install. FreeBSD however, was much harder. Firstly, there aren't any decent docs about it that I could find. Secondly, it really wants to use NFS, even though TFTP will be required anyway for the PXE boot stage. So, I ended up recompiling the pxeboot loader with LOADER_TFTP_SUPPORT enabled and LOADER_NFS_SUPPORT removed (though it still tries to do NFS mounts it seems). Of course, you can't do this under Linux easily. Nor can you do it on FreeBSD 4.10 it seems (I was recompiling the FreeBSD 6 loader). However you can on FreeBSD 5.4. You need the lib and sys source trees to do so. Or you can have my prebuilt copy, freebsd.0. pxelinux config looks like:
label freebsd
	kernel boot/freebsd.0
assuming you put it in a boot subdirectory under your tftpboot root dir. You then need http://ftp.uk.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.0/6.0-RELEASE-i386-bootonly.iso to get the rest of the /boot contents from. Burn it to CD or loopback mount it or work whatever magic does the trick for you to get access to the files in that image. Then copy all of /boot on it to boot in your tftproot. You don't actually need boot*, cdboot, loader or pxeboot, but they're all small files. Then, add the following to loader.conf:
boot_serial="YES"
console="comconsole"
kernel_options="-h"
vfs.root.mountfrom="ufs:/dev/md0c"
So, now you can type "freebsd" at your pxelinux boot prompt and it'll boot up the installer. Rock. I don't quite understand why I had to include the kernel_options line above - I thought setting boot_serial would do that for me. However, it works. With the only real pain being having to recompile pxeboot and the lack of docs. Which I've now sorted for you. ;)

16 November 2005

Jonathan McDowell: Spamcop Kill Kittens.

Dear SpamCop, Please die in a large chemical fire. Don't fucking expect me, as postmaster of a secondary MX, to read every single bounce that comes from it rather than just sending a bounce message. And try educating your lusers (and truely, some of them are lusers) about how to unsubscribe from lists rather than deciding to report them as spam. And while I'm not keen on marketing email, some of it is legitimate and has working opt out systems. Just because you missed the opt out box doesn't make it spam and doesn't mean the way to deal with it is to report it as such. Gah. I like to think that SpamCop's heart in the right place, but it doesn't avoid the fact that I spend more time dealing with fuckwitted reports from them than I do with spam (because I do actually take the reports seriously as sometimes there's truth in them). Outblaze's FBL is the only other thing that comes close in terms of the sheer stupidity of the reporters. SpamCop; Just Say No.

15 November 2005

Jonathan McDowell: No more hardware today, please.

So, today has been a day of hardware. Some good, some bad. First, the good. Take one Via EPIA-M motherboard, add a helping of LinuxBIOS and Etherboot and let simmer for a few hours on a low heat. Then add a sprinkling of Phil Hands' d-i preseeding for the final garnish. Tweak to suit your tastes and lo and behold. A neat little motherboard that does proper serial console, boots d-i over the network via tftp and does a completely automated Debian install. Of course, it's not quite that easy. LinuxBIOS requires a few out of tree patches that are still under discussion. The latest version of Etherboot (5.4.1) doesn't seem to work (lots of rubbish on the serial console and no boot), but the version that does (5.2.6) requires a backport of the latest via-rhine driver to avoid leaving the network card in a state that Linux isn't happy with. And Phil's documentation could do with some updating (which I should really email him about). Oh, and add to that the fact that numerous things seem to assume that there is a PC BIOS and that it will support standard interrupts. Yeah, like that's going to happen. Still, I seem to have almost got there and it's quite funky to watch it all happen automatically. Kudos to the d-i team for the ease with which you can preseed. Flush with success I moved on to the next challenge; scanning some forms before posting them off. Nice and easy, normally. If it weren't for the fact that the machine with the SCSI card for the scanner just happens to be the one I stole for the above, and that the new case it's in doesn't allow any PCI cards. Bah. So, find a spare machine, get it into a state where I can actually drive the scanner, scan away. Took far too long. I really need to get it hooked up to my main machine, but there isn't enough desk space to have it close enough for the cables I've got. Perhaps I should crack and buy a USB scanner. I don't really need high quality, just something as an alternative to photocopying. After that trial I've moved on to upgrading my PVR box; I got a new 320GB HD today to replace the 40GB that I'd been using - it was getting to annoying to have to either watch or syphon off various series that I'm recording. While I had the box open I decided to upgrade the motherboard to something that might support wake-on-lan, so this turned into a bigger job than it should have been. :( I'm currently waiting for the data to copy across before trying to stick it back together. Bah. Don't suppose anyone has an S370 P-III better than 667MHz and no better than 1GHz they want to part with cheaply? I'm currently running a Celeron 800MHz (which I think is a slight step up from the previous PIII-667), but a little more oompfh would help with streaming over the network. I'd just upgrade to something modern, but I suspect the extra cost of silent cooling would be a killer.

11 November 2005

Jonathan McDowell: Thinking in the shower

I often find I have really great ideas about stuff to blog about, code or do, while I'm in the shower. And then once I'm finished showering I've forgotten all about them. Becca says she does the same, but usually while in the bath. Where do the ideas go? Down the plughole with the water?

9 November 2005

Jonathan McDowell: OpenID enabled

Right, I think I've now done the magic to OpenID enable comments. Thanks to Slarti for the basis of the Blosxom support to do this. If you've got a Livejournal you already have an OpenID and if not then you can just a service like that provided by ImperialViolet, which is what I'm doing at present until I find time to knock a server up for earth.li.

7 November 2005

Jonathan McDowell: The Fear

This post is mainly for Chris, but also because it too me slightly longer than expected to remember the exact link to The Fear. I have a copy of the Preacher cartoon stuck beside my computer.

28 October 2005

Jonathan McDowell: Hello, from a frog free connection.

Rar. I've finally got the Netgear happier. I grabbed an OpenWRT 2.4.30 kernel and hacked that into my OpenEmbedded image. That stopped the init panic messages. I've also done some work on faking up a /etc based on the values from nvram - this should hopefully mean I have persistent data over reboots as well as meaning you can upgrade from a stock Netgear DG834G image and keep your settings. I think I'm going to have to write a very basic bit of C to crypt the password though, as there doesn't seem to be any existing tiny utility in OE that'll do so. Anyway. This post is done from my desktop sshed to the Netgear which is connected to the ADSL and doing IPv6, and I'm then sshed from there to the via IPv6 (I could have setup the routing so I just sshed directly from my desktop through the Netgear, but this was quicker). Yay! That proves the ethernet, ADSL and IPv6 works. Haven't tried the wireless yet. I think I'm at the stage where I need to pull the OpenWRT kernel into the OE framework so I can build it all easily, and then I'll commit it and be able to provide an image in case anyone else is actually interested in this warbling. :)

26 October 2005

Jonathan McDowell: Further DG834G work

I finally found some time to devote to hacking on the DG834G. Given that it seems the bootloader checksums almost the entire flash on each boot a writeable flash file system doesn't seem to be an easy option. This rules out vanilla OpenWRT unfortunately, which is a shame given the AR7Port. However as I'm familiar with OpenEmbedded (which seems to be non working at present, but is behind OpenZaurus which I run on my C3000) I decided to have a look at getting that going. So now I have an image that boots, creates a ramfs for /, pivotroots the flash round to /media/realroot, creates a bunch of symlinks and should give me a basic filesystem to play with. Except it's not very happy, producing INIT: PANIC: segmentation violation! sleeping for 30 seconds. messages. Booting to just /bin/sh works fine, but various things won't run. I'm currently blaming this on the fact I haven't changed the default Netgear kernel from 2.4.17, so the next course of action is probably to use an OpenWRT based kernel and see how that goes.

Next.

Previous.