Archive for February, 2003

Fluod Poisoning

Monday, February 24th, 2003

What a horrible weekend, I’ve just had. Felt rought Thursday and Friday, but put it down to just too much time in front of the computer screen. Friday night was a friends birthday party in town. Baby sitter all sorted, wife raring to go, me headache worsening. Made the most of it, enjoyed the evening somewhat, despite my worsening headache, only to have race home to puke my guts up, multiple times. At 3am, the constant dry retching would have become funny (like a hiccup) if it wasn’t for the incredible pain it caused. Please, I pleaded, there is nothing left in there, not even the bile, that disappeared an hour ago.

I next got up Sunday, and managed to go the park with the kids and friends and felt better but tired. Sunday afternoon and evening spent on sofa mulching.

Woke 6am this morning, bright and breezy ready to face world and children; “toast butter milk please”. I get into work, and after fifteen minutes have the same nagging headache I had Thursday.

Purge Completed Todo Utility

Friday, February 21st, 2003

In Simple XML Processing With elementtree, Uche Ogbuji claimed that “elementtree is fast, pythonic and very simple to use”. I decided to put it to the test by writing something I’ve been meaning to do for a while, writing a script to purge completed entries from the Zaurus ToDo application. I wasn’t let down.

Maybe I’m blind but I just couldn’t find a way of bulk removing entries using the limited GUI interface of the application, and I was building up hundreds of completed entries which must slow down processing over time. Luckily help was at hand because Sharp, in their wisdom, decided to store its data in XML documents.

Here is an example of todolist.xml

<!DOCTYPE Tasks>
<Tasks>
<RIDMax>
223
</RIDMax>
 <Task Completed="1" HasDate="0" Priority="3"
  Categories="-1042017918" Description="make a cup of tea"
  Uid="-1045778896" rid="221" rinfo="0"/>
 <Task Completed="0" HasDate="0" Priority="2"
  Categories="-1044048088" Description="write photolog plugin"
  Uid="-1045038462" rid="153" rinfo="0"/>
</Tasks>

The Task element has the attibute of Completed; 1 for completed, 0 for uncompleted. It should be a simple task to remove all the completed Tasks.

import sys
from elementtree.ElementTree import ElementTree, Element
tasks = ElementTree(file="/home/root/Applications/todolist/todolist.xml")
tree = tasks.getroot()
iter = tasks.getiterator()
for task in iter:
  if task.get("Completed") == "1":
    tree.remove(task)

f = open("/home/root/Applications/todolist/todolist.xml",'w')
tasks.write(f)
f.close()

There was just a couple of things to work out. One, you couldn’t remove from the iterator, so you have to use the getroot() function as well as the getiterator() function. Also, the examples looked like you could do

tasks.write("/home/root/Applications/todolist/todolist.xml")

but I couldn’t get this to work.

Note: you have to make sure that the todo applications isn’t “fastloaded” on the system, otherwise it will write over your changes with its in-memory copy.

Finally, for this to work on the Zaurus, you’ll need more than the standard Python IPK. You need python-xml, python-compress and python-codecs (all available from Riverbank). (You might also want python-devel to install modules but this isn’t completely necessary)

Google killed the Journo Star

Friday, February 21st, 2003

In an article about whether Google too powerful, this made me laugh.

Often it is as far from journalism as it is possible to get, with unsubstantiated rumour, prejudice and gossip masquerading as informed opinion.

Journalism is quite capable of descending into the sticky mire of rumour, prejudice and gossip (just pick up The Sun), just blogging is capable of doing the opposite.

Clearly, blogging isn’t going to replace journalism, at least in the near future, with people always wanting to hear from an ‘official’ voice, and to suggest otherwise, is to miss the point of what journalism is.

Whether Google is too powerful or not is a subject for another day.

Modified Recent Comments

Thursday, February 20th, 2003

The recent comments now include recent trackbacks as well, thanks to Mark Paschal as discussed here [blatent self reference to show a trackback].

It was very easy to do, just following the same format as before, just with Trackback tags instead of Comment tags. However, in doing so, I found out that my rebuild woes have trashed all my trackback ping references, as they now point to non-existant entries. Of course, now I’m using mySQL I can go in a change these (save for a rainy day). I also took the necessary rebuild to use the new comment form which looks a lot nicer than the old one (hmm, must check that validates actually). No threaded comments just yet.

Whilst checking up on Shelley’s code for Recent Comments, I noticed she is using PHP/mySQL to generate her Recent Trackbacks. For everyone who doesn’t have PHP, you can use the SimpleComments plugin for the same effect. Note: You don’t have to mix Comments and Trackbacks, just use <MTSimpleCommentIfTrackback> only.

UPDATE: Just realised this doesn’t work. Once I actually had a trackback to look at I realised there just wasn’t the information in the MTPing tag necessary. If only David Raynes MTPingedURLs plugin worked outside of invidual entries. You still see there has been a trackback, but you don’t get all the information that Shelley is displaying.

MTThreadedComments

Thursday, February 20th, 2003

Woo hoo MTThreadedComments [via Phil who is pausing before installing]

Read and review before installing? Where’s the fun in that?

Actually, this one looks a bit complicated as Phil says. How does it work with MTSimpleComments, where to put the comment form. Clearly the way Aquarionics does it is best, as I use it and it feels natural.

Three nice MT enhancements

Wednesday, February 19th, 2003

Mark discusses three ideas for MT that I’d really like to see. One written, one he is writing, one is currently still thoughtware.

First of all, he’s got a fix for SimpleComments so it doesn’t have to be in an entry.

Next, the FilterCategory plugin he is currently writing will be very useful indeed. I’m glad there are people out there that can write the thinks I want. I’m too lazy to invoke the LazyWeb.

Finally, an idea on trackback auto-discovery that I have thought about too.

One feature I would like would be less automatic TrackBack: I always find I’m accidentally sending pings somewhere I’d rather not, but I still don’t want to look up, copy, and paste the TB URL manually. I’d like MT to automatically fetch the TrackBack URLs, but then prompt if it should ping them. Kinda complicated UI, but that’s what I’d like.

Case in point. I don’t want to invoke the lazyweb, and I’m not going to link to it, just in case MT decides to ping it away. This happens quite a lot, and you find yourself trackbacking when you don’t, or even doing a double ping if you rebuild.