October 28, 2003
I've started spotting spam in the comments here. Which amuses me because I can't think why anyone would want to use what is essentially my web notepad to advertise pr0n.
But it's a pain to search out and remove manually, so I've installed MT-Blacklist. Lets see what happens now shall we.
October 20, 2003
Bad E-Commerce Web Site
The biggest crime, in my book at least, is designing your web site so that it only works with Internet Explorer.
The really bad thing, from my point of view, is that you can browse the catalogue on both sites and even add things to your basket at Virgin Wines. But they have made assumptions that you are running IE which only become apparent when you try and order. There is, sadly, no accessibility statement or list of supported browsers that I can find on either site. Bad, bad web sites.
I'm sure they won't notice the lack of my custom, but its the least I can do in the circumstances. That and send them an email pointing them to the Web Standards Project and the writings of Mr Zeldman.
October 19, 2003
iTunes v MusicMatch Jukebox
I just downloaded iTunes for Windows, played with it and uninstalled it.
There is no compelling reason to use it, unless you have an iPod or are buying music from the Apple Music Store. Which I can't because I'm not in merka. I've got a copy of MusicMatch Jukebox and it works like a charm, thanks very much.
It seems that my sentiments are shared by some other people.
October 16, 2003
Sum the squares of a sequence of numbers
There has been a long, long thread on comp.lang.python recently about the joys of lisp. I'm steering well clear of the discussion myself, but one thread-ette caught my attention.
The discussion was how to sum the square of a sequence of numbers. The pseudo code flew fast and furious in both functional and imperative styles. Which prompted a little dabbling, and I came up with this. Given a list of numbers in myList you can calculate the sum of their squares using;
sum([x*x for x in myList])
Kata 2, Revisited
Reviewing the definition of Kata Two I'm a little unsure what constitutes another algorithm. Is another search algorithm allowable, or should I implement another flavour of the binary chop?
All the specification states is that the code has to pass the unit tests. If this is the case then my second submission (in Python, naturally) is;
def chop(item, collection):
for index, element in enumerate(collection):
It will work, but I make no claims about efficiency. Oh, and you will need at least Python 2.3, because that is the first version that included the enumerate function.
October 15, 2003
Kata 2, Pass 1
Now I've skipped to Kata 2. My first pass is a fairly standard, procedural, binary search;
def chop(item, collection):
while ( start <= end ):
elif item < collection[middle]:
end = middle-1
start = middle+1
For my next exercise I'm going to try either a recursive solution or something with generators. I'm just hoping it will take slightly less than the two hours it took me to come up with this one.
October 14, 2003
A while ago, I mentioned Dave Thomas' Kata. Well, I've taken the plunge in a vain attempt to stretch my brain and had a bash at his latest. My solution is in Python and doesn't (yet) use generators, but its a good start. The code is here and;
A module trying out Kata Eighteen (http://www.pragprog.com/pragdave/Practices/Kata/KataEighteen.rdoc,v)
For ease of readability I've included the two classes in the same module.
def add_direct(self, item, dependencies):
def dependencies_for(self, item, results=):
for dep in self.dependencies[item]:
if dep not in results:
self.mine = depend()
"Make sure that A depends on B and C"
self.assertEqual(self.mine.dependencies_for('A', ), ['B', 'C', 'A'])
if __name__ == '__main__':
Corrections and comments are, as always, welcome.
October 09, 2003
One here for Simon who I promised a review of the differences between the new Python standard Date module and mxDateTime. Luckily now I don't need to bother as Gustavo Niemeyer has just announced python-dateutil which not only covers the differences but also offers a few more things whch aren't possible even in mxDateTime.
October 07, 2003
This t-shirt is almost perfect, except we need to replace the word "shell" with the word "Python"
October 06, 2003
I'm quite intrigued by XML Résumé Library (found courtesy of Jeremy Zawodny) . I'm always frustrated when I have to write my cv in Microsoft Word and then literally cut and paste it if I want to, for instance, turn it into a web page. Hopefully this will speed the process up somewhat, whilst allowing me to play with XML.
It also nicely intersects with a problem I've been thinking about, if not actually doing much with. I'm trying to come up with a decent XML format to describe the structure of a relational database. Google for database and XML and you'll get lots of references to storing XML documents in relational databases, or XML databases. Ask for metadata and XML and the subject matter is DTDs and XML-schema references.
All I require is a simple, standard way of describing my schema - specifying that it contains a number of tables, each made of a number of columns, stored in tablespaces and related to each other in specific but interesting ways. I'd like to have a vendor neutral format that I can turn into DDL statements for any number of varieties of relational database, starting with the usual suspects of MySQL, DB2, Oracle and SQL Server.
The closest things I can find are the XML metadata interchange specification and the relational section of the common warehouse metamodel. I'll have a look at these two and report back. In the meantime please feel free to let me know via the comments of other standards that I may have overlooked.
October 01, 2003
Just When You Think You Know Everything
People laugh at you. The humble amongst us are always hungry for knowledge and these VIM Tips are full of nuggets. The tips for using buffers and ftp were particularly interesting to me.
I'll confess to having had a play with the other editor recently. I was mainly trying to find out what all of the fuss was about. After my noodling about I can see why it was a much better choice than vi all those years ago when I first started using computers in anger. But in the meantime VIM has bridged the functionality gap to such an extent that choosing between the two is largely a matter of preference. As I've been using :wq! and ZZ for more years than I care to count I'll be sticking with "The Best Editor in the World" thanks very much.