<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns: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:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Erlends hjem i skyene</title>
	
	<link>http://hamberg.no/erlend</link>
	<description>p = &amp;p;</description>
	<lastBuildDate>Sun, 05 Sep 2010 15:29:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/erlend" /><feedburner:info uri="erlend" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Tur til Estenstadmarka</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/uzPRpc3ceGY/</link>
		<comments>http://hamberg.no/erlend/2010/09/05/tur-til-estenstadmarka/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 15:28:14 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[erlends spennende liv]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1160</guid>
		<description><![CDATA[I finværet i dag gikk vi en tur til Estenstadmarka. My Tracks logget turen vår, og jeg tok også noen bilder: View Tur til Estenstadmarka in a larger map]]></description>
			<content:encoded><![CDATA[<p>I finværet i dag gikk vi en tur til Estenstadmarka. <a href="http://mytracks.appspot.com/">My Tracks</a> logget turen vår, og jeg tok også noen bilder:</p>
<p><iframe width="475" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;t=p&amp;msa=0&amp;msid=114808987111412411743.00048f846dca4fda841b8&amp;ll=63.402053,10.446796&amp;spn=0.030743,0.081367&amp;z=13&amp;output=embed"></iframe><br /><small>View <a href="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;t=p&amp;msa=0&amp;msid=114808987111412411743.00048f846dca4fda841b8&amp;ll=63.402053,10.446796&amp;spn=0.030743,0.081367&amp;z=13&amp;source=embed" style="color:#0000FF;text-align:left">Tur til Estenstadmarka</a> in a larger map</small></p>
<p><a href="http://www.flickr.com/photos/ehamberg/4959929501/" title="Wheat by ehamberg, on Flickr"><img src="http://farm5.static.flickr.com/4116/4959929501_e4973db610_m.jpg" width="240" height="180" alt="Wheat" /></a></p>
<p><a href="http://www.flickr.com/photos/ehamberg/4959944489/" title="Estenstaddammen by ehamberg, on Flickr"><img src="http://farm5.static.flickr.com/4106/4959944489_a04d2417e7.jpg" width="240" height="180" alt="Estenstaddammen" /></a></p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/uzPRpc3ceGY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/09/05/tur-til-estenstadmarka/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/09/05/tur-til-estenstadmarka/</feedburner:origLink></item>
		<item>
		<title>Mitosis Animation</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/PjIJXxHFPw8/</link>
		<comments>http://hamberg.no/erlend/2010/05/11/mitosis-animation/#comments</comments>
		<pubDate>Tue, 11 May 2010 10:22:12 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[usortert]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1126</guid>
		<description><![CDATA[While studying for a biology class I came over the following gem and just had to share. Cute and educational!]]></description>
			<content:encoded><![CDATA[<p>While studying for a biology class I came over the following gem and just had to share. Cute <strong>and</strong> educational! <img src='http://hamberg.no/erlend/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube-nocookie.com/v/a3ogvCIbBqY&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube-nocookie.com/v/a3ogvCIbBqY&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/PjIJXxHFPw8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/05/11/mitosis-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/05/11/mitosis-animation/</feedburner:origLink></item>
		<item>
		<title>Vector Drawing is fun!</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/sEh9MMe8JHI/</link>
		<comments>http://hamberg.no/erlend/2010/05/10/vector-drawing-is-fun/#comments</comments>
		<pubDate>Mon, 10 May 2010 14:48:55 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[usortert]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1123</guid>
		<description><![CDATA[Ever since I discovered vector graphics I have loved to draw simple illustraions, so whenever I come over a Wikipedia page which lacks a simple, illustrative figure I try to make one. Today I added an illustration to the Wikipedia page on ploidy: Earlier illustrations include (low-res versions, click for full size): The illustrations are]]></description>
			<content:encoded><![CDATA[<p>Ever since I discovered vector graphics I have loved to draw simple illustraions, so whenever I come over a Wikipedia page which lacks a simple, illustrative figure I try to make one.</p>
<p>Today I added an illustration to the Wikipedia page on <a title="Wikipedia: Ploidy" href="http://en.wikipedia.org/wiki/Ploidy">ploidy</a>:</p>
<div class="wp-caption aligncenter" style="width: 210px"><a href="http://en.wikipedia.org/wiki/File:Haploid_vs_diploid.svg"><img title="Haploid_vs_diploid.svg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Haploid_vs_diploid.svg/200px-Haploid_vs_diploid.svg.png" alt="Haploid_vs_diploid.svg" width="200" height="470" /></a><p class="wp-caption-text">Haploid vs diploid.svg</p></div>
<p><span id="more-1123"></span>Earlier illustrations include (low-res versions, click for full size):</p>
<div class="wp-caption aligncenter" style="width: 210px"><a href="http://commons.wikimedia.org/wiki/File:Virtual_memory.svg"><img title="Virtual_memory.svg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Virtual_memory.svg/200px-Virtual_memory.svg.png" alt="Virtual_memory.svg" width="200" height="283" /></a><p class="wp-caption-text">Virtual memory.svg</p></div>
<div class="wp-caption aligncenter" style="width: 510px"><a href="http://commons.wikimedia.org/wiki/File:Alfa_beta_gamma_radiation_penetration.svg"><img title="Alfa_beta_gamma_radiation_penetration.svg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/61/Alfa_beta_gamma_radiation_penetration.svg/500px-Alfa_beta_gamma_radiation_penetration.svg.png" alt="Alfa_beta_gamma_radiation_penetration.svg" width="500" height="265" /></a><p class="wp-caption-text">Alfa beta gamma radiation penetration.svg</p></div>
<p>The illustrations are drawn with <a title="Inkscape.org" href="http://www.inkscape.org/">Inkscape</a> and are licensed under a dual CC-BY-SA-3.0 and GFDL licence, as recommended by Wikimedia Commons – so if you want to use them, or improve them, go ahead! <img src='http://hamberg.no/erlend/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/sEh9MMe8JHI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/05/10/vector-drawing-is-fun/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/05/10/vector-drawing-is-fun/</feedburner:origLink></item>
		<item>
		<title>How Neurons do Differentiation</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/23xFUZB4uh8/</link>
		<comments>http://hamberg.no/erlend/2010/03/22/how-neurons-do-differentiation/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 18:48:08 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[ai]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1111</guid>
		<description><![CDATA[Nature is simply amazing. Today I learnt… …how neural networks (think brains) can do differentiation by using temporal inhibition – i.e. by using a delayed signal. In the figure below, the node α will send a signal to two nodes. One of them – β – will pass on an inhibitory signal of the same]]></description>
			<content:encoded><![CDATA[<p>Nature is simply amazing.</p>
<p><strong>Today I learnt…</strong></p>
<p>…how neural networks (think brains) can do differentiation by using temporal inhibition – i.e. by using a delayed signal. In the figure below, the node <strong>α</strong> will send a signal to two nodes. One of them – <strong>β</strong> – will pass on an inhibitory signal of the same strength as its input signal, but with a delay. Thus, when <strong>β</strong>&#8216;s signal gets sent to the final node, <strong>α</strong> will at the same time be sending its “next” output signal to the final node.</p>
<div id="attachment_1120" class="wp-caption aligncenter" style="width: 410px"><a href="http://hamberg.no/erlend/wp-content/uploads/2010/03/tdifferentiation.png"><img class="size-medium wp-image-1120" title="tdifferentiation" src="http://hamberg.no/erlend/wp-content/uploads/2010/03/tdifferentiation-400x105.png" alt="" width="400" height="105" /></a><p class="wp-caption-text">“Differentiation” by using delayed inhibition. Solid lines indicate excitatory signals and the dotted line an inhibitory signal.</p></div>
<p>Therefore, the final node will receive two signals: the current output of <strong>α</strong> and the inverted previous output of <strong>α</strong>. If the final node sums these together its output will therefore be <strong>α</strong>&#8216;s current value minus its old value – i.e. positive if <strong>α</strong>&#8216;s output signal is increasing and negative if it is decreasing. Simple and beautiful!</p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/23xFUZB4uh8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/03/22/how-neurons-do-differentiation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/03/22/how-neurons-do-differentiation/</feedburner:origLink></item>
		<item>
		<title>Game of Life</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/tEspw8CrhS8/</link>
		<comments>http://hamberg.no/erlend/2010/03/20/game-of-life/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 18:58:32 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1094</guid>
		<description><![CDATA[While reading about cellular automata in preparation for an essay it struck me that I have never actually written Conway&#8217;s Game of Life. No, really! To correct this embarrassing fact I quickly wrote a version in Haskell using the GLUT bindings. It is very simple, but it works. import Graphics.UI.GLUT hiding &#40;get&#41; import Graphics.Rendering.GLU.Raw &#40;gluOrtho2D&#41;]]></description>
			<content:encoded><![CDATA[<p>While reading about cellular automata in preparation for an essay it struck me that I have never actually written <a href="http://en.wikipedia.org/wiki/Conway's Game of Life">Conway&#8217;s Game of Life</a>. No, really!</p>
<p>To correct this embarrassing fact I quickly wrote a version in Haskell using the <a href="http://hackage.haskell.org/package/GLUT">GLUT bindings</a>.</p>
<div id="attachment_1097" class="wp-caption aligncenter" style="width: 310px"><a href="http://hamberg.no/erlend/wp-content/uploads/2010/03/gol.png"><img class="size-medium wp-image-1097" title="Conway's Game of Life" src="http://hamberg.no/erlend/wp-content/uploads/2010/03/gol-300x232.png" alt="" width="300" height="232" /></a><p class="wp-caption-text">Conway&#39;s Game of Life</p></div>
<p><span id="more-1094"></span></p>
<p>It is very simple, but it works. <img src='http://hamberg.no/erlend/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> Graphics<span style="color: #339933; font-weight: bold;">.</span>UI<span style="color: #339933; font-weight: bold;">.</span>GLUT <span style="color: #06c; font-weight: bold;">hiding</span> <span style="color: green;">&#40;</span>get<span style="color: green;">&#41;</span>
<span style="color: #06c; font-weight: bold;">import</span> Graphics<span style="color: #339933; font-weight: bold;">.</span>Rendering<span style="color: #339933; font-weight: bold;">.</span>GLU<span style="color: #339933; font-weight: bold;">.</span>Raw <span style="color: green;">&#40;</span>gluOrtho2D<span style="color: green;">&#41;</span>
<span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span>IORef
<span style="color: #06c; font-weight: bold;">import</span> System<span style="color: #339933; font-weight: bold;">.</span>Random
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- dimensions of our cellular space</span>
width  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">80</span> <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Int</span>
height <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">60</span> <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Int</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- takes a two-dimensional list and returns the neighbours of (x,y)</span>
neighbours <span style="color: #339933; font-weight: bold;">::</span> <span style="color: green;">&#91;</span><span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">Int</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: #cccc00; font-weight: bold;">Int</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span>
neighbours m <span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">,</span>y<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>\<span style="color: green;">&#40;</span>x'<span style="color: #339933; font-weight: bold;">,</span>y'<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; m <span style="color: #339933; font-weight: bold;">!!</span> y' <span style="color: #339933; font-weight: bold;">!!</span> x'<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">filter</span> valid neighbours'
    <span style="color: #06c; font-weight: bold;">where</span> height'       <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">length</span> m
          width'        <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">length</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">head</span> m<span style="color: green;">&#41;</span>
          valid <span style="color: green;">&#40;</span>x'<span style="color: #339933; font-weight: bold;">,</span>y'<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> x' &amp;gt;<span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">0</span> &amp;amp;&amp;amp; x' &amp;lt; width' &amp;amp;&amp;amp; y' &amp;gt;<span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">0</span> &amp;amp;&amp;amp; y' &amp;lt; height'
          neighbours'   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span>y<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">,</span>y<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span>y<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: #5d478b; font-style: italic;">-- neighbours over</span>
                           <span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span>y<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span>y<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span>             <span style="color: #5d478b; font-style: italic;">-- neighbours left/right</span>
                           <span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span>y<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">,</span>y<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">,</span>y<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- neighbours under</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- updates all cells according to the rules in liveOrDead</span>
update <span style="color: #339933; font-weight: bold;">::</span> IORef <span style="color: green;">&#91;</span><span style="color: green;">&#91;</span><span style="color: #cccc00; font-weight: bold;">Bool</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #cccc00; font-weight: bold;">IO</span> <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span>
update c <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    cells &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> readIORef c
&nbsp;
    <span style="color: #06c; font-weight: bold;">let</span> coords <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">,</span>y<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">|</span> y &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> <span style="color: green;">&#91;</span>0<span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#40;</span>height<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> x &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> <span style="color: green;">&#91;</span>0<span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#40;</span>width<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span>
&nbsp;
    nextGen &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> <span style="font-weight: bold;">mapM</span> <span style="color: green;">&#40;</span>\<span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">,</span>y<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #06c; font-weight: bold;">do</span>
            <span style="color: #06c; font-weight: bold;">let</span> cell <span style="color: #339933; font-weight: bold;">=</span> cells <span style="color: #339933; font-weight: bold;">!!</span> y <span style="color: #339933; font-weight: bold;">!!</span> x
            <span style="color: #06c; font-weight: bold;">let</span> ns   <span style="color: #339933; font-weight: bold;">=</span> neighbours cells <span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">,</span>y<span style="color: green;">&#41;</span>
            <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> liveOrDead cell <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="font-weight: bold;">length</span> <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">filter</span> <span style="font-weight: bold;">id</span><span style="color: green;">&#41;</span> ns<span style="color: green;">&#41;</span>
        <span style="color: green;">&#41;</span> coords
&nbsp;
    writeIORef c <span style="color: green;">&#40;</span>nLists width nextGen<span style="color: green;">&#41;</span>
    display c
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- survival rule: a live cell only lives on if it has 2 or 3 live neighbours</span>
<span style="color: #5d478b; font-style: italic;">-- birth rule: a dead cell becomes a live cell if it has 3 live neighbours</span>
liveOrDead <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Bool</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #cccc00; font-weight: bold;">Int</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #cccc00; font-weight: bold;">Bool</span>
liveOrDead True nLive <span style="color: #339933; font-weight: bold;">=</span> nLive `<span style="font-weight: bold;">elem</span>` <span style="color: green;">&#91;</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">,</span><span style="color: red;">3</span><span style="color: green;">&#93;</span>
liveOrDead False nLive <span style="color: #339933; font-weight: bold;">=</span> nLive <span style="color: #339933; font-weight: bold;">==</span> <span style="color: red;">3</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- utility function: split a list into sublists of length n</span>
nLists <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Int</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: green;">&#91;</span><span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span><span style="color: green;">&#93;</span>
nLists <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
nLists n ls <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">take</span> n ls : nLists n <span style="color: green;">&#40;</span><span style="font-weight: bold;">drop</span> n ls<span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- utility function: draws a square at (x,y) with size w×h</span>
drawQuad <span style="color: #339933; font-weight: bold;">::</span> GLdouble <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; GLdouble <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; GLdouble <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; GLdouble <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #cccc00; font-weight: bold;">IO</span> <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span>
drawQuad x y w h <span style="color: #339933; font-weight: bold;">=</span>
    renderPrimitive Quads <span style="color: #339933; font-weight: bold;">$</span> <span style="color: #06c; font-weight: bold;">do</span>
        vertex <span style="color: green;">&#40;</span>Vertex3  x     y    <span style="color: red;">0</span><span style="color: green;">&#41;</span>
        vertex <span style="color: green;">&#40;</span>Vertex3 <span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">+</span>w<span style="color: green;">&#41;</span>  y    <span style="color: red;">0</span><span style="color: green;">&#41;</span>
        vertex <span style="color: green;">&#40;</span>Vertex3 <span style="color: green;">&#40;</span>x<span style="color: #339933; font-weight: bold;">+</span>w<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>y<span style="color: #339933; font-weight: bold;">-</span>h<span style="color: green;">&#41;</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span>
        vertex <span style="color: green;">&#40;</span>Vertex3  x    <span style="color: green;">&#40;</span>y<span style="color: #339933; font-weight: bold;">-</span>h<span style="color: green;">&#41;</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- draw each cell as a coloured square</span>
display <span style="color: #339933; font-weight: bold;">::</span> IORef <span style="color: green;">&#91;</span><span style="color: green;">&#91;</span><span style="color: #cccc00; font-weight: bold;">Bool</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #cccc00; font-weight: bold;">IO</span> <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span>
display c <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    cells &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> readIORef c
&nbsp;
    <span style="color: #06c; font-weight: bold;">let</span> h <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">fromIntegral</span> height
    <span style="color: #06c; font-weight: bold;">let</span> w <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">fromIntegral</span> width
&nbsp;
    <span style="font-weight: bold;">mapM_</span> <span style="color: green;">&#40;</span>\<span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">,</span>b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; <span style="color: #06c; font-weight: bold;">do</span>
        <span style="color: #06c; font-weight: bold;">if</span> b
          <span style="color: #06c; font-weight: bold;">then</span> currentColor <span style="color: #339933; font-weight: bold;">$=</span> Color4 <span style="color: red;">1.0</span> <span style="color: red;">0.8</span> <span style="color: red;">0.6</span> <span style="color: red;">1.0</span>
          <span style="color: #06c; font-weight: bold;">else</span> currentColor <span style="color: #339933; font-weight: bold;">$=</span> Color4 <span style="color: red;">0.4</span> <span style="color: red;">0.5</span> <span style="color: red;">0.4</span> <span style="color: red;">1.0</span>
        <span style="color: #06c; font-weight: bold;">let</span> x <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span>w<span style="color: #339933; font-weight: bold;">*</span><span style="font-weight: bold;">fromIntegral</span> <span style="color: green;">&#40;</span>n `<span style="font-weight: bold;">mod</span>` width<span style="color: green;">&#41;</span>
        <span style="color: #06c; font-weight: bold;">let</span> y <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">-</span><span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span>h<span style="color: #339933; font-weight: bold;">*</span><span style="font-weight: bold;">fromIntegral</span> <span style="color: green;">&#40;</span>n `<span style="font-weight: bold;">div</span>` width<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
        drawQuad x y <span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span>w<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span>h<span style="color: green;">&#41;</span>
        <span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">zip</span> <span style="color: green;">&#91;</span>0<span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">concat</span> cells<span style="color: green;">&#41;</span>
&nbsp;
    swapBuffers
&nbsp;
main <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">IO</span> <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    g &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> newStdGen
    <span style="color: #339933; font-weight: bold;">_</span> &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> getArgsAndInitialize
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- random starting values</span>
    cells &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> newIORef <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>nLists width <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">take</span> <span style="color: green;">&#40;</span>width<span style="color: #339933; font-weight: bold;">*</span>height<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">.</span> randoms<span style="color: green;">&#41;</span> g<span style="color: green;">&#41;</span>
&nbsp;
    <span style="color: #339933; font-weight: bold;">_</span> &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> createWindow <span style="background-color: #3cb371;">&quot;Conway's Game of Life&quot;</span>
    initialDisplayMode    <span style="color: #339933; font-weight: bold;">$=</span> <span style="color: green;">&#91;</span>DoubleBuffered<span style="color: green;">&#93;</span>
    windowSize            <span style="color: #339933; font-weight: bold;">$=</span> Size <span style="color: red;">800</span> <span style="color: red;">600</span>
    displayCallback       <span style="color: #339933; font-weight: bold;">$=</span> display cells
    idleCallback          <span style="color: #339933; font-weight: bold;">$=</span> Just <span style="color: green;">&#40;</span>update cells<span style="color: green;">&#41;</span>
    gluOrtho2D <span style="color: red;">0</span> <span style="color: red;">1</span> <span style="color: red;">0</span> <span style="color: red;">1</span>    <span style="color: #5d478b; font-style: italic;">-- orthogonal projection</span>
    mainLoop              <span style="color: #5d478b; font-style: italic;">-- start main loop</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/erlend/~4/tEspw8CrhS8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/03/20/game-of-life/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/03/20/game-of-life/</feedburner:origLink></item>
		<item>
		<title>Code Reading as a Team Activity</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/e3muRszHtpQ/</link>
		<comments>http://hamberg.no/erlend/2010/03/20/code-reading-as-a-team-activity/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 18:55:23 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1015</guid>
		<description><![CDATA[I am currently reading &#8220;Coders at Work&#8221; by Peter Seibel, a really interesting read for a code monkey like me. The book is full of good tips and experiences from actual coders who learnt by doing. Peter Seibel&#8217;s questions are really good – no doubt because he himself is a programmer – and all his]]></description>
			<content:encoded><![CDATA[<p>I am currently reading &#8220;<a title="Coder's at Work Homepage" href="http://www.codersatwork.com/">Coders at Work</a>&#8221; by Peter Seibel, a really interesting read for a code monkey like me. The book is full of good tips and experiences from actual coders who learnt by doing. Peter Seibel&#8217;s questions are really good – no doubt because he himself is a programmer – and all his interview subject have different and interesting stories to tell.</p>
<p><a href="http://hamberg.no/erlend/wp-content/uploads/2009/11/monkey_tutor.png"><img class="aligncenter size-medium wp-image-1045" title="monkey_tutor" src="http://hamberg.no/erlend/wp-content/uploads/2009/11/monkey_tutor-300x197.png" alt="monkey_tutor" width="300" height="197" /></a></p>
<p><span id="more-1015"></span></p>
<p>One of the things I found really interesting was how <a title="Wikipedia: Douglas Crockford" href="http://en.wikipedia.org/wiki/Douglas_Crockford">Douglas Crockford</a> recommended <strong>code reading</strong> as a way to avoid having confused programmers in a project that aren&#8217;t aware of their own situation before it&#8217;s too late. According to Crockford it also helps by making sure that the really good programmers mentor other people on their team. The procedure is very simple:</p>
<blockquote><p><strong>Seibel:</strong> Can you talk a bit about how you conduct a code reading?</p>
<p><strong>Crockford:</strong> At each meeting, someone&#8217;s responsible for reading their code, and they&#8217;ll walk us through everything, and the rest of us will observe. It&#8217;s a really good chance for the rest of the team to understand how their stuff is going to have to fit with that stuff.</p>
<p>We get everybody around the table; everybody gets a stack of paper. We also blow it up on the screen. And we all read through it together. And we&#8217;re all commenting on the code as we go along. People say, &#8220;I don&#8217;t understand this comment&#8221;, or, &#8220;This comment doesn&#8217;t seem to describe the code.&#8221; That kind of stuff can be so valuable because as a programmer you stop reading your own comments and you&#8217;re not aware that you&#8217;re misdirecting the reader. Having the people you work with helping to keep you code clean is a huge service—you find defects that you never would have found on your own.</p>
<p>I think an hour of code reading is worth two weeks of QA. It&#8217;s just a really effective way of removing errors. If you have someone who is strong reading, then the novices around them are going to learn a lot that they wouldn&#8217;t be learning otherwise, and if you have a novice reading, he&#8217;s going to get a lot of really good advice.</p>
<p>[...]</p>
<p>For one thing it makes it easier to track the project, because we can actually see what progress people are making. And we can see much sooner if they&#8217;re going off the rails or not.</p></blockquote>
<p>I simply loved this idea and would love to test it in practice. I know that I personally would find it highly motivating, both with respect to the quality of my own code and for the project as a whole by so explicitly seeing what the others are doing.</p>
<p>This is probably not going to work for all projects and teams, but for a relatively small team (working at the same location) aiming to produce code of a high quality I really believe this approach can work.</p>
<p>If anyone has experience with this, or similar approaches, I would love to hear your thoughts.</p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/e3muRszHtpQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/03/20/code-reading-as-a-team-activity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/03/20/code-reading-as-a-team-activity/</feedburner:origLink></item>
		<item>
		<title>HsUnixCompat.hs on Debian</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/Ei9SfRxwnl4/</link>
		<comments>http://hamberg.no/erlend/2010/01/17/hsunixcompat-hs-on-debian/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 17:44:28 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/?p=1091</guid>
		<description><![CDATA[Just so that a others (hopefully) will be spared the annoying and time-consuming work of tracking down the source of the following error message: * Missing header file: HsUnixCompat.h On my Debian system (Debian 5.0.3 – &#8220;Lenny&#8221;) the missing package was libbsd-dev: $ cabal unpack unix-compat Unpacking unix-compat-0.1.2.1&#8230; $ cd unix-compat-0.1.2.1/ $ runhaskell Setup.lhs configure]]></description>
			<content:encoded><![CDATA[<p>Just so that a others (hopefully) will be spared the annoying and time-consuming work of tracking down the source of the following error message:</p>
<blockquote><p>* Missing header file: HsUnixCompat.h</p></blockquote>
<p>On my Debian system (Debian 5.0.3 – &#8220;Lenny&#8221;) the missing package was <strong>libbsd-dev</strong>:</p>
<blockquote><p>$ <strong>cabal unpack unix-compat</strong><br />
Unpacking unix-compat-0.1.2.1&#8230;<br />
$ <strong>cd unix-compat-0.1.2.1/</strong><br />
$ <strong>runhaskell Setup.lhs configure -v3</strong><br />
[…]<br />
/usr/bin/gcc returned ExitFailure 1 with error message:<br />
In file included from include/HsUnixCompat.h:1,<br />
from /tmp/18515.c:1:<br />
/usr/lib/ghc-6.10.4/unix-2.3.2.0/include/HsUnix.h:79:21: error: libutil.h: No such file or directory<br />
$ <strong>apt-file search libutil.h</strong><br />
libbsd-dev: /usr/include/libutil.h</p></blockquote>
<img src="http://feeds.feedburner.com/~r/erlend/~4/Ei9SfRxwnl4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/01/17/hsunixcompat-hs-on-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/01/17/hsunixcompat-hs-on-debian/</feedburner:origLink></item>
		<item>
		<title>Cold Ocean</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/oPV1E_IjbIc/</link>
		<comments>http://hamberg.no/erlend/2010/01/09/cold-ocean/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 18:04:31 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[pictures]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/2010/01/09/cold-ocean/</guid>
		<description><![CDATA[Cold Ocean, originally uploaded by ehamberg. View from Råkvåg, Norway.]]></description>
			<content:encoded><![CDATA[<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/ehamberg/4260053508/" title="photo sharing"><img src="http://farm5.static.flickr.com/4021/4260053508_2dd475d038.jpg" style="border: solid 2px #000000;" alt="" /></a><br />
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/ehamberg/4260053508/">Cold Ocean</a>, originally uploaded by <a href="http://www.flickr.com/people/ehamberg/">ehamberg</a>.</span>
</div>
<p>
View from Råkvåg, Norway.</p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/oPV1E_IjbIc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/01/09/cold-ocean/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/01/09/cold-ocean/</feedburner:origLink></item>
		<item>
		<title>Winter Sun</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/PN0PG887kT0/</link>
		<comments>http://hamberg.no/erlend/2010/01/09/winter-sun/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 17:52:35 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[pictures]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/2010/01/09/winter-sun/</guid>
		<description><![CDATA[Winter Sun, originally uploaded by ehamberg. The sun over the Trondheim fjord a really cold day.]]></description>
			<content:encoded><![CDATA[<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/ehamberg/4260022020/" title="photo sharing"><img src="http://farm5.static.flickr.com/4008/4260022020_61eec4c3f7.jpg" style="border: solid 2px #000000;" alt="" /></a><br />
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/ehamberg/4260022020/">Winter Sun</a>, originally uploaded by <a href="http://www.flickr.com/people/ehamberg/">ehamberg</a>.</span>
</div>
<p>
The sun over the Trondheim fjord a really cold day.</p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/PN0PG887kT0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2010/01/09/winter-sun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2010/01/09/winter-sun/</feedburner:origLink></item>
		<item>
		<title>December in Trondheim</title>
		<link>http://feedproxy.google.com/~r/erlend/~3/pXbSlW_NKrA/</link>
		<comments>http://hamberg.no/erlend/2009/12/20/december-in-trondheim/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 14:24:43 +0000</pubDate>
		<dc:creator>Erlend</dc:creator>
				<category><![CDATA[pictures]]></category>
		<category><![CDATA[usortert]]></category>

		<guid isPermaLink="false">http://hamberg.no/erlend/2009/12/20/december-in-trondheim/</guid>
		<description><![CDATA[December in Trondheim, originally uploaded by ehamberg.]]></description>
			<content:encoded><![CDATA[<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/ehamberg/4199507835/" title="photo sharing"><img src="http://farm5.static.flickr.com/4008/4199507835_3086099bce.jpg" style="border: solid 2px #000000;" alt="" /></a><br />
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/ehamberg/4199507835/">December in Trondheim</a>, originally uploaded by <a href="http://www.flickr.com/people/ehamberg/">ehamberg</a>.</span>
</div></p>
<img src="http://feeds.feedburner.com/~r/erlend/~4/pXbSlW_NKrA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hamberg.no/erlend/2009/12/20/december-in-trondheim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hamberg.no/erlend/2009/12/20/december-in-trondheim/</feedburner:origLink></item>
	</channel>
</rss>
