Random notes from mg

a blog by Marius Gedminas

Marius is a Python hacker. He works for Programmers of Vilnius, a small Python/Zope 3 startup. He has a personal home page at http://gedmin.as. His email is marius@gedmin.as. He does not like spam, but is not afraid of it.

Tue, 18 Jan 2005

Weird quotient

Memes are infectious

What is your weird quotient? Click to find out! I am nerdier than 93% of all people. Are you nerdier? Click here to find out! I am 97% loser. What about you? Click here to find out!

posted at 02:08 | tags: | permanent link to this entry | 0 comments

The power of web applications

I'm really impressed by this zoomable map of Switzerland. Interactively zoom from the whole country down to individual streets and buildings! And it is insanely fast! I want one for Lithuania.

And it is all done in client-side Javascript.

posted at 02:08 | tags: , | permanent link to this entry | 0 comments

Sun, 16 Jan 2005

More on PyBlosxom

I want to store my blog in Subversion. Problem: Subversion does not preserve mtimes of files. Solution: a plugin like pyfilenamemtime, but different (I do not want to rename existing blog entries). Since I want to import my existing blog entries without renaming them, I wrote a plugin that reads timestamps from a separate text file. This should suffice, in addition to adding

[miscellany]
### Set use-commit-times to make checkout/update/switch/revert
### put last-committed timestamps on every file touched.
use-commit-times = yes

to ~/.subversion/config.

Now I want to have an RSS or Atom feed that validates. Answer: rss2renderer.

I'd like to have browsable archives for entries that do not fit on the front page (and then make the front page contain fewer entries). There are plugins in the PyBlosxom plugin registry that look promising: pyarchives, wbgpager.

More wishes: I want to be able to post blog entries with images. I'd like to be able to be able to add new blog entries with gnome-blogger and via a web form. And I want to have drafts that I can look at until I become satisfied and publish.

Stay tuned, if I figure out how to accomplish what I want, I'll blog about it.

posted at 21:38 | tags: | permanent link to this entry | 0 comments

Sun, 09 Jan 2005

IRC logs

So I've got supybot running and logging to a text file (one file per day). My next goal was to produce nice, aesthetically pleasing IRC logs in HTML.

First I defeated the urge to write my own IRC log to HTML converter from scratch. Then I started googling and was surprised how hard it was to find anything. I went through the whole IRC section in freshmeat.net. I finally decided that irclog2html.pl by Jeff Waugh was the closest thing to my ideal, with only two deficiencies:

  1. It's written in Perl, so customization is difficult.
  2. It produces sloppy HTML4 output in ISO-8859-1, while I wanted XHTML/CSS in UTF-8.

The obvious next step was to port irclog2html.pl to Python, refactor it so that customizations (e.g. adding a new output style) are straightforward, and then improve it. I also wrote a test script that runs both irclog2html.pl and irclog2html.py and compares the output. Unfortunately, I did not have any log files to test, so there may be some remaining bugs or just differences.

That's how I spent the night from 1 AM to 9:30 AM. At the end I have irclog2html.py that has a couple of new output styles (xhtml and xhtmltable), some bug fixes, understands ISO 8601 timestamps (YYYY-MM-DDTHH:MM:SS, such as found in irc logs produced by supybot's ChannelLogger), and can produce navigation links (prev, next, index) if you specify them on the command line. You can see the end result here:

SchoolTool IRC logs

I also wrote a second script, logs2html.py. It finds all log files in a directory, compares their mtimes to mtimes of corresponding html files, and runs irclog2html.py for logs that have changed. It also produces an index page and passes the necessary command line options to irclog2html.py to create navigational links. This script now from cron runs every five minutes.

And here's the stylesheed used by both scripts: irclog.css.

Today I wrote an ugly hacky script to split XChat log files into daily IRC log files suitable as input for logs2html.py, so that I could import past IRC conversations. I'm not publishing it because it's very ugly.

Update: irclog2html now has a web page. You can find the latest version there.

posted at 23:29 | tags: , | permanent link to this entry | 0 comments

Sat, 08 Jan 2005

Looking for an IRC bot

I'm looking for an IRC bot, mostly to provide logs of IRC conversations. I want and extensible one that is written in Python, so that I can add extra features (e.g. announcements of subversion commits). I want one that is in mature, usable, and available in Debian.

apt-cache search python irc bot gives me two answers:

Looks like I'll be investigating supybot. It appears to have a lot of features that I'm not interested in. Some are interesting.

posted at 22:46 | tags: , | permanent link to this entry | 0 comments