<?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>uRaNGaTaNG &#187; howto</title>
	<atom:link href="http://www.rngtng.com/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rngtng.com</link>
	<description>Featuring Ruby, Rails, Web development, Arduino, Processing, Nabaztag and more...</description>
	<lastBuildDate>Thu, 12 Jan 2012 10:08:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.rngtng.com/?pushpress=hub'/>
		<item>
		<title>HowTo: resque-web, resque scheduler and passenger</title>
		<link>http://www.rngtng.com/2011/07/29/howto-resque-web-resque-scheduler-and-passenger/</link>
		<comments>http://www.rngtng.com/2011/07/29/howto-resque-web-resque-scheduler-and-passenger/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 16:04:59 +0000</pubDate>
		<dc:creator>tobi</dc:creator>
				<category><![CDATA[Ruby, Rails & Co.]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[resque]]></category>
		<category><![CDATA[scheduler]]></category>

		<guid isPermaLink="false">http://www.rngtng.com/?p=562</guid>
		<description><![CDATA[Here's how you get resque-web and resque scheduler playing well with passenger:

Follow these instructions from resque readme (apache, ngnix) and check out current resque repo. Now update following two files:
1. Add gem "resque-scheduler","2.0.0.d" to Gemfile
2. Run bundle
3. Add require 'resque_scheduler' to config.ru

Restart you webserver and are ready to go - Happy scheduling!

Both file after ...]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how you get <a href="https://github.com/defunkt/resque">resque-web</a> and <a href="https://github.com/bvandenbos/resque-scheduler">resque scheduler</a> playing well with <a href="http://www.modrails.com/">passenger</a>:</p>
<p>Follow these instructions from resque readme (<a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_rack_based_ruby_application">apache</a>, <a href="http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_rack_app">ngnix</a>) and check out current resque repo. Now update following two files:<br />
1. Add <code>gem "resque-scheduler","2.0.0.d"</code> to Gemfile<br />
2. Run <code>bundle</code><br />
3. Add <code>require 'resque_scheduler'</code> to config.ru</p>
<p>Restart you webserver and are ready to go &#8211; Happy scheduling!</p>
<p>Both file after editing:<br />
<div id="gist-1101580" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c1">#!/usr/bin/env ruby</span></div><div class='line' id='LC2'><span class="nb">require</span> <span class="s1">&#39;logger&#39;</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="vg">$LOAD_PATH</span><span class="o">.</span><span class="n">unshift</span> <span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="bp">__FILE__</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;/lib&#39;</span><span class="p">)</span></div><div class='line' id='LC5'><span class="nb">require</span> <span class="s1">&#39;resque/server&#39;</span></div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'><span class="c1"># Set the RESQUECONFIG env variable if you&#39;ve a `resque.rb` or similar</span></div><div class='line' id='LC8'><span class="c1"># config file you want loaded on boot.</span></div><div class='line' id='LC9'><span class="k">if</span> <span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;RESQUECONFIG&#39;</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">exists?</span><span class="p">(</span><span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;RESQUECONFIG&#39;</span><span class="o">]</span><span class="p">))</span></div><div class='line' id='LC10'>&nbsp;&nbsp;<span class="nb">load</span> <span class="o">::</span><span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;RESQUECONFIG&#39;</span><span class="o">]</span><span class="p">)</span></div><div class='line' id='LC11'><span class="k">end</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="nb">require</span> <span class="s1">&#39;resque_scheduler&#39;</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC15'><span class="n">use</span> <span class="no">Rack</span><span class="o">::</span><span class="no">ShowExceptions</span></div><div class='line' id='LC16'><span class="n">run</span> <span class="no">Resque</span><span class="o">::</span><span class="no">Server</span><span class="o">.</span><span class="n">new</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1101580/3e8f09f7d99bcd47e33fdf5ce09fb6834b77f338/config.ru" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1101580#file_config.ru" style="float:right;margin-right:10px;color:#666">config.ru</a>
            <a href="https://gist.github.com/1101580">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">source</span> <span class="ss">:rubygems</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="n">gemspec</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="n">group</span> <span class="ss">:test</span> <span class="k">do</span></div><div class='line' id='LC6'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;rake&quot;</span></div><div class='line' id='LC7'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;resque-scheduler&quot;</span><span class="p">,</span><span class="s2">&quot;2.0.0.d&quot;</span></div><div class='line' id='LC8'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;rack-test&quot;</span><span class="p">,</span> <span class="s2">&quot;~&gt; 0.5&quot;</span></div><div class='line' id='LC9'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;mocha&quot;</span><span class="p">,</span> <span class="s2">&quot;~&gt; 0.9.7&quot;</span></div><div class='line' id='LC10'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;leftright&quot;</span><span class="p">,</span> <span class="ss">:platforms</span> <span class="o">=&gt;</span> <span class="ss">:mri_18</span></div><div class='line' id='LC11'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;yajl-ruby&quot;</span><span class="p">,</span> <span class="s2">&quot;~&gt;0.8.2&quot;</span><span class="p">,</span> <span class="ss">:platforms</span> <span class="o">=&gt;</span> <span class="ss">:mri</span></div><div class='line' id='LC12'>&nbsp;&nbsp;<span class="n">gem</span> <span class="s2">&quot;json&quot;</span><span class="p">,</span> <span class="s2">&quot;~&gt;1.5.3&quot;</span><span class="p">,</span> <span class="ss">:platforms</span> <span class="o">=&gt;</span> <span class="ss">:jruby</span></div><div class='line' id='LC13'><span class="k">end</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1101580/b684be9b2b93228c1accabb59a9dc4425edd367e/Gemfile" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1101580#file_gemfile" style="float:right;margin-right:10px;color:#666">Gemfile</a>
            <a href="https://gist.github.com/1101580">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.rngtng.com/?flattrss_redirect&amp;id=562&amp;md5=930179f1ba8785c97e3136cf81a0053e" title="Flattr" target="_blank"><img src="http://www.rngtng.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rngtng.com/2011/07/29/howto-resque-web-resque-scheduler-and-passenger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: ultra mega fast rails routes lookup</title>
		<link>http://www.rngtng.com/2011/03/16/howto-ultra-mega-fast-rails-routes-lookup/</link>
		<comments>http://www.rngtng.com/2011/03/16/howto-ultra-mega-fast-rails-routes-lookup/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 16:34:00 +0000</pubDate>
		<dc:creator>tobi</dc:creator>
				<category><![CDATA[Ruby, Rails & Co.]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.rngtng.com/?p=538</guid>
		<description><![CDATA[

I was quite annoyed by the wasted time it took each time I grep the rails routes table. 
Wait, can't this be cached?  - Sure it can!
So I came up this nice little alias to cache the output once:

alias route='CF=tmp/routes_cache; ] &#38;&#38; rake routes &#62; $CF; cat $CF &#124; ...]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2009/8/5/1249508265579/Frances-V150-TGV-fast-tra-001.jpg" alt="" /></p>
<p>I was quite annoyed by the wasted time it took each time I grep the rails routes table.<br />
<em>Wait, can&#8217;t this be cached?  &#8211; Sure it can!</em><br />
So I came up this nice little alias to cache the output once:<br />
<code><br />
alias route='CF=tmp/routes_cache; [[ ! -s $CF ]] &amp;&amp; rake routes &gt; $CF; cat $CF | grep '<br />
</code></p>
<p>now it&#8217;s ultra fast, try e.g.:<br />
<code><br />
$ route root<br />
</code><br />
bang!</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.rngtng.com/2011/03/16/howto-ultra-mega-fast-rails-routes-lookup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking the Nabaztag</title>
		<link>http://www.rngtng.com/2009/12/02/hacking-the-nabaztag/</link>
		<comments>http://www.rngtng.com/2009/12/02/hacking-the-nabaztag/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 10:20:55 +0000</pubDate>
		<dc:creator>tobi</dc:creator>
				<category><![CDATA[Happy Hacking]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[nabaztag]]></category>

		<guid isPermaLink="false">http://www.rngtng.com/?p=231</guid>
		<description><![CDATA[
Alright, I spend some time with my new toy Nabaztag 'Nabaccia'

What confused me most: there have been two Firmware version out there. Some project depend on the old one, some other on the, new Jabber based, version. 

Here are some interesting projects I've found:
http://nabaztools.sourceforge.net/ (outdated, MAC OS X)

http://sourceforge.net/projects/opennab/ (PHP)

http://code.google.com/p/nabazlib/ (python)

http://nabazlab.sourceforge.net/index_en.htm (windows only)

A working Proxyserver: ...]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><img class="aligncenter size-full wp-image-446" src="http://www.rngtng.com/files/2010/09/nabaztag.png" alt="" width="583" height="397" /></p>
<p>Alright, I spend some time with my new <em>toy</em> Nabaztag &#8216;<a href="http://twitter.com/nabaccia">Nabaccia</a>&#8216;</p>
<p>What confused me most: there have been two Firmware version out there. Some project depend on the old one, some other on the, new Jabber based, version. </p>
<p>Here are some interesting projects I&#8217;ve found:<br />
<a href="http://nabaztools.sourceforge.net/" target="_blank">http://nabaztools.sourceforge.net/</a> (outdated, MAC OS X)</p>
<p><a href="http://sourceforge.net/projects/opennab/" target="_blank">http://sourceforge.net/projects/opennab/</a> (PHP)</p>
<p><a href="http://code.google.com/p/nabazlib/" target="_blank">http://code.google.com/p/nabazlib/</a> (python)</p>
<p><a href="http://nabazlab.sourceforge.net/index_en.htm" target="_blank">http://nabazlab.sourceforge.net/index_en.htm</a> (windows only)</p>
<p>A working Proxyserver: jNabServer</p>
<p><a href="http://code.google.com/p/jnabserver/" target="_blank">http://code.google.com/p/jnabserver/</a></p>
<p>A good summery how to start &#8216;nabazhacking&#8217; is here:</p>
<p><a href="http://www.saraproft.org/?p=912" target="_blank">http://www.saraproft.org/?p=912</a></p>
<p><a href="http://blog.makezine.com/archive/2006/03/more_nabaztag_hacking.html" target="_blank">http://blog.makezine.com/archive/2006/03/more_nabaztag_hacking.html</a></p>
<p>A very detailed look into the electronics of the rabbit:</p>
<p><a href="http://www.petertyser.com/2007/03/11/nabaztag-nabaztagtag-dissection/" target="_blank">http://www.petertyser.com/2007/03/11/nabaztag-nabaztagtag-dissection/</a></p>
<p>Forums:<br />
<a href="http://nabaztag.forumactif.fr/" target="_blank">http://nabaztag.forumactif.fr/</a> (french)<br />
<a href="http://www.mynabaztag.de" target="_blank">http://www.mynabaztag.de</a> (german)<br />
<a href="http://www.nabaztalk.com" target="_blank">http://www.nabaztalk.com</a> (english)</p>
<p>Blogs:<br />
<a href="http://www.nabaztag-blog.de" target="_blank">http://www.nabaztag-blog.de</a> (german)</p>
<p>Quite complete list of other sources:</p>
<p><a href="http://www.nabzone.com/?frG=" target="_blank">http://www.nabzone.com/?frG=</a>/liens.php</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.rngtng.com/2009/12/02/hacking-the-nabaztag/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Understanding the Rainbowduino Controller by Seeedstudio</title>
		<link>http://www.rngtng.com/2009/10/02/understanding-the-rainbowduino-controller-by-seeedstudio/</link>
		<comments>http://www.rngtng.com/2009/10/02/understanding-the-rainbowduino-controller-by-seeedstudio/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 18:33:04 +0000</pubDate>
		<dc:creator>tobi</dc:creator>
				<category><![CDATA[Arduino & Co.]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[RainbowDuino]]></category>
		<category><![CDATA[seeedstudio]]></category>

		<guid isPermaLink="false">http://www.rngtng.com/?p=188</guid>
		<description><![CDATA[As you may know, I've orderd a Rainbowduino from Seeedstudio. They delivered quite fast and I'm very happy of the price/quality/functionality ratio. In my opinion, the Rainbowduino is the cheapest ready-to-go 8x8 RGB LED Controller Set at the moment - for just 43.4$ ( 19.90$ Board + 23.50$ Matrix)  you are set for ...]]></description>
			<content:encoded><![CDATA[<p>As you may know, I&#8217;ve orderd a <a href="http://www.seeedstudio.com/blog/?page_id=187" class="broken_link">Rainbowduino from Seeedstudio</a>. They delivered quite fast and I&#8217;m very happy of the price/quality/functionality ratio. In my opinion, the Rainbowduino is the cheapest ready-to-go 8&#215;8 RGB LED Controller Set at the moment &#8211; for just 43.4$ ( 19.90$ Board + 23.50$ Matrix)  you are set for taking of!</p>
<p>My first tests went quite well. The Rainbowduino comes  with a ready to use the program/<a href="http://www.seeedstudio.com/depot/images/product/RaibowduinoCMD_Bata.rar">sketch</a> which allows you basic controls via I2C bus easily, like writing letters &amp; lines in different color and light strength. But soon I hit the limits when it came so single control each LED to my will. So no doubt, I had to dig deeper in understanding how to control the Rainbowduino. Here a short summery of my results:</p>
<p>To understand how the Rainbowduino works, I kind of reverseengineered the sketch by seeedstudio which came with the controller. As usual for driving those Matrixes, <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">PWM</a> is used as basic concept. This means the frame image is created row by row by high frequency, so human eye puts it all together to one single image.</p>
<p>To simplify this process I created the Rainbowduino.h Library, which comes with some nice methods to set frames and draw those to the Rainbowduino. It&#8217;s part of the mtXcontrol firmware an can be <a href="http://github.com/rngtng/mtXcontrol/tree/master/firmware/rainbowduino/" class="broken_link">downloaded from github</a></p>
<p style="text-align: center"><img class="aligncenter" src="http://www.seeedstudio.com/depot/images/product/rainbowblock.jpg" alt="" width="528" height="298" /></p>
<p><strong>How it works:</strong><br />
To tell rainbowduino which row to draw the method &#8216;open_row&#8217; is called. As each row is represented by a one output PIN, this method sets the according PIN to high, all others to low. Unfortunately the row pins are not all on one port: rows 1-3 are on PORTB Bit 1-3, rows 4-8 are on PORTD Bit 4-8. This makes the method kind of bit ugly <img src='http://www.rngtng.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>After the row is selected, its time to set the pixels. One pixel consists of 3 LEDs: red, green &amp; blue. Each LED has to be separately to high or low to mix the final color (e.g. red + green is yellow). First all blue values of a row are set, then red and finally green. This happens in serial on PORTC. First bit is the value input, second bit is clock,  bit 3 the write mode bit and bit 4 to display the shifted value. Call the method &#8216;draw_row&#8217; to display a row. First parameter is the row number (0-7), second the intensity (1-16) and then the red, blue &amp; green values for the row. e.g passing the color values 1,0,0 would light the first pixel red and all other off, where as 255, 255, 255 would light up all LED and all colors, to the full row would be white.</p>
<p>To store the row values the Library comes with a frame buffer for 10 frames. (That the amount of frames we can store to EEPROM without compression as well). You can pre fill the buffer and set the frame number to display. By calling draw() the frame of the current _frame number is drawn.</p>
<p>It makes sense to call this function by a timer interrupt to not disturb your actual program progress and to ensure it&#8217;s call in regular frequency to avoid different display colors.</p>
<p>To set up the timer, include this in your code:</p>
<pre class="brush: cpp; title: ; notranslate">
Rainbowduino rainbow = Rainbowduino(10);  //max 10 Frames

void setup_timer() {
  TCCR2A = 0;
  TCCR2B = 1&lt;&lt;CS22 | 0 &lt;&lt;CS21 | 0&lt;&lt;CS20;
  TIMSK2 = 1&lt;&lt;TOIE2;
  TCNT2 = 0;
  sei();
}

ISR(TIMER2_OVF_vect) {
  rainbow.draw();
}
</pre>
<p>Now, just fill you frames with</p>
<pre class="brush: cpp; title: ; notranslate">
rainbow.set_frame(0, *data);
</pre>
<p>and your&#8217;re ready to go. Have fun!</p>
<p>First tests of the library with earlier version of <a href="http://www.rngtng.com/mtXcontrol">mtXcontrol</a>, an Editor to create images on the Matrix easily:<br />
<p><a href="http://www.rngtng.com/2009/10/02/understanding-the-rainbowduino-controller-by-seeedstudio/"><em>Click here to view the embedded video.</em></a></p></p>
<p>Stay tuned for more examples soon&#8230;</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.rngtng.com/2009/10/02/understanding-the-rainbowduino-controller-by-seeedstudio/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

