Andrew Channels Dexter Pinion

Wherein I write some stuff that you may like to read. Or not, its up to you really.

April 24, 2003

Ted Codd RIP

The father of the relational calculus, Ted Codd, passed away last week.

I'd just like to say a belated thanks to the man whose work has had such an influence on my career.

Posted by Andy Todd at 11:35 AM | Comments (0)

April 21, 2003

Database State of the Nation

I spent some of the long weekend checking out MySQL 4.0. Its looking good. I have used version 3 in the past and whilst I liked it I have never used it in anger. The new features in 4.0 and in particular the support of sub-queries in the upcoming 4.1 release make it a whole lot more attractive to me.

From now on when selecting a database engine for a project I think I will be asking why I shouldn't be using MySQL rather than why I should.

Of course, that has nothing to do with its first class Python support.

If you are using Mandrake, or another flavour of Linux, then V. Satheesh Babu has some excellent notes here.

Posted by Andy Todd at 04:17 PM | Comments (0)

April 16, 2003

Audio

Its nothing to do with programming, but these headphones are the dogs testes.

I'e been using the ones supplied with my Archos jukebox whilst on the move and plugged into my laptop at work. But they are in the bin now.

For sheer geek factor, take a look at the box they come in. That is some nice engineering.

Posted by Andy Todd at 12:05 PM | Comments (0)

April 15, 2003

So this is marketing?

Here is a fine idea from Kevin - Python is an agile programming language, and here is the definition.

I couldn't agree more and shall henceforth be removing the word "scripting" from my vocabulary.

Posted by Andy Todd at 11:00 AM | Comments (0)

April 14, 2003

Griping

Its probably me, but the lovely people from the Eclipse.org project could really do with a whack from the clue stick.

The front page of the web site has no "start here" or "introduction" sections. The link to the downloads is just a list of mirrors, no indication of what to do once you get there.

People, if you want idiots like me to use your tools give us at least a simple guide to download and installation. A noddy tutorial for when you start using the tool is also useful, but as I don't know how to install it yet, that's probably a step too far.

Before anyone starts accusing me of being any more stupid than I have admitted to so far, I have downloaded the SDK package (all 62 megabytes of it). That contains a README file, which also has no mention of how to do an installation. Bloody marvellous, and about as useful as a chocolate fireguard.

Posted by Andy Todd at 02:18 PM | Comments (4)

April 11, 2003

Python for DB2 Anyone?

Not content with looking at a number of different object/relational mapping tools (and the list is growing by the day), I now find myself extending my repertoire to include another database.

This week, I have been mostly looking at DB2. Note that this is DB2 Universal Database for UNIX, Windows and Linux version 8.1, not the cunningly named, but completely different DB2 Universal Database for iSeries, or the even more completely different DB2 Universal Database fo z/OS and OS/390. Don't you just love marketing?

Anyway, I've wrestled the installer to the ground and forced it onto my ever more groaning hard drive (current RDBMS count - six). I've installed the sample database and, like the good little Python programmer I am I thought I would glance through Patrick's DB2 and Python tutorial at IBM.

Which is were I came to a grinding halt. Like all of Patrick's work the tutorial is well written, concise and eminently understandable. But it requires me to (strangely enough) use the Python DB2 Interface And Tools suite hosted at Sourceforge. Which has a C module as a component. Which, naturally, needs to be compiled in the same target enivornment as your Python and DB2 installation.

Ah. That will be Windows2000 then. Guess what, I don't have Visual C++ installed so this chokes at the build stage.

Has anyone got a compiled module that I can use? Preferably for DB2 8.1 and Python 2.2.2. I'll post a question to the ever helpful DB-Sig mailing list as well.

Meanwhile I'll have to struggle on with inferior tools.

Posted by Andy Todd at 03:32 PM | Comments (1)

April 08, 2003

Light Reading for IT Managers

Anyone working in IT should read Bob Lewis' columns at Infoworld. Absolutely spot on stuff. I particularly like this quote from his piece on the ethics of taking work offshore;
"Businesses exist solely to maximize shareholder value."

Its worthwhile making this your work mantra, because in the free market its the only fact that is important. We may not like it, but we should accept it for the fact that it is - unless or until the system changes - and work with it.

Of course, if anyone is working for a wildly successful company that shows something other than lip service to all of their stakeholders (employees, customers, suppliers, local community, etc.) as well as chasing the almighty return on investment let me know. And I'll be round with my cv in hand before you can say "forty percent pay rise".

I arrived at these columns via one of the websites I regularly read. Sadly I've lost the link so I can't attribute this entry properly. When I find the link I'll post an update.

Posted by Andy Todd at 11:18 AM | Comments (0)

April 04, 2003

Exploring Object/Relational Mapping in Python

Long winded title that one, I'll have to revise it for future posts. This is the first in what I hope will be a series of posts. Its a learn while you go exercise, just like the rest of this blog, so please bear with me whilst I veer all over the place merrily making mistakes as I go.

I'm interested in object/relational mappers for a number of reasons. Primarily because I'm the database guy working with a bunch of java programmers during the day, but also because we need a nice easy to implement but lightweight persistence mechanism for PythonCard. These two driving factors aren't exactly identical but have bought to the same place. So, on with the investigation.

Our first cabs off the rank are the easiest to understand and explain and serve as a gentle introduction to the world of impedence mismatch.

dtuple

This module was written by Greg Stein, and is available from his python page. It converts the results of SQL queries on relational database into special objects whose attributes can then be accessed by subscript or dot notation. This is an extension to the standard db-api functionality of just returning each row as a tuple, requiring the programmer to then refer to each column value by index rather than a meaningful name.

Rather than explain its operation in detail here I will refer you to Steve Holden's recipe in the Python Cookbook.

Whilst dtuple is useful, it isn't an object relational mapper. It supports the transition of relations to objects but not back again. This means that the only way to create an object which dtuple understands is from the database. I can't create a new object and then persist it to the database, I have to do that myself and then fetch it into a dtuple type object.

dtuple makes the results of database queries more "pythonic" but doesn't support any kind of data manipulation. Which is fine if all you are doing in your application is pulling information out of a database. But I suspect that sooner or later you will want to change this data and put it back, in which case dtuple doesn't really help.

db_row

Provided by the The OPAL Group db_row performs a similar function to dtuple. It is available directly from their web page.

db_row also attempts to put a more "pythonic" face on the results of database queries. Its advantage over dtuple is that it uses new style classes (mental note to self, figure out what on earth that means). In practise this means that it re-uses dictionaries rather than creating a whole new one for each row returned and thus reduces the memory overhead when dealing with large result sets. For that reason alone it might be worth using, although I tend to avoid this problem these days by using generators to serve up the results of my queries.

Aside from that implementation detail the function is very similar to dtuple. So its also good for having more meaningful objects returned from queries but you end up writing your own SQL for everything else.

My conclusion is that these modules aren't what I am looking for. What might be worth investigating is extending dtuple or db_row so they support the missing functionality. Realistically though, I will only really consider that if none of the other available object relational wrappers are up to scratch.

Posted by Andy Todd at 04:36 PM | Comments (2)

Good User Interfaces in Java

Just back from Python UK. I had a very good time, but more of that later.

One of the topics of discussion was how to build good looking user interfaces in Java. My sole contribution was to mention that I think Spaces looks quite good. Its being developed by Diego Doval, who also writes an interesting blog.

A thought occurred to me that Spaces is already what Chandler is trying to be, but without all of the sound and fury. Feel free to disagree though, I may be completely wide of the mark.

This post was bought to you by the number 8 and at the urging of Simon.

Posted by Andy Todd at 09:40 AM | Comments (3)