Phillip Pearson - web + electronics notes

tech notes and web hackery from a new zealander who was vaguely useful on the web back in 2002 (see: python community server, the blogging ecosystem, the new zealand coffee review, the internet topic exchange).


Wanted: A serverless group blogging tool

One thing that I'd love to have right now is a group blogging tool that runs on Windows and lets you blog reasonably "rich" media. I'm working in a software dev team that is currently producing lots and lots of documents and it's getting difficult to keep track of them; I'm getting into the situation where I think that I need to write something, but it turns out that someone else has already written it -- I just don't realise that it's there.

I'm tempted to set up some sort of blogging tool, but I don't want to have a web server on my own box at work because it's a development box, meaning that it gets abused and rebooted every now and then, and it can't always be relied upon. Its name changes every now and then, too, meaning that http:// URLs will break.

We do have a big chunk of file server space, though, and a blog that used file:// URLs should work just fine. My bzero could be a candidate here, but it doesn't really do the media thing very well - I can't just open a window, paste an image into it, and click 'POST'.

The interesting components of this system are:

  • Some way of storing the data in such a way that several people can read/write it at once.
  • A nice front-end that supports drag-and-drop, cut-and-paste, etc.
  • Support for file:// URLs.

To get bzero to do it, I'd need to get it to run without a PyCS server and write the front end. The first bit isn't hard -- just turn off comments, trackbacks, etc, and use bzero render instead of bzero send. The front end just needs to be a simple rich text editor -- in .net, RichTextBox would do the trick. You'd have to parse the output to turn it into HTML, and save images out separately, but it should work OK.

Hmm ...

... more like this: [, ]

Colourful console output from Python on Windows

Someone just asked me how to display the received bytes from two serial ports in different colours, from a Python script. I'm assuming they're using Windows, which means they want to use the WConio library to change the colour and the PySerial library to talk to the serial port.

So, here we go. Note that I use sys.stdout.write rather than print because I don't want to have either a space (as with print "foo",) or a carriage return (print "foo") after each bit of output.

import sys, WConio, serial

SPEED = 19200

ports = [("COM1", serial.Serial(0, SPEED), 0x1f),
         ("COM2", serial.Serial(1, SPEED), 0x4f),

done = 0
while not done:
    for portname, port, colour in ports:
        n = port.inWaiting()
        if n:
    while WConio.kbhit():
        if WConio.getch()[0] == 27:
            done = 1

... more like this: [, ] ... topic exchange: []