<?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>MyFunnyDev &#187; Uncategorized</title>
	<atom:link href="http://michalkuklis.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://michalkuklis.com/blog</link>
	<description>web, coding and beyond</description>
	<lastBuildDate>Fri, 25 Jun 2010 05:51:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>javascript closures</title>
		<link>http://michalkuklis.com/blog/2010/06/25/javascript-closures-2/</link>
		<comments>http://michalkuklis.com/blog/2010/06/25/javascript-closures-2/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 05:37:54 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=302</guid>
		<description><![CDATA[For given content:

  &#60;div id=&#34;test0&#34;&#62;change me&#60;/div&#62;
  &#60;div id=&#34;test1&#34;&#62;change me&#60;/div&#62;
  &#60;div id=&#34;test2&#34;&#62;change me&#60;/div&#62;
  &#60;div id=&#34;test3&#34;&#62;change me&#60;/div&#62;

The code:

 for &#40;var i = 0; i &#60; 4; i++&#41; &#123;
   $&#40;'#test' + i&#41;.click&#40;function&#40;&#41;&#123;
     $&#40;this&#41;.html&#40;i&#41;;
   &#125;&#41;;
&#125;

will print (every time any of the elements is clicked):

4
4
4
4

Here is how this [...]]]></description>
			<content:encoded><![CDATA[<p>For given content:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;test0&quot;</span><span style="color: #339933;">&gt;</span>change me<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;test1&quot;</span><span style="color: #339933;">&gt;</span>change me<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;test2&quot;</span><span style="color: #339933;">&gt;</span>change me<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;test3&quot;</span><span style="color: #339933;">&gt;</span>change me<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"> <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#test'</span> <span style="color: #339933;">+</span> i<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>will print (every time any of the elements is clicked):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #CC0000;">4</span>
<span style="color: #CC0000;">4</span>
<span style="color: #CC0000;">4</span>
<span style="color: #CC0000;">4</span></pre></div></div>

<p>Here is how this could be solved with the closure:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#test'</span> <span style="color: #339933;">+</span> i<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/06/25/javascript-closures-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>managing gems with rvm named gem sets</title>
		<link>http://michalkuklis.com/blog/2010/05/30/managing-gems-with-rvm-named-gem-sets/</link>
		<comments>http://michalkuklis.com/blog/2010/05/30/managing-gems-with-rvm-named-gem-sets/#comments</comments>
		<pubDate>Mon, 31 May 2010 03:20:44 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=298</guid>
		<description><![CDATA[RVM (Ruby Version Manager) is a tool which lets you install and switch between multiple ruby versions. RVM has also something called Named Gem Sets. This is pretty cool because you can create many different gem sets for different types of apps. Here is how to do it (I assume you have rvm already installed [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rvm.beginrescueend.com/">RVM (Ruby Version Manager)</a> is a tool which lets you install and switch between multiple ruby versions. RVM has also something called <a href="http://rvm.beginrescueend.com/gemsets/basics/">Named Gem Sets</a>. This is pretty cool because you can create many different gem sets for different types of apps. Here is how to do it (I assume you have rvm already installed if not check <a href="http://rvm.beginrescueend.com/rvm/install/">this</a> out):</p>
<ul>
<li>go to your project folder and create new file called .<strong>rvmrc</strong></li>
<li>open .rvmrc and add rvm ruby-version@your-gem-set for example <strong>rvm ruby-1.9.1@railsgems</strong></li>
<li>close file and type: <strong>rvm gemset create your-gem-set </strong>(this will create new set)</li>
<li>type gem list (you should see empty list with no gems installed)</li>
</ul>
<p>It&#8217;s almost as you would start with a fresh system <img src='http://michalkuklis.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/05/30/managing-gems-with-rvm-named-gem-sets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dfs in ruby :)</title>
		<link>http://michalkuklis.com/blog/2010/01/14/bfs-in-ruby/</link>
		<comments>http://michalkuklis.com/blog/2010/01/14/bfs-in-ruby/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 05:38:42 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=277</guid>
		<description><![CDATA[I wrote simple dfs in ruby:

def dfs&#40;node, value, queue&#41;
  return false if node.nil?	
  return true if node.data == value
&#160;
  queue.push node.right unless node.right.nil?
  queue.push node.left unless node.left.nil?	
&#160;
  dfs&#40;queue.pop, value, queue&#41;	
end

for node:

class Node
  attr_accessor :left, :right, :data
end

]]></description>
			<content:encoded><![CDATA[<p>I wrote simple dfs in ruby:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> dfs<span style="color:#006600; font-weight:bold;">&#40;</span>node, value, queue<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">false</span> <span style="color:#9966CC; font-weight:bold;">if</span> node.<span style="color:#0000FF; font-weight:bold;">nil</span>?	
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#9966CC; font-weight:bold;">if</span> node.<span style="color:#9900CC;">data</span> == value
&nbsp;
  queue.<span style="color:#9900CC;">push</span> node.<span style="color:#9900CC;">right</span> <span style="color:#9966CC; font-weight:bold;">unless</span> node.<span style="color:#9900CC;">right</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
  queue.<span style="color:#9900CC;">push</span> node.<span style="color:#9900CC;">left</span> <span style="color:#9966CC; font-weight:bold;">unless</span> node.<span style="color:#9900CC;">left</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?	
&nbsp;
  dfs<span style="color:#006600; font-weight:bold;">&#40;</span>queue.<span style="color:#9900CC;">pop</span>, value, queue<span style="color:#006600; font-weight:bold;">&#41;</span>	
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>for node:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Node
  attr_accessor <span style="color:#ff3333; font-weight:bold;">:left</span>, <span style="color:#ff3333; font-weight:bold;">:right</span>, <span style="color:#ff3333; font-weight:bold;">:data</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2010/01/14/bfs-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Academia vs. Business</title>
		<link>http://michalkuklis.com/blog/2009/11/18/academia-vs-business/</link>
		<comments>http://michalkuklis.com/blog/2009/11/18/academia-vs-business/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 17:05:02 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=256</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.xkcd.com/comics/academia_vs_business.png" alt="Academia vs. Business" width="566" height="291" /></p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/11/18/academia-vs-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gemcutter &amp; Jeweler</title>
		<link>http://michalkuklis.com/blog/2009/10/17/gemcutter-jeweler/</link>
		<comments>http://michalkuklis.com/blog/2009/10/17/gemcutter-jeweler/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 05:03:47 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=240</guid>
		<description><![CDATA[More about gemcutter &#038; jeweler  can be found here.
Here are the steps how to publish patched gem cloned from github:
1. Append username to gem name in .gemspec or if you use jeweler open Rakefile and edit Jeweler::Tasks section save it and run:

rake gemspec

2. Build gem with:

gem build

3. Push new gem to gemcutter

gem push

]]></description>
			<content:encoded><![CDATA[<p>More about <a href="http://gemcutter.org/">gemcutter</a> &#038; <a href="http://github.com/technicalpickles/jeweler">jeweler </a> can be found <a href="http://railscasts.com/episodes/183-gemcutter-jeweler">here</a>.</p>
<p>Here are the steps how to publish patched gem cloned from github:</p>
<p>1. Append username to gem name in .gemspec or if you use jeweler open Rakefile and edit Jeweler::Tasks section save it and run:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rake gemspec</pre></div></div>

<p>2. Build gem with:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem build</pre></div></div>

<p>3. Push new gem to gemcutter</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem push</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/10/17/gemcutter-jeweler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BDD with Cucumber by Ben Mabey</title>
		<link>http://michalkuklis.com/blog/2009/08/29/bdd-with-cucumber/</link>
		<comments>http://michalkuklis.com/blog/2009/08/29/bdd-with-cucumber/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 16:16:33 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=235</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><embed src='http://mwrc2009.confreaks.com/player.swf' height='380' width='640' allowscriptaccess='always' allowfullscreen='true' flashvars='image=images%2F14-mar-2009-15-00-bdd-with-cucumber-ben-mabey-preview.png&#038;file=http%3A%2F%2Fmwrc2009.confreaks.com%2Fvideos%2F14-mar-2009-15-00-bdd-with-cucumber-ben-mabey-small.mp4&#038;plugins=viral-1'/></p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/08/29/bdd-with-cucumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>auto escaping html in Rails to protect from XSS</title>
		<link>http://michalkuklis.com/blog/2009/07/29/auto-escaping-html-in-rails-to-protect-from-xss/</link>
		<comments>http://michalkuklis.com/blog/2009/07/29/auto-escaping-html-in-rails-to-protect-from-xss/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 01:24:02 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=233</guid>
		<description><![CDATA[Tonight I found a plugin to auto escape html in order to protect from XSS attacks. I&#8217;m not sure why rails doesn&#8217;t do it out of the box (you have to use h() helper). Anyway the plugin is called xss_terminate and it can be found here. The cool thing about it is that now you [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight I found a plugin to auto escape html in order to protect from XSS attacks. I&#8217;m not sure why rails doesn&#8217;t do it out of the box (you have to use h() helper). Anyway the plugin is called xss_terminate and it can be found <a href="http://github.com/look/xss_terminate/tree/master">here</a>. The cool thing about it is that now you can forget about h() <img src='http://michalkuklis.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/07/29/auto-escaping-html-in-rails-to-protect-from-xss/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cron in Ruby</title>
		<link>http://michalkuklis.com/blog/2009/07/27/cron-in-ruby/</link>
		<comments>http://michalkuklis.com/blog/2009/07/27/cron-in-ruby/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 06:10:35 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=230</guid>
		<description><![CDATA[Check out how Whenever gem can simplify cron configuration.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://railscasts.com/episodes/164-cron-in-ruby">Check out</a> how <a href="http://github.com/javan/whenever/tree/master">Whenever</a> gem can simplify cron configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/07/27/cron-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>key-value store</title>
		<link>http://michalkuklis.com/blog/2009/07/26/key-value-store/</link>
		<comments>http://michalkuklis.com/blog/2009/07/26/key-value-store/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 15:40:56 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=227</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img width="700px" src="http://browsertoolkit.com/fault-tolerance.png" alt="Key/Value DB" /></p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/07/26/key-value-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>daemon_controller + Thinking Sphinx</title>
		<link>http://michalkuklis.com/blog/2009/07/22/daemon_controller-thinking-sphinx/</link>
		<comments>http://michalkuklis.com/blog/2009/07/22/daemon_controller-thinking-sphinx/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 06:13:02 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=220</guid>
		<description><![CDATA[I&#8217;ve created simple rails initiator in order to start Sphinx through daemon_controller based on the Thinking Sphinx configuration. I hope it will help somebody.

require 'daemon_controller'
&#160;
def before_start
  if not ThinkingSphinx.define_indexes?
    config = ThinkingSphinx::Configuration.instance
    cmd = &#34;#{config.bin_path}#{config.indexer_binary_name} --config \&#34;#{config.config_file}\&#34; --all&#34;
    cmd &#60;&#60; &#34; --rotate&#34; if ThinkingSphinx.sphinx_running?
  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created simple rails initiator in order to start <a href="http://sphinxsearch.com/">Sphinx</a> through <a href="http://blog.phusion.nl/2008/08/25/daemon_controller-a-library-for-robust-daemon-management/">daemon_controller</a> based on the <a href="http://freelancing-god.github.com/ts/en/">Thinking Sphinx</a> configuration. I hope it will help somebody.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'daemon_controller'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> before_start
  <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">not</span> ThinkingSphinx.<span style="color:#9900CC;">define_indexes</span>?
    config = <span style="color:#6666ff; font-weight:bold;">ThinkingSphinx::Configuration</span>.<span style="color:#9900CC;">instance</span>
    cmd = <span style="color:#996600;">&quot;#{config.bin_path}#{config.indexer_binary_name} --config <span style="color:#000099;">\&quot;</span>#{config.config_file}<span style="color:#000099;">\&quot;</span> --all&quot;</span>
    cmd <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot; --rotate&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> ThinkingSphinx.<span style="color:#9900CC;">sphinx_running</span>?
    <span style="color:#CC0066; font-weight:bold;">system</span> cmd
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">defined</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>ThinkingSphinx<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> ThinkingSphinx.<span style="color:#9900CC;">sphinx_running</span>? 
    conf_instance = <span style="color:#6666ff; font-weight:bold;">ThinkingSphinx::Configuration</span>.<span style="color:#9900CC;">instance</span>
    <span style="color:#0066ff; font-weight:bold;">@controller</span> = DaemonController.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>
      <span style="color:#ff3333; font-weight:bold;">:identifier</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Sphinx search server'</span>,
      <span style="color:#ff3333; font-weight:bold;">:start_command</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;#{conf_instance.bin_path}#{conf_instance.searchd_binary_name} --pidfile --config <span style="color:#000099;">\&quot;</span>#{conf_instance.config_file}<span style="color:#000099;">\&quot;</span>&quot;</span>,
      <span style="color:#ff3333; font-weight:bold;">:before_start</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> method<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:before_start</span><span style="color:#006600; font-weight:bold;">&#41;</span>,
      <span style="color:#ff3333; font-weight:bold;">:ping_command</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> TCPSocket.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>conf_instance.<span style="color:#9900CC;">configuration</span>.<span style="color:#9900CC;">searchd</span>.<span style="color:#9900CC;">address</span>, conf_instance.<span style="color:#9900CC;">configuration</span>.<span style="color:#9900CC;">searchd</span>.<span style="color:#9900CC;">port</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
      <span style="color:#ff3333; font-weight:bold;">:pid_file</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> conf_instance.<span style="color:#9900CC;">configuration</span>.<span style="color:#9900CC;">searchd</span>.<span style="color:#9900CC;">pid_file</span>,
      <span style="color:#ff3333; font-weight:bold;">:log_file</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> conf_instance.<span style="color:#9900CC;">configuration</span>.<span style="color:#9900CC;">searchd</span>.<span style="color:#9900CC;">log</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@controller</span>.<span style="color:#9900CC;">start</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2009/07/22/daemon_controller-thinking-sphinx/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
