Race day

But in the end a good day was had by all*, especially the spectators:

* Except: Kimi Raikkonen, Robert Kubica, Timo Glock, Takuma Sato, Nelsinho Piquet, Felipe Massa, David Coulthard, Jarno Trulli, Adrian Sutil, Mark Webber, Jenson Button, Anthony Davidson, Sebastian Vettel, Giancarlo Fisichella, Rubens Barrichello
Kimi ended up salvaging a point thanks to Barrichello's disqualification for exiting the pit lane against a red light. This also shifted Champ car champ Sebastien Bourdais to 7th rank (even though he didn't quite finish) and 2 points - not bad for your first f1 in a third tier car (which is why I included him in the list of people who *did* have a good day!
12:28 PM, 16 Mar 2008 by Mark Aufflick Permalink | Comments (0)
RAAF Roulettes

There was an even more awe inspiring FA/18 demonstration but I didn't get any still footage of that. I'll see if my phone-cam video is worth posting later.
05:44 AM, 15 Mar 2008 by Mark Aufflick Permalink | Comments (0)
Obligatory Kimi Photos


10:55 AM, 14 Mar 2008 by Mark Aufflick Permalink | Comments (0)
Webber looking fast

10:52 AM, 14 Mar 2008 by Mark Aufflick Permalink | Comments (0)
F111 flyby

10:49 AM, 14 Mar 2008 by Mark Aufflick Permalink | Comments (0)
Trulli's Toyota on a Truck

10:45 AM, 14 Mar 2008 by Mark Aufflick Permalink | Comments (0)
Nakajima coming to grief
Update: Oops, my brain slipped back in time! This post previously (and incorrectly) attributed this spin to Alex Wurz who no longer has an F1 driving seat.
10:42 AM, 14 Mar 2008 by Mark Aufflick Permalink | Comments (0)
Convert XML to SQL
You can transform your xml into sql using xslt. Stealing some bits of code from elsewhere on the net, I can use the following xslt to convert my del.icio.us bookmarks into a set of insert statements:
<?xmlversion="1.0"?> <!DOCTYPE rdf:RDF [ <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rss 'http://purl.org/rss/1.0/'> ]> <xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:rdf="&rdf;"xmlns:rss="&rss;"> <xsl:outputmethod="text"/> <!-- main template --> <xsl:templatematch="/rdf:RDF"> <xsl:apply-templatesselect="rss:item" /> </xsl:template> <xsl:templatematch="rss:item"> insert into links (url, title) values ( '<xsl:call-templatename="sql-escape"><xsl:with-paramname="text"select="rss:title"/></xsl:call-template>', '<xsl:call-templatename="sql-escape"><xsl:with-paramname="text"select="rss:link"/></xsl:call-template>' ); </xsl:template> <!-- utility functions --> <xsl:templatename="sql-escape"> <xsl:paramname="text"/> <xsl:variablename="tmp"> <xsl:call-templatename="replace-substring"> <xsl:with-paramname="from">'</xsl:with-param> <xsl:with-paramname="to">''</xsl:with-param> <xsl:with-paramname="value"select="$text"/> </xsl:call-template> </xsl:variable> <xsl:value-ofselect="$tmp"/> </xsl:template> <xsl:templatename="replace-substring"> <xsl:paramname="value" /> <xsl:paramname="from" /> <xsl:paramname="to" /> <xsl:choose> <xsl:whentest="contains($value,$from)"> <xsl:value-ofselect="substring-before($value,$from)" /> <xsl:value-ofselect="$to" /> <xsl:call-templatename="replace-substring"> <xsl:with-paramname="value"select="substring-after($value,$from)" /> <xsl:with-paramname="from"select="$from" /> <xsl:with-paramname="to"select="$to" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-ofselect="$value" /> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>If I save that to a file called
del2sql.xsl I can insert the links in the rss response like so:
wget -O - http://feeds.delicious.com/rss/aufflick | xsltproc del2sql.xsl - | psql links_dbPretty neat huh! Unfortunately xslt is even less decipherable than golf perl, but thems the breaks.
The command pipeline above uses the postgres psql command, but you can just as easily use this approach with mysql, oracle, sybase, sql server or whatever. Most database vendors/projects these days have some sort of xml functionality built in, but this puts all the processing load on the part of your system that is most difficult to scale. Better, I think, to do as much processing as possible on your application server which you can more easily scale.
You might also be better using xslt to convert to CSV and then using some simple script to slurp the csv into your database - you could then handle insert/update errors gracefully in your script.
The utility sql-escape and replace-substring templates can be placed in a common file and included into your xsl stylesheets via an xsl:import statement. If you have an xsl 2 compatible xslt engine you can use the x:replace() function directly instead of the recursive replace-substring template.
07:41 AM, 03 Mar 2008 by Mark Aufflick Permalink | Comments (0)
Archive
| March 2008 | ||||||
| S | M | T | W | T | F | S |
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | |||||
March 2012
February 2012
November 2011
October 2011
April 2011
March 2011
January 2011
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003
August 2003
Blog Categories
software (40)..cocoa (21)
..heads up 'tunes (5)
..ruby (6)
..lisp (4)
..perl (4)
..openacs (1)
mac (21)
embedded (2)
..microprocessor (2)
..avr (1)
electronics (3)
design (1)
photography (26)
..black and white (6)
..A day in Sydney (18)
..The Daily Shoot (6)
food (2)
Book Review (2)
Notifications
Request notifications






