Archive for February, 2008

27
Feb

Why I love Pandora

I was listening to my Neko Case station on Pandora and a song by the artist Hem starts playing.  I took note of enjoying the song and later made a “Hem” radio station to hopefully catch more of their songs and see if I would be more interested in their music.  Now I want to purchase an album or 2 from Hem.  This discovery of new music through Pandora is so incredible to me.  Now if only Apple would build an iPod with a Wi-fi link directly to Pandora, that would be a killer feature.  Maybe the iPod Touch does this already, I will have to research this.

12
Feb

XML::Twig and mixed content

Trying to rush and write a quick script to update some XML files, I forgot how XML parsers deal with mixed content.

Example XML:

 	<para>Some TEXT to display with a <link xlink:href="DOC1">link to DOC1</link>, followed by some more TEXT.</para>

Say I wanted to update the string “TEXT” to “text” so the sentence reads better. Originally, I thought the code would look like this.

foreach my $xPara ($xRoot->get_xpath(’.//para’)) {

my $text_content = $xPara->text();

$text_content =~ s/TEXT/text/s;

$xPara->set_text($text_content);

}

It turns out this is incorrect because it blows away the <link> tag but leaves it’s PCDATA content.The thing to remember here is that there are 3 children to the <para> tag. they are the first PCDATA node (the text before the link node), the <link> node, and the second PCDATA node (after the link node).

Here is some code that updates the XML correctly.

foreach my $xPara ($xRoot->get_xpath(’.//para’)) {

foreach my $xChild ($xPara->children()) {

if($xChild->is_text()) {

my $text_content = $xChild->text();

$text_content =~ s/TEXT/text/s;

$xChild->set_text($text_content);

}

}

}

06
Feb

Some thoughts on buying music lately…

Compact Disc

Pros

  • High Quality Audio
  • (Usually) No DRM
  • Serves as a good backup (assuming music transferred to computer/iPod)

Cons

  • Good record stores are getting harder to find
  • Requires acquiring the physical disc from store or through shipping from somewhere

iTunes

Pros

  • Slick interface
  • Easy access/download
  • Good selection of music

Cons

  • Requires backup strategy
  • DRM

Amazon MP3s

Pros

  • High quality digital format (usually 256kbps bitrate)
  • Easy access/download
  • No DRM

Cons

  • Requires backup strategy
  • Selection not as good as iTunes but getting better
04
Feb

Thrift Store Cowboys

I purchased the album Lay Low While Crawling or Creeping from the band Thrift Store Cowboys.  The more I listen the album the more I like it.  The style is “roots” or “alt-country”.  I originally heard one track on NPR’s podcast “All Songs Considered” and it was enough to peak my curiosity.  Definitely worth a listen if you are looking for something new and “under the radar”.