<?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"
	>

<channel>
	<title>techlog.fetmab.net</title>
	<atom:link href="http://techlog.fetmab.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://techlog.fetmab.net</link>
	<description>Technical insides from MMOG development with Ruby on Rails</description>
	<pubDate>Tue, 01 Apr 2008 06:55:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Euruko 2008 - The summary</title>
		<link>http://techlog.fetmab.net/euruko-2008-the-summary/</link>
		<comments>http://techlog.fetmab.net/euruko-2008-the-summary/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 16:41:19 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/euruko-2008-the-summary/</guid>
		<description><![CDATA[The next two days in Prague the things went more like they should :) . We had a nice first day with interesting talks. Unfortunately most of the talks were in a little bit &#8220;philosophical&#8221; direction. This IS interesting too, but it seemed to us, that nothing really new was said during that talks, so [...]]]></description>
			<content:encoded><![CDATA[<p>The next two days in Prague the things went more like they should :) . We had a nice first day with interesting talks. Unfortunately most of the talks were in a little bit &#8220;philosophical&#8221; direction. This IS interesting too, but it seemed to us, that nothing really new was said during that talks, so that the technical ones were more &#8220;innovative&#8221;.</p>
<p>Koichi&#8217;s topic was VERY interesting. Maybe it would&#8217;ve been cool, if he had the opportunity to speak something like the Netbeans tutorial. A longer, less philosophical, more detailed explanation of his work.</p>
<p>A very interesting talk of the first day was the lightning introduction to the &#8220;Agile Whiteboard&#8221; by Kingsley Hendrickse and his companion. This is actually a white board web application where you can pin notes (story cards) to a virtual whiteboard, drag and group them into categories. It may sound very simple but their implementation looked nice and really usable! So as far as we&#8217;ve understood there is no public version of this one now, but they will release it&#8217;s source in the near future. Maybe they should consider to make a &#8220;white board service&#8221; from that, too. There likely will be users who would pay for such a service.</p>
<p>Davids talk via Skype was nice, but philosophical, too. But what he said perfectly fitted into a Ruby conference! We thought it might be a little bit misplaced, beforehand. What turned out to be somewhat true during the Q&#038;A session after his talk. As it wasn&#8217;t a talk about &#8220;hard facts&#8221; not many questions regarding the talk arose and it seemed, that the people didn&#8217;t really know what to ask him. Maybe this is a little bit surprising, as a quick poll during Matz&#8217;s talk showed, that around 90% of the participants come from a Rails background.</p>
<p>The day ended with a nice party.</p>
<p>I had a beer and Goulash (thanks again, Carsten) with the person who taught me the Rails basics, a professor at the University of Bremen, and we talked a while about the conference day, a Rails/Ruby user group in Bremen and many other things.</p>
<p>Sunday morning I delayed our arrival at the conference with my strong feelings against getting up on time. So we missed the first talk which, accordingly to Carsten, was a very interesting one. So if you feel like testing if your mocks represent the mocked objects correctly, you should have a look at <a href="http://nutrun.com/">Synthesis</a> by George Malamidis.</p>
<p>Tomasz Stachewicz held an interesting talk about running things in background (mostly) in Rails. His solution is far superior to our <a href="http://stupid.fetmab.net">StupidBackground</a>, but the reason why he and we built our solutions seems to be the same: BackgrounDRB is too complex to use and run. So if you&#8217;re looking for accurate timed, background operations have a look at his project (no link, we&#8217;ve to wait till the slides get released). But if you just need a real simple solution with a nice, little DSL to define when things should run you definitively should have a look at StupidBackground ;) .</p>
<p>My favorite talk of the whole conference was the &#8220;Building <a href="http://playground.isonrails.com/">Rails Playground</a>&#8221; one by Petr Krontorád. They built a system, similar to Heroku but (different to what Jürgen suggested in his moderation of the Q&#038;A session after the talk) we think that this system is better than Heroku! It has a nicer editor, access to the hosted projects via WebDAV and nice statistics. And: It&#8217;s a non-commercial project! They see themselves as a platform for beginners to start working with Rails. I&#8217;ve requested an invite to the system just after 2 minutes of the talk. Can&#8217;t wait to be accepted! A lot of kudos to this Petr and the rest of the team!</p>
<p>Unfortunately we had to leave after this talk and missed the last two talks which sounded really interesting, too (&#8221;Aspect Oriented Programming in Ruby&#8221; and &#8220;Lessons Learned Writing Native Extensions&#8221;). And maybe even more unfortunately we missed the rest of the lighting talks :/ .</p>
<p>But we should stop moaning! It was a great weekend and the organisators of the event did a GREAT job! We should say thank you to all the sponsors: SUN, ataxo, brightbox, CODE GEAR, Engine Yard, Unicorn College, Bit Nami, Dr Nic Academy, iQuest, Kraxnet, Nodeta and Skvělý.cz to help making such a great experience possible!</p>
<p>See you all next year somewhere in Europe :) .</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/euruko-2008-the-summary/&amp;title=Euruko+2008+-+The+summary" title="Add 'Euruko 2008 - The summary' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Euruko 2008 - The summary' to Del.icio.us" alt="Add 'Euruko 2008 - The summary' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/euruko-2008-the-summary/&amp;title=Euruko+2008+-+The+summary" title="Add 'Euruko 2008 - The summary' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Euruko 2008 - The summary' to digg" alt="Add 'Euruko 2008 - The summary' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/euruko-2008-the-summary/" title="Add 'Euruko 2008 - The summary' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Euruko 2008 - The summary' to Technorati" alt="Add 'Euruko 2008 - The summary' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/euruko-2008-the-summary/&amp;t=Euruko+2008+-+The+summary" title="Add 'Euruko 2008 - The summary' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Euruko 2008 - The summary' to Yahoo My Web" alt="Add 'Euruko 2008 - The summary' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/euruko-2008-the-summary/&amp;title=Euruko+2008+-+The+summary" title="Add 'Euruko 2008 - The summary' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Euruko 2008 - The summary' to Stumble Upon" alt="Add 'Euruko 2008 - The summary' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/euruko-2008-the-summary/&amp;title=Euruko+2008+-+The+summary" title="Add 'Euruko 2008 - The summary' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Euruko 2008 - The summary' to Google Bookmarks" alt="Add 'Euruko 2008 - The summary' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/euruko-2008-the-summary/" title="Add 'Euruko 2008 - The summary' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Euruko 2008 - The summary' to Shadows" alt="Add 'Euruko 2008 - The summary' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Euruko+2008+-+The+summary&amp;url=http://techlog.fetmab.net/euruko-2008-the-summary/" title="Add 'Euruko 2008 - The summary' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Euruko 2008 - The summary' to Ask" alt="Add 'Euruko 2008 - The summary' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/euruko-2008-the-summary/&amp;title=Euruko+2008+-+The+summary" title="Add 'Euruko 2008 - The summary' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Euruko 2008 - The summary' to Live-MSN" alt="Add 'Euruko 2008 - The summary' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/euruko-2008-the-summary/" title="Add 'Euruko 2008 - The summary' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Euruko 2008 - The summary' to FaceBook" alt="Add 'Euruko 2008 - The summary' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/euruko-2008-the-summary/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Euruko 2008 - The beginning</title>
		<link>http://techlog.fetmab.net/euruko-2008-the-beginning/</link>
		<comments>http://techlog.fetmab.net/euruko-2008-the-beginning/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 16:41:08 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/euruko-2008-the-beginning/</guid>
		<description><![CDATA[Hey folks,
we&#8217;ve just returned, after an adventurous journey over Geneva, from Prague and brought a lot of impressions back, to Germany.
After the Euruko 2007 in Vienna, last year, this was the second Euruko we attended and we think that it was a great success! The familiar spirit couldn&#8217;t be washed away by a quadrupled number [...]]]></description>
			<content:encoded><![CDATA[<p>Hey folks,</p>
<p>we&#8217;ve just returned, after an adventurous journey over Geneva, from Prague and brought a lot of impressions back, to Germany.<br />
After the Euruko 2007 in Vienna, last year, this was the second Euruko we attended and we think that it was a great success! The familiar spirit couldn&#8217;t be washed away by a quadrupled number of participants and so we had two days full of fun and information, a great combination. I&#8217;ve splitted our report up into two parts. This one is a narrative summary of what happened, before the conference has even begun and the second part will be a less narrative summary of our favorite talks and comments on the conference. </p>
<p>It shouldn&#8217;t take too long, till the first curious thing happened to us: Just arrived at the Prague airport, we took our luggage, and wanted to take the next taxi to our hotel. But as we were just checking how long the transfer to the hotel would take by bus or tram, Peter and Marianna asked if we are attending Euruko&#8230; It took a while, but I can&#8217;t imagine anything that roughly sound like Euruko so I had to believe that they really said &#8220;Euruko&#8221;. After he explained, that he remembered our faces from the last conference the situation was little bit more clear ;) . But then that: They were at the airport with Karel and waited for&#8230; *drum roll* Matz :) . Woah! Alright, we changed our plan: No more taxi, instead a public transportation ride with Matz to the city. Nice start of this weekend! But actually the plan was changed once again. Sebastian was hit by a nasty virus last week and still struggled a little, so after waiting for about 30 minutes we left, without Matz and the his reception committee by taxi. Strange first hour in Prague :) .</p>
<p>After we had checked in at the hotel, I discovered Prague on my own. After a delicious meal near the hotel it was already somewhat around midnight, but I thought that tough Rubyists would doubtlessly partying till the early morning, so it would be worth go to the party, even if I would be a little late. A long story short: There is a club in Prague called &#8220;Farbique&#8221; or somewhat like that. I was confused, that it isn&#8217;t possible to buy a tram ticket IN the tram and then walked all the way down town, where this club is located. I found it&#8230; but it wasn&#8217;t &#8220;La Frabika&#8221; ;) . So this was my party-night at Friday. I found a ticket machine in a metro station, took the tram back to our hotel.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/euruko-2008-the-beginning/&amp;title=Euruko+2008+-+The+beginning" title="Add 'Euruko 2008 - The beginning' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Euruko 2008 - The beginning' to Del.icio.us" alt="Add 'Euruko 2008 - The beginning' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/euruko-2008-the-beginning/&amp;title=Euruko+2008+-+The+beginning" title="Add 'Euruko 2008 - The beginning' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Euruko 2008 - The beginning' to digg" alt="Add 'Euruko 2008 - The beginning' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/euruko-2008-the-beginning/" title="Add 'Euruko 2008 - The beginning' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Euruko 2008 - The beginning' to Technorati" alt="Add 'Euruko 2008 - The beginning' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/euruko-2008-the-beginning/&amp;t=Euruko+2008+-+The+beginning" title="Add 'Euruko 2008 - The beginning' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Euruko 2008 - The beginning' to Yahoo My Web" alt="Add 'Euruko 2008 - The beginning' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/euruko-2008-the-beginning/&amp;title=Euruko+2008+-+The+beginning" title="Add 'Euruko 2008 - The beginning' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Euruko 2008 - The beginning' to Stumble Upon" alt="Add 'Euruko 2008 - The beginning' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/euruko-2008-the-beginning/&amp;title=Euruko+2008+-+The+beginning" title="Add 'Euruko 2008 - The beginning' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Euruko 2008 - The beginning' to Google Bookmarks" alt="Add 'Euruko 2008 - The beginning' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/euruko-2008-the-beginning/" title="Add 'Euruko 2008 - The beginning' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Euruko 2008 - The beginning' to Shadows" alt="Add 'Euruko 2008 - The beginning' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Euruko+2008+-+The+beginning&amp;url=http://techlog.fetmab.net/euruko-2008-the-beginning/" title="Add 'Euruko 2008 - The beginning' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Euruko 2008 - The beginning' to Ask" alt="Add 'Euruko 2008 - The beginning' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/euruko-2008-the-beginning/&amp;title=Euruko+2008+-+The+beginning" title="Add 'Euruko 2008 - The beginning' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Euruko 2008 - The beginning' to Live-MSN" alt="Add 'Euruko 2008 - The beginning' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/euruko-2008-the-beginning/" title="Add 'Euruko 2008 - The beginning' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Euruko 2008 - The beginning' to FaceBook" alt="Add 'Euruko 2008 - The beginning' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/euruko-2008-the-beginning/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pimp My Rails - How to build a MMOG with Rails</title>
		<link>http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/</link>
		<comments>http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 15:22:13 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/</guid>
		<description><![CDATA[Hi,
we&#8217;ve been working on a Rails tutorial series in the last couple of weeks and the first of those articles has now been published.
Take a moment  and head over to the guys from galaxy-news.net. We&#8217;re proud being asked for this tutorial by Galaxy-News and hope you like it! Please leave any comments, regarding this [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>we&#8217;ve been working on a Rails tutorial series in the last couple of weeks and the first of those articles has now been published.<br />
Take a moment  and head over to the guys from <a href="http://www.galaxy-news.net">galaxy-news.net</a>. We&#8217;re proud being asked for this tutorial by Galaxy-News and hope you like it! Please leave any comments, regarding this article, at the Galaxy-News comment section.</p>
<p><a href="http://www.galaxy-news.net/content/230_pimp_my_rails.html"><strong>To the article!</strong></a></p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/&amp;title=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Del.icio.us" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/&amp;title=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to digg" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Technorati" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/&amp;t=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Yahoo My Web" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/&amp;title=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Stumble Upon" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/&amp;title=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Google Bookmarks" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Shadows" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails&amp;url=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Ask" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/&amp;title=Pimp+My+Rails+-+How+to+build+a+MMOG+with+Rails" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to Live-MSN" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Pimp My Rails - How to build a MMOG with Rails' to FaceBook" alt="Add 'Pimp My Rails - How to build a MMOG with Rails' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/pimp-my-rails-how-to-build-a-mmog-with-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stupid Background Update</title>
		<link>http://techlog.fetmab.net/stupid-background-update/</link>
		<comments>http://techlog.fetmab.net/stupid-background-update/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 10:01:31 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[iWeb]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[Stupid Background]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/stupid-background-update/</guid>
		<description><![CDATA[I&#8217;ve tagged the version 0.1.2 a few days ago and time has come to announce this :) .
A cool new feature made it&#8217;s way in this release which gives you the ability of concurrent jobs. In addition to this we&#8217;ve added a first, rough spec so it&#8217;s definitively a good one to check out.
But that&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve tagged the version 0.1.2 a few days ago and time has come to announce this :) .</p>
<p>A cool new feature made it&#8217;s way in this release which gives you the ability of concurrent jobs. In addition to this we&#8217;ve added a first, rough spec so it&#8217;s definitively a good one to check out.</p>
<p>But that&#8217;s not all. Together with the 0.1.2 release Stupid Background got it&#8217;s own webpage! Ok, I&#8217;ve to admit that it&#8217;s nothing special, just a drag&#038;drop page made with iWeb, but this means it looks fine ;) . So have a look at the new pages, which you can find at: <a href="http://stupid.fetmab.net/">http://stupid.fetmab.net </a>.</p>
<p><a href="http://stupid.fetmab.net"><img src='http://techlog.fetmab.net/wp-content/uploads/2008/02/20080216-stupid-background.jpg' alt='Stupid Background' /></a></p>
<p>So long!</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/stupid-background-update/&amp;title=Stupid+Background+Update" title="Add 'Stupid Background Update' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Stupid Background Update' to Del.icio.us" alt="Add 'Stupid Background Update' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/stupid-background-update/&amp;title=Stupid+Background+Update" title="Add 'Stupid Background Update' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Stupid Background Update' to digg" alt="Add 'Stupid Background Update' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/stupid-background-update/" title="Add 'Stupid Background Update' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Stupid Background Update' to Technorati" alt="Add 'Stupid Background Update' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/stupid-background-update/&amp;t=Stupid+Background+Update" title="Add 'Stupid Background Update' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Stupid Background Update' to Yahoo My Web" alt="Add 'Stupid Background Update' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/stupid-background-update/&amp;title=Stupid+Background+Update" title="Add 'Stupid Background Update' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Stupid Background Update' to Stumble Upon" alt="Add 'Stupid Background Update' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/stupid-background-update/&amp;title=Stupid+Background+Update" title="Add 'Stupid Background Update' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Stupid Background Update' to Google Bookmarks" alt="Add 'Stupid Background Update' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/stupid-background-update/" title="Add 'Stupid Background Update' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Stupid Background Update' to Shadows" alt="Add 'Stupid Background Update' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Stupid+Background+Update&amp;url=http://techlog.fetmab.net/stupid-background-update/" title="Add 'Stupid Background Update' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Stupid Background Update' to Ask" alt="Add 'Stupid Background Update' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/stupid-background-update/&amp;title=Stupid+Background+Update" title="Add 'Stupid Background Update' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Stupid Background Update' to Live-MSN" alt="Add 'Stupid Background Update' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/stupid-background-update/" title="Add 'Stupid Background Update' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Stupid Background Update' to FaceBook" alt="Add 'Stupid Background Update' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/stupid-background-update/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wanna have some fun? Try these: Class Variables and Forking!</title>
		<link>http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/</link>
		<comments>http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 19:51:42 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[class variables]]></category>

		<category><![CDATA[fork]]></category>

		<category><![CDATA[instance variables]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/</guid>
		<description><![CDATA[Ok boys,
the last two nights I spent on an issue which seems soooooo weird to me, that I have to write about it. I don&#8217;t know if it&#8217;s because I&#8217;m, even after a year of Ruby development, still too much Java-minded and just don&#8217;t get the idea of Ruby&#8217;s class variables or if they are [...]]]></description>
			<content:encoded><![CDATA[<p>Ok boys,</p>
<p>the last two nights I spent on an issue which seems soooooo weird to me, that I have to write about it. I don&#8217;t know if it&#8217;s because I&#8217;m, even after a year of Ruby development, still too much Java-minded and just don&#8217;t get the idea of Ruby&#8217;s class variables or if they are totally screwed up them self&#8230; Anyway, here is my story:</p>
<p>I tried to enhance the StupidBackground plugin a little. It should be possible to assign workers to a certain &#8220;runner&#8221;, so that it would be easy to have more than one background runner. Maybe one for your quick running tasks and one for the ones that take eons to finish.</p>
<p>Until tonight we stored the list of tasks a runner should run in a class variable of that runner. That worked out fairly good until I made the changes described above. After these changes the code runs somehow like this:</p>
<ul>
<li>Run &#8220;main runner&#8221;</li>
<li>Check all Worker classes</li>
<li>If a worker uses a different worker than the default one, start another worker and fork it away (via Daemonized)</li>
<ul>
<li>This forked away runner checks all workers again for the ones, using it</li>
<li>After the fork the &#8220;main runner&#8221; continues with the worker checking and maybe forks away more runners, when needed.</li>
</ul>
</ul>
<p>That means there is a process which forks away more and more processes and there are class variables. To make a long story short: An awful idea! All the processes shared the class variables! Which led to a state where every runner ran every task. As I said before, it took me quite a while to debug this, but finally the guys from #ruby-de on irc.freenode.org bailed me out.</p>
<p>So if class variables are the problem, was is the solution? Instance variables! Pretty good idea, but what to do in a class context like:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">class</span> Blah
    <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">foo</span>
      <span style="color:#008000; font-style:italic;">#what to do here?</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>As I said before my mind is still polluted with Java so I forgot about an important fact at this point: Class is a full-fledged object. So there would be no problem with using instance variables in this context. Ok, you have to understand that those instance variables are not accessible as an instance variable in the instance context of this class but I think this is comprehensible.</p>
<p>But I&#8217;m still astonished that the following is possible:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">class</span> Blah
    <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">foo</span>
      <span style="color:#0066ff; font-weight:bold;">@test_var</span> ||= <span style="color:#CC0066; font-weight:bold;">Array</span>.<span style="color:#9900CC;">new</span>
      <span style="color:#0066ff; font-weight:bold;">@test_var</span> &lt;&lt; <span style="color:#0066ff; font-weight:bold;">@test_var</span>.<span style="color:#9900CC;">size</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#CC0066; font-weight:bold;">p</span> Blah.<span style="color:#9900CC;">foo</span> <span style="color:#008000; font-style:italic;"># [0]</span>
  <span style="color:#CC0066; font-weight:bold;">p</span> Blah.<span style="color:#9900CC;">foo</span> <span style="color:#008000; font-style:italic;"># [0,1]</span>
  <span style="color:#CC0066; font-weight:bold;">p</span> Blah.<span style="color:#9900CC;">foo</span> <span style="color:#008000; font-style:italic;"># [0,1,2]</span></pre></td></tr></table></div>

<p>This might be not new to you if you really know Ruby, but if you&#8217;re just slowly getting to it from some other language such concepts might be hard to remember when you need them. But I hope with this post I can jog your memory :) .</p>
<p>Kudos to the guys at #ruby-de for the nice and quick help!</p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/&amp;title=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Del.icio.us" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/&amp;title=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to digg" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Technorati" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/&amp;t=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Yahoo My Web" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/&amp;title=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Stumble Upon" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/&amp;title=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Google Bookmarks" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Shadows" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21&amp;url=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Ask" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/&amp;title=Wanna+have+some+fun%3F+Try+these%3A+Class+Variables+and+Forking%21" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Live-MSN" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to FaceBook" alt="Add 'Wanna have some fun? Try these: Class Variables and Forking!' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/wanna-have-some-fun-try-these-class-variables-and-forking/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cache in a seperate folder</title>
		<link>http://techlog.fetmab.net/cache-in-a-seperate-folder/</link>
		<comments>http://techlog.fetmab.net/cache-in-a-seperate-folder/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 00:13:57 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Caching]]></category>

		<category><![CDATA[TTL]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/cache-in-a-seperate-folder/</guid>
		<description><![CDATA[Today we realized that the project is evolved enough to take some time and think about how we can cache things efficiently.
One of the actions we were in doubt of most seriously is the action that responds to an AJAX call and returns you the position of the trucks that are rolling all over the [...]]]></description>
			<content:encoded><![CDATA[<p>Today we realized that the project is evolved enough to take some time and think about how we can cache things efficiently.</p>
<p>One of the actions we were in doubt of most seriously is the action that responds to an AJAX call and returns you the position of the trucks that are rolling all over the map.</p>
<p>Some heave stuff going around in the background of this and even if anyone requests it only once in a minute, we wanted a caching solution for that, so that 100 users don&#8217;t do 100 requests that are handled by our application in a minute, but 99 requests that are fulfilled by Apache and just 1 which our application has to take care about.</p>
<p>The solution is pretty simple: Page Caching. Ok, this is not a big deal in Rails, but we had to expire the cache with a <a href="http://en.wikipedia.org/wiki/Time_to_live">TTL</a> of 1 minute or maybe 58 seconds. That is not included in the Rails caching mechanisms and even if there are <a href="http://www.elctech.com/2007/6/20/conditional-action-caching-with-cache_fu">plugins</a> out there that can do exactly that, we decided not to get into them, because we would like to stay as closest as possible to the Rails &#8220;core&#8221; to keep the way for future colleagues, joining us with the project, very straightforward and not full of third-party-plugin-obstacles.</p>
<p>So: How can we expire the Rails page cache every minute? Hm&#8230; just delete the file that it has generated every minute! Cool! Ok, cool for one file whose name we know very well, but not so cool if we want to expire the whole cache. Why? Rails keeps all the generated pages of the page cache just in your public directory.</p>
<p>So public/controller/action.html might be the path to a cached page. This is ok, but wouldn&#8217;t it be nice to have something like public/cache/controller/action.html? It definitely would be much clearer and the expiration of the whole cache would be very easy, too.</p>
<p>And it&#8217;s really easy to achieve this! Most of the way you have to go is described <a href="http://blog.hasmanythrough.com/2008/1/30/segregated-page-cache-storage">here</a> and <a href="http://www.railsenvy.com/2007/2/28/rails-caching-tutorial">here</a>. But for us there was a little, tricky pitfall: Basically Josh Susser&#8217;s howto is great with all it&#8217;s Capistrano recipes etc. But as we&#8217;re using Apache as the frontend webserver the Rails Envy guy&#8217;s article fills the gap for the <a href="http://www.railsenvy.com/2007/2/28/rails-caching-tutorial#moving">mod_rewrite modifications</a> that had to be done. Ok, I must admit these changes (if you have a rewrite rule for the normal public/anything/else behavior already)  are so minor that you can figure them out by yourself, so did we. But we made a dumb mistake:</p>
<p>This is the rule from the Rails Envy article:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre>  RewriteRule ^([^.]+)$ cache/$1.html [QSA]</pre></td></tr></table></div>

<p>But this assumes that your <Directory> of the virtual host is like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre>  &lt;Directory &quot;/var/www/application/current/public/&quot;&gt;</pre></td></tr></table></div>

<p>Our entry looked like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre>  &lt;Directory &quot;/var/www/application/current/public&quot;&gt;</pre></td></tr></table></div>

<p>Aaaaarg! Just one daft, missing slash at the end ruined us the show with 400 - Bad Request errors whose source we could not determine. Sometimes the problem&#8217;s solution is as simple as just change the rewrite rule (or the directory entry in the way showed above) to this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre>  RewriteRule ^([^.]+)$ /cache/$1.html [QSA]</pre></td></tr></table></div>

<p>Ok, pretty simple ;) . And now enjoy your moved cache and thank Josh and Gregg a lot for their posts!</p>
<p>One last thing to add: How do we delete the cache every 58 seconds? With <a href="/periodically-executed-tasks-in-your-rails-application-without-any-pain/">StupidBackground</a> of course ;) !</p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/cache-in-a-seperate-folder/&amp;title=Cache+in+a+seperate+folder" title="Add 'Cache in a seperate folder' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Cache in a seperate folder' to Del.icio.us" alt="Add 'Cache in a seperate folder' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/cache-in-a-seperate-folder/&amp;title=Cache+in+a+seperate+folder" title="Add 'Cache in a seperate folder' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Cache in a seperate folder' to digg" alt="Add 'Cache in a seperate folder' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/cache-in-a-seperate-folder/" title="Add 'Cache in a seperate folder' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Cache in a seperate folder' to Technorati" alt="Add 'Cache in a seperate folder' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/cache-in-a-seperate-folder/&amp;t=Cache+in+a+seperate+folder" title="Add 'Cache in a seperate folder' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Cache in a seperate folder' to Yahoo My Web" alt="Add 'Cache in a seperate folder' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/cache-in-a-seperate-folder/&amp;title=Cache+in+a+seperate+folder" title="Add 'Cache in a seperate folder' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Cache in a seperate folder' to Stumble Upon" alt="Add 'Cache in a seperate folder' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/cache-in-a-seperate-folder/&amp;title=Cache+in+a+seperate+folder" title="Add 'Cache in a seperate folder' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Cache in a seperate folder' to Google Bookmarks" alt="Add 'Cache in a seperate folder' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/cache-in-a-seperate-folder/" title="Add 'Cache in a seperate folder' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Cache in a seperate folder' to Shadows" alt="Add 'Cache in a seperate folder' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Cache+in+a+seperate+folder&amp;url=http://techlog.fetmab.net/cache-in-a-seperate-folder/" title="Add 'Cache in a seperate folder' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Cache in a seperate folder' to Ask" alt="Add 'Cache in a seperate folder' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/cache-in-a-seperate-folder/&amp;title=Cache+in+a+seperate+folder" title="Add 'Cache in a seperate folder' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Cache in a seperate folder' to Live-MSN" alt="Add 'Cache in a seperate folder' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/cache-in-a-seperate-folder/" title="Add 'Cache in a seperate folder' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Cache in a seperate folder' to FaceBook" alt="Add 'Cache in a seperate folder' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/cache-in-a-seperate-folder/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Just another day wasted</title>
		<link>http://techlog.fetmab.net/just-another-day-wasted/</link>
		<comments>http://techlog.fetmab.net/just-another-day-wasted/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 01:48:49 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[active record]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/?p=3</guid>
		<description><![CDATA[Hello there,
it&#8217;s late in Bremen, so I will keep this thing as short as possible: I just wasted the complete day&#8217;s work at Tansporter due to a bad preparation&#8230; dumb me! (Remember: Benchmark before any optimization!)
I tried to optimize some of our ActiveRecord find statements, installed a whole new column on a table solely for [...]]]></description>
			<content:encoded><![CDATA[<p>Hello there,</p>
<p>it&#8217;s late in Bremen, so I will keep this thing as short as possible: I just wasted the complete day&#8217;s work at Tansporter due to a bad preparation&#8230; dumb me! (Remember: Benchmark before any optimization!)</p>
<p>I tried to optimize some of our ActiveRecord find statements, installed a whole new column on a table solely for that reason, changed the model to fill this new column right and then changed the actual method I would like to spice up.</p>
<p>It was a 70 line monster of very ugly code. After refactoring it, there were just 40 lines left and it was very cool, clean and beautiful code. The main change: I replaced a find statement which returned a very huuuuge result set, which I had to iterate and do some computing on every element, with 4 very cool queries with just one result, each.</p>
<p>Sounds cool, but unfortunately it isn&#8217;t.</p>
<p>After I had a short &#8220;wow, that&#8217;s great stuff!&#8221; experience, I thought it might not be unclever to benchmark the new method and compare it to the old one.<br />
And here comes the trouble: The old method finished in about 0.018 seconds, the new one needed somewhat between 0.54 and 0.4 seconds&#8230; What a pitty!</p>
<p>So I switched back to the ugly version, to my rescue the added column could be used elsewhere so my effort was not completely useless.</p>
<p>What I&#8217;ve learned: One query with a large result set apparently performs MUCH better than 4 (not absolute trivial) queries with a very small result set, even if you have to iterate through the whole big result set.</p>
<p>Anyway I stumbled upon two cool, small things today that are worth mentioning them:</p>
<p><strong>1st: Get a random &#8220;thing&#8221; out of the database.</strong></p>
<p>Until today we managed this with a method at the particular model looking somehow like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">random_good</span>
    good = <span style="color:#0000FF; font-weight:bold;">nil</span>
    <span style="color:#9966CC; font-weight:bold;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!good<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">begin</span>
        good = Good.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">rand</span><span style="color:#006600; font-weight:bold;">&#40;</span>Good.<span style="color:#9900CC;">maximum</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::RecordNotFound</span> =&gt; e
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    good
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Today I received my copy of <a href="http://www.amazon.de/Rails-Driving-Enterprise-Addison-Wesley-Professional/dp/0321445619">The Rails Way</a> and one of the first things I found was the native, MySQL &#8220;ORDER BY RAND()&#8221; function. Pretty cool. Because database portability doesn&#8217;t really matter for us, the same function as above now looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">random_good</span>
    Good.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:order</span> =&gt; <span style="color:#996600;">'RAND()'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p><strong>2nd: Don&#8217;t forget about the power of ActiveRecord&#8217;s :include option!</strong></p>
<p>The :include option of a find statement is very powerful! I read about this maybe a year ago, never needed it again and forgot about it. Today I rediscovered the veeeeery nice nesting capability:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby">  tickets = Ticket.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:include</span> =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:user</span>,
      <span style="color:#006600; font-weight:bold;">&#123;</span>:operator =&gt; <span style="color:#006600; font-weight:bold;">&#123;</span>:open_tickets =&gt; <span style="color:#ff3333; font-weight:bold;">:user</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>I can&#8217;t really believe it, but after this find statement you can do this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby">  tickets.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">operator</span>.<span style="color:#9900CC;">open_tickets</span>.<span style="color:#9900CC;">last</span>.<span style="color:#9900CC;">user</span>.<span style="color:#9900CC;">nickname</span></pre></td></tr></table></div>

<p>&#8230;without ANY extra query! It&#8217;s all joined together in the one find query and still runs at a reasonable pace.</p>
<p>Ok, now it&#8217;s really time for me to go to bed.</p>
<p>Stay tuned,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/just-another-day-wasted/&amp;title=Just+another+day+wasted" title="Add 'Just another day wasted' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Just another day wasted' to Del.icio.us" alt="Add 'Just another day wasted' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/just-another-day-wasted/&amp;title=Just+another+day+wasted" title="Add 'Just another day wasted' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Just another day wasted' to digg" alt="Add 'Just another day wasted' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/just-another-day-wasted/" title="Add 'Just another day wasted' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Just another day wasted' to Technorati" alt="Add 'Just another day wasted' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/just-another-day-wasted/&amp;t=Just+another+day+wasted" title="Add 'Just another day wasted' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Just another day wasted' to Yahoo My Web" alt="Add 'Just another day wasted' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/just-another-day-wasted/&amp;title=Just+another+day+wasted" title="Add 'Just another day wasted' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Just another day wasted' to Stumble Upon" alt="Add 'Just another day wasted' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/just-another-day-wasted/&amp;title=Just+another+day+wasted" title="Add 'Just another day wasted' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Just another day wasted' to Google Bookmarks" alt="Add 'Just another day wasted' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/just-another-day-wasted/" title="Add 'Just another day wasted' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Just another day wasted' to Shadows" alt="Add 'Just another day wasted' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Just+another+day+wasted&amp;url=http://techlog.fetmab.net/just-another-day-wasted/" title="Add 'Just another day wasted' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Just another day wasted' to Ask" alt="Add 'Just another day wasted' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/just-another-day-wasted/&amp;title=Just+another+day+wasted" title="Add 'Just another day wasted' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Just another day wasted' to Live-MSN" alt="Add 'Just another day wasted' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/just-another-day-wasted/" title="Add 'Just another day wasted' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Just another day wasted' to FaceBook" alt="Add 'Just another day wasted' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/just-another-day-wasted/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Update on Flock</title>
		<link>http://techlog.fetmab.net/update-on-flock/</link>
		<comments>http://techlog.fetmab.net/update-on-flock/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 01:38:18 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[browser]]></category>

		<category><![CDATA[flock]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/update-on-flock/</guid>
		<description><![CDATA[Hey folks,
just a short update on my Flock usage, I already posted about Flock in late December.
Even after some weeks of browsing Flock seems to be a good companion: Rare crashes on my Mac Book and the memory usage is at least remarkable better than with Firefox 2.x.
I recently gave Firefox 3 Beta 2 a [...]]]></description>
			<content:encoded><![CDATA[<p>Hey folks,</p>
<p>just a short update on my Flock usage, <a href="/using-flock-update">I already posted about Flock in late December</a>.</p>
<p>Even after some weeks of browsing Flock seems to be a good companion: Rare crashes on my Mac Book and the memory usage is at least remarkable better than with Firefox 2.x.</p>
<p>I recently gave Firefox 3 Beta 2 a try, too and it was ok. But without any really benchmarking it feels as if Flock is still more reliable and has less memory leaks than Firefox 3, so I decided to switch back to Flock.</p>
<p>This suits my plans very well, as I just gave up my &#8220;social network antipathy&#8221; and registered a profile on Facebook. Flock is definitely the browser of choice for all this&nbsp; Flickr, Facebook, delicious stuff. I&#8217;m no heavy user of all of that but it&#8217;s nice that you can easily share links on delicious, even if you do it only once a day.</p>
<p>So, give Flock a chance, it&#8217;s worth it!</p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/update-on-flock/&amp;title=Update+on+Flock" title="Add 'Update on Flock' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Update on Flock' to Del.icio.us" alt="Add 'Update on Flock' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/update-on-flock/&amp;title=Update+on+Flock" title="Add 'Update on Flock' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Update on Flock' to digg" alt="Add 'Update on Flock' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/update-on-flock/" title="Add 'Update on Flock' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Update on Flock' to Technorati" alt="Add 'Update on Flock' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/update-on-flock/&amp;t=Update+on+Flock" title="Add 'Update on Flock' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Update on Flock' to Yahoo My Web" alt="Add 'Update on Flock' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/update-on-flock/&amp;title=Update+on+Flock" title="Add 'Update on Flock' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Update on Flock' to Stumble Upon" alt="Add 'Update on Flock' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/update-on-flock/&amp;title=Update+on+Flock" title="Add 'Update on Flock' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Update on Flock' to Google Bookmarks" alt="Add 'Update on Flock' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/update-on-flock/" title="Add 'Update on Flock' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Update on Flock' to Shadows" alt="Add 'Update on Flock' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Update+on+Flock&amp;url=http://techlog.fetmab.net/update-on-flock/" title="Add 'Update on Flock' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Update on Flock' to Ask" alt="Add 'Update on Flock' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/update-on-flock/&amp;title=Update+on+Flock" title="Add 'Update on Flock' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Update on Flock' to Live-MSN" alt="Add 'Update on Flock' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/update-on-flock/" title="Add 'Update on Flock' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Update on Flock' to FaceBook" alt="Add 'Update on Flock' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/update-on-flock/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Periodically executed tasks in your Rails application without any pain</title>
		<link>http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/</link>
		<comments>http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 08:54:01 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/</guid>
		<description><![CDATA[Hi again,
the time has come to &#8220;release&#8221; our first Rails plugin! *wooooooooah*
It&#8217;s mission is really simple: Do things &#8220;in&#8221; a Rails application periodically, in the background. Ok, sounds like a perfect job for cronjobs? Yes, it is. But let me explain this:
We are just two guys, coding all day long. Server administration is not our [...]]]></description>
			<content:encoded><![CDATA[<p>Hi again,</p>
<p>the time has come to &#8220;release&#8221; our first Rails plugin! *wooooooooah*</p>
<p>It&#8217;s mission is really simple: Do things &#8220;in&#8221; a Rails application periodically, in the background. Ok, sounds like a perfect job for cronjobs? Yes, it is. But let me explain this:</p>
<p>We are just two guys, coding all day long. Server administration is not our favorite sport and we do not  have a cool admin guy to keep things going. Due to that, we once had a cronjob running which we didn&#8217;t monitor as we should&#8217;ve. The end of the story is, that our job was not executed for 2 weeks until we recognized it.</p>
<p>So, cronjobs may be just perfect, but we really don&#8217;t want the extra pain of monitoring an extra tool and keep the crontables up to date with every deployment and so on. Our solution:</p>
<p><strong>StupidBackground</strong></p>
<p>Ohhh yes my dear, there are plenty of Ruby and/or Rails tools out there that do that background job thing very well: <a href="http://backgroundrb.rubyforge.org/">BackgrounDRb</a>, <a href="http://trix.pl/blog/ruby-on-rails/running-long-background-tasks-in-ruby-on-rails-made-dead-simple">BackgroundFu</a> and much more cool tools. But while some of these tools just are too much for our needs (BackgrounDRb), the other tools, which are simple enough, do not cover exactly what we wanted to do (BackgroundFu): Periodically call some methods which calculates things and then stores them to the database.</p>
<p>So that&#8217;s when StupidBackground comes into play.</p>
<p>It&#8217;s sooo stupid, that even <a href="http://www.railsenvy.com/2007/12/6/ruby-on-rails-commercial-out-takes">5 year olds</a> should immediately know how to use it. But just in case your mind is somehow different to that of a 5 year old, I&#8217;ll try to explain it for you anyway:</p>
<p><strong>1. Install it</strong></p>
<p><code>script/plugin install \ http://svn.fetmab.net/svn/plugins/stupid_background/tags/0.1.1</code></p>
<p><strong>2. Code your worker</strong></p>
<p>Just create a new class in &#8220;<em>lib/workers</em>&#8221; which inherits from &#8220;<em>StupidBackground::Worker</em>&#8221; like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">class</span> FiveYearOldFighter &lt; <span style="color:#6666ff; font-weight:bold;">StupidBackground::Worker</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Now just add some methods to this. When these methods are called by StupidBackground they are in a complete Rails environment created by &#8220;<em>script/runner</em>&#8220;. So feel free to use any models or whatever classes you like to use within your application. Like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">class</span> FiveYearOldFighter &lt; <span style="color:#6666ff; font-weight:bold;">StupidBackground::Worker</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> fight<span style="color:#006600; font-weight:bold;">&#40;</span>quantity, victory_chant<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> victory_chant <span style="color:#9966CC; font-weight:bold;">if</span> FiveYearOld.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>
          <span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:limit</span> =&gt; quantity, 
          <span style="color:#ff3333; font-weight:bold;">:order</span> =&gt; <span style="color:#996600;">&quot;badass_rank DESC&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">all</span>? <span style="color:#006600; font-weight:bold;">&#123;</span>|five_year_old|
              five_year_old.<span style="color:#9900CC;">fight</span>
          <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Last open question: How can we configure how often we would like to fight 5 year olds? It&#8217;s easy:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">class</span> FiveYearOldFighter &lt; <span style="color:#6666ff; font-weight:bold;">StupidBackground::Worker</span>
&nbsp;
    <span style="color:#008000; font-style:italic;">#THE NEXT TWO LINES ARE THE MAGIC!</span>
    call<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:fight</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">every</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span>.<span style="color:#9900CC;">hour</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">with</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">20</span>, <span style="color:#996600;">&quot;What a fight!&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    call<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:fight</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">every</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">10</span>.<span style="color:#9900CC;">minutes</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">with</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">5</span>, <span style="color:#996600;">&quot;Eaaasy one!&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> fight<span style="color:#006600; font-weight:bold;">&#40;</span>quantity, victory_chant<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> victory_chant <span style="color:#9966CC; font-weight:bold;">if</span> FiveYearOld.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>
          <span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:limit</span> =&gt; quantity, 
          <span style="color:#ff3333; font-weight:bold;">:order</span> =&gt; <span style="color:#996600;">&quot;badass_rank DESC&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">all</span>? <span style="color:#006600; font-weight:bold;">&#123;</span>|five_year_old|
              five_year_old.<span style="color:#9900CC;">fight</span>
          <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>To stay trained we now fight five 5 year olds every ten minutes and every hour we&#8217;re in the mood to fight 20 of them at the same time! Cool.</p>
<p><strong>3. Start the background magic</strong></p>
<p>Just one last thing to do:</p>
<p><code>rake background:start</code></p>
<p>And if you fought enough 5 year olds:</p>
<p><code>rake background:stop</code></p>
<p>Oh, and if you&#8217;ve forgotten if you&#8217;re right now fighting some 5 year olds try this:</p>
<p><code>rake background:status</code></p>
<p>That&#8217;s it. Pretty simple, but it is enough for our needs. Maybe this plugin is of some use for you.</p>
<p><strong>Behind the scenes</strong></p>
<p>StupidBackground uses the <a href="http://redhanded.hobix.com/inspect/daemonize.html">Daemonize</a> library from Travis Whitton, tiny but great! This fact also means, that StupidBackground will not work on Windows machines.</p>
<p>The background behavior is realized via a stupid <em>script/runner</em> call, it&#8217;s not high sophisticated but again: it fits our needs.</p>
<p>The execution of the tasks happens in an non sophisticated way, too: StupidBackground just determines how long it is until the next task needs to be run, then sleeps this periods and then runs the job.</p>
<p>So if you have one job which should run in 5 seconds and another job which should run in 6 seconds, the first job runs in 5 seconds and when it&#8217;s finished the second job runs. So the intervals which you specify in a worker are not accurate enough for brain surgery&#8230; You have to see them as rough intervals which works, you guessed it already: great for us.</p>
<p>Any worker is just instantiated once! So if you would like to share informations between two jobs in the same worker you easily can. But be aware of unattended side effects, when one method saves information in an instance variable and another job reads it, even if it should not! The simplest way to get around this is to outsource any logic from your worker and then write two workers which both use the outsourced code.</p>
<p>If you would like to overwrite the initializer of the worker ensure that your initialize method takes one argument and passes this to the super initializer:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>method<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;">#your stuff</span>
    <span style="color:#9966CC; font-weight:bold;">super</span><span style="color:#006600; font-weight:bold;">&#40;</span>method<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Somehow like this.</p>
<p>Summary</p>
<ul>
<li>Periodically, task execution in a Rails application, in the background.</li>
<li>No gems needed.</li>
<li>No extra YAML or any other configuration. Anything is configured within your workers.</li>
<li>One instance per worker, NOT per job.</li>
<li>No threading if two jobs should run at the same time! Just waiting for one to finish, then starting the other.</li>
</ul>
<p>Ok, I hope this is of some help for some of you. Feel free to add comments.</p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/&amp;title=Periodically+executed+tasks+in+your+Rails+application+without+any+pain" title="Add 'Periodically executed tasks in your Rails application without any pain' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Del.icio.us" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/&amp;title=Periodically+executed+tasks+in+your+Rails+application+without+any+pain" title="Add 'Periodically executed tasks in your Rails application without any pain' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to digg" alt="Add 'Periodically executed tasks in your Rails application without any pain' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/" title="Add 'Periodically executed tasks in your Rails application without any pain' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Technorati" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/&amp;t=Periodically+executed+tasks+in+your+Rails+application+without+any+pain" title="Add 'Periodically executed tasks in your Rails application without any pain' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Yahoo My Web" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/&amp;title=Periodically+executed+tasks+in+your+Rails+application+without+any+pain" title="Add 'Periodically executed tasks in your Rails application without any pain' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Stumble Upon" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/&amp;title=Periodically+executed+tasks+in+your+Rails+application+without+any+pain" title="Add 'Periodically executed tasks in your Rails application without any pain' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Google Bookmarks" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/" title="Add 'Periodically executed tasks in your Rails application without any pain' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Shadows" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Periodically+executed+tasks+in+your+Rails+application+without+any+pain&amp;url=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/" title="Add 'Periodically executed tasks in your Rails application without any pain' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Ask" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/&amp;title=Periodically+executed+tasks+in+your+Rails+application+without+any+pain" title="Add 'Periodically executed tasks in your Rails application without any pain' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to Live-MSN" alt="Add 'Periodically executed tasks in your Rails application without any pain' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/" title="Add 'Periodically executed tasks in your Rails application without any pain' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Periodically executed tasks in your Rails application without any pain' to FaceBook" alt="Add 'Periodically executed tasks in your Rails application without any pain' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/periodically-executed-tasks-in-your-rails-application-without-any-pain/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Back in the game</title>
		<link>http://techlog.fetmab.net/back-in-the-game/</link>
		<comments>http://techlog.fetmab.net/back-in-the-game/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 22:21:51 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[fetmab]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/back-in-the-game/</guid>
		<description><![CDATA[Hey folks,
I&#8217;m back from vacations. It was great, even if there was some snow shortage. We nearly all managed to get over the icy, artificial snow&#8230; nearly. On our third day&#8217;s last run my girlfriend felt unlucky and hurt her knee so bad she might needs an surgery. But she&#8217;s alright so this sounds a [...]]]></description>
			<content:encoded><![CDATA[<p>Hey folks,</p>
<p>I&#8217;m back from vacations. It was great, even if there was some snow shortage. We nearly all managed to get over the icy, artificial snow&#8230; nearly. On our third day&#8217;s last run my girlfriend felt unlucky and hurt her knee so bad she might needs an surgery. But she&#8217;s alright so this sounds a little bit more scary as it actually is.</p>
<p>Nevertheless our development is gaining some momentum this week as I get more and more back to work. The weeks before Christmas were awful. I missed no chance to get distracted from work and did not really made some progress.</p>
<p>But now things seems to go smoother and it is as the fun would come back to my work. Don&#8217;t know why, but it&#8217;s definitively a good thing.</p>
<p>I promised you some tech is coming back to this block with the presentation of our first two Rails plugins but this has to wait for some more days, but it&#8217;s coming&#8230; I promise you.</p>
<p>For now I can tell you something about where we are right now with the game:</p>
<p>I&#8217;m really looking forward to finish all of the pathfinding code this week, which means we&#8217;re really done with all of the &#8220;heavy&#8221; code. All what comes up next is not that heavy but not less important interface and minor gameplay work. That said, I hope to start the first private beta testing in February.. wow. It&#8217;s really exciting to see the project grow, even more with such a small team as we are.</p>
<p>Ok, before I spent anymore time telling you how cool we are, I should get back to Textmate and get this last pathfinding issues ultimately out of the door.</p>
<p>See you later!</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/back-in-the-game/&amp;title=Back+in+the+game" title="Add 'Back in the game' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Back in the game' to Del.icio.us" alt="Add 'Back in the game' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/back-in-the-game/&amp;title=Back+in+the+game" title="Add 'Back in the game' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Back in the game' to digg" alt="Add 'Back in the game' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/back-in-the-game/" title="Add 'Back in the game' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Back in the game' to Technorati" alt="Add 'Back in the game' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/back-in-the-game/&amp;t=Back+in+the+game" title="Add 'Back in the game' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Back in the game' to Yahoo My Web" alt="Add 'Back in the game' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/back-in-the-game/&amp;title=Back+in+the+game" title="Add 'Back in the game' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Back in the game' to Stumble Upon" alt="Add 'Back in the game' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/back-in-the-game/&amp;title=Back+in+the+game" title="Add 'Back in the game' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Back in the game' to Google Bookmarks" alt="Add 'Back in the game' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/back-in-the-game/" title="Add 'Back in the game' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Back in the game' to Shadows" alt="Add 'Back in the game' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Back+in+the+game&amp;url=http://techlog.fetmab.net/back-in-the-game/" title="Add 'Back in the game' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Back in the game' to Ask" alt="Add 'Back in the game' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/back-in-the-game/&amp;title=Back+in+the+game" title="Add 'Back in the game' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Back in the game' to Live-MSN" alt="Add 'Back in the game' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/back-in-the-game/" title="Add 'Back in the game' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Back in the game' to FaceBook" alt="Add 'Back in the game' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/back-in-the-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Flock - Update</title>
		<link>http://techlog.fetmab.net/using-flock-update/</link>
		<comments>http://techlog.fetmab.net/using-flock-update/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 00:59:33 +0000</pubDate>
		<dc:creator>Thorben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[browser]]></category>

		<category><![CDATA[flock]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/using-flock-update/</guid>
		<description><![CDATA[Ok ok &#8230; it&#8217;s time for some excuses! We&#8217;ve really neglected this blog for quite a long time but I promise to be back in the game starting in the early days of 2008!
Before we get back to blog business I&#8217;ll enjoy a ski holiday in Jasna (Slovakia) with my girlfriend and two friends of [...]]]></description>
			<content:encoded><![CDATA[<p>Ok ok &#8230; it&#8217;s time for some excuses! We&#8217;ve really neglected this blog for quite a long time but I promise to be back in the game starting in the early days of 2008!</p>
<p>Before we get back to blog business I&#8217;ll enjoy a ski holiday in <a href="http://www.jasna.sk">Jasna (Slovakia)</a> with my girlfriend and two friends of us.</p>
<p>Some general update: The game is doing some progress, it&#8217;s harder than we thought to fight this fight with such a small team that Sebastian and I are. But expect some more detailed news on this at the end of january.</p>
<p>Now to the main reason why I&#8217;m writing this (to less time to go in depth with all the progress we made since october): <a href="http://www.flock.com">Flock</a>.</p>
<p>I&#8217;m using a Mac now for quite some time and (<a href="http://www.techcrunch.com/2007/11/01/flock-10-released/">like Duncan Riley</a>) see Firefox wasting memory on a grand scale! After reading the post of Duncan in early november I installed Flock but soon went back to Firefox as I can&#8217;t find any of my beloved plugins like Firebug in the Flock Addon Repository.</p>
<p>Today I stumbled onto Flock again and thought: Hey, why did I never tried out the regular Firefox Repository?! So started Flock again, surfed to <a href="https://addons.mozilla.org/en-US/firefox/">https://addons.mozilla.org/en-US/firefox/</a> and without any problem installed Firebug, GreaseMonkey and Co. I&#8217;m using a default of not accepting any cookies in Firefox and I&#8217;m using <a href="https://addons.mozilla.org/en-US/firefox/addon/2497">CookieSafe</a> to allow cookies on a per site basis. It&#8217;s a pity that neither this plugin nor the <a href="https://addons.mozilla.org/en-US/firefox/addon/44">Permit Cookies</a> plugin are working with Flock out of the box. But after a while I found a plugin called <a href="https://addons.mozilla.org/en-US/firefox/addon/4703">Cookie Monster</a> doing mainly the same as the two others mentioned before and this could be installed in Flock with no hassle at all. Cool thing.</p>
<p>So even if I&#8217;m quite the opposite of a heavy &#8220;Web 2.0&#8243; user, not engaged in any social platform like Facebook, MySpace and so on, I really like some of Flocks features. The direct access to del.icio.us bookmarks, the integrated blog editor (where this post is written in) or the integration of Twitter and Flickr right into the browser are very promising to make my browsing experience a better one.</p>
<p>Ok, that&#8217;s all I want to say so long. Now time has to proof if Flock can keep this promises or if all these tools are just looking nice but deliver nothing more then their original web interfaces do. In addition to this I&#8217;ll have a look at the memory usage of this little beast.</p>
<p>Right now I switched my default browser setting to Flock. Let&#8217;s see how long this lasts.</p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<p><strong>Update:</strong><br />
See <a href="/update-on-flock">this post</a> for further experiences.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/using-flock-update/&amp;title=Using+Flock+-+Update" title="Add 'Using Flock - Update' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Using Flock - Update' to Del.icio.us" alt="Add 'Using Flock - Update' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/using-flock-update/&amp;title=Using+Flock+-+Update" title="Add 'Using Flock - Update' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Using Flock - Update' to digg" alt="Add 'Using Flock - Update' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/using-flock-update/" title="Add 'Using Flock - Update' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Using Flock - Update' to Technorati" alt="Add 'Using Flock - Update' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/using-flock-update/&amp;t=Using+Flock+-+Update" title="Add 'Using Flock - Update' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Using Flock - Update' to Yahoo My Web" alt="Add 'Using Flock - Update' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/using-flock-update/&amp;title=Using+Flock+-+Update" title="Add 'Using Flock - Update' to Stumble Upon"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Using Flock - Update' to Stumble Upon" alt="Add 'Using Flock - Update' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://techlog.fetmab.net/using-flock-update/&amp;title=Using+Flock+-+Update" title="Add 'Using Flock - Update' to Google Bookmarks"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Using Flock - Update' to Google Bookmarks" alt="Add 'Using Flock - Update' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shadows.com/shadows.aspx?url=http://techlog.fetmab.net/using-flock-update/" title="Add 'Using Flock - Update' to Shadows"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/shadows.png" title="Add 'Using Flock - Update' to Shadows" alt="Add 'Using Flock - Update' to Shadows" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&amp;t=webpages&amp;title=Using+Flock+-+Update&amp;url=http://techlog.fetmab.net/using-flock-update/" title="Add 'Using Flock - Update' to Ask"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/ask.png" title="Add 'Using Flock - Update' to Ask" alt="Add 'Using Flock - Update' to Ask" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://techlog.fetmab.net/using-flock-update/&amp;title=Using+Flock+-+Update" title="Add 'Using Flock - Update' to Live-MSN"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'Using Flock - Update' to Live-MSN" alt="Add 'Using Flock - Update' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://techlog.fetmab.net/using-flock-update/" title="Add 'Using Flock - Update' to FaceBook"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Using Flock - Update' to FaceBook" alt="Add 'Using Flock - Update' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://techlog.fetmab.net/using-flock-update/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updating certain fields of an ActiveRecord object from params</title>
		<link>http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/</link>
		<comments>http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/#comments</comments>
		<pubDate>Sun, 14 Oct 2007 07:38:09 +0000</pubDate>
		<dc:creator>sepp</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[active record]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/</guid>
		<description><![CDATA[While it is always good to have attr_accessible or attr_protected set in a ActiveRecord model class to protect it from abuse when updating any object of that class from the params of a Rails controller.
But what to do when you have that attr_accessible but you won&#8217;t let a certain action in your controller even edit [...]]]></description>
			<content:encoded><![CDATA[<p>While it is always good to have attr_accessible or attr_protected set in a ActiveRecord model class to protect it from abuse when updating any object of that class from the params of a Rails controller.</p>
<p>But what to do when you have that attr_accessible but you won&#8217;t let a certain action in your controller even edit all of those accessible fields. Maybe because you&#8217;re paranoid or just a think that an action should only be allowed to edit what they was invented for, there might be some good reasons.</p>
<p>We faced this problem lately and came up with that solution:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> update_by_params<span style="color:#006600; font-weight:bold;">&#40;</span>params, *fields<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">attributes</span> = params.<span style="color:#9900CC;">reject</span>
        <span style="color:#006600; font-weight:bold;">&#123;</span>|key,value| !fields.<span style="color:#9900CC;">index</span> key.<span style="color:#9900CC;">to_sym</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">save</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> update_by_params!<span style="color:#006600; font-weight:bold;">&#40;</span>params, *fields<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">attributes</span> = params.<span style="color:#9900CC;">reject</span>
        <span style="color:#006600; font-weight:bold;">&#123;</span>|key,value| !fields.<span style="color:#9900CC;">index</span> key.<span style="color:#9900CC;">to_sym</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">save</span>!
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>The update_by_params instance method on the ActiveRecord::Base class let you do something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="ruby"><span style="color:#008000; font-style:italic;"># ... in a controller ...</span>
<span style="color:#9966CC; font-weight:bold;">def</span> change_password
  <span style="color:#0066ff; font-weight:bold;">@current_user</span>.<span style="color:#9900CC;">update_by_params</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:user</span><span style="color:#006600; font-weight:bold;">&#93;</span>,
      <span style="color:#ff3333; font-weight:bold;">:password</span>, <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  redirect_to frontpage_url
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>And then the user won&#8217;t be able to edit his address with a <em>hacked</em> password change form, even if he is allowed to do so in his profile.</p>
<p>The method will save the object after the update. To handle errors on saving there are (as usual in Rails) two specifications of this method available, one with a ! at the end which just uses save! to save the object and one without the ! which uses save. So update_by_params! will throw an error if the save fails while update_by_params just returns false.</p>
<p>Have fun with that.</p>
<p>Yours,</p>
<p>Thorben<br />
FEtMab-Team</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Bookmarks to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/&amp;title=Updating+certain+fields+of+an+ActiveRecord+object+from+params" title="Add 'Updating certain fields of an ActiveRecord object from params' to Del.icio.us"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Updating certain fields of an ActiveRecord object from params' to Del.icio.us" alt="Add 'Updating certain fields of an ActiveRecord object from params' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/&amp;title=Updating+certain+fields+of+an+ActiveRecord+object+from+params" title="Add 'Updating certain fields of an ActiveRecord object from params' to digg"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Updating certain fields of an ActiveRecord object from params' to digg" alt="Add 'Updating certain fields of an ActiveRecord object from params' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/" title="Add 'Updating certain fields of an ActiveRecord object from params' to Technorati"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Updating certain fields of an ActiveRecord object from params' to Technorati" alt="Add 'Updating certain fields of an ActiveRecord object from params' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/&amp;t=Updating+certain+fields+of+an+ActiveRecord+object+from+params" title="Add 'Updating certain fields of an ActiveRecord object from params' to Yahoo My Web"><img src="http://techlog.fetmab.net/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Updating certain fields of an ActiveRecord object from params' to Yahoo My Web" alt="Add 'Updating certain fields of an ActiveRecord object from params' to Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://techlog.fetmab.net/updating-certain-fields-of-an-activerecord-object-from-params/&amp;title=Updating+certain+fields+of+an+ActiveRecord+object+from+params" title="Add 'Updating certain fields of an ActiveRecord objec