Tuesday, December 30, 2008

Human Readable iTunes Playlist

Some quick xslt for converting an iTunes playlist exported as xml into plain text suitable for copy/paste to email or whatever:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text">

<xsl:strip-space elements="*">

<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="dict/dict">
<xsl:apply-templates/>
<xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="key[text()='Year']">
<xsl:value-of select="following-sibling::integer">
<xsl:text> </xsl:text>
</xsl:template>

<xsl:template match="key[text()='Name']">
<xsl:value-of select="following-sibling::string">
<xsl:text> </xsl:text>
</xsl:template>

<xsl:template match="key[text()='Artist']">
<xsl:value-of select="following-sibling::string">
<xsl:text> </xsl:text>
</xsl:template>

<xsl:template match="text()|@*">
</xsl:template>

</xsl:stylesheet>


Then run as such:

xsltproc playlist.xslt NewYearsPlaylist.xml

Wednesday, October 01, 2008

Language

I was having a discussion the other night with a friend about computer programming languages. She was trying to explain what a programming language is to a non-tech person. Something she said triggered a memory about a talk I saw at OOPSLA '98 in Vancouver 10 years ago. Out of all the computer conferences and talks I've heard over the years, this one particular talk stands out and I point people to it whenever appropriate.

It was the keynote talk by Guy Steele, one of the authors of the Java language. He did something very unique in the talk that kept the audience engaged for almost the entire hour. It was a technique I haven't seen before or since, and while a bit gimicky, it was definitely memorable.

Fortunately, someone has posted the talk to Google Video with some enhanced graphics.

http://video.google.com/videoplay?docid=-8860158196198824415

It might be surprising to some younger folks I know to see that he used an actual overhead projector with handwritten slides. Projectors and powerpoint for presentations were rare even just 10 years ago. The content of the talk is just as relevant today to computer science as it was 10 years ago.