<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://townx.org">
<channel>
 <title>townx</title>
 <link>http://townx.org/blog/elliot</link>
 <description>Blog on Ruby on Rails, open source, music, family, random other stuff</description>
 <language>en</language>
<image><url>http://www.feedburner.com/fb/images/pub/fb_pwrd.gif</url></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/townx" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Links for 2009-07-08 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/a6irXnaCOec/townxelliot</link><pubDate>Thu, 09 Jul 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-07-08</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://github.com/toland/patron/tree/master"&gt;toland's patron at master - GitHub&lt;/a&gt;&lt;br/&gt;
Ruby HTTP client library based on libcurl&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby"&gt;How to create small, unique tokens in Ruby&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-07-08</feedburner:origLink></item><item><title>Links for 2009-07-07 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/66BZt6ARQWw/townxelliot</link><pubDate>Wed, 08 Jul 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-07-07</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zooie.wordpress.com/2009/07/06/a-comparison-of-open-source-search-engines-and-indexing-twitter/"&gt;A Comparison of Open Source Search Engines &amp;laquo; zooie&amp;rsquo;s blog&lt;/a&gt;&lt;br/&gt;
Lucene, Sphinx, Zettair and the like&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-07-07</feedburner:origLink></item><item><title>Links for 2009-07-06 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/drPWoIhrCxo/townxelliot</link><pubDate>Tue, 07 Jul 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-07-06</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://sparcool.net/"&gt;SPARCool&lt;/a&gt;&lt;br/&gt;
SPARCool offers a way to run SPARQL queries about any URI that follows the Linked Data principles by calling a simple URL based on the http://sparcool.net/format/predicate[;l=lang]/URI pattern.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kenai.com/projects/suncloudapis/forums/forum/topics/911-PROPOSAL-Handling-Asynchronous-Operation-Requests?"&gt;Handling Asynchronous Operation Requests &amp;mdash; Project Kenai&lt;/a&gt;&lt;br/&gt;
Handling asynchronous requests in RESTful systems (from the Sun Cloud APIs perspective)&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-07-06</feedburner:origLink></item><item><title>Links for 2009-07-02 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/-KVKBe3oQMY/townxelliot</link><pubDate>Fri, 03 Jul 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-07-02</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.webbynode.com/"&gt;Webbynode&lt;/a&gt;&lt;br/&gt;
VPS provider - really must shift my websites to one of these&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.fatfreecrm.com/"&gt;Fat Free CRM - Ruby On Rails-based open source CRM platform&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-07-02</feedburner:origLink></item><item>
 <title>Example of how to put RDFa into an HTML list</title>
 <link>http://feedproxy.google.com/~r/townx/~3/AQKmfuYi5uM/example-how-put-rdfa-html-list</link>
 <description>&lt;p&gt;I'm not going to try to explain &lt;a href="http://www.w3.org/TR/rdf-primer/"&gt;&lt;span class="caps"&gt;RDF&lt;/span&gt;&lt;/a&gt; and/or &lt;a href="http://www.w3.org/TR/xhtml-rdfa-primer/"&gt;&lt;span class="caps"&gt;RDF&lt;/span&gt;a&lt;/a&gt; here, but thought any poor suckers looking for &lt;span class="caps"&gt;RDF&lt;/span&gt;a examples might benefit from me posting what I finally worked out, with help from my colleague &lt;a href="http://dynamicorange.com/"&gt;Rob&lt;/a&gt;. Namely, how to annotate an &lt;span class="caps"&gt;HTML &lt;/span&gt;ordered list (&amp;lt;ol&amp;gt;) with &lt;span class="caps"&gt;RDF&lt;/span&gt;a attributes; and how to put &lt;span class="caps"&gt;RDF&lt;/span&gt;a attributes onto form elements.&lt;/p&gt;

&lt;p&gt;Here's the &lt;span class="caps"&gt;HTML &lt;/span&gt;page with &lt;span class="caps"&gt;RDF&lt;/span&gt;a embedded in it. What I'm representing here is a sequence of collections, and the individual collections within it:&lt;/p&gt;



&lt;pre&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML+RDFa 1.0//EN&amp;quot; &amp;quot;http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Collections&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Collections&amp;lt;/h1&amp;gt;
    &amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;http://receptacular.org/collections&amp;quot;&amp;gt;
      &amp;lt;ol xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:rdfs=&amp;quot;http://www.w3.org/2000/01/rdf-schema#&amp;quot; xmlns:rdf=&amp;quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema#&amp;quot; xmlns:rec=&amp;quot;http://receptacular.org/schema#&amp;quot; typeof=&amp;quot;rdf:Seq&amp;quot; about=&amp;quot;http://receptacular.org/collections&amp;quot;&amp;gt;
        &amp;lt;li rel=&amp;quot;rdf:_1&amp;quot; resource=&amp;quot;http://receptacular.org/collections/1&amp;quot;&amp;gt;
          &amp;lt;span style=&amp;quot;display:none;&amp;quot; rel=&amp;quot;rdf:type&amp;quot; resource=&amp;quot;http://receptacular.org/schema#Collection&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;div class=&amp;quot;collection-label&amp;quot; property=&amp;quot;rdfs:label&amp;quot;&amp;gt;Vague Collection&amp;lt;/div&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-1-hidden&amp;quot; property=&amp;quot;rec:hidden&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-1-hidden&amp;quot;&amp;gt;hidden&amp;lt;/label&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-1-defaultSearch&amp;quot; property=&amp;quot;rec:defaultSearch&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-1-defaultSearch&amp;quot;&amp;gt;use for searches&amp;lt;/label&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li rel=&amp;quot;rdf:_2&amp;quot; resource=&amp;quot;http://receptacular.org/collections/2&amp;quot;&amp;gt;
          &amp;lt;span style=&amp;quot;display:none;&amp;quot; rel=&amp;quot;rdf:type&amp;quot; resource=&amp;quot;http://receptacular.org/schema#Collection&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;div class=&amp;quot;collection-label&amp;quot; property=&amp;quot;rdfs:label&amp;quot;&amp;gt;Archive Collection&amp;lt;/div&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-2-hidden&amp;quot; property=&amp;quot;rec:hidden&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-2-hidden&amp;quot;&amp;gt;hidden&amp;lt;/label&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-2-defaultSearch&amp;quot; property=&amp;quot;rec:defaultSearch&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-2-defaultSearch&amp;quot;&amp;gt;use for searches&amp;lt;/label&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li rel=&amp;quot;rdf:_3&amp;quot; resource=&amp;quot;http://receptacular.org/collections/3&amp;quot;&amp;gt;
          &amp;lt;span style=&amp;quot;display:none;&amp;quot; rel=&amp;quot;rdf:type&amp;quot; resource=&amp;quot;http://receptacular.org/schema#Collection&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;div class=&amp;quot;collection-label&amp;quot; property=&amp;quot;rdfs:label&amp;quot;&amp;gt;Main Collection&amp;lt;/div&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-3-hidden&amp;quot; property=&amp;quot;rec:hidden&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;true&amp;quot; checked=&amp;quot;checked&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-3-hidden&amp;quot;&amp;gt;hidden&amp;lt;/label&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-3-defaultSearch&amp;quot; property=&amp;quot;rec:defaultSearch&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;true&amp;quot; checked=&amp;quot;checked&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-3-defaultSearch&amp;quot;&amp;gt;use for searches&amp;lt;/label&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ol&amp;gt;
      &amp;lt;p&amp;gt;
        &amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Save&amp;quot; id=&amp;quot;save-collections&amp;quot;/&amp;gt;
      &amp;lt;/p&amp;gt;
    &amp;lt;/form&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;



&lt;p&gt;Available online here: &lt;a href="http://receptacular.org/collections" title="http://receptacular.org/collections"&gt;http://receptacular.org/collections&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Things of note:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;The doctype declaration. This is the &lt;span class="caps"&gt;W3C &lt;/span&gt;sanctioned doctype for &lt;span class="caps"&gt;XHTML&lt;/span&gt;+RDFa pages. By the way, the &lt;span class="caps"&gt;W3C &lt;/span&gt;validator will correctly validate this page, but standard &lt;span class="caps"&gt;XHTML &lt;/span&gt;validators don't (e.g. like "this one"http://nutrun.com/weblog/xhtmlvalidator-validate-xhtml-in-java/:). That's another story...&lt;/li&gt;
&lt;li&gt;Namespace declarations on the &amp;lt;ol&amp;gt; element wrapping the list items. This is what causes standard &lt;span class="caps"&gt;XHTML &lt;/span&gt;validation approaches to fail.&lt;/li&gt;
&lt;li&gt;The &amp;lt;ol&amp;gt; element is defined with &lt;strong&gt;typeof="rdf:Seq"&lt;/strong&gt; and &lt;strong&gt;about="http://receptacular.org/collections"&lt;/strong&gt;. This sets it up as the &lt;span class="caps"&gt;RDF&lt;/span&gt; Seq resource.&lt;/li&gt;
&lt;li&gt;The &amp;lt;li&amp;gt; elements inside the &amp;lt;ol&amp;gt; are Seq items, within the wrapping Seq resource. Each is each defined as a resource using the &lt;strong&gt;resource&lt;/strong&gt; attribute. They are linked back to the enclosing &amp;lt;ol&amp;gt; element using the &lt;strong&gt;rel&lt;/strong&gt; attribute on each. Note that the value for the &lt;strong&gt;rel&lt;/strong&gt; attribute is an rdf Seq number, which orders the items within the enclosing Seq resource.&lt;/li&gt;
&lt;li&gt;The &lt;span class="caps"&gt;RDF &lt;/span&gt;type of each Seq item is set using a hidden &amp;lt;span&amp;gt; element. Note that these elements have no text in them, but have opening and closing tags. If you just use a self-closing start tag for this element, the &lt;span class="caps"&gt;HTML &lt;/span&gt;doesn't display property. &lt;/li&gt;
&lt;li&gt;The &amp;lt;span&amp;gt; elements use the &lt;strong&gt;rel&lt;/strong&gt; attribute to mark their &lt;span class="caps"&gt;RDF &lt;/span&gt;type relationship to the outer list item; and the &lt;strong&gt;resource&lt;/strong&gt; attribute to specify the location of the resource representing their type.&lt;/li&gt;
&lt;li&gt;Each Seq item has an enclosed &amp;lt;div&amp;gt; which represents its &lt;strong&gt;rdfs:label&lt;/strong&gt; property. Note that the &lt;strong&gt;property&lt;/strong&gt; RDFa attribute is used to specify which property of the enclosing resource is being defined. Also note that the value of the property is inlined between the start and end tags of the &amp;lt;div&amp;gt;.&lt;/li&gt;
&lt;li&gt;The two checkboxes define two more properties for each Seq resource: &lt;strong&gt;rec:hidden&lt;/strong&gt; and &lt;strong&gt;rec:defaultSearch&lt;/strong&gt;. (The semantics of the properties aren't discussed here, as I'm concentrating on syntax.) Each is defined on a standard &lt;span class="caps"&gt;XHTML &lt;/span&gt;&amp;lt;input&amp;gt; element: the relationship to the enclosing Seq item is defined with the &lt;strong&gt;property&lt;/strong&gt; attribute; the value of the property is defined using the &lt;strong&gt;content&lt;/strong&gt; attribute; and the data type of the literal value is defined via the &lt;strong&gt;datatype&lt;/strong&gt; attribute. Any of the standard &lt;span class="caps"&gt;XML &lt;/span&gt;datatypes could be used here, or other types from other schemas.&lt;/li&gt;
&lt;li&gt;When working with form elements which represent property values for &lt;span class="caps"&gt;RDF &lt;/span&gt;resources, you may need to change the &lt;strong&gt;content&lt;/strong&gt; attribute in response to UI changes. (In the application from which this example was extracted, we use &lt;a href="http://jquery.com/"&gt;JQuery&lt;/a&gt; to respond to changes in the check box which set the &lt;strong&gt;content&lt;/strong&gt; attribute.)&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;To see the &lt;span class="caps"&gt;RDF &lt;/span&gt;which can be extracted from this page, you can use the &lt;span class="caps"&gt;W3C'&lt;/span&gt;s &lt;a href="http://www.w3.org/2007/08/pyRdfa/"&gt;&lt;span class="caps"&gt;RDF&lt;/span&gt;a Distiller&lt;/a&gt;. Here's the resulting &lt;span class="caps"&gt;RDF&lt;/span&gt;:&lt;/p&gt;



&lt;pre&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;rdf:RDF
  xmlns:dist=&amp;quot;http://www.w3.org/2007/08/pyRdfa/distiller#&amp;quot;
  xmlns:rdf=&amp;quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;quot;
  xmlns:rdfs=&amp;quot;http://www.w3.org/2000/01/rdf-schema#&amp;quot;
  xmlns:rec=&amp;quot;http://receptacular.org/schema#&amp;quot;
  xmlns:xhv=&amp;quot;http://www.w3.org/1999/xhtml/vocab#&amp;quot;
  xmlns:xml=&amp;quot;http://www.w3.org/XML/1998/namespace&amp;quot;
  xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema#&amp;quot;
&amp;gt;
  &amp;lt;rdf:Seq rdf:about=&amp;quot;http://receptacular.org/collections&amp;quot;&amp;gt;
    &amp;lt;rdf:_1&amp;gt;
      &amp;lt;rec:Collection rdf:about=&amp;quot;http://receptacular.org/collections/1&amp;quot;&amp;gt;
        &amp;lt;rec:hidden rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:hidden&amp;gt;
        &amp;lt;rec:defaultSearch rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:defaultSearch&amp;gt;
        &amp;lt;rdfs:label&amp;gt;Vague Collection&amp;lt;/rdfs:label&amp;gt;
      &amp;lt;/rec:Collection&amp;gt;
    &amp;lt;/rdf:_1&amp;gt;
    &amp;lt;rdf:_2&amp;gt;
      &amp;lt;rec:Collection rdf:about=&amp;quot;http://receptacular.org/collections/2&amp;quot;&amp;gt;
        &amp;lt;rec:hidden rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:hidden&amp;gt;
        &amp;lt;rec:defaultSearch rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:defaultSearch&amp;gt;
        &amp;lt;rdfs:label&amp;gt;Archive Collection&amp;lt;/rdfs:label&amp;gt;
      &amp;lt;/rec:Collection&amp;gt;
    &amp;lt;/rdf:_2&amp;gt;
    &amp;lt;rdf:_3&amp;gt;
      &amp;lt;rec:Collection rdf:about=&amp;quot;http://receptacular.org/collections/3&amp;quot;&amp;gt;
        &amp;lt;rec:hidden rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;true&amp;lt;/rec:hidden&amp;gt;
        &amp;lt;rec:defaultSearch rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;true&amp;lt;/rec:defaultSearch&amp;gt;
        &amp;lt;rdfs:label&amp;gt;Main Collection&amp;lt;/rdfs:label&amp;gt;
      &amp;lt;/rec:Collection&amp;gt;
    &amp;lt;/rdf:_3&amp;gt;
  &amp;lt;/rdf:Seq&amp;gt;
&amp;lt;/rdf:RDF&amp;gt;
&lt;/pre&gt;



&lt;p&gt;Saving changes to an &lt;span class="caps"&gt;RDF&lt;/span&gt;a-enabled form like this is another challenge, for which we used &lt;a href="http://code.google.com/p/rdfquery/"&gt;rdfquery&lt;/a&gt;, and &lt;span class="caps"&gt;RDF &lt;/span&gt;library for JQuery. (I recommend you use the latest svn &lt;span class="caps"&gt;HEAD &lt;/span&gt;version of this library, as older versions have a bug where they ignore &lt;span class="caps"&gt;RDF&lt;/span&gt;a elements nested inside elements without &lt;span class="caps"&gt;RDF&lt;/span&gt;a attributes.) Maybe I'll get round to that another time.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=AQKmfuYi5uM:y_JkmurN4VU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=AQKmfuYi5uM:y_JkmurN4VU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=AQKmfuYi5uM:y_JkmurN4VU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=AQKmfuYi5uM:y_JkmurN4VU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=AQKmfuYi5uM:y_JkmurN4VU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/example-how-put-rdfa-html-list#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/howtos">howtos</category>
 <pubDate>Tue, 30 Jun 2009 04:52:35 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">779 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/example-how-put-rdfa-html-list</feedburner:origLink></item>
<item>
 <title>Script to copy random mp3s from a directory to an mp3 player</title>
 <link>http://feedproxy.google.com/~r/townx/~3/EMpBzEIBdy0/script-copy-random-mp3s-directory-mp3-player</link>
 <description>&lt;p&gt;This is a Ruby script which randomly copies mp3 files from one directory to an mp3 player. I wrote it so I could easily fill up my mp3 player from the 9000 odd mp3s I have on a different external drive.&lt;/p&gt;

&lt;p&gt;To run it, you'll need the &lt;strong&gt;sys-filesystem&lt;/strong&gt; gem (see &lt;a href="http://rubyforge.org/projects/sysutils" title="http://rubyforge.org/projects/sysutils"&gt;http://rubyforge.org/projects/sysutils&lt;/a&gt;):&lt;/p&gt;



&lt;pre&gt;
$ gem install sys-filesystem
&lt;/pre&gt;



&lt;p&gt;Next, edit these variables in the script (near the top):&lt;br /&gt;
* &lt;code&gt;source_dir&lt;/code&gt; to the directory containing the mp3s you want to select from&lt;br /&gt;
* &lt;code&gt;dest_dir&lt;/code&gt; to the path for the directory on your mp3 player you want to copy to&lt;/p&gt;

&lt;p&gt;&lt;span style="color:red"&gt;Be a bit careful, as this will attempt to fill the &lt;code&gt;dest_dir&lt;/code&gt; you specify with mp3 files from &lt;code&gt;source_dir&lt;/code&gt;. You might end up filling the wrong disk up.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Then just run it with ruby from the command line:&lt;/p&gt;



&lt;pre&gt;
$ ruby mp3s_random.rb
&lt;/pre&gt;



&lt;p&gt;Note that it won't delete anything from the destination drive, and will attempt to fill all the space available. Also note that it doesn't keep trying mp3s until it finds one which will fit the last remaining space: once it tries to copy a file which won't fit, it stops. You can always run it again to see whether the next run finds a file small enough to fit.&lt;/p&gt;

&lt;p&gt;I've only tested it on Linux, but, who knows, it might work on Windows too. (No operating-system specific commands are used in the script, as it uses Ruby for all file operations.)&lt;/p&gt;

&lt;p&gt;The code is below, but I've attached it as well.&lt;/p&gt;



&lt;pre&gt;
require 'rubygems'
require 'sys/filesystem'
require 'ftools'

source_dir = '/media/disk/music'
dest_dir = '/media/disk-1/music'

files = Dir[File.join(source_dir, '/**/*.mp3')]
num_files = files.size

stat = Sys::Filesystem.stat(dest_dir)

disk_free_space_kb = (stat.blocks_free * stat.fragment_size).to_kb

files_selected = []

while disk_free_space_kb &amp;gt; 0 and num_files &amp;gt; 0 do
  # choose an mp3
  file_num_to_copy = rand(num_files - 1) + 1
  file_path = files.delete_at(file_num_to_copy)

  num_files = num_files - 1

  # work out how big file is
  file_size_kb = File.stat(file_path).size.to_kb

  # subtract from free space
  if (disk_free_space_kb - file_size_kb) &amp;gt; 0
    files_selected &amp;lt;&amp;lt; file_path
    disk_free_space_kb = disk_free_space_kb - file_size_kb
  else
    break
  end
end

files_selected.each do |f|
  copy_to_path = File.join(dest_dir, File.basename(f))
  puts &amp;quot;Copying #{f} to device&amp;quot;
  File.copy(f, copy_to_path)
end
&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=EMpBzEIBdy0:bzcUr79VfZA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=EMpBzEIBdy0:bzcUr79VfZA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=EMpBzEIBdy0:bzcUr79VfZA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=EMpBzEIBdy0:bzcUr79VfZA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=EMpBzEIBdy0:bzcUr79VfZA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/script-copy-random-mp3s-directory-mp3-player#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/howtos">howtos</category>
 <enclosure url="http://townx.org/files/mp3s_random.rb" length="939" type="application/x-ruby" />
 <pubDate>Tue, 30 Jun 2009 04:24:41 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">778 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/script-copy-random-mp3s-directory-mp3-player</feedburner:origLink></item>
<item><title>Links for 2009-06-29 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/PyMQ9K-yOPs/townxelliot</link><pubDate>Tue, 30 Jun 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-06-29</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://github.com/zohmg/zohmg/tree/master"&gt;zohmg's zohmg at master - GitHub&lt;/a&gt;&lt;br/&gt;
Zohmg is a data store for aggregation of multi-dimensional time series data, built on top of Hadoop, Dumbo and HBase.

(Nice README with a good worked example means I might even use it.)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://tokyocabinet.sourceforge.net/"&gt;Tokyo Cabinet: a modern implementation of DBM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-06-29</feedburner:origLink></item><item><title>Links for 2009-06-22 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/RpVZcyQ9YcU/townxelliot</link><pubDate>Tue, 23 Jun 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-06-22</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://github.com/dpp/goatrodeo/tree/master"&gt;dpp's goatrodeo at master - GitHub&lt;/a&gt;&lt;br/&gt;
Goat Rodeo is a Scala-based transactional system that shares
semantics between in-memory, RDBMS persisted, and cloud persisted
systems.&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-06-22</feedburner:origLink></item><item><title>Links for 2009-06-17 [del.icio.us]</title><link>http://feedproxy.google.com/~r/townx/~3/KK7Aov4CqQg/townxelliot</link><pubDate>Thu, 18 Jun 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/townxelliot#2009-06-17</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://portableapps.com/suite"&gt;PortableApps.com Suite and PortableApps.com Platform | PortableApps.com - Portable software for USB drives&lt;/a&gt;&lt;br/&gt;
50 open source apps for Windows which can be stored and run from a small (~1Gb)  USB key&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.commontag.org/Home"&gt;Home - Common Tag&lt;/a&gt;&lt;br/&gt;
&amp;quot;Common Tag is an open tagging format developed to make content more connected, discoverable and engaging.&amp;quot;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://sourceforge.net/projects/bigdata/"&gt;SourceForge.net: bigdata&lt;/a&gt;&lt;br/&gt;
bigdata(R) is a scale-out storage and computing fabric supporting optional transactions, very high concurrency, and very high aggregate IO rates.&lt;/li&gt;
&lt;/ul&gt;</description><feedburner:origLink>http://del.icio.us/townxelliot#2009-06-17</feedburner:origLink></item><item>
 <title>How I worked out that curl is doing bad things with MARC</title>
 <link>http://feedproxy.google.com/~r/townx/~3/e5ArutwJhZA/how-i-worked-out-curl-doing-bad-things-marc</link>
 <description>&lt;p&gt;I work on a system at &lt;a href="http://talis.com/"&gt;Talis&lt;/a&gt; which posts &lt;span class="caps"&gt;MARC &lt;/span&gt;records from customer library databases into a &lt;span class="caps"&gt;MARC &lt;/span&gt;to &lt;span class="caps"&gt;RDF &lt;/span&gt;transformer. The resulting &lt;span class="caps"&gt;RDF &lt;/span&gt;generated from the &lt;span class="caps"&gt;MARC &lt;/span&gt;is sent into the &lt;a href="http://www.talis.com/platform/"&gt;Talis Platform&lt;/a&gt;, where it's used to power &lt;a href="http://talis.com/prism"&gt;Prism&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Over the last day or so I've been working on a bug which has prevented some records going correctly through this process. Along the way, I noticed another bug occurring somewhere between the post from the customer site into our &lt;span class="caps"&gt;MARC &lt;/span&gt;to &lt;span class="caps"&gt;RDF &lt;/span&gt;transformer. It looked as if line break characters in the original &lt;span class="caps"&gt;MARC &lt;/span&gt;record were being lost somewhere in the process. Consequently, when the &lt;span class="caps"&gt;MARC &lt;/span&gt;was pushed into the transformer, the record got spat out as invalid, as the length specified in the &lt;span class="caps"&gt;MARC &lt;/span&gt;leader didn't correspond to the length of the record (now it had lost its line break characters). (By the way, working directly with byte streams is the only way to work with &lt;span class="caps"&gt;MARC, &lt;/span&gt;for precisely this reason.)&lt;/p&gt;

&lt;p&gt;I had a sudden insight on the way home, triggered by remembering issues I'd had with &lt;a href="http://curl.haxx.se/"&gt;curl&lt;/a&gt; (the command line &lt;span class="caps"&gt;HTTP &lt;/span&gt;client) working on &lt;a href="http://code.google.com/p/hardfidget/"&gt;another personal project&lt;/a&gt;. On that project, I'd been trying to post &lt;span class="caps"&gt;RDF &lt;/span&gt;triples in ntriple format into my application using curl. However, the application only seemed to recognise the first &lt;span class="caps"&gt;RDF &lt;/span&gt;triple in the posted file. I couldn't understand why.&lt;/p&gt;

&lt;p&gt;Then, when I echoed the body of the &lt;span class="caps"&gt;HTTP &lt;/span&gt;request, as received by my app from curl, I realised the issue: curl was sending the body of the request &lt;span class="caps"&gt;WITHOUT LINE BREAKS.&lt;/span&gt; As line break characters act as the delimiter between triples in &lt;span class="caps"&gt;RDF &lt;/span&gt;ntriple format, my app was only seeing a single &lt;span class="caps"&gt;RDF &lt;/span&gt;ntriple. When I tried an alternative tool to send the posts (the extremely useful &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2691"&gt;Poster add-on for Firefox&lt;/a&gt;), the ntriples were received correctly.&lt;/p&gt;

&lt;p&gt;Once I remembered this, I decided to do some debugging of the kind of requests curl would send if it were posting &lt;span class="caps"&gt;MARC &lt;/span&gt;records. My hypothesis was that curl was stripping line break characters from the &lt;span class="caps"&gt;MARC &lt;/span&gt;record (which is bad, as they are valid characters in &lt;span class="caps"&gt;MARC&lt;/span&gt;), and hence causing the record to be shorter than the leader said it should be.&lt;/p&gt;

&lt;p&gt;First step was to put together something to echo and/or save &lt;span class="caps"&gt;HTTP &lt;/span&gt;request bodies. &lt;a href="http://rack.rubyforge.org/"&gt;Rack&lt;/a&gt; is ideal for this sort of thing, so I used this little Rack web server program:&lt;/p&gt;



&lt;pre&gt;
require 'rubygems'
require 'rack'

def save_body(body)
  File.open('last_raw_request', 'w') {|f| f.write(body)}
  body
end

Rack::Handler::WEBrick.run(lambda {|e| [200, {}, save_body(e['rack.input'].read)]}, :Port=&amp;gt;7777)
&lt;/pre&gt;



&lt;p&gt;This saves the raw request body to a file called "last_raw_request".&lt;/p&gt;

&lt;p&gt;I first posted a &lt;span class="caps"&gt;MARC &lt;/span&gt;file with line breaks in it (attached) using Poster (with Content-Type set to application/marc21) through Firefox. The &lt;span class="caps"&gt;MARC &lt;/span&gt;file came through intact and still valid.&lt;/p&gt;

&lt;p&gt;I then posted a &lt;span class="caps"&gt;MARC &lt;/span&gt;file with line breaks in it using curl:&lt;/p&gt;



&lt;pre&gt;
curl -d @marcfile.mrc -H &amp;quot;Content-Type:application/marc21&amp;quot; &lt;a href="http://localhost:7777/" title="http://localhost:7777/"&gt;http://localhost:7777/&lt;/a&gt;
&lt;/pre&gt;



&lt;p&gt;Which produced an invalid &lt;span class="caps"&gt;MARC &lt;/span&gt;file with line breaks missing.&lt;/p&gt;

&lt;p&gt;The solution is to use the &lt;code&gt;--data-binary&lt;/code&gt; switch when using curl to send binary data, which we're not doing when sending &lt;span class="caps"&gt;MARC &lt;/span&gt;from the customer site. Mostly this doesn't matter, but it does when the &lt;span class="caps"&gt;MARC &lt;/span&gt;record contains line break characters.&lt;/p&gt;

&lt;p&gt;Namely:&lt;/p&gt;



&lt;pre&gt;
curl --data-binary @marcfile.mrc -H &amp;quot;Content-Type:application/marc21&amp;quot; &lt;a href="http://localhost:7777/" title="http://localhost:7777/"&gt;http://localhost:7777/&lt;/a&gt;
&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=e5ArutwJhZA:R5hnNwXC0NY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=e5ArutwJhZA:R5hnNwXC0NY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=e5ArutwJhZA:R5hnNwXC0NY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=e5ArutwJhZA:R5hnNwXC0NY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=e5ArutwJhZA:R5hnNwXC0NY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/how-i-worked-out-curl-doing-bad-things-marc#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <pubDate>Wed, 10 Jun 2009 04:21:31 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">777 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/how-i-worked-out-curl-doing-bad-things-marc</feedburner:origLink></item>
<item>
 <title>Open source at work</title>
 <link>http://feedproxy.google.com/~r/townx/~3/PBjOKULL11w/open-source-work</link>
 <description>&lt;p&gt;It's taken a while, but a &lt;a href="http://drupal.org/node/156582"&gt;feature request I logged 2 years ago&lt;/a&gt; has finally made it to Drupal trunk. (The basic idea was to put a timeout on Drupal &lt;span class="caps"&gt;HTTP &lt;/span&gt;requests to other systems, to prevent a whole Drupal site timing out if one of its requests to another site hung - prompted by working on AllConsuming and Last.fm modules for Drupal.) My original patch was promptly rejected, but it's been fascinating watching the discussion around the idea over the months, culminating in a well-rounded, properly-tested patch landing in &lt;span class="caps"&gt;CVS.&lt;/span&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=PBjOKULL11w:VZS0HTECZ98:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=PBjOKULL11w:VZS0HTECZ98:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=PBjOKULL11w:VZS0HTECZ98:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=PBjOKULL11w:VZS0HTECZ98:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=PBjOKULL11w:VZS0HTECZ98:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/open-source-work#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <pubDate>Mon, 08 Jun 2009 10:39:14 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">776 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/open-source-work</feedburner:origLink></item>
<item>
 <title>Some basic hardware testing on Linux</title>
 <link>http://feedproxy.google.com/~r/townx/~3/G2rsjngt59Q/some-basic-hardware-testing-linux</link>
 <description>&lt;p&gt;I've got a slightly unstable computer at the moment which I've been trying to diagnose. Still haven't worked out exactly what's wrong (it freezes randomly in both Windows and Linux), but I have found some useful testing tools on the way (for Ubuntu Intrepid Ibex unless otherwise stated).&lt;/p&gt;

&lt;h2&gt;Memory&lt;/h2&gt;

&lt;p&gt;Recent Ubuntu Linux distros include MemTest86+, a memory testing tool. You just select this option from the grub boot menu when your computer starts and it boots into a dedicated memory testing &lt;span class="caps"&gt;OS.&lt;/span&gt; The tests are fairly simple to get going, but taking hours, literally. You need to run them overnight.&lt;/p&gt;

&lt;h2&gt;Hard disks&lt;/h2&gt;

&lt;p&gt;The smartmontools package includes some testing tools for hard disks which have &lt;span class="caps"&gt;S.M.A.R.T. &lt;/span&gt;capability (most modern motherboards and hard disks support this). Once you've installed the package, you can use the &lt;strong&gt;smartctl&lt;/strong&gt; command line tool to run diagnostics on your hard disks.&lt;/p&gt;

&lt;p&gt;I used this tool like this:&lt;/p&gt;



&lt;pre&gt;
$ sudo smartctl -t long /dev/sda
&lt;/pre&gt;



&lt;p&gt;This starts the test, which will take a fair amount of time (mine took around 30 minutes for a 40Gb disk). Once it's finished, you can do:&lt;/p&gt;



&lt;pre&gt;
$ sudo smartctl -H /dev/sda
&lt;/pre&gt;



&lt;p&gt;to see the results. Mine looked like this:&lt;/p&gt;



&lt;pre&gt;
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is &lt;a href="http://smartmontools.sourceforge.net/" title="http://smartmontools.sourceforge.net/"&gt;http://smartmontools.sourceforge.net/&lt;/a&gt;

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
&lt;/pre&gt;



&lt;h2&gt;&lt;span class="caps"&gt;CPU&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;A simple test to max out your &lt;span class="caps"&gt;CPU &lt;/span&gt;(and exercise your graphics card) is to run &lt;span class="caps"&gt;GLX &lt;/span&gt;gears:&lt;/p&gt;



&lt;pre&gt;
$ glxgears -info
&lt;/pre&gt;



&lt;p&gt;However, that doesn't really stress your system. For that, I used a tool called &lt;a href="http://users.bigpond.net.au/CPUburn/"&gt;&lt;span class="caps"&gt;CPU&lt;/span&gt; Burn-in&lt;/a&gt;. This is ostensibly an overclockers tool, but what it does is attempt to push your &lt;span class="caps"&gt;CPU &lt;/span&gt;to maximum operating temperature so you can see whether it's stable. It's a binary download, so it's very easy to use, and has a &lt;a href="http://users.bigpond.net.au/CPUburn/downloads/cpuburn-in.tar.gz"&gt;Linux version&lt;/a&gt;. Unzip it, cd to the directory, and run:&lt;/p&gt;



&lt;pre&gt;
./cpuburn-in 10
&lt;/pre&gt;



&lt;p&gt;where 10 is the number of minutes you want to run the tests for. This one scared me a bit, as I watched the temperature of my &lt;span class="caps"&gt;CPU &lt;/span&gt;and system slowly climb. Read the caveats and warnings on the web site before running this tool.&lt;/p&gt;

&lt;h2&gt;Monitoring&lt;/h2&gt;

&lt;p&gt;While you're doing all this, you want to watch the system temperature etc. For this, you can use the xsensors tool. This is a simple apt-get on Ubuntu, but for some reason the default config. file is in the wrong place (it's called /etc/sensors3.conf but the app. is expecting /etc/sensors.conf). You can tell it where the config. file is using the -c switch, e.g.&lt;/p&gt;



&lt;pre&gt;
./xsensors -c /etc/sensors3.conf
&lt;/pre&gt;



&lt;p&gt;This displays a graphical readout of various system temperatures, fan speeds etc..&lt;/p&gt;

&lt;p&gt;You can also watch various aspects of system usage by adding the hardware monitor applet to your panel (right-click on the panel and select Hardware Monitor). This lets you watch how much your &lt;span class="caps"&gt;CPU, &lt;/span&gt;memory, disks etc. are being utilised.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=G2rsjngt59Q:EZ_IJeQNWA8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=G2rsjngt59Q:EZ_IJeQNWA8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=G2rsjngt59Q:EZ_IJeQNWA8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=G2rsjngt59Q:EZ_IJeQNWA8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=G2rsjngt59Q:EZ_IJeQNWA8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/some-basic-hardware-testing-linux#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <pubDate>Thu, 04 Jun 2009 14:22:46 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">775 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/some-basic-hardware-testing-linux</feedburner:origLink></item>
<item>
 <title>Decoding FLV files with ffmpeg</title>
 <link>http://feedproxy.google.com/~r/townx/~3/FB4C9a3qR20/decoding-flv-files-ffmpeg</link>
 <description>&lt;p&gt;I'm using Ubuntu Intrepid Ibex, but the ffmpeg distribution it comes with doesn't support recent &lt;span class="caps"&gt;FLV &lt;/span&gt;file encodings (like some videos from YouTube). You get an error like this when you try to do anything with them:&lt;/p&gt;



&lt;pre&gt;
[flv @ 0xb800e4c8]Unsupported video codec (7)
&lt;/pre&gt;



&lt;p&gt;My solution was to checkout ffmpeg from its Subversion repository and compile it myself:&lt;/p&gt;



&lt;pre&gt;
$ svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg-svn
$ cd ffmpeg-svn
$ ./configure --prefix=~/apps/ffmpeg-svn --enable-libmp3lame
$ make install
&lt;/pre&gt;



&lt;p&gt;To do the compile, you'll probably need &lt;strong&gt;build-essential&lt;/strong&gt;, as well as &lt;strong&gt;libmp3lame-dev&lt;/strong&gt;, and the *-dev versions of any other codecs you want to use.&lt;/p&gt;

&lt;p&gt;Use the resulting binary to do the conversion:&lt;/p&gt;



&lt;pre&gt;
$ ~/apps/ffmpeg-svn/bin/ffmpeg -i infile.flv outfile.mpg
&lt;/pre&gt;



&lt;p&gt;It turns out this version does support those recent &lt;span class="caps"&gt;FLV &lt;/span&gt;files, happily.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=FB4C9a3qR20:cr0kIql_5Gs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=FB4C9a3qR20:cr0kIql_5Gs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=FB4C9a3qR20:cr0kIql_5Gs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=FB4C9a3qR20:cr0kIql_5Gs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=FB4C9a3qR20:cr0kIql_5Gs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/decoding-flv-files-ffmpeg#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/howtos">howtos</category>
 <pubDate>Tue, 12 May 2009 04:50:31 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">774 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/decoding-flv-files-ffmpeg</feedburner:origLink></item>
<item>
 <title>Describing (finding) subjects which don't have a particular predicate in SPARQL</title>
 <link>http://feedproxy.google.com/~r/townx/~3/yZhUUpqeU_g/describing-finding-subjects-which-dont-have-particular-predicate-sparql</link>
 <description>&lt;p&gt;If you want to do something like a &lt;span class="caps"&gt;SQL NOT &lt;/span&gt;in &lt;a href="http://www.w3.org/TR/rdf-sparql-query/"&gt;&lt;span class="caps"&gt;SPARQL&lt;/span&gt;&lt;/a&gt;, here's what the query looks like:&lt;/p&gt;



&lt;pre&gt;
PREFIX rs: &amp;lt;http://schemas.talis.com/2006/recordstore/schema#&amp;gt;
PREFIX rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt;

DESCRIBE ?tenancy {
  ?tenancy rdf:type rs:Tenancy .
  OPTIONAL { ?tenancy rs:platformStoreUri ?o } .
  FILTER ( !bound(?o) )
}
&lt;/pre&gt;



&lt;p&gt;Here I'm looking for subjects with rdf type of &lt;a href="http://schemas.talis.com/2006/recordstore/schema#Tenancy" title="http://schemas.talis.com/2006/recordstore/schema#Tenancy"&gt;http://schemas.talis.com/2006/recordstore/schema#Tenancy&lt;/a&gt;, which don't have a &lt;a href="http://schemas.talis.com/2006/recordstore/schema#platformStoreUri" title="http://schemas.talis.com/2006/recordstore/schema#platformStoreUri"&gt;http://schemas.talis.com/2006/recordstore/schema#platformStoreUri&lt;/a&gt; predicate. The important bit is that you make the predicate which could potentially not be "set" OPTIONAL; and add a &lt;span class="caps"&gt;FILTER &lt;/span&gt;which only includes subjects where the predicate is bound to a value. This effectively screens out any subjects where the predicate has not been added to the subject. This pattern is basically &lt;strong&gt;Negation as Failure&lt;/strong&gt; (according to the &lt;span class="caps"&gt;SPARQL &lt;/span&gt;recommendation), which derives from logic programming. Feels a bit like being back at university.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=yZhUUpqeU_g:iRR1y3Um5i8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=yZhUUpqeU_g:iRR1y3Um5i8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=yZhUUpqeU_g:iRR1y3Um5i8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=yZhUUpqeU_g:iRR1y3Um5i8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=yZhUUpqeU_g:iRR1y3Um5i8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/describing-finding-subjects-which-dont-have-particular-predicate-sparql#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/howtos">howtos</category>
 <pubDate>Tue, 07 Apr 2009 04:37:11 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">773 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/describing-finding-subjects-which-dont-have-particular-predicate-sparql</feedburner:origLink></item>
<item>
 <title>Installing Windows on the second hard disk of a Linux machine</title>
 <link>http://feedproxy.google.com/~r/townx/~3/dHriAqoIqSY/installing-windows-second-hard-disk-linux-machine</link>
 <description>&lt;p&gt;I recently upgraded the hardware of my old desktop &lt;span class="caps"&gt;PC, &lt;/span&gt;with the aim of providing the house with a new-ish Linux machine for watching movies and using the internet, and a Windows machine for writing music and playing (old) games. My plan was to use two hard disks: one for Linux, another for Windows, and choose which to use at boot time.&lt;/p&gt;

&lt;p&gt;Normal procedure is to install Windows first, then install Linux into a spare partition on the same hard drive (Windows tends to overwrite any disk you put it on). But it's easier to get a Linux machine up and running, see what hardware you've got, and get a decent system without needing to go and find loads of old drivers. So I decided to install Linux first. I plugged in a drive for it as the Primary &lt;span class="caps"&gt;IDE &lt;/span&gt;drive, and installed Ubuntu Linux onto it.&lt;/p&gt;

&lt;p&gt;Then, I unplugged the Linux drive, plugged the other drive in, and installed Windows 2000 onto the second drive (just to make sure Windows couldn't overwrite Linux). Got that working too.&lt;/p&gt;

&lt;p&gt;Then I plugged the Linux drive in, as the first drive on the &lt;span class="caps"&gt;IDE &lt;/span&gt;cable; and the Windows disk as the second.&lt;/p&gt;

&lt;p&gt;The trick then is to get grub (the Linux bootloader I'm using) to present you with both disks as options as boot time. There's a sample configuration in /boot/grub/menu.lst, but that didn't work for me: it looked like it was working, then just hung. I tried a couple of things, but nothing which worked.&lt;/p&gt;

&lt;p&gt;Finally, I found &lt;a href="http://www.weiqigao.com/blog/2004/01/14/windows_on_the_second_hard_drive_linux_on_the_first.html"&gt;this blog entry&lt;/a&gt; and used the configuration there. The trick is to make Windows think it's installed on the first disk on the &lt;span class="caps"&gt;IDE &lt;/span&gt;cable. I added this to the bottom of menu.lst:&lt;/p&gt;



&lt;pre&gt;
title Windows 2000
rootnoverify (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
&lt;/pre&gt;



&lt;p&gt;which does the trick! Now I get a working Windows 2000 option in my grub boot menu.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=dHriAqoIqSY:7icSde9udMU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=dHriAqoIqSY:7icSde9udMU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=dHriAqoIqSY:7icSde9udMU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=dHriAqoIqSY:7icSde9udMU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=dHriAqoIqSY:7icSde9udMU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/installing-windows-second-hard-disk-linux-machine#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/howtos">howtos</category>
 <pubDate>Tue, 31 Mar 2009 17:18:45 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">772 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/installing-windows-second-hard-disk-linux-machine</feedburner:origLink></item>
<item>
 <title>Creating a self-signed SSL certificate for Apache on Linux</title>
 <link>http://feedproxy.google.com/~r/townx/~3/LqXvBkwcGt8/creating-self-signed-ssl-certificate-apache-linux</link>
 <description>&lt;p&gt;(This is extracted from &lt;a href="http://moochlabs.com/files/apache_and_php_course.pdf"&gt;my Apache course materials&lt;/a&gt;, but it's a useful howto in its own right.)&lt;/p&gt;

&lt;p&gt;To generate a self-signed &lt;span class="caps"&gt;SSL &lt;/span&gt;certificate, you will need openssl installed first.&lt;/p&gt;

&lt;p&gt;Then follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Generate the server's private key; we'll use a 1024-bit key using the &lt;span class="caps"&gt;RSA &lt;/span&gt;algorithm:&lt;br/&gt;
&lt;code&gt;openssl genrsa -out server.key 1024&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Generate a certificate-signing request:&lt;br/&gt;
&lt;code&gt;openssl req -new -key server.key -out server.csr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Fill in the required information at the prompts:&lt;br/&gt;


&lt;pre&gt;
   Country Name (2 letter code) [GB]:GB
   State or Province Name (full name) []:.
   Locality Name (eg, city) [Newbury]:Birmingham
   Organization Name (eg, company) [My Company Ltd]:Talis
   Organizational Unit Name (eg, section) []:Library Products
   Common Name (eg, your name or your server's hostname) []:prism.talis.com
   Email Address []:.

   Please enter the following 'extra' attributes to be sent with your certificate request

   A challenge password []:.
   An optional company name []:.
&lt;/pre&gt;


The really important one is the Common Name: this must match the domain name which will serve the &lt;span class="caps"&gt;SSL &lt;/span&gt;site; otherwise connecting clients will get a prompt about a mismatch between the certificate's host name and the actual host name of the server.&lt;br/&gt;&lt;br /&gt;
Note that we left the password blank. If we don't do this, Apache will prompt you for the certificate password each time you start the server, which is a pain in the arse.&lt;/li&gt;
&lt;li&gt;Create a self-signed certificate from the certificate-signing request (.csr file):&lt;br/&gt;
&lt;code&gt;openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rm server.csr&lt;/code&gt; (you don't need it any more)&lt;/li&gt;
&lt;li&gt;Put the .crt and .key files into Apache's &lt;span class="caps"&gt;SSL &lt;/span&gt;directory and configure Apache to use them&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If I get round to it I'll do another entry explaining how to make Apache use them.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=LqXvBkwcGt8:iPN1nJwi2A0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=LqXvBkwcGt8:iPN1nJwi2A0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=LqXvBkwcGt8:iPN1nJwi2A0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=LqXvBkwcGt8:iPN1nJwi2A0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=LqXvBkwcGt8:iPN1nJwi2A0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/creating-self-signed-ssl-certificate-apache-linux#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/howtos">howtos</category>
 <pubDate>Thu, 05 Mar 2009 04:36:44 -0600</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">771 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/creating-self-signed-ssl-certificate-apache-linux</feedburner:origLink></item>
<item>
 <title>FRBR explained pretty well</title>
 <link>http://feedproxy.google.com/~r/townx/~3/GcWVcP-MsBM/frbr-explained-pretty-well</link>
 <description>&lt;p&gt;I've been struggling for a while to understand &lt;a href="http://en.wikipedia.org/wiki/FRBR"&gt;&lt;span class="caps"&gt;FRBR&lt;/span&gt;&lt;/a&gt;. It's basically (I quote) &lt;a href="http://www.loc.gov/cds/FRBR.html"&gt;a conceptual model for the bibliographic universe&lt;/a&gt;. At its core are concepts describing bibliographic "things": books, works, scores, audio books, novels, all that litter. But there are two odd vague things sitting in between Items (physical things you can hold) and Works (the broad idea of "a work of art", separate from how it occurs in the world): Manifestations and Expressions. I kind of understood the difference, but they seem to have smudged boundaries.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://futurelib.pbwiki.com/Framework"&gt;This comment&lt;/a&gt; on the futurelib wiki by &lt;a href="http://bibwild.wordpress.com/"&gt;jrochkind&lt;/a&gt; cleared up some of the confusion for me:&lt;/p&gt;

&lt;blockquote&gt;
An item, is an actual individual concrete book in your hand.

&lt;p&gt;A manifestation is the set of all items that are identical (or close enough) in &lt;em&gt;physical form&lt;/em&gt; as well as content.&lt;/p&gt;

&lt;p&gt;An expression is the set of all manifestations that are identical in &lt;em&gt;textual&lt;/em&gt; or &lt;em&gt;information&lt;/em&gt; content. (or close enough for our purpopes; an archeologist would consider the coffee stain on the back to be distinguishing information content; we do not).&lt;/p&gt;

And a work is the set of all expressions that well, consist of the same intellectual work. This is definitely a cultural concept, but it's one we have and find useful. We consider the audio book version of a book to be the same &lt;em&gt;book&lt;/em&gt;, just a different version. That's work.&lt;br /&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thanks Jonathan.&lt;/p&gt;

&lt;p&gt;Also ran across &lt;a href="http://vocab.org/frbr/core"&gt;Ian Davis' translation of &lt;span class="caps"&gt;FRBR &lt;/span&gt;concepts to &lt;span class="caps"&gt;RDF&lt;/span&gt;&lt;/a&gt;. He's my boss.&lt;/p&gt;

&lt;p&gt;And the &lt;a href="http://www.collectionscanada.gc.ca/jsc/rda.html"&gt;Resource Description and Access cataloguing standard&lt;/a&gt;, which I hadn't encountered before. And by coincidence, a recent &lt;a href="http://www.ukoln.ac.uk/bib-man/presentations/ucl-2009/ppt-2000-html/RDA-UCL-2009-03-02_files/v3_document.html"&gt;&lt;span class="caps"&gt;UKOLN &lt;/span&gt;guest lecture on &lt;span class="caps"&gt;RDA&lt;/span&gt;&lt;/a&gt; just appeared in one of my &lt;span class="caps"&gt;RSS &lt;/span&gt;feeds.&lt;/p&gt;

&lt;p&gt;Most of this was triggered by a colleague tipping me off to &lt;a href="http://www.extensiblecatalog.org/"&gt;eXtensibleCatalog&lt;/a&gt;, a new open source discovery layer for bibliographic data, built on Drupal (amongst other things). It has its &lt;a href="https://urresearch.rochester.edu/handle/1802/6377"&gt;own metadata format&lt;/a&gt;, plus &lt;a href="http://www.extensiblecatalog.org/software/mst"&gt;tools for translating out of common library metadata formats&lt;/a&gt; (like &lt;span class="caps"&gt;MARC&lt;/span&gt;) into their own format.&lt;/p&gt;

&lt;p&gt;It's quite fascinating, this whole library metadata lark, once you get your teeth into it. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/townx?a=GcWVcP-MsBM:ZraFG0cjHZI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=GcWVcP-MsBM:ZraFG0cjHZI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=GcWVcP-MsBM:ZraFG0cjHZI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/townx?a=GcWVcP-MsBM:ZraFG0cjHZI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/townx?i=GcWVcP-MsBM:ZraFG0cjHZI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
 <comments>http://townx.org/blog/elliot/frbr-explained-pretty-well#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <pubDate>Wed, 04 Mar 2009 14:37:46 -0600</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">770 at http://townx.org</guid>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><feedburner:origLink>http://townx.org/blog/elliot/frbr-explained-pretty-well</feedburner:origLink></item>
<lastBuildDate>Thu, 09 Jul 2009 00:00:00 PDT</lastBuildDate></channel>
</rss>
