<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">

 <title>Bjørn Arild Mæland's Blog</title>
 
 <link type="text/html" rel="alternate" href="http://chrononaut.net/" />
 <updated>2009-09-03T13:59:01+02:00</updated>
 <id>http://chrononaut.net/</id>
 <author>
   <name>Bjørn Arild Mæland</name>
 </author>

 
 <link rel="self" href="http://feeds.feedburner.com/chrononaut" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
   <title>The Rule of 78</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/4FqMYBZIUwU/the-rule-of-78.html" />
   <updated>2009-09-03T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2009/09/03/the-rule-of-78</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In 1986, McClelland and Rumelhart published their seminal paper on the learning
of past tenses of English verbs. It played a large part in the renewal of
academic interest in neuron-like computing and machine learning. I'm taking a
class on &lt;a href="http://gandalf.aksis.uib.no/lingkurs/webroot/index.php?page=dasp303&amp;amp;lang=en&amp;amp;course=dasp303"&gt;modelling for computational linguistics&lt;/a&gt; this term and we've been using
&lt;a href="http://www.ra.cs.uni-tuebingen.de/software/JavaNNS/welcome_e.html"&gt;JavaNNS&lt;/a&gt; to play around with some neural networks. McClelland and Rumelhart
provides a scaled-down example of their experiment, so we used that as a
practice exercise. They call their example the &lt;i&gt;rule of 78&lt;/i&gt;. It can be described
as a basic rewriting rule, e.g. &lt;code&gt;(2 4 7) -&amp;gt; (2 4 8)&lt;/code&gt;, &lt;code&gt;(1 6 8) -&amp;gt; (1 6 7)&lt;/code&gt;,
etc. The point is that the rules are regular in the sense that it is only the
last digit that gets changed in the output (7 turns into 8 and vice versa). This
is just like regular verbs &amp;ndash; the base form remains intact and there is a
systematic change to the suffix. However, they also introduce an exception to
the rule: &lt;code&gt;(1 4 7) -&amp;gt; (1 4 7)&lt;/code&gt;. This can be seen as an irregular verb, e.g. hit
-&amp;gt; hit.
&lt;/p&gt;
&lt;p&gt;
In order to get this data set into JavaNNS, we need to encode it somehow, into
sequences of binary numbers. McClelland and Rumelhart use a simple feed-forward
network with 8 inputs and 8 outputs, so we'll basically do the same thing. They
don't mention how they encoded the patterns into binary sequences, but its quite
easy to figure out how it can be done. I'll spoil it in the table below:
&lt;/p&gt;
&lt;table rules="groups" cellspacing="0" border="2" frame="hsides" cellpadding="6"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="right" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;&lt;col align="left" /&gt;&lt;/col&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col"&gt;Pattern&lt;/th&gt;&lt;th scope="col"&gt;1&lt;/th&gt;&lt;th scope="col"&gt;2&lt;/th&gt;&lt;th scope="col"&gt;3&lt;/th&gt;&lt;th scope="col"&gt;4&lt;/th&gt;&lt;th scope="col"&gt;5&lt;/th&gt;&lt;th scope="col"&gt;6&lt;/th&gt;&lt;th scope="col"&gt;7&lt;/th&gt;&lt;th scope="col"&gt;8&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;(1 4 7)&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;(2 4 7)&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;(2 4 8)&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;p&gt;
Et cetera. I wrote a small Ruby script for creating pattern files with these
data for JavaNNS, which is available &lt;a href="http://gist.github.com/180234"&gt;here&lt;/a&gt;. It's very raw but it should be
understandable. It produces .pat files which can be opened directly in JavaNNS
and then used for training the network. I won't go into the details of
McClelland and Rumelhart's training scheme, however I'd highly recommend reading
the article for the rest of the story. We more or less replicated their results,
using Backpropagation as the learning function in JavaNNS.
&lt;/p&gt;

&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="/images/javanns-78.png" alt="/images/javanns-78.png" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/4FqMYBZIUwU" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/09/03/the-rule-of-78.html</feedburner:origLink></entry>
 
 <entry>
   <title>Frequencies of word frequencies</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/FoDfJPnd6Jk/frequencies-of-word-frequencies.html" />
   <updated>2009-08-25T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2009/08/25/frequencies-of-word-frequencies</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
During Christopher D. Manning's CS224N lectures on Natural Language
Processing, he intially presents some interesting tables of the frequencies of
word frequencies you can expect to see in a regular corpus. The corpus he uses
as an example is Tom Sawyer, freely &lt;a href="http://www.gutenberg.org/etext/74"&gt;available from Project Gutenberg&lt;/a&gt;. The topic
is data sparseness and N-gram language models (lecture 2). These sorts of things
are really simple to plot out with &lt;a href="http://www.nltk.org/"&gt;NLTK&lt;/a&gt;; here I am just going to quickly go
through the steps required to get a nice plot of the data.
&lt;/p&gt;

&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="/images/whatsinourcorpora.png" alt="/images/whatsinourcorpora.png" /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
First, we need to get a list of all the words in our corpus:
&lt;/p&gt;



&lt;pre class="src src-python"&gt;&lt;span style="color: #888a85;"&gt;#&lt;/span&gt;&lt;span style="color: #888a85;"&gt;# Assuming that nltk is available, and that the text is in the current
&lt;/span&gt;&lt;span style="color: #888a85;"&gt;#&lt;/span&gt;&lt;span style="color: #888a85;"&gt;# directory, named 'twain-tomsawyer.txt'
&lt;/span&gt;&lt;span style="color: #fcaf3e;"&gt;import&lt;/span&gt; nltk
reader = nltk.corpus.reader.PlaintextCorpusReader(&lt;span style="color: #73d216;"&gt;'.'&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;'twain-tomsawyer.txt'&lt;/span&gt;)
words = reader.words(&lt;span style="color: #73d216;"&gt;'twain-tomsawyer.txt'&lt;/span&gt;) &lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;List of all the words in the text
&lt;/span&gt;&lt;/pre&gt;




&lt;p&gt;
Note that the NLTK corpus reader class does a lot of work behind the scenes,
including tokenization. To create a word frequency distribution of the words we
just collected, we can use the &lt;a href="http://nltk.googlecode.com/svn/trunk/doc/api/nltk.probability.FreqDist-class.html"&gt;FreqDist&lt;/a&gt; class:
&lt;/p&gt;



&lt;pre class="src src-python"&gt;fdist = nltk.FreqDist([w.lower() &lt;span style="color: #fcaf3e;"&gt;for&lt;/span&gt; w &lt;span style="color: #fcaf3e;"&gt;in&lt;/span&gt; words])
&lt;/pre&gt;




&lt;p&gt;
The values of this frequency distribution now consists of an integer for each
word in the corpus, telling us how often they occured (i.e. the word
frequencies). We'd like to group these frequencies under 13 different labels
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11-51, 51-100, &amp;gt;100):
&lt;/p&gt;



&lt;pre class="src src-python"&gt;&lt;span style="color: #fcaf3e;"&gt;def&lt;/span&gt; &lt;span style="color: #729fcf;"&gt;group&lt;/span&gt;(i):
    &lt;span style="color: #fcaf3e;"&gt;if&lt;/span&gt; i &amp;lt; 11: &lt;span style="color: #fcaf3e;"&gt;return&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;str&lt;/span&gt;(i)
    &lt;span style="color: #fcaf3e;"&gt;elif&lt;/span&gt; i &lt;span style="color: #fcaf3e;"&gt;in&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;range&lt;/span&gt;(11, 51): &lt;span style="color: #fcaf3e;"&gt;return&lt;/span&gt;(&lt;span style="color: #73d216;"&gt;"11-50"&lt;/span&gt;)
    &lt;span style="color: #fcaf3e;"&gt;elif&lt;/span&gt; i &lt;span style="color: #fcaf3e;"&gt;in&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;range&lt;/span&gt;(51, 101): &lt;span style="color: #fcaf3e;"&gt;return&lt;/span&gt;(&lt;span style="color: #73d216;"&gt;"51-100"&lt;/span&gt;)
    &lt;span style="color: #fcaf3e;"&gt;else:&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;return&lt;/span&gt;(&lt;span style="color: #73d216;"&gt;"&amp;gt;100"&lt;/span&gt;)
&lt;/pre&gt;




&lt;p&gt;
Now we can create another frequency distribution of the previously obtained
values:
&lt;/p&gt;



&lt;pre class="src src-python"&gt;fdist_freq = nltk.FreqDist([group(freq) &lt;span style="color: #fcaf3e;"&gt;for&lt;/span&gt; freq &lt;span style="color: #fcaf3e;"&gt;in&lt;/span&gt; fdist.values()])
&lt;/pre&gt;




&lt;p&gt;
Here we basically count how often each of the 13 different "groups" occur,
resulting in the frequencies we were after. To plot out the data graphically we
can now use &lt;code&gt;fdist_freq.plot()&lt;/code&gt;, or as a plain text table with
&lt;code&gt;fdist_freq.tabulate()&lt;/code&gt;.
&lt;/p&gt;

&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="/images/freqdistpng.png" alt="/images/freqdistpng.png" /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
In summary, I hope this small article shows how easy it is to do corpus
experiments with NLTK. The best part is that the toolkit provides an uniform
corpus API for dealing with different kinds of corpora (tagged, annotated,
coded, etc). The NLTK data collection also includes a lot of corpora to play
around with right out of the box.
&lt;/p&gt;
&lt;p&gt;
The complete code is available &lt;a href="http://gist.github.com/174631"&gt;here&lt;/a&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/FoDfJPnd6Jk" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/08/25/frequencies-of-word-frequencies.html</feedburner:origLink></entry>
 
 <entry>
   <title>Using Metal with live-validations</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/RjFIfR6bTo4/using-metal-with-live-validations.html" />
   <updated>2009-08-04T13:51:00+02:00</updated>
   <id>http://chrononaut.net/2009/08/04/using-metal-with-live-validations</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The popular &lt;a href="http://github.com/augustl/live-validations/tree/master"&gt;live-validations&lt;/a&gt; plugin for Rails works by providing a &lt;a href="http://github.com/augustl/live-validations/blob/025bd57c1a1fc5279fe39f0e89d49cde19e65f5f/app/controllers/live_validations_controller.rb"&gt;controller&lt;/a&gt;
that is polled asynchronously by Ajax-requests. I decided that re-implementing
this controller as a piece of Metal (a way to write &lt;i&gt;super fast pieces of optimized logic that routes around Action Controller&lt;/i&gt; in Rails 2.3+) would be a nice
learning-opportunity. I started out by watching
&lt;a href="http://www.railsenvy.com/2009/6/11/rack-metal-and-rails-middleware"&gt;Gregg Pollack's screencast on Rack, Metal, and Rails Middleware&lt;/a&gt; &amp;ndash; highly
recommendable if you want to learn more about any of
the mentioned technologies. After watching I was able to whip up some code:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;&lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;Allow the metal piece to run in isolation
&lt;/span&gt;require(&lt;span style="color: #c17d11;"&gt;File&lt;/span&gt;.dirname(__FILE__) + &lt;span style="color: #73d216;"&gt;"/../../config/environment"&lt;/span&gt;) &lt;span style="color: #fcaf3e;"&gt;unless&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;defined?&lt;/span&gt;(&lt;span style="color: #c17d11;"&gt;Rails&lt;/span&gt;)

&lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;Drop-in replacement for the LiveValidations controller that ships with
&lt;/span&gt;&lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;live-validations.
&lt;/span&gt;&lt;span style="color: #fcaf3e;"&gt;class&lt;/span&gt; &lt;span style="color: #c17d11;"&gt;ValidationPoller&lt;/span&gt;

  &lt;span style="color: #fcaf3e;"&gt;def&lt;/span&gt; &lt;span style="color: #729fcf;"&gt;self.call&lt;/span&gt;(env)
    &lt;span style="color: #fcaf3e;"&gt;if&lt;/span&gt; env[&lt;span style="color: #73d216;"&gt;"PATH_INFO"&lt;/span&gt;] =~ &lt;span style="color: #73d216;"&gt;/^\/live_validations\/uniqueness/&lt;/span&gt;
      params = &lt;span style="color: #c17d11;"&gt;HashWithIndifferentAccess&lt;/span&gt;.new(&lt;span style="color: #c17d11;"&gt;Rack&lt;/span&gt;::&lt;span style="color: #c17d11;"&gt;Request&lt;/span&gt;.new(env).params)
      responder = &lt;span style="color: #c17d11;"&gt;LiveValidations&lt;/span&gt;.current_adapter.validation_responses[&lt;span style="color: #ad7fa8;"&gt;:uniqueness&lt;/span&gt;]

      [200, {&lt;span style="color: #73d216;"&gt;"Content-Type"&lt;/span&gt; =&amp;gt; &lt;span style="color: #73d216;"&gt;"text/html"&lt;/span&gt;}, [responder.respond(params).to_s]]
    &lt;span style="color: #fcaf3e;"&gt;else&lt;/span&gt;
      [404, {&lt;span style="color: #73d216;"&gt;"Content-Type"&lt;/span&gt; =&amp;gt; &lt;span style="color: #73d216;"&gt;"text/html"&lt;/span&gt;}, [&lt;span style="color: #73d216;"&gt;"Not Found"&lt;/span&gt;]]
    &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;

&lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
As described in the comments, this really is a drop-in solution (just store the
file in the &lt;code&gt;app/metal&lt;/code&gt; folder). The controller
that ships with live-validations will never be reached (or any other part of
Rails &amp;ndash; this all happens before the Rails routing process is triggered). We &lt;a href="http://github.com/hadley/crantastic/blob/3f36eafdf59f5241ab0d03f1574c6660512a74c3/app/metal/validation_poller.rb"&gt;use&lt;/a&gt;
this in production for &lt;a href="http://crantastic.org"&gt;crantastic&lt;/a&gt; (my GSoC 2009 project) without any
problems. If you have a really big site this will probably give you a small
improvement in performance &amp;ndash; I haven't done any benchmarking though.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/RjFIfR6bTo4" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/08/04/using-metal-with-live-validations.html</feedburner:origLink></entry>
 
 <entry>
   <title>Validating your markup with RSpec and markup_validity</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/aApWmwXjh2A/validating-your-markup-with-rspec-and-markup_validity.html" />
   <updated>2009-06-13T17:32:00+02:00</updated>
   <id>http://chrononaut.net/2009/06/13/validating-your-markup-with-rspec-and-markup_validity</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
markup_validity was announced earlier today by Aaron Patterson on the
comp.lang.ruby mailing list (&lt;a href="http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/25c26224c0bdf70b"&gt;read the full announcement here&lt;/a&gt;). Perfect timing,
as this was something I have wanted to add to my test suites for some time
now. Here are my installation notes:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;sudo gem install markup_validity
&lt;span style="color: #729fcf;"&gt;echo&lt;/span&gt; &lt;span style="color: #73d216;"&gt;'config.gem "markup_validity"'&lt;/span&gt; &amp;gt;&amp;gt; $&lt;span style="color: #fce94f;"&gt;RAILS_ROOT&lt;/span&gt;/config/environments/test.rb
&lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;Thats it!
&lt;/span&gt;&lt;/pre&gt;




&lt;p&gt;
I then added a basic spec for one of my controllers:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;describe &lt;span style="color: #c17d11;"&gt;PackagesController&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;

  integrate_views

  it &lt;span style="color: #73d216;"&gt;"should have an XHTML Strict compilant show page"&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
    get &lt;span style="color: #ad7fa8;"&gt;:show&lt;/span&gt;, &lt;span style="color: #ad7fa8;"&gt;:id&lt;/span&gt; =&amp;gt; 1
    response.body.should be_xhtml_strict
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;

&lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
However, I ran into an internal error when running the spec:
&lt;/p&gt;
&lt;blockquote&gt;

&lt;p&gt;"Internal error: xmlSchemaVDocWalk, there
is at least one entity reference in the node-tree currently being
validated. Processing of entities with this XML Schema processor is not
supported (yet). Please substitute entities before validation.."
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;
My pages make use of HTML entities, and seemingly those aren't supported for
validation yet. Thus, I added the following method to my &lt;code&gt;core_extensions.rb&lt;/code&gt;
file:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;&lt;span style="color: #fcaf3e;"&gt;class&lt;/span&gt; &lt;span style="color: #c17d11;"&gt;String&lt;/span&gt;
  &lt;span style="color: #fcaf3e;"&gt;def&lt;/span&gt; &lt;span style="color: #729fcf;"&gt;strip_entities&lt;/span&gt;
    &lt;span style="color: #fce94f;"&gt;self&lt;/span&gt;.gsub(&lt;span style="color: #73d216;"&gt;/&amp;amp;#?[A-Za-z0-9]+;/&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;''&lt;/span&gt;)
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
And changed the XHTML strict assertion in my spec to read like this:
&lt;code&gt;response.body.strip_entities.should be_xhtml_strict&lt;/code&gt;. If you end up using
&lt;code&gt;strip_entities&lt;/code&gt; a lot, I guess it could make sense to monkey patch.
&lt;/p&gt;
&lt;p&gt;
All in all, this seems to be a nice gem for making sure your generated XHTML is
valid.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;UPDATE:&lt;/b&gt; This has been fixed by Aaron in HEAD, so the substitution tricky won't
be necessary anymore after the new version is released.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/aApWmwXjh2A" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/06/13/validating-your-markup-with-rspec-and-markup_validity.html</feedburner:origLink></entry>
 
 <entry>
   <title>Demonstrating how Heroku handles your database</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/rZ61BlmiTqk/demonstrating-how-heroku-handles-your-database.html" />
   <updated>2009-05-11T13:15:00+02:00</updated>
   <id>http://chrononaut.net/2009/05/11/demonstrating-how-heroku-handles-your-database</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;a href="http://heroku.com/"&gt;Heroku&lt;/a&gt; is an amazing platform for hosting &lt;a href="http://rack.rubyforge.org/"&gt;Rack&lt;/a&gt;-compilant web
applications. Although some people complain about steep pricing, I'm sure that
many will feel that the productivity gain is worth it. I'll provide
more detail about Heroku and how I/we use it later. This post will simply show
how database configuration is done when you work with Heroku. I think this might
be a bit vague in the &lt;a href="http://docs.heroku.com/"&gt;documentation&lt;/a&gt;, some people get confused over it. Lets
utilize the console:
&lt;/p&gt;



&lt;pre class="src src-yaml"&gt;&lt;span style="color: #888a85;"&gt;zero:~/Projects/crantastic $ heroku console&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;Ruby console for crantastic.heroku.com&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;&amp;gt;&amp;gt; puts File.read(Rails.configuration.database_configuration_file)&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;---&lt;/span&gt;
&lt;span style="color: #fce94f;"&gt;production&lt;/span&gt;&lt;span style="color: #888a85;"&gt;:&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;encoding&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: unicode&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;adapter&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: postgresql&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;username&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: something_random&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;port&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: 5432&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;host&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: somewhere.at.heroku&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;database&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: something_random&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  &lt;/span&gt;&lt;span style="color: #fce94f;"&gt;password&lt;/span&gt;&lt;span style="color: #888a85;"&gt;: something_random&lt;/span&gt;

&lt;span style="color: #888a85;"&gt;=&amp;gt; nil&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
Heroku in practice replaces your apps database.yml when you push your site to
their servers. Your data will be stored in one of their fancy PostgreSQL
servers no matter what you use locally - this means that you don't have to think
about database.yml &lt;i&gt;at all&lt;/i&gt; (except for development purpses, naturally). &lt;a href="http://adam.blog.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/"&gt;Taps&lt;/a&gt;
makes sure that everything's db agnostic. If you want to push your
latest development db to Heroku, simply run &lt;code&gt;heroku db:push&lt;/code&gt;. Awesome!
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/rZ61BlmiTqk" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/05/11/demonstrating-how-heroku-handles-your-database.html</feedburner:origLink></entry>
 
 <entry>
   <title>Oystercatcher Spotting 2.0</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/ogPB2RvDDs4/oystercatcher-spotting-2.0.html" />
   <updated>2009-05-09T11:59:00+02:00</updated>
   <id>http://chrononaut.net/2009/05/09/oystercatcher-spotting-2.0</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
Since 2005, the University of Bergen has made a &lt;a href="http://tjeld.uib.no/"&gt;webcam&lt;/a&gt; of roof-breeding
oystercatchers (&lt;i&gt;tjeld&lt;/i&gt;, in Norwegian) available for everyone to enjoy. And for
some reason, the site is quite popular among students and others during the
breeding period in May. To make this activity a bit more practical, at least for
me, I decided to turn to why's &lt;a href="http://shoooes.net/"&gt;Shoes&lt;/a&gt;, the nicest/smallest GUI library known to
man. Thus I created a small GUI app that fetches the latest images from the
webcam and display them at 240x180 instead of the original 800x600. Together
with "always on top", this turned out to work quite well. What can &lt;i&gt;possibly&lt;/i&gt; be
better than watching birds while working?
&lt;/p&gt;

&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="/images/tjeldapp.jpg" alt="/images/tjeldapp.jpg" /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
If you want to attempt to install this thingy, install Shoes from
&lt;a href="http://shoooes.net/"&gt;http://shoooes.net/&lt;/a&gt;, then download &lt;a href="http://chrononaut.net/tjeld-app.shy"&gt;http://chrononaut.net/tjeld-app.shy&lt;/a&gt;. Run
Shoes, click "Open an App" and select the .shy file you just downloaded. It has
been reported to be rather dodgy in Windows (d'oh), it works fine in Linux and
OS X though. The source is made available &lt;a href="http://gist.github.com/108208"&gt;here&lt;/a&gt;. It weights in at about 20 lines
of code (discarding the comments etc). Not bad for a fully functional webcam
frontend.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/ogPB2RvDDs4" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/05/09/oystercatcher-spotting-2.0.html</feedburner:origLink></entry>
 
 <entry>
   <title>Using Compass with Jekyll</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/HZbZ92WUr6Y/using-compass-with-jekyll.html" />
   <updated>2009-05-08T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2009/05/08/using-compass-with-jekyll</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://github.com/chriseppstein/compass/tree"&gt;Compass&lt;/a&gt; is a great stylesheet framework that has received a lot of well-deserved
attention recently. It got an additional boost in popularity after being
highlighted as featured project in &lt;a href="http://github.com/blog/429-github-rebase-20"&gt;GitHub Rebase #20&lt;/a&gt;. In this small post I'll
describe how you could use it together with &lt;a href="http://github.com/mojombo/jekyll/tree/master"&gt;Jekyll&lt;/a&gt;. It's not exactly rocket
science, but following these steps might save you some time.
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;sudo gem install chriseppstein-compass
&lt;span style="color: #729fcf;"&gt;cd&lt;/span&gt; your/jekyll/root
compass -f blueprint --sass-dir _sass .
&lt;/pre&gt;




&lt;p&gt;
This will create a _sass directory for sass sources, a config.rb file for
compass and a grid.png image file. As you might know, prefixing the sass
directory with an underscore causes Jekyll to skip over it when it compiles the
site. I'm accepting &lt;i&gt;stylesheets&lt;/i&gt; as the default directory for compiled css
files, however. The next step is optional but recommended. Open _config.yml and
add (or modify) an &lt;i&gt;exclude&lt;/i&gt; section:
&lt;/p&gt;



&lt;pre class="src src-yaml"&gt;&lt;span style="color: #fce94f;"&gt;exclude&lt;/span&gt;&lt;span style="color: #888a85;"&gt;:&lt;/span&gt;
&lt;span style="color: #888a85;"&gt;  - config.rb&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
This is a new feature in Jekyll 0.5.1 which can be used to exclude arbitrary
files from being copied during compilation (note that GitHub Pages still use
Jekyll 0.5.0). Now you're all set for using Sass with the CSS framework of your
choice for styling your site! Just run &lt;code&gt;compass --watch&lt;/code&gt; together with
&lt;code&gt;jekyll --server --auto&lt;/code&gt; while developing. If you're interested, the
entire source code for this blog (using Compass, of course) is available on &lt;a href="http://github.com/Chrononaut/chrononaut.github.com/tree/master"&gt;GitHub&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
If you don't already use Compass and would like to learn more, there's an hour
long walk through available on &lt;a href="http://www.vimeo.com/4335944"&gt;Vimeo&lt;/a&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/HZbZ92WUr6Y" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/05/08/using-compass-with-jekyll.html</feedburner:origLink></entry>
 
 <entry>
   <title>ZSH Tip of the Day: #2</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/WQHcdvRWAGs/zsh-tip-of-the-day%3A-%232.html" />
   <updated>2009-04-07T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2009/04/07/zsh-tip-of-the-day:-#2</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
How many times have you forgotten to use &lt;code&gt;sudo&lt;/code&gt; when executing
commands? Countless, I'm sure. One trick is to simply write &lt;code&gt;sudo
!!&lt;/code&gt;, since !! is replaced with the full contents of the previously
entered command. Sure beats re-entering the entire thing. But we can do better -
three key strokes should be enough. Here's how I do it:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;&lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;Prefix the previous line with "sudo " then execute it
&lt;/span&gt;&lt;span style="color: #729fcf;"&gt;rerun-with-sudo&lt;/span&gt; () {
  &lt;span style="color: #fce94f;"&gt;LBUFFER&lt;/span&gt;=&lt;span style="color: #73d216;"&gt;"sudo !!"&lt;/span&gt;
  zle accept-line
}
zle -N rerun-with-sudo

&lt;span style="color: #729fcf;"&gt;bindkey&lt;/span&gt; &lt;span style="color: #73d216;"&gt;'\C-x\C-x'&lt;/span&gt; rerun-with-sudo
&lt;/pre&gt;




&lt;p&gt;
I think this small function showcases how nice zle is. LBUFFER is basically a
variable which contains the contents of the prompt. Since this function assigns
to LBUFFER, it overwrites anything already there (if anything) with &lt;code&gt;sudo
!!&lt;/code&gt;. &lt;code&gt;zle accept-line&lt;/code&gt; is equivalent to hitting
enter. Finally I bind the function to ^x^x - which now can be used to quickly
rerun commands with sudo.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/WQHcdvRWAGs" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/04/07/zsh-tip-of-the-day%3A-%232.html</feedburner:origLink></entry>
 
 <entry>
   <title>Experimenting with automatons in Ruby (part 2)</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/2zUhEZ9-N6M/experimenting-with-automatons-in-ruby-%28part-2%29.html" />
   <updated>2009-03-21T00:00:00+01:00</updated>
   <id>http://chrononaut.net/2009/03/21/experimenting-with-automatons-in-ruby-(part-2)</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Better late than never, I finally published the code I produced for my small
automaton library at &lt;a href="http://github.com/Chrononaut/rton/tree/master"&gt;http://github.com/Chrononaut/rton/tree/master&lt;/a&gt;. It was
created as part of a introductionary course in computational linguistics. I'm
quite pleased with how the DSL turned out. Consider the following example, a
&lt;a href="http://en.wikipedia.org/wiki/Pushdown_automaton"&gt;pushdown automaton&lt;/a&gt; for the a&lt;sup&gt;n&lt;/sup&gt; b&lt;sup&gt;n&lt;/sup&gt; language:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;&lt;span style="color: #fce94f;"&gt;@anbn&lt;/span&gt; = &lt;span style="color: #c17d11;"&gt;Automaton&lt;/span&gt;.setup(&lt;span style="color: #ad7fa8;"&gt;:pda&lt;/span&gt;) &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
  initial_state &lt;span style="color: #ad7fa8;"&gt;:q0&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
    transition [&lt;span style="color: #73d216;"&gt;'a'&lt;/span&gt;, &lt;span style="color: #c17d11;"&gt;EMPTY&lt;/span&gt;], [&lt;span style="color: #ad7fa8;"&gt;:q0&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;'A'&lt;/span&gt;]
    transition [&lt;span style="color: #73d216;"&gt;'b'&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;'A'&lt;/span&gt;],   [&lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt;, &lt;span style="color: #c17d11;"&gt;EMPTY&lt;/span&gt;]
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;

  state &lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
    transition [&lt;span style="color: #73d216;"&gt;'b'&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;'A'&lt;/span&gt;],   [&lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt;, &lt;span style="color: #c17d11;"&gt;EMPTY&lt;/span&gt;]
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;

  final_states &lt;span style="color: #ad7fa8;"&gt;:q0&lt;/span&gt;, &lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt;
&lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
From the initial state, if an 'a' is read, 'A' is pushed onto the stack. This is
called the automatons 'pushing state'. Once a 'b' is read, it transists to state
q1, where it starts popping off the 'A' characters from the stack. Basically, if
the end of the input string is reached and the stack is empty at that point, the
string is accepted. Therefore this automaton accepts input strings like a b, a a
b b, etc.
&lt;/p&gt;
&lt;p&gt;
Unfortunately, I doubt that I will actually turn this into something generally
usable, mainly because I now spend more time on languages like Python and
Clojure for NLP tasks. However, I can recommend &lt;a href="http://www.jflap.org/"&gt;JFLAP&lt;/a&gt; for a more visual
automaton experience.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/2zUhEZ9-N6M" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/03/21/experimenting-with-automatons-in-ruby-%28part-2%29.html</feedburner:origLink></entry>
 
 <entry>
   <title>ZSH Tip of the Day: #1</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/T6aUk0tn6Jw/zsh-tip-of-the-day%3A-%231.html" />
   <updated>2009-03-12T00:00:00+01:00</updated>
   <id>http://chrononaut.net/2009/03/12/zsh-tip-of-the-day:-#1</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
As you can see in my zsh repository &lt;a href="http://github.com/Chrononaut/my-zsh/tree/master"&gt;on GitHub&lt;/a&gt;, I spend a lot of time playing
around with my zsh configuration. I'm going to present some of my favourite
tricks here on this blog. Today I'll show a very useful function that
handles extraction of files. It serves two purposes: it both abstracts away the
specific extraction command and deletes the archive file (if successfully
extracted). I call it &lt;i&gt;ed&lt;/i&gt;:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;&lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;Extract &amp;amp; Delete
&lt;/span&gt;&lt;span style="color: #729fcf;"&gt;ed&lt;/span&gt;() {
  &lt;span style="color: #fcaf3e;"&gt;case&lt;/span&gt; ${&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;##*.} &lt;span style="color: #fcaf3e;"&gt;in&lt;/span&gt;
    tar)
      tar -xvf $&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;
      ;;
    tgz|gz)
      tar -zxvf $&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;
      ;;
    tbz|tbz2|bz2)
      tar -jxvf $&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;
      ;;
    zip)
      unzip $&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;
      ;;
    rar)
      unrar x $&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;
      ;;
  &lt;span style="color: #fcaf3e;"&gt;esac&lt;/span&gt; || &lt;span style="color: #fcaf3e;"&gt;return&lt;/span&gt; 1
  rm $&lt;span style="color: #fce94f;"&gt;1&lt;/span&gt;
}
&lt;/pre&gt;




&lt;p&gt;
This allows you to do stuff like &lt;code&gt;ed latest.tar.gz&lt;/code&gt;, and it would
have the same effect as &lt;code&gt;tar -zxvf latest.tar.gz; rm latest.tar.gz&lt;/code&gt;.
As you can see, it determines which extraction command to use based on the file
extension. I find that I almost always want to delete archive files
after I have extracted them, hence the deletion. Hope you'll find it useful as well!
&lt;/p&gt;
&lt;p&gt;
NOTE: In order to make &lt;a href="http://github.com/mojombo/jekyll/tree"&gt;Jekyll&lt;/a&gt; handle the # in the title of this post, I had to
create a &lt;a href="http://github.com/Chrononaut/jekyll/commit/8c1c0e0aa6073b528407d8afcf683abb5f86d24f"&gt;small patch&lt;/a&gt;.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/T6aUk0tn6Jw" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/03/12/zsh-tip-of-the-day%3A-%231.html</feedburner:origLink></entry>
 
 <entry>
   <title>Introducing Happyblogger</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/ELKj072DcMo/introducing-happyblogger.html" />
   <updated>2009-03-11T00:00:00+01:00</updated>
   <id>http://chrononaut.net/2009/03/11/introducing-happyblogger</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
I finally ditched my old Blogger account and hacked together a neat blogging
solution I would like to call &lt;i&gt;happyblogger&lt;/i&gt;. Its basically just some glue that
lets me write posts in Emacs' fabolous &lt;a href="http://orgmode.org/"&gt;org-mode&lt;/a&gt; and via some processing lets
mojombo's slick &lt;a href="http://github.com/mojombo/jekyll/tree/master"&gt;Jekyll&lt;/a&gt; package take care of the rest. I'm very pleased with the
result, at least for the time being. :) This is of course mostly for personal
use, but I've wrapped it up into a package that should be easy to install/use
for others as well.
&lt;/p&gt;
&lt;p&gt;
I actually thought that I had to modify Jekyll quite heavily to get it to work
with orgmode instead of the default Textile/Markdown, but luckily it was enough
to just postprocess the HTML that orgmode produces and feed it right into
Jekyll. The processing is done with Hpricot. I did create some patches for
Jekyll though while I was looking through its codebase (now accepted into the
mainline). Happyblogger depends on these patches - this means that you currently
have to install Jekyll from git in order to use it.
&lt;/p&gt;
&lt;p&gt;
The code, along with some documentation, is available at &lt;a href="http://github.com/Chrononaut/happyblogger/tree/master"&gt;happyblogger's GitHub repository&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
If you actually decide to give it a shot it would be interesting to hear your
comments, but since I haven't added a commenting solution yet you'd have to ship
me an &lt;a href="mailto:bjorn.maeland@gmail.com"&gt;email&lt;/a&gt;. :)
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/ELKj072DcMo" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2009/03/11/introducing-happyblogger.html</feedburner:origLink></entry>
 
 <entry>
   <title>Working with strings in Prolog</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/TSClHwkHSS8/working-with-strings-in-prolog.html" />
   <updated>2008-11-30T00:00:00+01:00</updated>
   <id>http://chrononaut.net/2008/11/30/working-with-strings-in-prolog</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
Strings in Prolog can be quite confusing if you come from another
language. In this short article I will illustrate how they work, mainly by showing
different examples and by creating a term that checks if a string is contained
within another string.
&lt;/p&gt;
&lt;p&gt;
First off, strings in Prolog are written in single quotes. Terms written in
double quotes are immediately converted to a list of character codes. Therefore,
strings can be handed directly to &lt;i&gt;write&lt;/i&gt;. Strings are also atoms.
&lt;/p&gt;



&lt;pre class="src src-prolog"&gt;?- &lt;span style="color: #73d216;"&gt;'bergen'&lt;/span&gt; = &lt;span style="color: #fce94f;"&gt;L&lt;/span&gt;.
&lt;span style="color: #fce94f;"&gt;L&lt;/span&gt; = bergen.

?- &lt;span style="color: #73d216;"&gt;"bergen"&lt;/span&gt; = &lt;span style="color: #fce94f;"&gt;L&lt;/span&gt;.
&lt;span style="color: #fce94f;"&gt;L&lt;/span&gt; = &lt;span style="color: #fcaf3e;"&gt;[&lt;/span&gt;98, 101, 114, 103, 101, 110&lt;span style="color: #fcaf3e;"&gt;]&lt;/span&gt;.

?- atom(&lt;span style="color: #73d216;"&gt;'bergen'&lt;/span&gt;).
&lt;span style="color: #729fcf;"&gt;true&lt;/span&gt;.

?- is_list(&lt;span style="color: #73d216;"&gt;"bergen"&lt;/span&gt;).
&lt;span style="color: #729fcf;"&gt;true&lt;/span&gt;.

?- write(&lt;span style="color: #73d216;"&gt;'sdf'&lt;/span&gt;).
&lt;span style="color: #729fcf;"&gt;sdf&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;true&lt;/span&gt;.

?- write(&lt;span style="color: #73d216;"&gt;"sdf"&lt;/span&gt;).
&lt;span style="color: #fcaf3e;"&gt;[&lt;/span&gt;115, 100, 102&lt;span style="color: #fcaf3e;"&gt;]&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;true&lt;/span&gt;.

?- writef(&lt;span style="color: #73d216;"&gt;"%s"&lt;/span&gt;, &lt;span style="color: #fcaf3e;"&gt;[&lt;/span&gt;&lt;span style="color: #73d216;"&gt;"sdf"&lt;/span&gt;&lt;span style="color: #fcaf3e;"&gt;]&lt;/span&gt;).
&lt;span style="color: #729fcf;"&gt;sdf&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;true&lt;/span&gt;.
&lt;/pre&gt;




&lt;p&gt;
Since strings in Prolog are atoms, they naturally cannot be manipulated. So for
certain tasks they need to be converted to char lists. This can be done with
&lt;i&gt;name&lt;/i&gt;. So to print the first character of a string you'll have to
convert it to a char list first.
&lt;/p&gt;



&lt;pre class="src src-prolog"&gt;?- name(&lt;span style="color: #73d216;"&gt;'bergen'&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;CharList&lt;/span&gt;), nth0(0, &lt;span style="color: #fce94f;"&gt;CharList&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;FirstChar&lt;/span&gt;), put(&lt;span style="color: #fce94f;"&gt;FirstChar&lt;/span&gt;).
&lt;span style="color: #729fcf;"&gt;b&lt;/span&gt;
&lt;span style="color: #fce94f;"&gt;CharList&lt;/span&gt; = &lt;span style="color: #fcaf3e;"&gt;[&lt;/span&gt;98, 101, 114, 103, 101, 110&lt;span style="color: #fcaf3e;"&gt;]&lt;/span&gt;,
&lt;span style="color: #fce94f;"&gt;FirstChar&lt;/span&gt; = 98.
&lt;/pre&gt;




&lt;p&gt;
We now know enough to create our term, &lt;i&gt;contains/2&lt;/i&gt;. For illustration,
we will make it work for both strings and char lists, by converting to a char
list when needed. It will succeed if A is contained within B. We'll need a
utility term for this as well. Note that I am using SWI-Prolog, so I am
utilizing built in terms that might not be available elsewhere.
of this article, but they should be decipherable if you have written recursive
terms in Prolog. The full program as well as an example that generates all
possible substrings contained within A follows below.
&lt;/p&gt;



&lt;pre class="src src-prolog"&gt;&lt;span style="color: #729fcf;"&gt;sublist&lt;/span&gt;(&lt;span style="color: #fce94f;"&gt;S&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;L&lt;/span&gt;) :-
  append(&lt;span style="color: #fce94f;"&gt;_&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;L2&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;L&lt;/span&gt;),
  append(&lt;span style="color: #fce94f;"&gt;S&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;_&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;L2&lt;/span&gt;).

&lt;span style="color: #729fcf;"&gt;contains&lt;/span&gt;(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;) :-
  atom(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;),
  atom(&lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;),
  name(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;AA&lt;/span&gt;),
  name(&lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;BB&lt;/span&gt;),
  contains(&lt;span style="color: #fce94f;"&gt;AA&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;BB&lt;/span&gt;).

&lt;span style="color: #729fcf;"&gt;contains&lt;/span&gt;(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;) :-
  atom(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;),
  name(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;AA&lt;/span&gt;),
  contains(&lt;span style="color: #fce94f;"&gt;AA&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;).

&lt;span style="color: #888a85;"&gt;%% &lt;/span&gt;&lt;span style="color: #888a85;"&gt;The empty list is removed mainly for nicer output in the following example.
&lt;/span&gt;&lt;span style="color: #729fcf;"&gt;contains&lt;/span&gt;(&lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;) :-
  sublist(&lt;span style="color: #fce94f;"&gt;B&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;A&lt;/span&gt;),
  &lt;span style="color: #fce94f;"&gt;B&lt;/span&gt; \= &lt;span style="color: #fcaf3e;"&gt;[]&lt;/span&gt;.

?- forall( contains(&lt;span style="color: #73d216;"&gt;'bergen'&lt;/span&gt;, &lt;span style="color: #fce94f;"&gt;X&lt;/span&gt;) , writef(&lt;span style="color: #73d216;"&gt;"%s\n"&lt;/span&gt;, &lt;span style="color: #fcaf3e;"&gt;[&lt;/span&gt;&lt;span style="color: #fce94f;"&gt;X&lt;/span&gt;&lt;span style="color: #fcaf3e;"&gt;]&lt;/span&gt;) ).
&lt;span style="color: #729fcf;"&gt;b&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;be&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;ber&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;berg&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;berge&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;bergen&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;e&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;er&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;erg&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;erge&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;ergen&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;r&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;rg&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;rge&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;rgen&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;g&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;ge&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;gen&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;e&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;en&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;n&lt;/span&gt;
&lt;span style="color: #729fcf;"&gt;true&lt;/span&gt;.
&lt;/pre&gt;



&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/TSClHwkHSS8" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2008/11/30/working-with-strings-in-prolog.html</feedburner:origLink></entry>
 
 <entry>
   <title>Experimenting with automatons in Ruby (part 1)</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/As22Kdwcxi0/experimenting-with-automatons-in-ruby-%28part-1%29.html" />
   <updated>2008-10-26T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2008/10/26/experimenting-with-automatons-in-ruby-(part-1)</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
A finite automaton is an abstract computing device, which more often than not is
used to recognize formal languages. One can look at an automaton as a tape
reader which consists of a initial state, a set of final states and a set of
transitions between states. The automaton accepts its input if it has reached
the end of the input tape and is in a final state.
&lt;/p&gt;
&lt;p&gt;
For the purpose of language processing we will implement different kinds of
automatons in Ruby, starting with the simplest one we can conceive. We'll start
out with a deterministic finite-state automaton (DFSA). Such an automaton is
called deterministic, since it in any given state only has one possible
transition for a given input symbol.
&lt;/p&gt;
&lt;p&gt;
First we need an example language to work with, so I've created the
"Ruby-language". It can be described with the following regular expression:
@/Ru+by/@ (yes, DFSA's correspond to the languages that can be described by (pure)
regular expressions). I admit this is a quite boring language, but we have to
start somewhere, right? The alphabet for this language is the set {R,u,b,y}.
&lt;/p&gt;
&lt;p&gt;
To create an automaton for this language we need four states (visualize this as
a directed graph):
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
q0: 'R' -&amp;gt; q1
&lt;/li&gt;
&lt;li&gt;
q1: 'u' -&amp;gt; q2
&lt;/li&gt;
&lt;li&gt;
q2: 'u' -&amp;gt; q2, 'b' -&amp;gt; q3
&lt;/li&gt;
&lt;li&gt;
q3: 'y' -&amp;gt; q4

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The initial state is q0 and the set of final states is {q4}. As you can see
there is a cycle at q2 to allow for an (theoretically) infinite amount of 'u'
characters. Also note that there is no ambiguity of which state is the next one
at any given point for any given input. Hence, the automaton is deterministic.
&lt;/p&gt;
&lt;p&gt;
On to the implementation considerations. One of the most important design
decisions is how we should represent the state transitions. For a DFSA almost
anything would work, but we want to choose something flexible. Let's try with a
nested hash:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;{
 &lt;span style="color: #ad7fa8;"&gt;:q0&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"R"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt;},
 &lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"u"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q2&lt;/span&gt;},
 &lt;span style="color: #ad7fa8;"&gt;:q2&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"u"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q2&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;"b"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q3&lt;/span&gt;},
 &lt;span style="color: #ad7fa8;"&gt;:q3&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"y"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q4&lt;/span&gt;}
}
&lt;/pre&gt;




&lt;p&gt;
I think this will work quite well. If we look up a given state in the hash, we
will get another hash of all the possible transitions. Matching this up with a
input tape should be quite easy. I've sketched up a spec for how this should
work in practice:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;describe &lt;span style="color: #73d216;"&gt;"the Ruby-language"&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
  before(&lt;span style="color: #ad7fa8;"&gt;:each&lt;/span&gt;) &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
    &lt;span style="color: #fce94f;"&gt;@r&lt;/span&gt; = &lt;span style="color: #c17d11;"&gt;DFSA&lt;/span&gt;.new({
                    &lt;span style="color: #ad7fa8;"&gt;:q0&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"R"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt;},
                    &lt;span style="color: #ad7fa8;"&gt;:q1&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"u"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q2&lt;/span&gt;},
                    &lt;span style="color: #ad7fa8;"&gt;:q2&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"u"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q2&lt;/span&gt;, &lt;span style="color: #73d216;"&gt;"b"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q3&lt;/span&gt;},
                    &lt;span style="color: #ad7fa8;"&gt;:q3&lt;/span&gt; =&amp;gt; {&lt;span style="color: #73d216;"&gt;"y"&lt;/span&gt; =&amp;gt; &lt;span style="color: #ad7fa8;"&gt;:q4&lt;/span&gt;}
                  }, &lt;span style="color: #ad7fa8;"&gt;:q0&lt;/span&gt;, [&lt;span style="color: #ad7fa8;"&gt;:q4&lt;/span&gt;])
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;

  it &lt;span style="color: #73d216;"&gt;"should recognize valid sentences"&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
    &lt;span style="color: #fce94f;"&gt;@r&lt;/span&gt;.should recognize %w(&lt;span style="color: #c17d11;"&gt;R&lt;/span&gt; u b y)
    &lt;span style="color: #fce94f;"&gt;@r&lt;/span&gt;.should recognize %w(&lt;span style="color: #c17d11;"&gt;R&lt;/span&gt; u u u u b y)
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;

  it &lt;span style="color: #73d216;"&gt;"should reject invalid sentences"&lt;/span&gt; &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt;
    &lt;span style="color: #fce94f;"&gt;@r&lt;/span&gt;.should_not recognize %w(r u b y)
    &lt;span style="color: #fce94f;"&gt;@r&lt;/span&gt;.should_not recognize %w(&lt;span style="color: #c17d11;"&gt;R&lt;/span&gt; u b)
  &lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;/pre&gt;





&lt;p&gt;
Note that we give the input to the automaton as a list (I've picked the %w()
syntax since it feels kinda Lispy). This is called tokenization, and for now
we'll do it by hand. The second argument to the DFSA constructor is the symbol
for the initial state, and the third one is the set of final states. We won't
worry about the actual implementation yet, as we want to let this sink in for a
bit.
&lt;/p&gt;
&lt;p&gt;
The next article in this series will be to create a DSL for setting up the
automaton, then I'll write up on non-deterministic automatons and pushdown
automatons. I'll also show more actual code (I'll create a GitHub repos for the
automaton library). Possibly I'll get to transducers as well. If you have any
suggestions, please leave a comment or ship me an e-mail.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/As22Kdwcxi0" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2008/10/26/experimenting-with-automatons-in-ruby-%28part-1%29.html</feedburner:origLink></entry>
 
 <entry>
   <title>Use your .gitignore as the ignore pattern for echoe</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/wrNxkGR5-p8/use-your-.gitignore-as-the-ignore-pattern-for-echoe.html" />
   <updated>2008-08-09T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2008/08/09/use-your-.gitignore-as-the-ignore-pattern-for-echoe</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
Use your .gitignore as the ignore pattern for echoe
&lt;/p&gt;
&lt;p&gt;
Echoe is a library for quickly creating gems in Ruby. I I've hacked up a quick patch for it so you can use your .gitignore file as the manifest ignore pattern. I found it boring to re-list the ignore stuff since it in 99% of the cases (at least for me) already is present in .gitignore.
&lt;/p&gt;
&lt;p&gt;
I'm sure that the patch doesn't work perfectly though. I know there is differences between the globbing syntax in gitignore and in Ruby's File#fnmatch - the latter is stricter. But it still works perfectly for the (small) projects I've tried it on.
&lt;/p&gt;
&lt;p&gt;
Usage goes down like this:
&lt;/p&gt;



&lt;pre class="src src-ruby"&gt;&lt;span style="color: #c17d11;"&gt;Echoe&lt;/span&gt;.new(&lt;span style="color: #c17d11;"&gt;PROJECT&lt;/span&gt;) &lt;span style="color: #fcaf3e;"&gt;do&lt;/span&gt; |p|
  &lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;...
&lt;/span&gt;  p.ignore_pattern = &lt;span style="color: #c17d11;"&gt;FileList&lt;/span&gt;[&lt;span style="color: #73d216;"&gt;".gitignore"&lt;/span&gt;]
  &lt;span style="color: #888a85;"&gt;# &lt;/span&gt;&lt;span style="color: #888a85;"&gt;...
&lt;/span&gt;&lt;span style="color: #fcaf3e;"&gt;end&lt;/span&gt;
&lt;/pre&gt;




&lt;p&gt;
Grab it from my fork on GitHub.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;UPDATE:&lt;/b&gt; This feature is now included in echoe 3.0.2!
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/wrNxkGR5-p8" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2008/08/09/use-your-.gitignore-as-the-ignore-pattern-for-echoe.html</feedburner:origLink></entry>
 
 <entry>
   <title>The lack of Database Abstraction in PHP</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/sUyykTyajFM/the-lack-of-database-abstraction-in-php.html" />
   <updated>2008-07-21T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2008/07/21/the-lack-of-database-abstraction-in-php</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Unfortunately, almost none of the most popular PHP software supports other
databases than MySQL (with MediaWiki being a notable exception - it supports
Postgres). When you're used to programming in Ruby, multi-db compatibility is
something you just take for granted after a while because of the excellent
ActiveRecord and DataMapper projects. In PHP however, this is a real deal
breaker. I don't know if its a cultural problem or a library problem. I did look
at Propel some time ago, but honestly the Java-esque XML configuration and
over-complex API turned me off real quick. If someone could come up with
something better, maybe even WordPress will support SQLite and PostgreSQL one
day&amp;hellip;
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/sUyykTyajFM" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2008/07/21/the-lack-of-database-abstraction-in-php.html</feedburner:origLink></entry>
 
 <entry>
   <title>Arch Linux: First impressions</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/jYI5eIlptYo/arch-linux%3A-first-impressions.html" />
   <updated>2008-06-02T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2008/06/02/arch-linux:-first-impressions</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
So, I finally got fed up with Ubuntu. I really wanted to use FreeBSD again - but
unfortunately the hardware in this box is not compatible. Arch Linux looked like
a decent alternative so I downloaded the 2007.08-2 image and started
installing. Misfortune struck again as I had to spend a couple of hours trying
to get wireless working, but everything worked well as soon as I switched to the
2008.04-RC image. I wonder why they don't link to the RC image on the "Get Arch"
page.
&lt;/p&gt;
&lt;p&gt;
After some configuration I ended up with a really slick system - It's amazing
how much faster stuff runs on OpenBox! Also, the BSD inspired rc.conf and init
system made my day. The only real problem I encountered was when I tried to
install an older version of a library. Pacman (Arch's package manager) doesn't
support this. I consider this to be a flaw in the package manager (which all
over feels immature compared to apt or BSD ports), and I predict the devs will
realize this sooner or later - even though they currently consider it to be a
"feature".
&lt;/p&gt;
&lt;p&gt;
I find it amusing how things tend to move in cycles. When I started out with
Linux ~8 years ago Slackware was the coolest thing around. Then we somehow ended
up with Ubuntu. And now the "KISS"-distros are turning into the hippest kids on
the block again. If you're fed up with the bloat, give Arch a try. :)
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/jYI5eIlptYo" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2008/06/02/arch-linux%3A-first-impressions.html</feedburner:origLink></entry>
 
 <entry>
   <title>Public domain?</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/_LzNeRDlI0o/public-domain%3F.html" />
   <updated>2007-12-06T00:00:00+01:00</updated>
   <id>http://chrononaut.net/2007/12/06/public-domain?</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
I'm currently reading "Fundamentals of database systems" by Elmasri &amp;amp; Navathe as
part of the curriculum in a database course at my University. The book overall
isn't all that bad, but their take on open source databases is really
horrid. Quote:
&lt;/p&gt;
&lt;blockquote&gt;

&lt;p&gt;"Personal computers and database system-like software products such as
Excel, Visual FoxPro, Access (Microsoft), or SQL Anywhere (Sybase), and
public domain products such as MySQL and PostgreSQL are being heavily
utilized by users who previously belonged to the category of casual and
occasional database users."
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;
Wow. Public domain? I think they should at least invest two minutes to read up
about open source software and open source licences, before they wrote about
it. Excel and PostgreSQL in the same sentence? That's pretty fucked up if you
ask me. And they have this highly patronizing tone which goes something like
"commercial dbms &amp;gt; *, lol!". Someone should ship the authors a copy of
PostgreSQL, I'm sure they would've been amazed if they tried it.
&lt;/p&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/_LzNeRDlI0o" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2007/12/06/public-domain%3F.html</feedburner:origLink></entry>
 
 <entry>
   <title>Leopard: First impressions</title>
   <link href="http://feedproxy.google.com/~r/chrononaut/~3/EioueMuz7aA/leopard%3A-first-impressions.html" />
   <updated>2007-10-27T00:00:00+02:00</updated>
   <id>http://chrononaut.net/2007/10/27/leopard:-first-impressions</id>
   <content type="html">


&lt;div class="outline-text-2" id="text-1"&gt;

&lt;p&gt;
Alright, so Leopard has arrived! On Friday I wiped the harddrive of my MacBook
and eagerly installed my new OS. In this post I will present some of my thoughts
about it, based a couple of days usage.
&lt;/p&gt;
&lt;p&gt;
The good:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
It's very convenient that so much quality software ships with the OS. Built-in svn is nice even tho I prefer Git, since a lot of projects use it. I really wanted the Ruby support to be good. But it turned out that I pretty quickly had to change it with a custom install via MacPorts. The built in Ruby simply refused to install the ruby-postgres gem. I gave the exact same params to extconf.rb with the custom Ruby in place, and it just worked. I had to install PostgreSQL 8.2 from source by the way, since the port for it is broken at the moment. Its still very nice that the OS ships with a up to date Ruby tho.
&lt;/li&gt;
&lt;li&gt;
Spaces are cool, even tho I don't like everything about their behavior. I really want to disable the animated gliding that occurs when you change between spaces.
&lt;/li&gt;
&lt;li&gt;
The new finder feels much better to use.
&lt;/li&gt;
&lt;li&gt;
Safari have gotten a bunch of updates as well, I especially like the new search function.
&lt;/li&gt;
&lt;li&gt;
Its faster than Tiger.

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The bad:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Transparency which you cant turn off. God, I hate transparent windows.
&lt;/li&gt;
&lt;li&gt;
The new terminal isn't as good as expected. I switched back to iTerm pretty quickly.
&lt;/li&gt;
&lt;li&gt;
The new dock is way too heavy on the eye candy for my taste.

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The ugly:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
A lot of port breakage, but thats to be expected I guess. And most of them
get fixed really quick.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/chrononaut/~4/EioueMuz7aA" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://chrononaut.net/2007/10/27/leopard%3A-first-impressions.html</feedburner:origLink></entry>
 

</feed>
