Andrew Channels Dexter Pinion

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

January 16, 2002

Quality Code

Here is some quality code Alex Martelli posted on comp.lang.python;

class fifo:
    def __init__(self):
        self.data = []
        self.first = 0
    def head(self):
        return self.data[self.first]
    def pop(self):
        self.first += 1
        if self.first > len(self.data)/2:
            self.data = self.data[self.first:]
            self.first = 0
    def append(self, value):
        self.data.append(value)

I'm posting it here as a mental note to myself to use this class whenever I need a first in, first out stack.

Posted by Andy Todd at 09:31 AM | Comments (0)

January 09, 2002

Debian Configuration Woes

In the words of Victor Meldrew - "I don't believe it".

I thought I understood this technology stuff. I've managed to install Debian on Bobo's old laptop (a Thinkpad 390E for the technical). All went swimmingly well (eventually). Now I have a stable system which I can boot up and log onto. When I go to do some actual work I discover that the tools I want to use (python, wxGTK, wxPython) are either not present or terribly out of date. "No problem" I think to myself, this was the reason I chose Debian, as it has this wonderful package structure to help me seamlessly upgrade. With just a few key strokes I can get the latest version of any module on the system and know that it will work. Beautiful.

Well, two days and innumerable swear words later and I am no better off. I have traced the source of my frustration though. The Debian package utilities (dpkg, apt-get and dselect) all rely on a configuration file (/etc/apt/sources.list if you must know) and the contents of mine is wrong. I know it is wrong because the package utilities all tell me so. What they don't tell me, and what I can't find anywhere on the web or in the manuals, is how to fix it. Good grief. I shall be writing a stern e-mail, once I have solved my problem (and I'll put the solution up here as well).

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