<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>1rad</title>
	<atom:link href="http://1rad.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://1rad.wordpress.com</link>
	<description>For your viewing pleasure: Some piece on ruby each monday morning...</description>
	<lastBuildDate>Tue, 03 Nov 2009 13:16:51 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='1rad.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/a8034bcb97561dd490f02b158855ff02?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>1rad</title>
		<link>http://1rad.wordpress.com</link>
	</image>
			<item>
		<title>0&#215;28 &#8211; Rails thread threats, and run_later</title>
		<link>http://1rad.wordpress.com/2009/10/18/0x28-rails-thread-threats-and-run_later/</link>
		<comments>http://1rad.wordpress.com/2009/10/18/0x28-rails-thread-threats-and-run_later/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 10:41:17 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=398</guid>
		<description><![CDATA[We all know that rails has a rocky history regarding threads. Sadly, that seems also include the Rails port of one of my favourite Merb features: run_later.  
Basically run_later takes a block, turns it into a Proc, and sends it to a worker threads for later execution. That way the request processing is not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=398&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We all know that rails has a rocky history regarding threads. Sadly, that seems also include the Rails port of one of my favourite Merb features: <a href="http://github.com/mattmatt/run_later">run_later</a>.  </p>
<p>Basically run_later takes a block, turns it into a Proc, and sends it to a worker threads for later execution. That way the request processing is not hindered in any way. Say, you want to send a &#8220;you have just signed-up&#8221; email to your users: this is a perfect solution: easy to use, lightweight (you don&#8217;t need extra middle ware), and semi reliable (no fallback when your system breaks down).</p>
<p>However, I ran into few problems using mattmatt&#8217;s solution in, at least, development mode: </p>
<p>- the app regularly ran into class (un)loading issues, and<br />
- Rails&#8217; mysql adapter apparently didn&#8217;t disposed of used database connections, refusing new connections</p>
<p>While all of the above can be explained as some of the quirks of the development environment it didn&#8217;t increase the &#8220;trust level&#8221; into that solution (and I have to point out here, that markmark&#8217;s code looks pretty good to me, and that these problems more likely arise from the somewhat idiosyncratic behaviour of Rails towards threads)</p>
<p>That made me thinking: why use threads in the first place? After all, what we need is a defined point during request processing that gives us a handle to yield of some piece of code, and which occurs after the request&#8217;s response has been sent back to the client. And, yes, thanks to metal, I found one.</p>
<p>So <a href="http://github.com/pboy/threadless">here</a> is a solution. It is not as feature complete as markmark&#8217;s, tests are still missing, and it blocks the server process until the run_later block is finished. (But you have more than one server process running, haven&#8217;t you?)</p>
<p>Someone out there wants to help move that into a regular plugin?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/398/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=398&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/10/18/0x28-rails-thread-threats-and-run_later/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;27 &#8211; [BUG] cross-thread violation of rb_gc()&#8230;</title>
		<link>http://1rad.wordpress.com/2009/09/06/0x27-bug-cross-thread-violation-of-rb_gc/</link>
		<comments>http://1rad.wordpress.com/2009/09/06/0x27-bug-cross-thread-violation-of-rb_gc/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 14:34:51 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=396</guid>
		<description><![CDATA[If you are running accross this error


[BUG] cross-thread violation of rb_gc()
ruby 1.8.6 (2008-08-11) [universal-darwin9.0]


- say you are are installing the latest so-called &#8220;stable&#8221; typo version on your OSX machine &#8211; then you might see the above error. Here is the solution: *remove the bundled json gem!*: It is version 1.1.3, which is way old, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=396&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you are running accross this error<br />
<code>
<pre>
[BUG] cross-thread violation of rb_gc()
ruby 1.8.6 (2008-08-11) [universal-darwin9.0]
</pre>
<p></code><br />
- say you are are installing the latest so-called &#8220;stable&#8221; <a href="http://github.com/fdv/typo/tree/master">typo</a> version on your OSX machine &#8211; then you might see the above error. Here is the solution: *remove the bundled json gem!*: It is version 1.1.3, which is way old, and apparently it contains some binaries that were compiled using ruby 1.8.6. Just install the &#8220;json&#8221; gem locally.   </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/396/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=396&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/09/06/0x27-bug-cross-thread-violation-of-rb_gc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;26 &#8211; Where 100% C0 code coverage is just not good enough</title>
		<link>http://1rad.wordpress.com/2009/08/28/0x26-where-100-c0-code-coverage-is-just-not-good-enough/</link>
		<comments>http://1rad.wordpress.com/2009/08/28/0x26-where-100-c0-code-coverage-is-just-not-good-enough/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 13:40:20 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=393</guid>
		<description><![CDATA[I guess you are using rcov too to check that all your code was active in your tests at least once. Well, then, here are some bad news: 

rcov code coverage only checks whether or not a line was executed, meaning any code from that source line. And this usually trips on

do_something if some_condition?

because what [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=393&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I guess you are using rcov too to check that all your code was active in your tests at least once. Well, then, here are some bad news: </p>
<ul>
<li>rcov code coverage only checks whether or not a line was executed, meaning any code from that source line. And this usually trips on
<pre class="brush: ruby;">
do_something if some_condition?
</pre>
<p>because what happens if some_condition? always fails in your tests? (say, &#8220;Rails.env.production?&#8221;). A somewhat chatty way to detect such cases is to write it down on multiple lines: </p>
<pre class="brush: ruby;">
if some_condition?
  do_something
end
</pre>
</li>
<li>Due to the heavily dynamic structure of a Ruby application nearly nothing is guaranteed to yield the same results when calling at a different time or in a different context, even code as simple as
<pre class="brush: ruby;">
%w(a b c).sort
</pre>
<p>may yield unexpected &#8211; for the naive reader &#8211; results. So even if you have 100% code coverage, the case might be that the entire test framework which runs the tests for you behaves differently depending if called from rcov, and then your code might behave different within the framework and without it.
</li>
</ul>
<p>No, I don&#8217;t strive for a 100% test coverage. I employ TDD any now and then: there are cases where that works just perfectly. I employ a big enough test suite to give me confidence in my app. And I employ black box tests &#8211; the real world is where the real app will be running. So testing against that is what gives me confidence in my application.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=393&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/08/28/0x26-where-100-c0-code-coverage-is-just-not-good-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;25 &#8211; Add support for greylisted users to your site</title>
		<link>http://1rad.wordpress.com/2009/08/26/0x25-add-support-for-greylisted-users-to-your-site/</link>
		<comments>http://1rad.wordpress.com/2009/08/26/0x25-add-support-for-greylisted-users-to-your-site/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 22:59:53 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=391</guid>
		<description><![CDATA[In the ever ongoing fight against spam there is one really wonderful weapon: greylisting. For those that don&#8217;t know how it works: whenever an email server sends an email for the first time, the receiving mail server rejects the email with a temporary error. The idea being that a legimitate server resends the email after [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=391&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In the ever ongoing fight against spam there is one really wonderful weapon: greylisting. For those that don&#8217;t know how it works: whenever an email server sends an email for the first time, the receiving mail server rejects the email with a temporary error. The idea being that a legimitate server resends the email after a certain period of time, and then the email gets through, but a spam sender is likely not to resend the mail again.</p>
<p>Which works like a charm &#8211; I have a spam ratio of less than 1% since I enabled grey listing, and that without any spam classification on my servers &#8211; unless&#8230; you are registering at a new web service. In which case the confirmation email doesn&#8217;t get through the first time, me having to wait for some indeterminate time. On a countless number of services I just decided that the wait was not worth my time&#8230;</p>
<p>If you want to give me and other grey listers a smooth user experience consider the following:</p>
<ul>
<li>reduce the grace period from one hour (which is quite likely the default value in your Linux distribution too) to a value around 5 minutes, and/or</li>
<li>modify your application that a user, which is registered, may use the service for a certain time without confirming the confirmation email.</li>
</ul>
<p>I understand that the second option is some work and might not always possible; but the first option is just a simple configuration setting and should take your system admin no longer than 5 minutes.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/391/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=391&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/08/26/0x25-add-support-for-greylisted-users-to-your-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;24 &#8211; mongrel_rails restart: It might not work well.</title>
		<link>http://1rad.wordpress.com/2009/08/10/0x24-mongrel_rails-restart/</link>
		<comments>http://1rad.wordpress.com/2009/08/10/0x24-mongrel_rails-restart/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 10:06:25 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=383</guid>
		<description><![CDATA[Just found out that mongrel_rails restart does NOT work, when the original mongrel was started with the -c option. Yuk! 
Well, this is not entirely true. It works if the -c parameter contains an absolute path, or refers &#8220;to itself&#8221;:
-c ../current works like a charm, and in fact updates the current directory to whereever current [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=383&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Just found out that mongrel_rails restart does NOT work, when the original mongrel was started with the <i>-c</i> option. Yuk! </p>
<p>Well, this is not entirely true. It works if the -c parameter contains an absolute path, or refers &#8220;to itself&#8221;:<br />
<i>-c ../current</i> works like a charm, and in fact updates the current directory to whereever current points currently.</p>
<p>However, I could not get <i>mongrel_rails restart &#8211;soft</i> working&#8230;.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/383/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=383&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/08/10/0x24-mongrel_rails-restart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;23 &#8211; Study: ruby coders are more attractive than PHP coders.</title>
		<link>http://1rad.wordpress.com/2009/07/22/0x23-study-ruby-coders-are-more-attractive-than-php-coders/</link>
		<comments>http://1rad.wordpress.com/2009/07/22/0x23-study-ruby-coders-are-more-attractive-than-php-coders/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 17:07:43 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=380</guid>
		<description><![CDATA[Well, that is of course total bullshit. With that title I will conduct a small experiment.
I found that the least informative of my blog posts attract the most readers. So if this stays true with that post (and a title like that should attract at least some attention) I will add more noise here. Promise!
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=380&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well, that is of course total bullshit. With that title I will conduct a small experiment.</p>
<p>I found that the least informative of my blog posts attract the most readers. So if this stays true with that post (and a title like that should attract at least some attention) I will add more noise here. Promise!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/380/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=380&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/07/22/0x23-study-ruby-coders-are-more-attractive-than-php-coders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;22 &#8211; Your daily class variables and constants surprise</title>
		<link>http://1rad.wordpress.com/2009/07/20/0x22-your-daily-class-variables-and-constants-surprise/</link>
		<comments>http://1rad.wordpress.com/2009/07/20/0x22-your-daily-class-variables-and-constants-surprise/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 12:55:14 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[class variable]]></category>
		<category><![CDATA[constant]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scope]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=378</guid>
		<description><![CDATA[It is not chrismas, hence no quiz, but this was strangely surprising:

class A
  @@t = &#34;A::@@t&#34;
  T=&#34;A::T&#34;

  def self.s1; @@t; end
  def self.s2; T; end
end

class B &#60; A
  def self.s1; @@t; end
  def self.s2; T; end
end

class C &#60; A
  @@t = &#34;C::@@t&#34;
  T=&#34;C::T&#34;
  def self.s1; @@t; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=378&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It is not chrismas, hence no quiz, but this was strangely surprising:</p>
<pre class="brush: ruby;">
class A
  @@t = &quot;A::@@t&quot;
  T=&quot;A::T&quot;

  def self.s1; @@t; end
  def self.s2; T; end
end

class B &lt; A
  def self.s1; @@t; end
  def self.s2; T; end
end

class C &lt; A
  @@t = &quot;C::@@t&quot;
  T=&quot;C::T&quot;
  def self.s1; @@t; end
  def self.s2; T; end
end

[ A.s1, A.s2, B.s1, B.s2, C.s1, C.s2 ]
</pre>
<p>gives you</p>
<pre class="brush: ruby;">
[&quot;C::@@t&quot;, &quot;A::T&quot;, &quot;C::@@t&quot;, &quot;A::T&quot;, &quot;C::@@t&quot;, &quot;C::T&quot;]
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/378/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=378&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/07/20/0x22-your-daily-class-variables-and-constants-surprise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;21 &#8211; Array#to_proc</title>
		<link>http://1rad.wordpress.com/2009/07/17/0x21-arrayto_proc/</link>
		<comments>http://1rad.wordpress.com/2009/07/17/0x21-arrayto_proc/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 11:09:19 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=375</guid>
		<description><![CDATA[
class Array
  def to_proc
    proc do &#124;obj&#124;
      self.map { &#124;sym&#124; obj.send(sym) }
    end
  end
end

gives you

Account.all.map(&#38;%w(id email))

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=375&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre><code style="font-size:80%;">
class Array
  def to_proc
    proc do |obj|
      self.map { |sym| obj.send(sym) }
    end
  end
end
</code></pre>
<p>gives you</p>
<pre><code>
Account.all.map(&amp;%w(id email))
</code></pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=375&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/07/17/0x21-arrayto_proc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>0&#215;20 &#8211; Sphinx/ThinkingSphinx vs Xapian/ActsAsXapian shootout</title>
		<link>http://1rad.wordpress.com/2009/07/10/0x20-thinkingsphinx-vs-actsasxapian-shootout/</link>
		<comments>http://1rad.wordpress.com/2009/07/10/0x20-thinkingsphinx-vs-actsasxapian-shootout/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 16:44:17 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[acts_as_xapian]]></category>
		<category><![CDATA[fulltext]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[Sphinx]]></category>
		<category><![CDATA[thinking_sphinx]]></category>
		<category><![CDATA[Xapian]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=371</guid>
		<description><![CDATA[This benchmark compares thinking_sphinx with acts_as_xapian. We need a search engine that gives us the IDs of matching documents from a fulltext index, basic text search only.
Data

one table with 200k entries with 5k of text (avg) in one column
one table with 500k entries with 7k of text (avg) in 6 columns
one table with 500k entries [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=371&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This benchmark compares thinking_sphinx with acts_as_xapian. We need a search engine that gives us the IDs of matching documents from a fulltext index, basic text search only.</p>
<h2>Data</h2>
<ul>
<li>one table with 200k entries with 5k of text (avg) in one column</li>
<li>one table with 500k entries with 7k of text (avg) in 6 columns</li>
<li>one table with 500k entries with 7k of text (avg) in 4 columns</li>
</ul>
<h2>Indexing</h2>
<p>Initial indexing took 10 mins with thinking_sphins and 75 mins(!!) on acts_as_xapian</p>
<h2>Search performance</h2>
<p>The search performance on queries that return only a few items is nearly identical.</p>
<p>The search performance on queries that return many items (~10000) is nearly<br />
identical, 90% of the time is spend in ActiveRecord.</p>
<p>In our case &#8211; we only need IDs and not the entire documents &#8211; sphinx runs<br />
at 0.6 secs for a particular query (with 10000 results),<br />
where acts_as_xapian needs 4.5 secs. This is because thinking_sphinx allows<br />
you to only fetch the ids, where acts_as_xapian insists of pulling the<br />
models from the database. When patching acts_as_xapian to allow for pulling<br />
ids only, we land at 0.6 vs 0.4 secs.</p>
<h2>Results</h2>
<p>We will choose sphinx because </p>
<ul>
<li>it is similarily fast to xapian</li>
<li>runs over the network by default</li>
<li>Indexing is way faster (I guess because acts_as_xapian pulls all data to be index from the database to hand it over, while sphinx can do that itself)</li>
<li>acts_as_xapian would need to be patched for performance reasons.</li>
</ul>
<h2>And here is some food for our beloved web spiders</h2>
<ul>
<li><a href="http://xapian.org/">Xapian</a></li>
<li><a href="http://github.com/frabcus/acts_as_xapian/tree/master">acts_as_xapian</a></li>
<li><a href="http://sphinxsearch.com/">Sphinx</a></li>
<li><a href="http://freelancing-god.github.com/ts/en/">thinking_sphinx</a></li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/371/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=371&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/07/10/0x20-thinkingsphinx-vs-actsasxapian-shootout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
		<item>
		<title>CouchDB is here to stay!</title>
		<link>http://1rad.wordpress.com/2009/07/08/couchdb-is-here-to-stay/</link>
		<comments>http://1rad.wordpress.com/2009/07/08/couchdb-is-here-to-stay/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 20:59:52 +0000</pubDate>
		<dc:creator>eno</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1rad.wordpress.com/?p=369</guid>
		<description><![CDATA[While some of my 5 readers on average (per day) might already know, for everyone else: CouchDB will be part of the next Ubuntu release. And that one comes with long time support. 
Congratulations, Couchies.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=369&subd=1rad&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>While some of my 5 readers on average (per day) might already know, for everyone else: <a href="http://couch.io">CouchDB</a> will be part of the next Ubuntu release. And that one comes with long time support. </p>
<p>Congratulations, Couchies.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1rad.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1rad.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1rad.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1rad.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1rad.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1rad.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1rad.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1rad.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1rad.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1rad.wordpress.com/369/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1rad.wordpress.com&blog=4662390&post=369&subd=1rad&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1rad.wordpress.com/2009/07/08/couchdb-is-here-to-stay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">eno</media:title>
		</media:content>
	</item>
	</channel>
</rss>