28 Feb 2002

XML Python Layer of Database

Not been doing much else lately except this. It is nearly workable. Well, actually it is working, but has a few bugs which are being discovered by the bug miester Aquarius who has already written some weblogging software with it.

I have to say, I've totally shocked myself by it working. It was only meant as a exercise to learn me some Python, before doing a proper program for Dellah.

Now, it is going to be used as the back-end for dellah. I haven't decided whether to use XSLT yet, but I'm not sure it's needed now. One more, rewrite of the parser, and I'll upload the code. Don't know if that will be useful as the only other person I know who uses Python already has the code. If any one else uses Python, let me know. If anyone uses PHP, you've only got yourselves to blame.

Posted at 17:23

19 Feb 2002

Scrapheap database

Version 0.1 of xPlod is complete, and I'll load it up tonight after tiding up the code a little bit. I have to admit that the code looks like it was bodged together on Scrapheap Challenge rather than designed like a Ferrari.

When you are very new at a programming language, you are bound to do things the wrong way, or in a way that isn't best for the language. For instance, I started by having a Storage class that loaded the xml file in and out of memory. Later, it became apparent that this wasn't too clever, and other classes do it a different (and simpler) way. I still have to go back and change the first classes I did to the new methodology. Despite these differences, I'm finding it is going to be a lot quicker to code in Python than with Java. Another reason to cross over from the Dark Side.

xPlod will allow to you create and delete a table, select, update, insert and delete from the table. So far the where parsing only allows for equals, not equals, like '%something%' and like 'startswith%'.

Thanks for all the suggestions for additional functionality, but all I'm planning to include at this stage is ORDER BY and some more where clauses, including greater than, less than and not like.

Despite joking that this is a noddy database, it does provide a rather flexible framework for just about anything you want to do. It would be quite easy to maintain a simple weblogging system using it alongside Castalian. Of course, seen as the format is XML, it is ideal for using XSLT to convert your data into just about any style going. I will have to do a lot of extra work to get that right. Oracle provide an XSQL processor that takes your sql statements and XSLT stylesheet and pumps out the output. Wouldn't it be cool to do that with Castalian? Pipe dream?

Posted at 14:57

18 Feb 2002

xPlod

xPlod, the XML Python Layer of Database, an alternate version of plod, or a way of learning Python-XML whilst pretending to do something useful, is coming on in leaps and bounds. Not sure which direction the leaps and bounds are heading yet :)

So far, you can create or delete a table, useful. You can insert a row, nice. You can do a limited amount of selecting. So far, you can do

select * from emp
select * from emp where empno = 7499
select * from emp where empno != 7499
select * from emp where ename like '%SM%'
+ all of the above whilst selecting individual columns, e.g.
select empno, ename from emp

It presents it in a neat sqlplus style format. Nothing fancy, who wants to mess around with that sort of thing. More to come.

btw, Aq asked whether it supports xpath queries on xml files. Well, not really. The point is to ape what you can do with sql (I'm using Oracle's brand of sql, so let me know if you want "contains" instead of "like") rather than provide xpath functionality in sql scripts. It does however use xpath to get the results.

Example, the table is stored in the following format.

<row id='1'>
<empno>7369</empno>
<ename>SMITH</ename>
<sal>800</sal>
</row>

to do a query like "where ename like '%SM%'", I use xpath to evaluate the xml document like :-

_path = 'rowset/row[contains('+column+',"'+value+'")]'
(after a bit of tweaking column = ename and value = SM)

Posted at 12:12

15 Feb 2002

MMR

My thoughts on the MMR vaccine issue in case you were wondering

Posted at 12:17

12 Feb 2002

2Mb is not quite enough

Memo to self. When looking for things to put on your Palm Pilot, don't bother trying to place the whole of the afe fanfic archive on. You rapidly run out of memory.

Shame, because it would have been useful if I'd ever got stuck in a lift.

Posted at 17:01

8 Feb 2002

The Original Drug Culture

I saw a Horizon documentary program on this city last Wednesday.

Originally, archaeologists thought that civilisation started because of war. Because every early city had battlements, weapon remains and pictures/drawings of war, it was assumed that people created the cities to defend themselves.

However, the city of Caral didn't have any of the features of war, just signs of the processing of drugs from cocoa leaves[1]. This suggests that civilisation started (at least in the America's) because people wanted to get together and get high. The original hippy commune.

The programme went on to suggest that a river ran through the location of Caral to the sea, providing transport for trade (and drug smuggling). Speculation was that the river dried up and the people left the area before the city had to build battlements and take arms to defend themselves.

[1] Note: having chewed cocoa leaves when I was in Peru[2], they definitely need "processing".[3]
[2] It is illegal to export the leaves and as the next stop was Columbia, I didn't really have any intention of doing so
[3] It should be stated that I do not endorse the "processing" of such substances in any way, shape or form, but I should have been warned that cocoa leaves taste absolutely foul if chewed.

Posted at 12:36

7 Feb 2002

Yer Can Change the Laws of Physics

This New Scientist article will have the Star Trek fans jumping up and down.

Posted at 17:23

Lift Entrapment

I have yet to be stuck in a lift. I wonder how I would react? I would like to think that I would be cool with the whole situation, but maybe it would freak me out.

I don't have a problem with small, enclosed spaces, but I think what would be trouble would be other people. It would be better if it wasn't a glass lift, because people could point and stare at me. Little children mocking, Look at the strange man in the lift. Why is he trapped there.

So, a metal link. Enclosed, a small universe. But populated with other people? How would they react? Would they freak leading me into the unnatural role of calmer, soother? Or would their reaction infuse me, and cause me to erupt a hitherto unknown claustrophobia?

Alone in the box, I would think up many scenarios of what could happen. I wouldn't be phased by films such as "The Towering Inferno", although if it got uncomfortably hot, I might be slightly nervous. I'd try to order a pizza using my mobile phone, just to confuse the poor pizza boy when describing my location.

And when they finally got it out, I wouldn't be gushingly thankful, Oh you are so kind and brave, rescuing me. I wouldn't be grumpy, About time too. I'd confuse them, let them think my confinement had driven me mad, Oh, put me back, I was getting a nice suntan, but it was a bit windy.

Posted at 14:40

6 Feb 2002

Flood Alert

The River Thames. December 2000.  The flood plain is, err, flooded

Given the recent rising of water levels in the UK, I thought I'd share a picture I took of the River Thames in December 2000. This was taken just across the road from where I walk. It is also part of the route I cycle to work. This year, I may buy a canoe.

Posted at 12:30