<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">

  <title><![CDATA[Sebastian Cohnen]]></title>
  
  <link href="http://tisba.de/" />
  <updated>2012-02-21T10:41:38+01:00</updated>
  <id>http://tisba.de/</id>
  <author>
    <name><![CDATA[Sebastian Cohnen]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/tisbablog" /><feedburner:info uri="tisbablog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
    <title type="html"><![CDATA[How to Find Periodic Effects on Performance using Autocorrelation]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/0gpjJnGGMSg/" />
    <updated>2012-02-21T10:30:00+01:00</updated>
    <id>http://tisba.de/2012/02/21/how-to-find-periodic-effects-on-performance-using-autocorrelation</id>
    <content type="html">&lt;p&gt;For one of my clients I&amp;#8217;m doing performance assessments on a quite regular basis. For &lt;a href="http://adcloud.com" title="adcloud"&gt;adcloud&lt;/a&gt;, performance is a primary key to success. To give you a little background: adcloud&amp;#8217;s adserver system is serving thousands of requests per second &amp;mdash; only with a couple of application servers. And since customers don&amp;#8217;t like slow loading ads on their pages, latency besides raw throughput is a fundamental criteria defining the service&amp;#8217;s quality.&lt;/p&gt;

&lt;p&gt;We basically run extensive load tests with different scenarios all the time to ensure that a new feature or even a small improvement does not compromise the stability and quality of the system &amp;mdash; especially under load. Functional correctness is covered by unit and integration tests, but non-functional aspects like throughput and latency are a bit harder to measure and to deliver. How exactly the setup looks like, which I created to help adcloud to run automated, distributed load tests, will be the topic of another post. For this article I&amp;#8217;d like to outline an idea I have had in mind for quite some time now and which has been proven to work at least once.&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;&lt;em&gt;Please note that I cannot present you real numbers here as they are confidential. I hope that the concept behind the idea is still comprehensible.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;The Problem: Periodic Effects&lt;/h2&gt;

&lt;p&gt;A few weeks ago, while performance testing a rather important and big release, we tried to figure out why sometimes the average response times (and the variation too) were looking okay and sometimes not. I had a suspicion that we could have a semi-periodic variance in the average response times, due to tasks running in the background. By just looking at the data and plotted graphs (see next next image), it was very hard to see.&lt;/p&gt;

&lt;p&gt;&lt;img class="center" src="http://tisba.de/images/posts/autocorrelation/graph_stdvar.png"&gt;&lt;/p&gt;

&lt;p&gt;So how can you verify that you have other (background) processes, scheduled activities or other external factors that influence your performance?&lt;/p&gt;

&lt;h2&gt;A Possible Solution: Autocorrelation&lt;/h2&gt;

&lt;p&gt;It turns out, that this problem was the topic of a lecture at the &lt;a href="http://www.fh-koeln.de/"&gt;university&lt;/a&gt;. I remembered a lecture about the &lt;em&gt;&amp;#8220;scientific basics of audio-visual media&amp;#8221;&lt;/em&gt;, where our &lt;a href="http://www.gm.fh-koeln.de/~hartmann/hartmann/Home.html"&gt;professor&lt;/a&gt; explained a quite simple, yet powerful tool to uncover periodicities in semi-periodic signals: &lt;em&gt;Autocorrelation&lt;/em&gt;. Okay, we don&amp;#8217;t have a signal in the sense of audio-visual media, but  we could think of the response time as a function over time, which would make it kind of like a signal.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Autocorrelation"&gt;Autocorrelation&lt;/a&gt; (short &lt;em&gt;ACF&lt;/em&gt;, autocorrelation function) is a cross-correlation of a signal with itself. By correlating a signal with itself, repetitive patterns will stand out and make it much easier to see. The (discrete) autocorrelation of a signal &lt;code&gt;x&lt;/code&gt; is defined by the following simple equation.&lt;/p&gt;

&lt;p&gt;&lt;img class="center" src="http://tisba.de/images/posts/autocorrelation/ac_formula.png"&gt;&lt;/p&gt;

&lt;p&gt;The entire signal &lt;code&gt;x&lt;/code&gt; is shifted by an offset &lt;code&gt;j&lt;/code&gt; and then multiplied by the original signal. This is repeated for every sample in the discrete signal. &lt;code&gt;R[0]&lt;/code&gt; is basically the &lt;a href="http://en.wikipedia.org/wiki/Energy_(signal_processing"&gt;energy of the signal&lt;/a&gt; and therefore the maximum of the ACF. &lt;code&gt;R[1]&lt;/code&gt; is the correlation of the signal with itself shifted by one sample &amp;mdash; you get the idea. If the signal has a significant enough self-similarity, the ACF will show this relation. In the case of a suspected periodicity the signal will repeat itself after each period. All we have to do now is run the autocorrelation and check for maxima in the result. If the maxima are within a certain delta of your suspected periodicity, you were right!&lt;/p&gt;

&lt;p&gt;So far, so good. I started to implement a discrete autocorrelation function in Ruby to give it a try.&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;autocorrelation (autocorrelation.rb)&lt;/span&gt; &lt;a href='http://tisba.de/code/autocorrelation/autocorrelation.rb'&gt;download&lt;/a&gt;&lt;/figcaption&gt;
 &lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;span class='line-number'&gt;3&lt;/span&gt;
&lt;span class='line-number'&gt;4&lt;/span&gt;
&lt;span class='line-number'&gt;5&lt;/span&gt;
&lt;span class='line-number'&gt;6&lt;/span&gt;
&lt;span class='line-number'&gt;7&lt;/span&gt;
&lt;span class='line-number'&gt;8&lt;/span&gt;
&lt;span class='line-number'&gt;9&lt;/span&gt;
&lt;span class='line-number'&gt;10&lt;/span&gt;
&lt;span class='line-number'&gt;11&lt;/span&gt;
&lt;span class='line-number'&gt;12&lt;/span&gt;
&lt;span class='line-number'&gt;13&lt;/span&gt;
&lt;span class='line-number'&gt;14&lt;/span&gt;
&lt;span class='line-number'&gt;15&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='rb'&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;autocorrelate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;window_size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;[]&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;.signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;.window_size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;      &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;&lt;code&gt;autocorrelate&lt;/code&gt; will cross-correlate the given &lt;code&gt;signal&lt;/code&gt; with itself, returning a new signal. I am using a sliding window here to optimize the process a bit (see below how to choose it properly). Also note that I patched the internal array&amp;#8217;s element accessor &lt;code&gt;[]&lt;/code&gt; in order to return &lt;code&gt;0&lt;/code&gt; instead of &lt;code&gt;nil&lt;/code&gt; for indices that are not set. To ease up further analysis you can normalize the signal. This is easy since the 0th shift is the maxima of the signal.&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;normalization (normalization.rb)&lt;/span&gt; &lt;a href='http://tisba.de/code/autocorrelation/normalization.rb'&gt;download&lt;/a&gt;&lt;/figcaption&gt;
 &lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;span class='line-number'&gt;3&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='rb'&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;normalize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;signal_n&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;signal_n&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;Now, all you have to do, is read your signal with something like &lt;code&gt;signal = load_signal("data/requests.txt")&lt;/code&gt; (signal needs to be an array of floats) and dump it into the method shown above.&lt;/p&gt;

&lt;p&gt;How to choose a proper size for the sliding window? &lt;code&gt;window_size&lt;/code&gt; has to be big enough to catch your suspected periodicity. Choosing it too big just slows down the process and does not increase the accuracy. In our case I chose &lt;code&gt;window_size&lt;/code&gt; to be ~300 samples wide, since I had the suspicion, that one of our periodic executed background tasks could be responsible for the variation. This task runs every 30 minutes, and since &lt;a href="tsung.erlang-projects.org"&gt;tsung&lt;/a&gt; generates one sample every 10 seconds, I was on the safe side using 300 samples for the &lt;code&gt;window_size&lt;/code&gt; in this case.&lt;/p&gt;

&lt;h2&gt;Result&lt;/h2&gt;

&lt;p&gt;Initially I had some problems getting my peak-picker working properly, so I decided to just plot the results using gnuplot. The following image shows the plotted autocorrelated and normalized values of the initial signal, &lt;code&gt;R[j]&lt;/code&gt;. The x-axis represents the used time-based shift. Keep in mind that tsung takes 1 sample every 10 seconds.&lt;/p&gt;

&lt;p&gt;&lt;img class="center" src="http://tisba.de/images/posts/autocorrelation/ac_requests.png"&gt;&lt;/p&gt;

&lt;p&gt;As you can clearly see, we have a peak at about every 180 samples, indicating that we have a base frequency of 1/1800 seconds, or 1/30 minutes. And 30 minutes looks pretty much exactly like one of our background tasks. The process runs for a few minutes, which is the reason the result is not a perfectly sharp spike. In the end, we optimized the task to have significantly less impact on the system&amp;#8217;s latency and shipped the feature &amp;mdash; end of story :)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;PS: adcloud is always looking for skilled developers. Feel free to contact me if you want to get in touch and make sure to visit their &lt;a href="http://adcloud.com/dev"&gt;dev site&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/0gpjJnGGMSg" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2012/02/21/how-to-find-periodic-effects-on-performance-using-autocorrelation/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Ruby is Magic!]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/Ozg9jo--zIk/" />
    <updated>2012-01-25T18:46:00+01:00</updated>
    <id>http://tisba.de/2012/01/25/ruby-is-magic</id>
    <content type="html">&lt;p&gt;As you might have been noticed already &lt;a href="https://twitter.com/railsbros_dirk"&gt;Dirk&lt;/a&gt; and I started &lt;a href="http://rubyismagic.de"&gt;rubyismagic.de&lt;/a&gt;. First it was just a quick idea to give a talk at &lt;a href="http://colognerb.de"&gt;cologne.rb&lt;/a&gt; – the local Ruby User Group here in Cologne. We talked about the seven types of closures in Ruby and we good quite positiv feedback right after the talk. So we decided to make the show a regular one at colognerb. We will take a closer look stuff you see everyday using Ruby, like closures.&lt;/p&gt;

&lt;p&gt;For every presentation at colognerb we&amp;#8217;ll post an article, the slides and code. Additionally we&amp;#8217;ll add some articles in between on subjects that are related to the shows topics.&lt;/p&gt;

&lt;p&gt;We hope you have fun reading the first episodes post about &lt;a href="http://rubyismagic.de/blog/2012/01/19/episode-7-closures/"&gt;Closures in Ruby&lt;/a&gt;.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/Ozg9jo--zIk" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2012/01/25/ruby-is-magic/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Riak talk at NoSQL UG Cologne]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/1a8aNs9mt-U/" />
    <updated>2012-01-16T09:36:00+01:00</updated>
    <id>http://tisba.de/2012/01/16/riak-talk-at-nosql-ug-cologne</id>
    <content type="html">&lt;p&gt;I helt a another little talk (in German) where I presented Riak at the &lt;a href="http://www.nosql-cologne.org/"&gt;NoSQL Usergroup Colgogne&lt;/a&gt;. A little late (sorry, caught a cold), but here are my slides.&lt;/p&gt;

&lt;div style="width:700px" id="__ss_11073579"&gt;&lt;iframe src="http://www.slideshare.net/slideshow/embed_code/11073579" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;

&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/1a8aNs9mt-U" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2012/01/16/riak-talk-at-nosql-ug-cologne/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[CouchDB Talk at NoSQL Cologne]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/8vJiAHx-Q-c/" />
    <updated>2011-11-16T00:00:00+01:00</updated>
    <id>http://tisba.de/2011/11/16/CouchDB-Talk-nosqlcgn</id>
    <content type="html">&lt;p&gt;I helt a little talk (in German) where I presented/introduced CouchDB at the &lt;a href="http://www.nosql-cologne.org/"&gt;NoSQL Usergroup Colgogne&lt;/a&gt; on Nov. 2nd. A little late, but here are my slides.&lt;/p&gt;

&lt;div style="width:700px" id="__ss_10182913"&gt;&lt;iframe src="http://www.slideshare.net/slideshow/embed_code/10182913" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;

&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/8vJiAHx-Q-c" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2011/11/16/CouchDB-Talk-nosqlcgn/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Native List Functions with CouchDB]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/_WAbS-gxt1M/" />
    <updated>2010-11-25T00:00:00+01:00</updated>
    <id>http://tisba.de/2010/11/25/native-list-functions-with-couchdb</id>
    <content type="html">&lt;p&gt;&lt;a href="http://wiki.apache.org/couchdb/Formatting_with_Show_and_List" title="Formatting_with_Show_and_List - Couchdb Wiki"&gt;Show and List Functions&lt;/a&gt; are used to transform single documents (show) and multiple documents e.g. from a view (list) into anything you want: JSON, HTML lists, SVG graphs&amp;#8230;&lt;/p&gt;

&lt;p&gt;You might know that you can write CouchDB Views in &lt;a href="http://www.erlang.org/" title="Erlang Programming Language, Official Website"&gt;Erlang&lt;/a&gt;. But you can also write Show and List functions in Erlang as well. Today I played a bit around with a list function I&amp;#8217;ve implemented in JavaScript first. I wanted to know, how much faster a native version would be and I wanted to write some Erlang too. I&amp;#8217;ve not done any extensive benchmarking, just simple queries, but the difference is quite significant. Writing Erlang - if you aren&amp;#8217;t used to it - might be an obstacle though.&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;So, what have I done? First you need to enable the Erlang view server. The &lt;a href="http://wiki.apache.org/couchdb/EnableErlangViews"&gt;&amp;#8220;How to Enable Erlang Views&amp;#8221;&lt;/a&gt; wiki page tells you what to do: Add a new section to your &lt;code&gt;local.ini&lt;/code&gt; or via Futon.&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='ini'&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;[native_query_servers]&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="na"&gt;erlang&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;{couch_native_process, start_link, []}&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;Here is the list function, I&amp;#8217;ve written in JavaScript: It&amp;#8217;s purpose is to filter view results based upon uniqueness of a specific field &lt;code&gt;ad_id&lt;/code&gt; in that case.&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;span class='line-number'&gt;3&lt;/span&gt;
&lt;span class='line-number'&gt;4&lt;/span&gt;
&lt;span class='line-number'&gt;5&lt;/span&gt;
&lt;span class='line-number'&gt;6&lt;/span&gt;
&lt;span class='line-number'&gt;7&lt;/span&gt;
&lt;span class='line-number'&gt;8&lt;/span&gt;
&lt;span class='line-number'&gt;9&lt;/span&gt;
&lt;span class='line-number'&gt;10&lt;/span&gt;
&lt;span class='line-number'&gt;11&lt;/span&gt;
&lt;span class='line-number'&gt;12&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='javascript'&gt;&lt;span class='line'&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;last_ad_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;headers&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;text/plain&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;getRow&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;last_ad_id&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ad_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;      &lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ad_id&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot; with &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;      &lt;span class="nx"&gt;last_ad_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ad_id&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;And here is the Erlang version with the same functionality. I&amp;#8217;m very new to Erlang so there might be (much) room for improvement :)&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;span class='line-number'&gt;3&lt;/span&gt;
&lt;span class='line-number'&gt;4&lt;/span&gt;
&lt;span class='line-number'&gt;5&lt;/span&gt;
&lt;span class='line-number'&gt;6&lt;/span&gt;
&lt;span class='line-number'&gt;7&lt;/span&gt;
&lt;span class='line-number'&gt;8&lt;/span&gt;
&lt;span class='line-number'&gt;9&lt;/span&gt;
&lt;span class='line-number'&gt;10&lt;/span&gt;
&lt;span class='line-number'&gt;11&lt;/span&gt;
&lt;span class='line-number'&gt;12&lt;/span&gt;
&lt;span class='line-number'&gt;13&lt;/span&gt;
&lt;span class='line-number'&gt;14&lt;/span&gt;
&lt;span class='line-number'&gt;15&lt;/span&gt;
&lt;span class='line-number'&gt;16&lt;/span&gt;
&lt;span class='line-number'&gt;17&lt;/span&gt;
&lt;span class='line-number'&gt;18&lt;/span&gt;
&lt;span class='line-number'&gt;19&lt;/span&gt;
&lt;span class='line-number'&gt;20&lt;/span&gt;
&lt;span class='line-number'&gt;21&lt;/span&gt;
&lt;span class='line-number'&gt;22&lt;/span&gt;
&lt;span class='line-number'&gt;23&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='erlang'&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;fun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;Head&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;Req&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="nv"&gt;Fun&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nv"&gt;Row&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nv"&gt;PrevAdID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;Doc&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;couch_util&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;get_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;doc&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Row&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;        &lt;span class="nv"&gt;Resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nn"&gt;couch_util&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;get_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;ad_id&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Doc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;          &lt;span class="n"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;            &lt;span class="n"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;          &lt;span class="nv"&gt;AdID&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;            &lt;span class="k"&gt;if&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;              &lt;span class="nv"&gt;AdID&lt;/span&gt; &lt;span class="o"&gt;/=&lt;/span&gt; &lt;span class="nv"&gt;PrevAdID&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                &lt;span class="nv"&gt;DocID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;couch_util&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;get_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;id&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Row&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                &lt;span class="nv"&gt;Text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;couch_util&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;get_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Doc&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                &lt;span class="nv"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list_to_binary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;io_lib&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Doc-ID &lt;/span&gt;&lt;span class="si"&gt;~p~n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;DocID&lt;/span&gt;&lt;span class="p"&gt;]))),&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                &lt;span class="nv"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list_to_binary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;io_lib&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Text &lt;/span&gt;&lt;span class="si"&gt;~p~n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;])));&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;              &lt;span class="n"&gt;true&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                &lt;span class="n"&gt;null&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;            &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;            &lt;span class="nv"&gt;AdID&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;        &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Resp&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="nv"&gt;FoldRows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;Fun&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;    &lt;span class="n"&gt;nil&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;Although this might not be a very good example, I&amp;#8217;ve learned some things. The Bindings available in the native Erlang views are defined in &lt;a href="https://gist.github.com/davisp/couchdb/blob/master/src/couchdb/couch_native_process.erl#L299"&gt;src/couchdb/couch_native_process.erl#299&lt;/a&gt;. Available are &lt;code&gt;Log&lt;/code&gt;, &lt;code&gt;Emit&lt;/code&gt; (for Views), &lt;code&gt;Start&lt;/code&gt;, &lt;code&gt;Send&lt;/code&gt; and &lt;code&gt;GetRow&lt;/code&gt; which are the counterparts to &lt;code&gt;log()&lt;/code&gt;, &lt;code&gt;emit(key, value)&lt;/code&gt;, &lt;code&gt;start()&lt;/code&gt;, &lt;code&gt;send()&lt;/code&gt; and &lt;code&gt;getRow()&lt;/code&gt; in the JavaScript view server. Additionally &lt;code&gt;FoldRows&lt;/code&gt; can be used as a helper to iterate over all rows in a list function.&lt;/p&gt;

&lt;p&gt;Uh, I almost forgot got talk about speed: The native view was about 75-85% (processing a few hundred rows takes about 200ms with Erlang) faster than the JavaScript version. But speed is not everything and often fast enough is okay. Since I don&amp;#8217;t speak Erlang very well, I&amp;#8217;d think at least twice before I optimize my views using native Erlang.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/_WAbS-gxt1M" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/11/25/native-list-functions-with-couchdb/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Fixing problems with iconv and ruby 1.9.x (rvm)]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/oQ_hok1lal4/" />
    <updated>2010-11-19T00:00:00+01:00</updated>
    <id>http://tisba.de/2010/11/19/fixing-problems-with-iconv-ruby19</id>
    <content type="html">&lt;p&gt;Today I had some weird issues with various gems complaining about missing iconv and readline. Here is how I fixed it: Installing the libs via &lt;code&gt;rvm package install&lt;/code&gt;, switched to the system ruby (not sure if this is really necessary), remove ruby 1.9.2 (&lt;strong&gt;important!&lt;/strong&gt;) and reinstall it. Before installing the rvm packages I removed any previous trace of them by &lt;code&gt;rm -rf ~/.rvm/usr&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I hope that might be handy for anyone having issues with that too.&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;span class='line-number'&gt;3&lt;/span&gt;
&lt;span class='line-number'&gt;4&lt;/span&gt;
&lt;span class='line-number'&gt;5&lt;/span&gt;
&lt;span class='line-number'&gt;6&lt;/span&gt;
&lt;span class='line-number'&gt;7&lt;/span&gt;
&lt;span class='line-number'&gt;8&lt;/span&gt;
&lt;span class='line-number'&gt;9&lt;/span&gt;
&lt;span class='line-number'&gt;10&lt;/span&gt;
&lt;span class='line-number'&gt;11&lt;/span&gt;
&lt;span class='line-number'&gt;12&lt;/span&gt;
&lt;span class='line-number'&gt;13&lt;/span&gt;
&lt;span class='line-number'&gt;14&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='line'&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;rm -rf ~/.rvm/usr
&lt;/span&gt;&lt;span class='line'&gt;rvm package install iconv
&lt;/span&gt;&lt;span class='line'&gt;rvm package install readline
&lt;/span&gt;&lt;span class='line'&gt;rvm package install zlib
&lt;/span&gt;&lt;span class='line'&gt;rvm package install autoconf
&lt;/span&gt;&lt;span class='line'&gt;rvm use system
&lt;/span&gt;&lt;span class='line'&gt;rvm remove 1.9.2
&lt;/span&gt;&lt;span class='line'&gt;rvm install 1.9.2 --with-iconv-dir&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$rvm_path&lt;/span&gt;/usr &lt;span class="se"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                  --with-readline-dir&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$rvm_path&lt;/span&gt;/usr &lt;span class="se"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                  --with-zlib-dir&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$rvm_path&lt;/span&gt;/usr &lt;span class="se"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;                  --with-openssl-dir&lt;span class="o"&gt;=&lt;/span&gt;/usr/local
&lt;/span&gt;&lt;span class='line'&gt;rvm --default 1.9.2
&lt;/span&gt;&lt;span class='line'&gt;rvm wrapper 1.9.2 textmate
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;

&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/oQ_hok1lal4" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/11/19/fixing-problems-with-iconv-ruby19/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Using gem edit via TextMate]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/9SbXvlTzX1I/" />
    <updated>2010-11-18T00:00:00+01:00</updated>
    <id>http://tisba.de/2010/11/18/using-gemedit-via-textmate</id>
    <content type="html">&lt;p&gt;The &lt;a href="https://rubygems.org/gems/gemedit"&gt;gemedit&lt;/a&gt;-gem is very useful if you want to have a quick look at what the lib you are using is doing. I found myself using &lt;code&gt;gem edit some_gem_name&lt;/code&gt; quite often, several times a day. Yesterday I thought it would be nice to have a shortcut to open a gem&amp;#8217;s code from within TextMate. So I wrote a little TextMate snippet. You can grab it here: &lt;a href="https://gist.github.com/703646"&gt;https://gist.github.com/703646&lt;/a&gt; (I&amp;#8217;ll also update the gist, if I found any bugs/issues).&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;If you follow the &amp;#8220;installation&amp;#8221; instructions, you can now hover over a word, press your chosen shortcut and the script will try to find a gem and opens it in a new TextMate window. If no corrosponding gem is found you&amp;#8217;ll get a text box where you can type in the name of the gem you want to see/edit.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://tisba.de/assets/images/edit_rubygem.png" alt="Specify the gem you want to open" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://tisba.de/assets/images/edit_rubygem_bundle_editor.png" alt="Edit Rubygem Bundle Editor" /&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/9SbXvlTzX1I" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/11/18/using-gemedit-via-textmate/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Wikipedia on CouchDB]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/59AC22oKP9s/" />
    <updated>2010-10-01T00:00:00+02:00</updated>
    <id>http://tisba.de/2010/10/01/wikipedia-on-couchdb</id>
    <content type="html">&lt;p&gt;This is the first post of a little series I&amp;#8217;m planing. It&amp;#8217;s about one of my favorite open source projects at the moment: &lt;a href="http://couchdb.apache.org" title="Apache CouchDB: The CouchDB Project"&gt;Apache CouchDB&lt;/a&gt;. I assume you&amp;#8217;ve already heard of the not-so-new player in the NoSQL league and I&amp;#8217;m watching the project for quite a while now. Little hint: &lt;a href="irc://irc.freenode.net/couchdb"&gt;#couchdb&lt;/a&gt; on irc.freenode.net is where you get in touch with the couchers and I&amp;#8217;m there most of the day, too.&lt;/p&gt;

&lt;p&gt;But what will this little series be about? Short: Play with &lt;a href="http://en.wikipedia.org/wiki/Main_Page" title="Main Page - Wikipedia, the free encyclopedia"&gt;Wikipedia&lt;/a&gt; and CouchDB. I want to give interested people some guidance to CouchDB and working with it. It&amp;#8217;s fun, believe me! And why Wikipedia? Because everybody knows it, they have &lt;a href="http://en.wikipedia.org/wiki/Special:Statistics"&gt;plenty of data&lt;/a&gt; to play with and it&amp;#8217;s just a perfect match for a &lt;a href="http://en.wikipedia.org/wiki/Document-oriented_database" title="Document-oriented database - Wikipedia, the free encyclopedia"&gt;document-orientated database&lt;/a&gt; like CouchDB. You can keep it simple, just import it, or you go one step further, do benchmarks, see how it performs, add lucene-powered full-text indices, write map/reduce views to analyse Wikipedia&amp;#8217;s content&amp;hellip; the possibilites are endless and maybe you even create something useful ;)&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;This first post will be about, how to get the data from Wikipedia into CouchDB.&lt;/p&gt;

&lt;h2&gt;Some preparations&lt;/h2&gt;

&lt;p&gt;We will first of all install CouchDB. You can get the latest version from &lt;a href="http://www.couchone.com/get" title="Get — Your Data. Anywhere."&gt;CouchOne&lt;/a&gt;. Of course you can build CouchDB from scratch if you like to, but this is perfect to get started. On Linux you might want to use a package out of your distributions repository. For more information check out the &lt;a href="http://wiki.apache.org/couchdb/" title="FrontPage - Couchdb Wiki"&gt;offcial wiki&lt;/a&gt; page on &lt;a href="http://wiki.apache.org/couchdb/Installation" title="Installation - Couchdb Wiki"&gt;installing CouchDB&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once that&amp;#8217;s done, you can use my import-tool by cloning my &lt;a href="http://github.com/tisba/wikiimporter.git"&gt;wikiimporter&lt;/a&gt;-repository on GitHub:&lt;/p&gt;

&lt;figure class='code'&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class=''&gt;&lt;span class='line'&gt;git clone http://github.com/tisba/wikiimporter.git &amp;&amp; cd wikiimporter&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;I&amp;#8217;ve basically written some little scripts that will help you to fetch the latest XML dump of Wikipedia, parse and transform it to &lt;a href="http://www.json.org/" title="JSON"&gt;JSON&lt;/a&gt; and upload the stuff into your CouchDB instance.&lt;/p&gt;

&lt;p&gt;To use my scripts, you need the following dependencies:&lt;/p&gt;

&lt;figure class='code'&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class=''&gt;&lt;span class='line'&gt;gem install nokogiri trollop yajl-ruby&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;Now we are ready to rumble!&lt;/p&gt;

&lt;h2&gt;Let&amp;#8217;s go!&lt;/h2&gt;

&lt;p&gt;What&amp;#8217;s next? Right: Get the material. I assume you are in the wikiimporter directory:&lt;/p&gt;

&lt;figure class='code'&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class=''&gt;&lt;span class='line'&gt;./bin/wiki2couch.sh enwiki http://localhost:5984/enwiki&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;This will take some time depending on your bandwidth and IO-performance. You can also cancel the process. Be aware that you cannot resume it at the moment, but if you just want to have a few thousand articles this will work just fine.&lt;/p&gt;

&lt;p&gt;If you want more information on wikiimporter check out the projects &lt;a href="http://github.com/tisba/wikiimporter/blob/master/README.md" title="README.md at master from tisba's wikiimporter - GitHub"&gt;README&lt;/a&gt; on GitHub.&lt;/p&gt;

&lt;h2&gt;What&amp;#8217;s next?&lt;/h2&gt;

&lt;p&gt;Next time I&amp;#8217;ll quickly show how to set up &lt;a href="http://github.com/rnewson/couchdb-lucene" title="rnewson's couchdb-lucene at master - GitHub"&gt;couchdb-lucene&lt;/a&gt; to realize a nice fulltext search to explore the imported wikipedia articles.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/59AC22oKP9s" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/10/01/wikipedia-on-couchdb/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[Hire me!]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/DkaVFoCIdH4/" />
    <updated>2010-09-28T00:00:00+02:00</updated>
    <id>http://tisba.de/2010/09/28/Hire-me</id>
    <content type="html">&lt;p&gt;I recently finished my studies in computer science at the &lt;a href="http://www.fh-koeln.de/" title="Fachhochschule K&amp;ouml;ln - Cologne University of Applied Sciences"&gt;Cologne University of Applied Sciences&lt;/a&gt;, so you may call me master of computer science now *yay!* ;)&lt;/p&gt;

&lt;p&gt;Seriously: It feels good to be (finally) finished with this part of my life now. And now?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I&amp;#8217;d like to work on your projects!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m specialized in Ruby and Rails and other web technology like JavaScript and all the stack down to application servers, caching, messaging services, protocols like HTTP&amp;hellip; &amp;ndash; you name it. I also have experience in MySQL as well as several NoSQL datastores (especially &lt;a href="http://couchdb.apache.org/" title="Apache CouchDB: The CouchDB Project"&gt;CouchDB&lt;/a&gt;). My master&amp;#8217;s thesis was about &lt;em&gt;design patterns for scalable, service-orientated web-architectures&lt;/em&gt; &amp;mdash; so designing and implementing scalable web-architectures is something I&amp;#8217;m familiar with too.&lt;/p&gt;

&lt;p&gt;My desk and working place &lt;a href="http://maps.google.de/maps?f=q&amp;amp;source=s_q&amp;amp;hl=de&amp;amp;geocode=&amp;amp;q=Hochstadenstra%C3%9Fe+1-3,+K%C3%B6ln&amp;amp;sll=50.92804,6.93953&amp;amp;sspn=0.008683,0.016608&amp;amp;ie=UTF8&amp;amp;hq=&amp;amp;hnear=Hochstadenstra%C3%9Fe+1,+K%C3%B6ln+50674+K%C3%B6ln,+Nordrhein-Westfalen&amp;amp;ll=50.9266,6.942072&amp;amp;spn=0.017366,0.033216&amp;amp;z=15"&gt;here&lt;/a&gt; in Cologne (Germany) is hosted by the mighty &lt;a href="http://galaxycats.com/" title="Galaxy Cats IT Consulting GmbH - Ruby on Rails Beratung und Entwicklung - Home"&gt;Galaxy Cats&lt;/a&gt; which are very passionate developers and geeks &amp;mdash; just like me. So if you want to get in touch feel free to drop by (&lt;a href="http://en.wikipedia.org/wiki/Club-Mate" title="Club-Mate - Wikipedia, the free encyclopedia"&gt;Club Mate&lt;/a&gt; is on me).&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m looking forward to hear from you!&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/DkaVFoCIdH4" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/09/28/Hire-me/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[CouchDB Shirt Arrived]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/B2xFirufUgg/" />
    <updated>2010-05-19T00:00:00+02:00</updated>
    <id>http://tisba.de/2010/05/19/CouchDB-Shirt-Arrived</id>
    <content type="html">&lt;p&gt;Have a look what just arrived! :)&lt;/p&gt;

&lt;p&gt;&lt;img src="http://tisba.de/assets/images/couchdb_shirt.jpg" alt="CouchDB Shirt" /&gt;&lt;/p&gt;

&lt;p&gt;Ordered from the German &lt;a href="http://couchdb-de.spreadshirt.de/" title="CouchDB Shop Germany"&gt;CouchDB-Spreadshirt&lt;/a&gt;. If you want to have other products just ping me (I am managing the products there).&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/B2xFirufUgg" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/05/19/CouchDB-Shirt-Arrived/</feedburner:origLink></entry>
  
  <entry>
    <title type="html"><![CDATA[CouchDB-Lucene Console]]></title>
    <link href="http://feedproxy.google.com/~r/tisbablog/~3/4H75LJDTIPs/" />
    <updated>2010-04-21T00:00:00+02:00</updated>
    <id>http://tisba.de/2010/04/21/CouchDB-Lucene-Console</id>
    <content type="html">&lt;p&gt;Really quick, but I wanted to start with an actual useful blogpost (I&amp;#8217;ve some more interesting topics in the queue though). So here we go!&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m playing a lot with &lt;a href="http://couchdb.apache.org/" title="Apache CouchDB: The CouchDB Project"&gt;CouchDB&lt;/a&gt; and &lt;a href="http://github.com/rnewson/couchdb-lucene"&gt;CouchDB-Lucene&lt;/a&gt; and I was missing something: An &lt;strong&gt;easy&lt;/strong&gt; way to play with queries to c-l, without having to think about proper URL encodings, without having to remember the current/correct URL and syntax for a given index. And so I wrote this little ruby gem called &lt;a href="http://github.com/tisba/cl-console/" title="tisba's cl-console at master - GitHub"&gt;cl-console&lt;/a&gt;!&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;To get started:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install the gem: &lt;code&gt;gem install cl-console&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;ensure that CouchDB and CouchDB-Lucene is running&lt;/li&gt;
&lt;li&gt;fire up an IRB session: &lt;code&gt;irb -rrubygems -rcl_console&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;instantiate a CLConsole-object (see readme for details)&lt;/li&gt;
&lt;li&gt;have fun!&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Here is what a typical session looks like (&lt;em&gt;I&amp;#8217;ve used pretty_print for prettier output&lt;/em&gt;):&lt;/p&gt;

&lt;figure class='code'&gt;&lt;figcaption&gt;&lt;span&gt;Example session&lt;/span&gt;&lt;/figcaption&gt;&lt;div class="highlight"&gt;&lt;table&gt;&lt;tr&gt;&lt;td class="gutter"&gt;&lt;pre class="line-numbers"&gt;&lt;span class='line-number'&gt;1&lt;/span&gt;
&lt;span class='line-number'&gt;2&lt;/span&gt;
&lt;span class='line-number'&gt;3&lt;/span&gt;
&lt;span class='line-number'&gt;4&lt;/span&gt;
&lt;span class='line-number'&gt;5&lt;/span&gt;
&lt;span class='line-number'&gt;6&lt;/span&gt;
&lt;span class='line-number'&gt;7&lt;/span&gt;
&lt;span class='line-number'&gt;8&lt;/span&gt;
&lt;span class='line-number'&gt;9&lt;/span&gt;
&lt;span class='line-number'&gt;10&lt;/span&gt;
&lt;span class='line-number'&gt;11&lt;/span&gt;
&lt;span class='line-number'&gt;12&lt;/span&gt;
&lt;span class='line-number'&gt;13&lt;/span&gt;
&lt;span class='line-number'&gt;14&lt;/span&gt;
&lt;span class='line-number'&gt;15&lt;/span&gt;
&lt;span class='line-number'&gt;16&lt;/span&gt;
&lt;span class='line-number'&gt;17&lt;/span&gt;
&lt;span class='line-number'&gt;18&lt;/span&gt;
&lt;span class='line-number'&gt;19&lt;/span&gt;
&lt;span class='line-number'&gt;20&lt;/span&gt;
&lt;span class='line-number'&gt;21&lt;/span&gt;
&lt;span class='line-number'&gt;22&lt;/span&gt;
&lt;span class='line-number'&gt;23&lt;/span&gt;
&lt;span class='line-number'&gt;24&lt;/span&gt;
&lt;span class='line-number'&gt;25&lt;/span&gt;
&lt;span class='line-number'&gt;26&lt;/span&gt;
&lt;span class='line-number'&gt;27&lt;/span&gt;
&lt;span class='line-number'&gt;28&lt;/span&gt;
&lt;span class='line-number'&gt;29&lt;/span&gt;
&lt;span class='line-number'&gt;30&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class='code'&gt;&lt;pre&gt;&lt;code class='irb'&gt;&lt;span class='line'&gt;&lt;span class="gp"&gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class="n"&gt;cl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;CLConsole&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;cl-test/cl-test/range&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;=&amp;gt; #&amp;lt;CLConsole:0x101e2f7c8 @options={}, @cl_url=&amp;quot;http://localhost:5984/cl-test/_fti/_design/cl-test/range&amp;quot;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="gp"&gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class="n"&gt;pp&lt;/span&gt; &lt;span class="n"&gt;cl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;{&amp;quot;doc_count&amp;quot;=&amp;gt;2,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;disk_size&amp;quot;=&amp;gt;585,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;current&amp;quot;=&amp;gt;true,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;ref_count&amp;quot;=&amp;gt;2,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;fields&amp;quot;=&amp;gt;[&amp;quot;price&amp;quot;, &amp;quot;default&amp;quot;],&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;optimized&amp;quot;=&amp;gt;true,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;last_modified&amp;quot;=&amp;gt;&amp;quot;1271589171000&amp;quot;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;doc_del_count&amp;quot;=&amp;gt;0}&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;=&amp;gt; nil&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="gp"&gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class="n"&gt;pp&lt;/span&gt; &lt;span class="n"&gt;cl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;test&amp;quot;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="gp"&gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="ss"&gt;:test&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;{&amp;quot;total_rows&amp;quot;=&amp;gt;1,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;etag&amp;quot;=&amp;gt;&amp;quot;11a69e6ea30bedf8&amp;quot;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;search_duration&amp;quot;=&amp;gt;0,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;q&amp;quot;=&amp;gt;&amp;quot;default:test&amp;quot;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;rows&amp;quot;=&amp;gt;[{&amp;quot;id&amp;quot;=&amp;gt;&amp;quot;f3fba9f61520e0ef2a245772a900074c&amp;quot;, &amp;quot;score&amp;quot;=&amp;gt;1}],&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;fetch_duration&amp;quot;=&amp;gt;0,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;limit&amp;quot;=&amp;gt;25,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt; &amp;quot;skip&amp;quot;=&amp;gt;0}&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;=&amp;gt; nil&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="gp"&gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class="n"&gt;pp&lt;/span&gt; &lt;span class="n"&gt;cl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qd&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;test&amp;quot;&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="gp"&gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="ss"&gt;:test&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;[{&amp;quot;price&amp;quot;=&amp;gt;&amp;quot;543.00&amp;quot;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;  &amp;quot;title&amp;quot;=&amp;gt;&amp;quot;test&amp;quot;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;  &amp;quot;_rev&amp;quot;=&amp;gt;&amp;quot;4-7d11268b0aa408f4b55bbd5df5ab2b49&amp;quot;,&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;  &amp;quot;_id&amp;quot;=&amp;gt;&amp;quot;f3fba9f61520e0ef2a245772a900074c&amp;quot;}]&lt;/span&gt;
&lt;/span&gt;&lt;span class='line'&gt;&lt;span class="go"&gt;=&amp;gt; nil&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;


&lt;p&gt;I have to admit, &lt;code&gt;cl-console&lt;/code&gt; is a very lame name, but who cares? I hope you like it anyways :)&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/tisbablog/~4/4H75LJDTIPs" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://tisba.de/2010/04/21/CouchDB-Lucene-Console/</feedburner:origLink></entry>
  
</feed>

