<?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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.luguber.info &#187; programming</title>
	<atom:link href="http://blog.luguber.info/category/it/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.luguber.info</link>
	<description></description>
	<lastBuildDate>Sun, 27 Jun 2010 10:43:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ZenTest er finfint!</title>
		<link>http://blog.luguber.info/2010/03/10/zentest-er-finfint/</link>
		<comments>http://blog.luguber.info/2010/03/10/zentest-er-finfint/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:57:10 +0000</pubDate>
		<dc:creator>jone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.luguber.info/2010/03/10/zentest-er-finfint/</guid>
		<description><![CDATA[Det er mye enklere å teste når testene kjører av seg selv og maser når det må mases. Med ZenTest og test_notifier får du beskjed når ting går galt helt automagisk &#8211; og det via libnotify/knotify. For en kjapp oppskrift, se her: getting started with autotest]]></description>
			<content:encoded><![CDATA[<p>Det er mye enklere å teste når testene kjører av seg selv og maser når det må mases. Med ZenTest og test_notifier får du beskjed når ting går galt helt automagisk &#8211; og det via libnotify/knotify. For en kjapp oppskrift, se her: <a href="http://ph7spot.com/musings/getting-started-with-autotest">getting started with autotest</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.luguber.info/2010/03/10/zentest-er-finfint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>capistrano ftw</title>
		<link>http://blog.luguber.info/2008/11/25/capistrano-ftw/</link>
		<comments>http://blog.luguber.info/2008/11/25/capistrano-ftw/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 21:25:47 +0000</pubDate>
		<dc:creator>jone</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.luguber.info/?p=123</guid>
		<description><![CDATA[This is just a small nod in the direction of capistrano, the rails deployment machine. It gives great satisfaction to commit your latest fixes to master and run a quick &#8220;cap deploy&#8221;, and a few seconds later having an up to date server on the other end. No need to meddle with the server, it [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a small nod in the direction of <a href="http://www.capify.org/" target="_blank">capistrano</a>, the rails deployment machine. It gives great satisfaction to commit your latest fixes to master and run a quick &#8220;cap deploy&#8221;, and a few seconds later having an up to date server on the other end.<br />
No need to meddle with the server, it is all automagic:)</p>
<p>Now &#8211; back to work&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.luguber.info/2008/11/25/capistrano-ftw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>personal ruby buddha machine</title>
		<link>http://blog.luguber.info/2008/11/25/personal-ruby-buddha-machine/</link>
		<comments>http://blog.luguber.info/2008/11/25/personal-ruby-buddha-machine/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 23:36:27 +0000</pubDate>
		<dc:creator>jone</dc:creator>
				<category><![CDATA[Musikk]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[sdl]]></category>

		<guid isPermaLink="false">http://blog.luguber.info/?p=120</guid>
		<description><![CDATA[Some days ago I came across a post on the FM3 buddha machine. Finding it a fascinating concept, and being able to download their samples I sprinkled a few lines of ruby over them an stirred. Voilà &#8211; my own personal buddha machine playing wonderful ambient soundscapes in a random fashion. Using the sdl_ruby library, [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I came across a post on the <a href="http://www.fm3buddhamachine.com/" target="_blank">FM3 buddha machine</a>. Finding it a fascinating concept, and being able to download their samples I sprinkled a few lines of ruby over them an stirred. Voilà &#8211; my own personal buddha machine playing wonderful ambient soundscapes in a random fashion. Using the sdl_ruby library, the whole thing became surprisingly simple:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/ruby -w</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'sdl'</span>
SDL.<span style="color:#9900CC;">init</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">SDL::INIT_AUDIO</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#6666ff; font-weight:bold;">SDL::Mixer</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">44100</span>,<span style="color:#6666ff; font-weight:bold;">SDL::Mixer::DEFAULT_FORMAT</span>,<span style="color:#006666;">2</span>,<span style="color:#006666;">4096</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
clips = <span style="color:#CC00FF; font-weight:bold;">Dir</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'audio'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">entries</span>.<span style="color:#9900CC;">delete_if</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> ! <span style="color:#006600; font-weight:bold;">&#40;</span>x =~ <span style="color:#006600; font-weight:bold;">/</span>wav$<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">while</span> <span style="color:#0000FF; font-weight:bold;">true</span>
        <span style="color:#9966CC; font-weight:bold;">for</span> i <span style="color:#9966CC; font-weight:bold;">in</span> 1..<span style="color:#6666ff; font-weight:bold;">SDL::Mixer</span>.<span style="color:#9900CC;">allocate_channels</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#41;</span>
                        <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">not</span> <span style="color:#6666ff; font-weight:bold;">SDL::Mixer</span>.<span style="color:#9900CC;">play</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>i<span style="color:#006600; font-weight:bold;">&#41;</span>
                                <span style="color:#6666ff; font-weight:bold;">SDL::Mixer</span>.<span style="color:#9900CC;">playChannel</span><span style="color:#006600; font-weight:bold;">&#40;</span>i,<span style="color:#6666ff; font-weight:bold;">SDL::Mixer::Wave</span>.<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;audio/&quot;</span><span style="color:#006600; font-weight:bold;">+</span>clips<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0066; font-weight:bold;">rand</span><span style="color:#006600; font-weight:bold;">&#40;</span>clips.<span style="color:#9900CC;">length</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<span style="color:#CC0066; font-weight:bold;">rand</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">30</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
                        <span style="color:#9966CC; font-weight:bold;">end</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
        <span style="color:#CC0066; font-weight:bold;">sleep</span> <span style="color:#006666;">0.5</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.luguber.info/2008/11/25/personal-ruby-buddha-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Numerical sorting in ruby</title>
		<link>http://blog.luguber.info/2008/11/19/numerical-sorting-in-ruby/</link>
		<comments>http://blog.luguber.info/2008/11/19/numerical-sorting-in-ruby/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 13:36:53 +0000</pubDate>
		<dc:creator>jone</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[blocks]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.luguber.info/?p=114</guid>
		<description><![CDATA[Quick note on how to do numerical sorting in ruby. When calling sort, ruby will perform a lexicographical sorting by default, meaning that the following array 1 2 a=&#91;&#34;0&#34;,&#34;10&#34;,&#34;9&#34;,&#34;1&#34;&#93; a.sort.each&#123;&#124;val&#124; p val&#125; will output "0" "1" "10" "9" If this is not what you want, this might be it: 1 a.sort&#123;&#124;x,y&#124; x.to_i &#60; =&#62; y.to_i&#125;.each [...]]]></description>
			<content:encoded><![CDATA[<p>Quick note on how to do numerical sorting in ruby.<br />
When calling sort, ruby will perform a lexicographical sorting by default, meaning that the following array</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">a=<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;0&quot;</span>,<span style="color:#996600;">&quot;10&quot;</span>,<span style="color:#996600;">&quot;9&quot;</span>,<span style="color:#996600;">&quot;1&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
a.<span style="color:#9900CC;">sort</span>.<span style="color:#9900CC;">each</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>val<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">p</span> val<span style="color:#006600; font-weight:bold;">&#125;</span></pre></td></tr></table></div>

<p>will  output </p>
<pre>
"0"
"1"
"10"
"9"
</pre>
<p>If this is not what you want, this might be it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">a.<span style="color:#9900CC;">sort</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x,y<span style="color:#006600; font-weight:bold;">|</span> x.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> y.<span style="color:#9900CC;">to_i</span><span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>val<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">p</span> val <span style="color:#006600; font-weight:bold;">&#125;</span></pre></td></tr></table></div>

<p>outputs:</p>
<pre>
"0"
"1"
"9"
"10"
</pre>
<p>Yay, blocks to the rescue:)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.luguber.info/2008/11/19/numerical-sorting-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS/Rails</title>
		<link>http://blog.luguber.info/2008/09/15/cssrails/</link>
		<comments>http://blog.luguber.info/2008/09/15/cssrails/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 07:14:29 +0000</pubDate>
		<dc:creator>jone</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[notat]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.luguber.info/?p=109</guid>
		<description><![CDATA[Notat til meg selv: bruk &#60;%= stylesheet_link_tag "cssfil" %&#62; for å inkludere css, så slipper man trøblete proxy-servere som bare vil servere gamle versjoner.]]></description>
			<content:encoded><![CDATA[<p>Notat til meg selv:<br />
bruk</p>
<pre>&lt;%= stylesheet_link_tag "cssfil" %&gt;</pre>
<p>for å inkludere css, så slipper man trøblete proxy-servere som bare vil servere gamle versjoner.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.luguber.info/2008/09/15/cssrails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
