Andrew Channels Dexter Pinion

Wherein I write some stuff that you may like to read. Or not, its up to you really.

November 29, 2003

Even More Knoppix

The adoration continues. I hadn't realised until I read System recovery with Knoppix, that Knoppix comes with QTParted.

This is a robust, open source, partition manager. The free software equivalent of Partition Magic. I've been looking for something like this for a while. It seems that every time I buy a new machine I have to buy a new version of partition magic, because the current copy I have won't work with the new operating system or file systems that it uses. With this kind of planned obsolescence I end up spending quite a bit, well not any longer.

Posted by Andy Todd at 12:05 PM | Comments (1)

November 28, 2003

More Knoppix

I take back everything I said about KDE being troublesome under KNOPPIX. I just downloaded the latest ISO image, verified the md5 checksum, burnt it to CD and voila. Not only do I now have KDE 3.1 but I've managed to set up a home directory on my USB memory stick so that I've got the same setup whichever machine I use. Fantastic.

Posted by Andy Todd at 01:00 PM | Comments (0)

November 24, 2003

Always Learning

Here is a really useful feature that I didn't know about until today - function based indexes in Oracle. Cool.

How we could use them in DB2 because it suffers from the same problem that Oracle used to. Namely that applying a function to a column means that it can't be accessed via an index - with a requisite increase in the speed of queries.

I'm getting a little grief from our client at the moment because all of our date information is stored in TIMESTAMP columns. They don't like the fact that when they access data by day they have to use a function ('DATE') to split out the date part. It doesn't matter that they can use 'BETWEEN' to achieve the same thing and that it will use an index. They are insisting I replace all of the TIMESTAMP columns in our database with seperate DATE and TIME ones. I suspect that this is because its common practise on their mainframe DB2 systems, but I may be wrong.

[Courtesy of Alan Green in turn courtesy of Simon Brunning]

Posted by Andy Todd at 01:36 PM | Comments (2)

November 21, 2003

Free Software

As featured on Slashdot today, TheOpenCD. I shall be pressing up a few and handing them around at work. My tactic is to impress people with the free as-in-beer aspect of these programs, which will then hopefully lead to an appreciation of their free as-in-speech qualities.

Posted by Andy Todd at 02:12 PM | Comments (0)

November 19, 2003

Browsing the Windows Neighbourhood

Mental note to self, check out LinNeighborhood. Its a way of graphically checking out the windows devices on your local network.

Extra bonus marks for being available as a Debian package.

As recommended in this LinuxWorld article. Just whatever you do, don't point MPT at it. He'll never stop laughing at the suggestion that any desktop software is intuitive and easy to use, least of all packages like evolution, gnucash and (ha ha) OpenOffice.

Posted by Andy Todd at 02:19 PM | Comments (1)

November 12, 2003

MP3 Jukebox Hacking

It looks like I can upgrade the firmware on my Archos Jukebox. Its open source to boot. Cool.

I don't think you can do this with your iPod.

Emboldened by my success "upgrading" the firmware I resolved once more to get the thing to mount on my Debian box. A little light googling led me to the hotplug package. After apt-get'ting it I plugged in the Jukebox, turned it on and - nothing. I had added the appopriate line to my /etc/fstab file;

/dev/sda1    /mnt/archos    auto    rw,user,noauto    0  0

But all I got was an error message saying no medium found.

As a last resort I rebooted - and everything worked. Woo, and furthermore, hoo.

Hope that answers your question Vale.

Posted by Andy Todd at 11:45 AM | Comments (0)

November 04, 2003

Right Padding A String

I've been writing some Java today, shock horror. I approached it as if I was writing some Python code, but just with more symbols in the source code.

It was a nice reminder that even in such similar languages, common idioms don't necessarily travel. As an example I wanted to right pad a string. This isn't supported by the String class, so I wrote a method;

public String rightPad(String s, int length, char pad) {
	StringBuffer buffer = new StringBuffer(s);
	int curLen=s.length();
	if (curLen < length)
		for (int i=0; i<length; i++)
	return buffer.toString();

Then I tried to implement it in Python. Here is my first pass;

def fill(fillString, toLength, fillChar):
    while len(fillString) < toLength:
        fillString += fillChar
    return fillString

Which is pretty much a direct copy of the Java code. But, I thought, there must be a more Pythonic way, so I came up with;

def newFill(fillString, toLength, fillChar):
    return fillString+''.join([fillChar for x in range(len(fillString),toLength)])

Hmmm, I'm not sure if its better, or just more obscure. It looks awfully LISP like to me.

Posted by Andy Todd at 08:28 PM | Comments (9)