2008-08-05

Ubuntu 8.04 & ZODB

After a fresh install, saying:

sudo apt-get install python-zodb

..did not properly set up ZODB. Some kind of version conflict/Ubuntu bug. Had to add following lines to /etc/apt/sources.list:

deb http://ppa.launchpad.net/schooltool-owners/ubuntu hardy main
deb-src http://ppa.launchpad.net/schooltool-owners/ubuntu hardy main

..and say:

sudo apt-get install python-zodb
sudo apt-get install python-zope.interface
sudo apt-get install python-zope.proxy

See: https://bugs.launchpad.net/ubuntu/+source/zodb/+bug/226292/comments/5

2008-08-04

Ubuntu 8.04 LTS Server Edition and Parallels

Install went ok, but failed to boot to the newly installed system. Had to boot to a rescue prompt from the CD, and say:

apt-get install linux-virtual

After which it worked fine. See:  https://answers.launchpad.net/ubuntu/+question/23343

2008-08-03

Python shelve speed testing

import shelve, os, time, sha

class Foo:
    def __init__(self):
        self.data = sha.new(repr(time.time())).hexdigest()

nobjects = 100000

try:
    os.unlink('speedtest.db')
except OSError:
    print "creating db file"

start = time.time()

db = shelve.open('speedtest')

i = nobjects
while i > 0:
    db[str(i)] = Foo()
    db.sync()
    i = i - 1

db.close()

t = time.time() - start
print t, " sec for ", nobjects, " objects; ", t/nobjects, " sec/object"

On a 2 GHz MacBook with 1 GB of RAM and Python 2.3.5 the run time for this program is around 7 seconds. ("7.00173902512 sec for 100000 objects; 7.00173902512e-05 sec/object", the AnyDBM backend being "Berkeley DB 1.85 (Hash, version 2, native byte-order)".) Omitting the .sync() call shaves a few hundred milliseconds from that.

See also: http://codeidol.com/python/python3/Databases-and-Persistence/Shelve-Files/

2008-05-20

PIC Baud Rate Generator calculations

Piclist.com has an online tool to determine correct bits to set in to the SPBRG register, based on clock speed and allowed error margin. Here: http://www.piclist.com/techref/microchip/spbrgcalc.asp.

2008-04-10

All the South Park episodes online

South Park Studios have put all the episodes online, for free (as in beer, or something). See http://www.southparkstudios.com/episodes/. Thanks, Jan, for the tip. This is mega-mega-awesome!

See especially season 5 first episode.

2008-03-10

IE6, IE7, FF...

Using these stupid hacks is discouraged by some people smarter than me. However, should the need rise, here's a hint from some dude Neil Kilbride:

"Although Firefox and IE7 and more similar than ever in rendering CSS, IE6 has always had a mind of its own, adding padding and spacing amongst other things in random locations. However, there is a simple way to cater specifically for the major browsers. IE6 recognises underscore lines, but IE7 does not. IE6 and IE7 recognise period lines. For example..." (link to complete post above).