Richard Jones' Log

Sun, 30 Jan 2005
PySpotting tweaked by Toby

My friend Toby has re-worked the original design to clean it up a little and make it slightly more Pythonic. Very nice. Did I mention this would make a good PyCon t-shirt? :)

category: Python | permanent link
Sat, 29 Jan 2005
Distutils sprinting at PyCon

I've signed up for the distutils sprint at (before) PyCon - Fred has offered support for PEP 314, and I've stated that I'll sit in a corner and implement PEP 243 by myself if need be, but I want to get it done in those four days. Having someone with root access to python.org handy would make it possible to finish the project in the four days, rather than leave it dangling as happens all too often (not a dig at the python.org roto-rooters, just a recognition that they're busy people).

Daddy t-shirts

After the recent "guilt and parenting go hand in hand" sentiment on Daddy Types, it looks like The Onion are on the game too, with their "I'm going to be the worst father ever" t-shirt. I'm a Large.

Actually, Toby, Callum (on the left), Abbey and I went to the Melbourne Aquarium yesterday afternoon. Overall I think everyone had a fun time - Abbey was just amazed by several of the huge tanks, and spent a fair amount of time "pook pook"ing to the fish, possibly in an attempt to communicate (she learnt very early on, though not via Lenore, that fishies go "pook pook"). Photos of Abbey at the aquarium to come when I dump the camera contents next month. So, a success, yay!

I waited until the end of the day to try to burn out her mouth with dinner that was too hot :( OK, I exaggerate. There was much crying though. She was able to eat her brekky this morning, and doesn't appear to hold a permanent grudge, so maybe everything will be OK ;)

Sat, 22 Jan 2005
New pyblagg feed parser coming soon...

I needed to do something else for a change, so I've decided to hack up a new generator for pyblagg. It's in testing at the moment, and I hope to have it in place in the next few days.

It fixes the long-standing issues I've had regarding scraping the wiki page that has the feeds (was done by hand, now done by script ;), and also handling undated feeds (why oh why do those pybloxsom feeds still remain undated?) It uses the latest feedparser.py, including using the e-tag and last-modified support. I'm going to set up an RSS feed for the page itself, and one of those fancy FOAF/OPML things for the blogroll.

And ob-sqlite, it now uses sqlite for the feed / entries storage ;)

I'm also going to contact the planet python maintainer to see whether we should pool resources regarding feed URLs.

category: Python | permanent link
Fri, 21 Jan 2005
Digital publishing

Steve Jackson Games' e23 digital publishing project uses a publishing model that we've been planning at work for a while. My boss also believes that Digital Rights Management* shouldn't take the form of roadblocks (i.e. access controls including encryption). His approach is very similar to e23, but also includes watermarking the downloaded PDF files with information such as the purchaser's name and the date purchased. Some people understand this approach, but others just find it incomprehensible - probably mostly because they don't fully understand how DRM roadblocks are circumventable. I've given up trying to explain this to people, as the sheer panic I sometimes encounter is scary.

news via BoingBoing

*: possibly because of the focus on encryption and access controls, it is often not known that a large part of DRM is the identification of the Work, its creator(s) and consumer(s).

Thu, 20 Jan 2005
rel="nofollow"

This weblog now implements rel="nofollow" for links in comments - those links will not be indexed by Google, MSN, Yahoo! etc so don't even bother putting spam here.

Update: Just got my first new comment spam since introducing this. Sigh.

PySpotting

This design could be the next PyCon t-shirt, as far as I'm concerned :)

category: Python | permanent link
Wed, 19 Jan 2005
Surfacing for air

It's been a busy week at work. Lots of really good stuff going on in the conference software and the conferences themselves - the new Technology and Sustainability conferences are getting good responses.

I've got some news though - my Roundup presentation has been accepted for PyCon, and my rego has been paid. Just have to organise the accommodation etc. The wiki is useful, but needs some work, which I hope to get around to this weekend.

The date of the next 48-hour game programming competition has been set - April 15th (Friday) to 17th (Sunday). Looking forward to it already, but I need to do some work on the website (like creating a new home folder, etc).

Finally, I've asked my current web hosts if I can run the Roundup project's tracker on there (ie. eat my own dogfood) which they've agreed to, yay! Now to find the time to migrate the old sf.net tracker items over...

category: Python | permanent link
Thu, 13 Jan 2005
Mini-ITX vs. MiniMac

MiniMac $1550, Mini-ITX $1220. Both are configured to have DVD-RW, 80GB HD, 512MB RAM, wireless networking and digital TV capture. On the downside, the ITX system has fans, but they're supposed to be quiet. In its favour, the ITX system has S/PDIF audio out, which the Mac can't do.

Mini-ITX components* (from Aus PC Market - I'm pretty sure I could get cheaper components locally):

$286.00VIA M-10000 MiniITX Motherboard w/1Ghz CPU - 1xPCI 1xDDR, Video/audio/LAN/TVout/Firewire
$176.00PC-3200 512mb Corsair 184-pin DDR SDRAM (200mhz XMS3200 CAS 3) w/heatspreader
$143.00Black 2699 Mini-ITX desktop case w/external fanless PSU, suit VIA Eden / M-Series, takes SlimCD, 1x PCI slot
$242.00 + $33.00Pioneer Tray-loading Slim DVD-RW+DL, 8x DVD±R, 4x DVD±RW, 2.4x Dual Layer+R plus IDE/Power adapter GHA-K003 for Slim CD-ROM (GHA-SR242)
$126.50Maxtor 80GB DiamondMax Plus9 ATA133 IDE Hard drive, 7200RPM, 2mb cache (I'd probably spend another $80 and get 200GB)
$71.50Skymaster USB2 802.11g 54mbps Wireless Network Dongle (or I could just go with the cable, which would cut $120 off the Mac price too)
$146.30AverTV DVB-T 771 digital terrestrial TV PCI card w/remote control

And, it'd be a bit of fun to actually build the thing :)

Update: Linux distro to run on it. And a HOWTO for good measure.

Update 2: OK, this so wasn't supposed to be a Mac-bashing exercise, but rather hopefully the first in a series on my adventures in build-your-own-PVR-land.

*Prices are Aussie of course.

Wed, 12 Jan 2005
On users of software

Inbox full of errors from system, generated by users trained to believe that if they just keep hitting the button, it'll eventually work.

Paraphrasing: "If I press this button, it hurts. Ow ... ow ... ow ... ow ... ow ..."

Appropriate Simpsons moment:

Bart's turn again. A cupcake is connected to the mild electrical current. There's even a sign that says, "Do not touch." Bart sees the cupcake. Bart sees the sign. He tosses it aside and goes for the cupcake. He gets shocked. Imitating Moe (not the bartender) "Wiseguy, eh?". He tries again, and slaps himself like Curly. He tries once more. "Ow." Again. "Ow." Again. "Ow." Lisa once again takes score. "Hamster 2, Bart 0"
category: Noise | permanent link
Tue, 11 Jan 2005
Mac mini *almost* perfect

The Mac mini is IMHO almost perfect. Swap the modem port* for a composite video out, and you've got me sold. It would make a pretty damned good media center. Not sure why Apple missed that particularly obvious step. Digital audio out would also be nice, but I'm not that fussy.

Update: at the bottom of the specs page, I notice their DVI to video adapter. I guess I'm just going to have to buy one now. Rachel, can I have one, please? :)

Update 2: add in a firewire / USB video capture box or maybe TV tuner and it's also a PVR.

*: modem in a laptop I can understand, but modem in a desktop, these days?

cElementTree released!

I use ElementTree a lot, for reading, creating and manipulating XML files. It's the only XML tool I use (for HTML, I use BeautifulSoup). And now it's faster. A lot faster:

    library                     memory  time
    ------------------------------------------------------------
    minidom (python 2.1)        80000k  6.5s
    minidom (python 2.4)        53000k  1.4s
    ElementTree 1.3             14500k  1.1s
    pyRXPU                      11500k  0.22s
    cElementTree 0.8             5700k  0.058s
    ------------------------------------------------------------
    readlines (read as text)     5050k  0.032s
    ------------------------------------------------------------

That's pretty damned cool :)

The only minor annoyance with ElementTree is that there's no downloadable docs. Sadly it doesn't offer pydoc much information either. Makes it hard for me to code on the train.

Update: /F has informed me that more recent ElementTree downloads have the docs bundled (we're still running 1.1, having not even tested upgrading to 1.2 yet - just been remedied :)

Sun, 09 Jan 2005
Year planner PDF generation in Python

Rachel and I are trying to introduce some more planning into our lives. To this end, I looked around for some free year planning calendar, but to no avail. So, an hour of hacking later, here's some code (rlcal.py) that generates a couple of PDFs (Jan-Jun, Jul-Dec)

# rlcal.py v1.1 (C) 2005 Richard Jones
# Generates 2 PDF pages for a "year planner". Year is hard-coded.
# license: http://creativecommons.org/licenses/by-nc-sa/2.0
# Requires ReportLab PDF library <http://www.reportlab.org/>
import calendar
from reportlab.lib import colors
from reportlab.graphics import shapes, renderPDF

YEAR = 2005

def half_year(startmon):
    '''"startmon" gives the 1-indexed month to start the page on'''
    mons = []
    reqd = 0
    # ask calendar.py to figure the actual days for each month
    for mon in range(6):
        weeks = calendar.monthcalendar(YEAR, mon + startmon)
        weeks[-1] = filter(None, weeks[-1])
        mdays = []
        for week in weeks:
            mdays.extend(week)
        reqd = max(reqd, len(mdays))
        mons.append(mdays)

    LEFTMARGIN = 5
    DAYCOLWIDTH = 50
    CELLWIDTH  = 80
    CELLHEIGHT = 19
    TOPROWHEIGHT = 18
    WIDTH = LEFTMARGIN + DAYCOLWIDTH + CELLWIDTH*6
    HEIGHT = reqd * CELLHEIGHT + TOPROWHEIGHT

    d = shapes.Drawing(WIDTH, HEIGHT)

    # month headings
    for i in range(6):
        x = LEFTMARGIN + i*CELLWIDTH + DAYCOLWIDTH + CELLWIDTH/2
        d.add(shapes.String(x, HEIGHT-14, calendar.month_abbr[i + startmon],
            fontSize=14, fontName='Times-Bold', textAnchor='middle'))

    # day row headings
    for i in range(reqd):
        y = HEIGHT - i*CELLHEIGHT - TOPROWHEIGHT
        d.add(shapes.String(LEFTMARGIN + 10, y-14, calendar.day_abbr[i%7],
            fontSize=14))

    # cells for each day, light grey background if weekend
    lightgrey = colors.HexColor(0xD0D0D0)
    for j in range(6):
        x = LEFTMARGIN + j*CELLWIDTH + DAYCOLWIDTH
        for i in range(reqd):
            if i >= len(mons[j]) or not mons[j][i]: continue
            y = HEIGHT - i*CELLHEIGHT - TOPROWHEIGHT
            color = (i%7 > 4) and lightgrey or colors.white
            d.add(shapes.Rect(x, y, CELLWIDTH, -CELLHEIGHT, fillColor=color))
            d.add(shapes.String(x+1, y-10, str(mons[j][i]), fontSize=10))
    return d

if __name__ == '__main__':
    renderPDF.drawToFile(half_year(1), 'calendar.jan-jun.pdf')
    renderPDF.drawToFile(half_year(7), 'calendar.jul-dec.pdf')
Wed, 05 Jan 2005
Background checking, Google-style

I find myself resorting to googling "<potential purchase> sucks" a lot these days.

I just got junk mail from Doubleday*, wanting me to sign up for their book/CD clubs. Couldn't find any substantive information in the offers about what signing up entails, what the opt-out provisions are, ongoing fees, expected charges for subsequent purchases, future shipping costs, etc. So I headed off to Google, with searches like "doubleday sucks" and "doubleday ripoff". There's enough stories out there to have me concerned, so I think I'll stick with the bricks-and-mortar stores for now.

*: this is the one disadvantage of staying in the one house for more than 12-18 months - the volume of targetted junk mail increases dramatically. I'm still not moving ever again though. 7 times in 9 years is plenty enough.

Mon, 03 Jan 2005
Roundup news

Some Roundup progress today. How about "Getting Things Done" in Roundup? And 0.7.10 should be out today, followed closely by 0.8.0b2...

category: Python | permanent link