<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Caffeinated Code</title>
	<atom:link href="http://caffeinatedcode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://caffeinatedcode.wordpress.com</link>
	<description></description>
	<pubDate>Thu, 12 Jun 2008 08:04:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>Extending SML&#8217;s lists</title>
		<link>http://caffeinatedcode.wordpress.com/2008/06/12/extending-smls-lists/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/06/12/extending-smls-lists/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 08:04:14 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[functional]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[sml]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=19</guid>
		<description><![CDATA[I&#8217;ve been busy working on a project in SML/NJ, and in the process I ended up writing a few generic list functions. I&#8217;ve extracted these into a separate module, and I&#8217;m putting it up here. Warning: These are just quick hacks (but they work (I think!)), and not all of them will be useful outside [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve been busy working on a project in <a href="http://www.smlnj.org/">SML/NJ</a>, and in the process I ended up writing a few generic list functions. I&#8217;ve extracted these into a separate module, and I&#8217;m putting it up here. Warning: These are just quick hacks (but they work (I think!)), and not all of them will be useful outside of my project.</p>
<p>Briefly, here&#8217;s what this contains:<br />
A specialized version of foldl, a join function similair to Ruby&#8217;s, list generating functions and range functions, map and app functions that also pass in the index of the element, and a special kind of cross product function.</p>
<p>Anyway here goes (sorry for the meaningless syntax highlighting, SML/NJ is of course not supported by the WordPress sourcecode plugin):</p>
<pre name="code" class="ruby">

structure ListExtension = struct
  exception InvalidArgument of string;

  (*
  * folds left across a list, applying a binary function pairwise to its members.
  * Eg, foldLeft f [a,b,c] = f(f(a,b),c);
  *)
  fun foldLeft f [] = raise InvalidArgument &quot;Empty list to foldLeft&quot;
    |foldLeft f (h::[]) = h
    |foldLeft f (h::t) = foldl (fn (a,b) =&amp;gt; f (b,a)) h t

  (*
  * &#039;joins&#039; a list into a string, converting each member into a string by the
  * given function, and interspersing the given string
  *)
  local
    fun join_aux s f (h::t) res =
        if res = &quot;&quot; then
          join_aux s f t (f h)
        else
          join_aux s f t (res ^ s ^ (f h))
      |join_aux s f [] res = res
  in
    fun join s f h = join_aux s f h &quot;&quot;
  end

  (*
  * Convenience function when the conversion is identity
  * eg joinString &quot;+&quot; [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;] = &quot;a+b+c&quot;
  *)
  fun joinString s h = join s (fn a =&amp;gt; a) h

  (*
  * List generators.
  *)
  local
    fun step_aux n inc lim f l =
      if (inc &gt; 0 andalso n &gt; lim) orelse
         (inc &lt; 0 andalso n &lt; lim) orelse
         (inc = 0) then
        l
      else
        step_aux (n + inc) inc lim f ((f n)::l)
  in
    fun step start fin inc f =
      if start &lt;= fin then
        List.rev (step_aux start inc fin f [])
      else
         List.rev (step_aux start (~inc) fin f [])
  end

  fun downfrom n f = step n 0 1 f
  fun upto n f = step 0 n 1 f
  fun fromto start fin f = step start fin 1 f

  fun range from to = ste from to 1 (fn i =&gt; i)
  fun rangeStep from to inc = step from to inc (fn i =&gt; i)

  (*
  * Map with index. Same as List.map, but also passes in the index as an
  * argument to the given function
  *)
  local
    fun mapi_aux f [] i res = (List.rev res)
      |mapi_aux f (h::t) i res = mapi_aux f t (i+1) (f (i,h)::res)
  in
    fun mapi f l = mapi_aux f l 0 []
  end

  (*
  * app with index. Same as List.app, but also passes in the index as an
  * argument to the given function
  *)
  local
    fun appi_aux f [] i = ()
      |appi_aux f (h::t) i = (f (i, h); appi_aux f t (i+1))
  in
    fun appi f l = appi_aux f l 0
  end

  (*
  * Applies the function f to each element of the cross product of the two
  * lists.
  * f(a,b) is discarded if it is NONE, if it is SOME(c) then c is added to the result
  *)
  local
    fun crossProduct_aux f (h::t) l result =
      crossProduct_aux f t l ((List.mapPartial (f h) l) @ result)
      |crossProduct_aux f [] l result = result
  in
    fun crossProduct f (a, b) = crossProduct_aux f (List.rev a) b []
  end
end
</pre>
<p>Suggestions/ additions are welcome of course.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=19&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/06/12/extending-smls-lists/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu hardy upgrade problems</title>
		<link>http://caffeinatedcode.wordpress.com/2008/04/27/ubuntu-hardy-upgrade-problems/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/04/27/ubuntu-hardy-upgrade-problems/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 07:13:19 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=18</guid>
		<description><![CDATA[I got hardy yesterday, and the upgrade wasn&#8217;t without problems. I&#8217;m posting my solutions here: hopefully they&#8217;ll help someone else.
Nvidia
First, Ubuntu wouldn&#8217;t let me upgrade, saying &#8220;Couldn&#8217;t calculate upgrade&#8221;. A peek at the logs (at /var/log/dist_upgrade/) revealed that this was because of nvidia-glx. It needed to be removed (because there is now a nvidia-glx-new), but [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I got hardy yesterday, and the upgrade wasn&#8217;t without problems. I&#8217;m posting my solutions here: hopefully they&#8217;ll help someone else.</p>
<h1><font size="3">Nvidia</font></h1>
<p>First, Ubuntu wouldn&#8217;t let me upgrade, saying <i>&#8220;Couldn&#8217;t calculate upgrade&#8221;</i>. A peek at the logs (at /var/log/dist_upgrade/) revealed that this was because of <i>nvidia-glx</i>. It needed to be removed (because there is now a <i>nvidia-glx-new</i>), but it was in the removal blacklist. So I thought I&#8217;d do this manually. I removed <i>nvidia-glx</i> and installed <i>nvidia-glx-new</i> with apt, and then tried upgrading again.<br />
I consider this a bug in the upgrade system. The installer should at least tell me that this might be the issue, and that I should consider changing my drivers, because if I hadn&#8217;t known about the existence of nvidia-glx-new, the log alone would have been of no use.</p>
<p>Ok, having done that I tried dist-upgrade&#8217;ing again. This time it looked like it was going to work. But then it threw up errors about nvidia-glx-new, and every single xorg package. I tried reinstalling nvidia-glx-new, but dpkg didn&#8217;t let me (I kept getting <i>&#8220;subprocess post-removal script returned error exit status 2&#8243;</i>). Google led me to this:<br />
<code><br />
sudo dpkg-divert &#8211;remove /usr/X11R6/lib/libGL.so.1<br />
sudo dpkg-divert &#8211;remove /usr/X11R6/lib/libGL.so.1.2<br />
sudo dpkg-divert &#8211;remove /usr/lib/xorg/modules/libGLcore.so<br />
</code><br />
However dpkg-divert gave me <i>&#8220;No such file or directory&#8221;</i> for each of the libgGL&#8217;s. After some headscratching, I realized the reason was that there was no &#8216;lib&#8217; directory in &#8216;/usr/X11R6&#8242;. So a <b>&#8216;mkdir /usr/X11R6/lib&#8217;</b> and then dpkg-divert &#8211;remove fixed the problem.<br />
I still don&#8217;t understand how this happened in the first place - I&#8217;m just happy I got it to work.</p>
<h1><font size="3">Terminal Fonts</font></h1>
<p>After hardy was installed I noticed that my Terminal had stopped antialiasing its fonts. Here&#8217;s the fix:<br />
<code><br />
cd /etc/fonts/conf.d<br />
sudo rm 10-hinting-medium.conf<br />
sudo rm 10-no-sub-pixel.conf<br />
sudo ln -s ../conf.avail/10-hinting-full.conf<br />
sudo ln -s ../conf.avail/10-sub-pixel-rgb.conf<br />
</code></p>
<h1><font size="3">Firefox</font></h1>
<p>Now my one remaining gripe is with Firefox. ff3b5 is <i>highly</i> unstable for me. I used Beta 4 up until now, and that worked just great. beta 5 has crashed on me 4 times just while writing this blog post! (although that&#8217;s an extreme case.. it isn&#8217;t that bad normally).<br />
However, I may have found a solution. I&#8217;m beginning to think its firebug that&#8217;s causing the crashes, but I&#8217;m not sure yet. Any other ideas?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=18&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/04/27/ubuntu-hardy-upgrade-problems/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Haskell ? : The ternary operator</title>
		<link>http://caffeinatedcode.wordpress.com/2008/04/11/haskell-the-ternary-operator/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/04/11/haskell-the-ternary-operator/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 12:04:13 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[Haskell]]></category>

		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=17</guid>
		<description><![CDATA[
? :: Bool -&#62; (t, t) -&#62; t
a ? (b, c) = if a then b else c

And there you have the Haskell ternary operator. Nice syntax, and lazy evaluation means that only one of b or c is ever evaluated!
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><code><br />
? :: Bool -&gt; (t, t) -&gt; t<br />
a ? (b, c) = if a then b else c<br />
</code><br />
And there you have the Haskell ternary operator. Nice syntax, and lazy evaluation means that only one of b or c is ever evaluated!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=17&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/04/11/haskell-the-ternary-operator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple Javascript Progress Bar</title>
		<link>http://caffeinatedcode.wordpress.com/2008/04/08/simple-javascript-progress-bar/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/04/08/simple-javascript-progress-bar/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 09:39:13 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=15</guid>
		<description><![CDATA[Here&#8217;s a quick and obvious-in-hindsight progress bar that I created while working on a project:


&#60;div id=&#34;progress&#34; style=&#34;border: 1px solid black;&#34;&#62;
  &#60;div style=&#34;background-color:green; width:50%&#34;&#62;&#38;nbsp;&#60;/div&#62;
&#60;/div&#62;

Now just use Javascript to change the width of the inner div!
Of course there can be any number of variations on this theme. For example, a repeating background-image can give a nice [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here&#8217;s a quick and obvious-in-hindsight progress bar that I created while working on a project:</p>
<pre name="code" class="html">

&lt;div id=&quot;progress&quot; style=&quot;border: 1px solid black;&quot;&gt;
  &lt;div style=&quot;background-color:green; width:50%&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Now just use Javascript to change the width of the inner div!</p>
<p>Of course there can be any number of variations on this theme. For example, a repeating background-image can give a nice effect. </p>
<p>Or how about a discrete bar instead with say, five stars? Just use five image tags, then if you have these image elements in the array &#8217;stars&#8217;:</p>
<pre name="code" class="javascript">

progress = Math.round (progress/20); //progress was a percentage
for (i =0; i &lt; progress; i++) stars[i].src = &quot;filled_star.gif&quot;;
for (i = progress; i &lt; 5; i++) stars[i].src = &quot;empty_star.gif&quot;;
</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=15&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/04/08/simple-javascript-progress-bar/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A look at Gobo Linux</title>
		<link>http://caffeinatedcode.wordpress.com/2008/03/26/a-look-at-gobo-linux/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/03/26/a-look-at-gobo-linux/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 13:58:59 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=12</guid>
		<description><![CDATA[I came across an interesting Linux distro today, called GoboLinux. Gobo brings about a radical change in the way your filesystem is organized. Instead of having your programs scattered all over, Gobo organizes the filesystem in a much more sane manner (because lets face it, there may be a method to the madness that is [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I came across an interesting Linux distro today, called <a href="http://www.gobolinux.org">GoboLinux</a>. Gobo brings about a radical change in the way your filesystem is organized. Instead of having your programs scattered all over, Gobo organizes the filesystem in a much more sane manner (because lets face it, there may be a <a href="http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard">method</a> to the madness that is the Linux filesystem, but for most purposes, it&#8217;s still madness). In Gobo, doing an <span style="background-color:#BD934F;color:#222222;">&nbsp;ls /&nbsp;</span> will give you:<br />
<code><br />
Programs<br />
Users<br />
System<br />
Files<br />
Mount<br />
Depot<br />
</code><br />
You can easily tell whats going to be where. For example the <span style="background-color:#BD934F;color:#222222;">/Programs</span> directory has&#8230; well all your Programs! But the best part is, if you had two versions of Foo, they&#8217;d be in <span style="background-color:#BD934F;color:#222222;">/Programs/Foo/1.0/</span> and <span style="background-color:#BD934F;color:#222222;">/Programs/Foo/2.0/</span>. In effect, <i>the filesystem is now your package manager</i>. Thats a really cool way of looking at package management. You install a program into <span style="background-color:#BD934F;color:#222222;">/Programs</span> (Gobo comes with a nice path-agnostic compilation system called &#8220;Compile&#8221;), and then if you want to uninstall, just delete its directory. Want to know which program a file &#8220;belongs&#8221; to? That&#8217;s natural as well, with this hierarchy.</p>
<p>Of course everything cannot possibly be so simple, and Gobo has an uglier side. First of course, the filesystem-as-package-manager cannot by itself deal with dependencies. Compile handles dependencies, but if you&#8217;re going to slap a package manager on top anyway, then you&#8217;ve lost some of the elegance you gained with this new filesystem hierarchy.</p>
<p>What&#8217;s worse is that Gobo needs to litter all the directories with symlinks to handle shared files, etc. What&#8217;s <i>even</i> worse is that Gobo still maintains the the traditional hierarchy alongside the new one! Without it, they would go straight to compatibility hell. So they still have /usr and friends, but these are now symlinks to their Gobo counterparts. They&#8217;ve even made a kernel extension (called GoboHide) to hide this ugly underbelly from your eyes (GoboHide is not strictly required, it&#8217;s only for hiding the traditional hierarchy).</p>
<p>I can&#8217;t help get the feeling that I&#8217;ve been sent back to square one :). Of course, that&#8217;s not really true, and my gripes are aesthetic more than anything else. Gobo really has done something pretty innovative. But wouldn&#8217;t it have been easier to just use <a href="http://fuse.sourceforge.net/">fuse</a> to achieve the same goal? Don&#8217;t touch the filesystem hierarchy, don&#8217;t make a new distro, just make a filesystem with fuse, that acts as a different &#8220;view&#8221; of all your files. </p>
<p>I admit I haven&#8217;t thought too much about it, but it seems possible to extend this to a package manager that would masquerade as a filesystem. You would certainly be able to get the <span style="background-color:#BD934F;color:#222222;">/Programs</span> coolness, and an <span style="background-color:#BD934F;color:#222222;">rm -rf /Programs/Foo/1.0</span>, would uninstall version 1.0 of Foo. You might even be able to manage dependencies within the confines of the filesystem-as-package-manager paradigm. On the other hand, it could just be a hook into an existing package manager, and still provide many of the advantages of Gobo. Food for thought, and perhaps for an interesting project at some point in the future!</p>
<p>As far as Gobo itself goes, I think its great that they&#8217;ve done something so innovative, and I wish them luck. Only problem is, a nicer filesystem hierarchy is not by itself a strong enough motivation to switch distros (especially since I&#8217;m perfectly happy with my package manager). Maybe as Gobo matures it&#8217;ll be worth looking at again.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=12&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/03/26/a-look-at-gobo-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mumble your tests!</title>
		<link>http://caffeinatedcode.wordpress.com/2008/02/22/mumble-your-tests/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/02/22/mumble-your-tests/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 09:04:23 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=7</guid>
		<description><![CDATA[
I&#8217;ve been working on a rails project, and in some screen cast, I saw autotest+growl and fell in love. I googled a bit for a Linux version of growl, and I found Mumbles. There was no built in autotest support, so I hacked around, extended the Mumbles dbus interface just a little, and then made [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href='http://caffeinatedcode.files.wordpress.com/2008/03/screenshot.png' title='mumbles screenshot'><img align='right' src='http://caffeinatedcode.files.wordpress.com/2008/03/screenshot.png' alt='mumbles screenshot' /></a><br />
I&#8217;ve been working on a rails project, and in some screen cast, I saw autotest+growl and fell in love. I googled a bit for a Linux version of growl, and I found <a href="http://mumbles-project.org">Mumbles</a>. There was no built in autotest support, so I hacked around, extended the Mumbles dbus interface just a little, and then made a simple autotest hook that uses Mumbles.</p>
<p>Until the author commits my patch to his repository, you can get my patched version as a tarball here: <a href='http://caffeinatedcode.files.wordpress.com/2008/02/mumbles1.jpg' title='Mumbles Patched'>Mumbles patched</a> (its a bziped tarball, not a jpeg file - wordpress limitations, so right-click and save as)</p>
<p>And here&#8217;s the autotest plugin:</p>
<pre name="code" class="ruby">

require &#039;dbus&#039;

def send_message(title, message, icon)
  begin
    bus = DBus::SessionBus.instance
    mumbles_service = bus.service(&quot;org.mumblesproject.Mumbles&#038;quot <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
    mumbles = mumbles_service.object(&quot;/org/mumblesproject/Mumbles&#038;quot <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
    mumbles.introspect
    mumbles_iface = mumbles[&quot;org.mumblesproject.Mumbles&quot;]
    sig = mumbles_iface.signals[&quot;Notify&quot;]
    bus.emit(mumbles_service, mumbles, mumbles_iface, sig, title, message, icon)
  rescue Exception =&gt; e
  end
end

Autotest.add_hook :ran_command do |at|
   begin
     output = at.results.last.slice(/(\d+) examples?, (\d+) failures?(, \d+ pending)?/)
     if output =~ /.*[1-9] failure.*/ then
       send_message(&quot;FAIL&quot;, &quot;#{output}&quot;, &quot;fail.png&#038;quot <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
     else
       send_message(&quot;PASS&quot;, &quot;#{output}&quot;, &quot;pass.png&#038;quot <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
     end
  rescue Exception =&gt; e
  end
end
</pre>
<p>You&#8217;ll need the ruby-dbus library which you can get <a href='https://trac.luon.net/ruby-dbus/'>here</a></p>
<p>*Update:* surrounded the hook with begin rescue. Without this, autotest would crash if I had a syntax error in my spec, because at.result.last would be nil</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=7&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/02/22/mumble-your-tests/feed/</wfw:commentRss>
	
		<media:content url="http://caffeinatedcode.files.wordpress.com/2008/03/screenshot.png" medium="image">
			<media:title type="html">mumbles screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>chwnd!</title>
		<link>http://caffeinatedcode.wordpress.com/2008/02/19/chwnd/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/02/19/chwnd/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 19:30:32 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[bash]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=6</guid>
		<description><![CDATA[I did something incredibly stupid.
I wanted to do this:


sudo chown &#60;me&#62; somedir/*

Instead, I did this:


sudo chown &#60;me&#62; /*

Oops! I realised what was happening, and Ctrl+C&#8217;d. When I tried to put things back to normal, I realised i couldn&#8217;t sudo. sudo gave me some error about /etc/sudoers having the wrong uid. It turns out this was [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I did something incredibly stupid.<br />
I wanted to do this:</p>
<pre name="code" class="cpp">

sudo chown &lt;me&gt; somedir/*
</pre>
<p>Instead, I did this:</p>
<pre name="code" class="cpp">

sudo chown &lt;me&gt; /*
</pre>
<p>Oops! I realised what was happening, and Ctrl+C&#8217;d. When I tried to put things back to normal, I realised i couldn&#8217;t sudo. sudo gave me some error about /etc/sudoers having the wrong uid. It turns out this was because /etc/sudoers was one of the things that got chowned before I stopped chowning things.</p>
<p>So if you&#8217;re ever in such a situation, here&#8217;s what you do:<br />
In ubuntu, simply boot into recovery mode, with other distros, you may have to manually log in as root. Then chown your sudoers, and anything else that you messed up and reboot.</p>
<p>What I did was simply this:</p>
<pre name="code" class="cpp">

chown -R root:root /bin
chown -R root:root /boot
chown -R root:root /etc
</pre>
<p>Those being the only three dirs affected. However, there may have been files that <strong>should</strong> belong to me and shouldn&#8217;t be chowned to root (there weren&#8217;t in this case, but if I hadn&#8217;t Ctrl+C&#8217;d fast enough, there would have been such files). So really, I should be checking for files with me as owner, but root as the group, and then only chowning those. In which case the following <em>might</em> be a better way (might because its untested)</p>
<pre name="code" class="cpp">

ls -Rl / | grep &quot;&lt;yourusername&gt;[[:space:]]root&quot;  | awk &#039;{print $8}&#039; | xargs chown -R root:root
</pre>
<p>Of course this wont work if you have spaces in your filenames. Just change the awk part appropriately (it&#8217;ll end up uglier!)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=6&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/02/19/chwnd/feed/</wfw:commentRss>
		</item>
		<item>
		<title>bash fun: alarm clock</title>
		<link>http://caffeinatedcode.wordpress.com/2008/02/08/bash-fun-alarm-clock/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/02/08/bash-fun-alarm-clock/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 10:56:06 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[bash]]></category>

		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/?p=5</guid>
		<description><![CDATA[Over time I&#8217;ve become immune to most kinds of alarm clocks. The only thing loud enough to wake me is music coming from my 5.1 speakers. But I&#8217;m really particular about what I want to wake up listening to, and it can&#8217;t be the same song every day. So, I came up with this thing:


#!/bin/bash
function [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Over time I&#8217;ve become immune to most kinds of alarm clocks. The only thing loud enough to wake me is music coming from my 5.1 speakers. But I&#8217;m really particular about what I want to wake up listening to, and it can&#8217;t be the same song every day. So, I came up with this thing:</p>
<pre name="code" class="cpp">

#!/bin/bash
function createAlarm
{
  command=&quot;gst-launch-0.10 playbin uri=\&quot;file://&quot;$1&quot;\&quot;&quot;
  echo ${2}&quot; &quot;${3}&quot; * * * &quot;${command}|crontab -
}
if [ -z &quot;$1&quot; ]; then
  echo Usage: $0 &quot; &quot;
  exit
fi

if [ -z &quot;$2&quot; ]; then
  min=00
else
  min=$2
fi
if [ -z &quot;$3&quot; ]; then
  hr=07
else
  hr=$3
fi

pattern=$(echo &quot;$1&quot; |sed -r -e &#039;s/\s/*/g&#039; -e &#039;s/.*/*&amp;*/&#039 <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> 

IFS=$&#039;\n&#039;
declare -a results
results=($(find -H ~/Music/ -iname &quot;$pattern&quot; -printf &quot;%p\n%f\n&quot;))

if [ ${#results} -eq 0 ]; then
  echo &quot;No results&quot;
  exit;
elif [${#results} = 2]; then
  #dont show menu
  createAlarm ${results[0]} $min $hr
else
  for i in `seq 1 2 ${#results[*]}`
  do
    echo $((($i+1)/2))&#038;quot <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> &quot;${results[i]}$&#039;\n&#039;
  done
  echo -n &quot;select# &quot;
  read i
  createAlarm ${results[$(($i*2-2))]} $min $hr
fi
</pre>
<p>It searches through my music based on the keywords I give, then it creates a crontab which uses gstreamer to play the song. Incredibly useful, and much faster than navigating a GUI to find a song, set a time, etc like I used to do before. Try it!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=5&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/02/08/bash-fun-alarm-clock/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing Ubuntu</title>
		<link>http://caffeinatedcode.wordpress.com/2008/01/21/installing-ubuntu/</link>
		<comments>http://caffeinatedcode.wordpress.com/2008/01/21/installing-ubuntu/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 10:27:00 +0000</pubDate>
		<dc:creator>hellfeuer</dc:creator>
		
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://caffeinatedcode.wordpress.com/2008/01/21/installing-ubuntu/</guid>
		<description><![CDATA[
As I clap my hands,
with the echoes, it begins to dawn&#8211;
the summer moon.
-Basho 
I finally made the decision to install Ubuntu. I had been running it off VMWare for really long, but I always knew I had to switch eventually. After several long hourse of defragmentation (with 3 different defragmenters!) I finally managed to get [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://bp2.blogger.com/_W8jbJkWStIk/R5SCqRvLJfI/AAAAAAAAA0k/rStDYNDPPb4/s1600-h/jaustin_saturated_full_logo_021_trans.png"><img src="http://bp2.blogger.com/_W8jbJkWStIk/R5SCqRvLJfI/AAAAAAAAA0k/rStDYNDPPb4/s320/jaustin_saturated_full_logo_021_trans.png" style="float:left;cursor:pointer;width:314px;height:92px;margin:0 10px 10px 0;" border="0" /></a></p>
<div style="text-align:right;"><span style="font-style:italic;font-family:times new roman,times;font-size:85%;"><span style="font-family:Comic Sans MS;">As I clap my hands,<br />
with the echoes, it begins to dawn&#8211;<br />
the summer moon.<br />
-Basho </span></span></div>
<p><span style="font-family:arial;"><span style="font-size:100%;">I finally made the decision to install Ubuntu. I had been running it off VMWare for really long, but I always knew I had to switch eventually. After several long hourse of defragmentation (with 3 different defragmenters!) I finally managed to get the Vista disk manager to shrink my partition enough to get myself a measly 8 Gb of space.</span></span><span style="font-size:100%;"></span></p>
<p><span style="font-family:arial;font-size:100%;">Anyway installation was no problem, what I really wanted to do was restore my system as it used to be on VMWare. <a href="http://linuxmint.com/wiki/index.php/Remastersys">Remastersys</a> seemed perfect, but sadly didn&#8217;t work for me. The author was really helpful, but given the amount of time I had spent defragging, I was way too impatient to wait for a fix. There are other ways to duplicate your system, but they involve re-downloading all your packages anyway, so I decided to do it manually.</span><span style="font-size:100%;"> </span><span style="font-family:arial;font-size:100%;"></span></p>
<p>By the time everything was ready it was really late and I was exhausted. Still, <span style="font-size:100%;"><span style="font-family:arial;">I feel an irresistible urge to tweak things. Also I need to launch a hunt for alternatives to some of the Windows only programs I had gotten used to. There goes the rest of the week!</span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/caffeinatedcode.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/caffeinatedcode.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/caffeinatedcode.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/caffeinatedcode.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/caffeinatedcode.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/caffeinatedcode.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/caffeinatedcode.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/caffeinatedcode.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/caffeinatedcode.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/caffeinatedcode.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/caffeinatedcode.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/caffeinatedcode.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=caffeinatedcode.wordpress.com&blog=2642107&post=4&subd=caffeinatedcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://caffeinatedcode.wordpress.com/2008/01/21/installing-ubuntu/feed/</wfw:commentRss>
	
		<media:content url="http://bp2.blogger.com/_W8jbJkWStIk/R5SCqRvLJfI/AAAAAAAAA0k/rStDYNDPPb4/s320/jaustin_saturated_full_logo_021_trans.png" medium="image" />
	</item>
	</channel>
</rss>