<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ruby Fleebie &#187; Easy reading</title>
	<atom:link href="http://www.rubyfleebie.com/category/easy-reading/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubyfleebie.com</link>
	<description>Because programming should be fun</description>
	<lastBuildDate>Wed, 25 Jan 2012 18:06:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Should ruby go the haml route and uses significant whitespaces?</title>
		<link>http://www.rubyfleebie.com/should-ruby-go-the-haml-route-and-uses-significant-whitespaces/</link>
		<comments>http://www.rubyfleebie.com/should-ruby-go-the-haml-route-and-uses-significant-whitespaces/#comments</comments>
		<pubDate>Mon, 30 May 2011 12:00:30 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/?p=344</guid>
		<description><![CDATA[Before I start, let me get something straight: I&#8217;m not saying it would be a good or bad idea&#8230; I&#8217;m just asking the question.
I must say that my first experience with a significant whitespace language was a disaster. The first time I had to use Python was on a server via ssh. I was in [...]]]></description>
			<content:encoded><![CDATA[<p>Before I start, let me get something straight: I&#8217;m not saying it would be a good or bad idea&#8230; I&#8217;m just asking the question.</p>
<p>I must say that my first experience with a significant whitespace language was a disaster. The first time I had to use Python was on a server via ssh. I was in a hurry and wanted to monkey patch some buggy script I had installed. So without thinking too much I opened the script with a text editor called <a href="http://www.nano-editor.org/">nano</a>. The problem is that a TAB in nano produces between 173 and 177 white spaces. Realizing this I decided to refrain from indenting one line or two because it was too ugly and unreadable. Then python told me that I could not do this&#8230; and at the time I remember thinking it was unacceptable that a script start to malfunction just because of a few missing whitespaces. Anyway, I spent some long minutes trying to fix a few indentation issues (in nano! I still didn&#8217;t realize it was the source of the problem) and it was very tedious.  Had I try debugging the python script on my local computer with gedit for example, things would surely have turned out differently.</p>
<p><strong>Then Haml came&#8230; and I stayed away</strong></p>
<p>This unpleasant experience I had with Python had a rather negative side effect: It made me completely ignore <a href="http://haml-lang.com/">Haml</a> for a long time, which is sad because it is such a great alternative to erb. </p>
<p>But now I use Haml, and I really like it. Not having to &#8220;close my tags&#8221; is more satisfying than I thought it would be. I always delight when I realize I was about to write a &#8220;- end&#8221; tag to close a &#8220;- @items.each&#8221; loop or something like that. I don&#8217;t have to! Less typing, less noise, cleaner, prettier, I love this! Wouldn&#8217;t be nice if we could do away with the &#8220;end&#8221; keyword in ruby as well?</p>
<p>Just to give us an idea, here is how an actual class from the Haml gem would look like if it was written in Significant Whitespace ruby:</p>
<pre class="brush: ruby; title: ;">
    class ParseNode &lt; Struct.new(:type, :line, :value, :parent, :children)
      def initialize(*args)
        super
        self.children ||= []

      def inspect
        text = &quot;(#{type} #{value.inspect}&quot;
        children.each {|c| text &lt;&lt; &quot;\n&quot; &lt;&lt; c.inspect.gsub(/^/, &quot;  &quot;)}
        text + &quot;)&quot;
</pre>
<p>Great, it sill looks like ruby. We just removed some noise to make it even more readable.</p>
<p>Let&#8217;s convert a longer method, still from the Haml gem, to see how it would look like:</p>
<pre class="brush: ruby; title: ;">
    def parse_new_attributes(line)
      line = line.dup
      scanner = StringScanner.new(line)
      last_line = @index
      attributes = {}

      scanner.scan(/\(\s*/)
      loop do
        name, value = parse_new_attribute(scanner)
        break if name.nil?

        if name == false
          text = (Haml::Shared.balance(line, ?(, ?)) || [line]).first
          raise Haml::SyntaxError.new(&quot;Invalid attribute list: #{text.inspect}.&quot;, last_line - 1)

        attributes[name] = value
        scanner.scan(/\s*/)

        if scanner.eos?
          line &lt;&lt; &quot; &quot; &lt;&lt; @next_line.text
          last_line += 1
          next_line
          scanner.scan(/\s*/)

      static_attributes = {}
      dynamic_attributes = &quot;{&quot;
      attributes.each do |name, (type, val)|
        if type == :static
          static_attributes[name] = val
        else
          dynamic_attributes &lt;&lt; inspect_obj(name) &lt;&lt; &quot; =&gt; &quot; &lt;&lt; val &lt;&lt; &quot;,&quot;

      dynamic_attributes &lt;&lt; &quot;}&quot;
      dynamic_attributes = nil if dynamic_attributes == &quot;{}&quot;

      return [static_attributes, dynamic_attributes], scanner.rest, last_line
</pre>
<p>Well, not bad at all&#8230; the only problem is that the loop is quite long and I had to double-check to know if the &#8220;static_attributes&#8221; statement was part of the loop or right after. This kind of double checking could get on my nerves fast. </p>
<p>I&#8217;m still undecided. I dislike end tags but they can clear things up sometimes. Anyway, I guess we probably never see this implemented in ruby. What&#8217;s your thoughts on significant whitespace languages?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/should-ruby-go-the-haml-route-and-uses-significant-whitespaces/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Generate round-robin sport schedules with RRSchedule</title>
		<link>http://www.rubyfleebie.com/generate-round-robin-sport-schedules-with-rrschedule/</link>
		<comments>http://www.rubyfleebie.com/generate-round-robin-sport-schedules-with-rrschedule/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 15:03:31 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/?p=234</guid>
		<description><![CDATA[One of our projects, called Mon Curling, is a web application that helps recreational curling leagues with their schedules, results and standings.  One thing that the app was NOT doing was to generate the schedule automatically. Instead, the league manager had to generate his schedule beforehand and enter all the matches manually in our [...]]]></description>
			<content:encoded><![CDATA[<p>One of our projects, called <a href="http://www.moncurling.com/en">Mon Curling</a>, is a web application that helps recreational curling leagues with their schedules, results and standings.  One thing that the app was NOT doing was to generate the schedule automatically. Instead, the league manager had to generate his schedule beforehand and enter all the matches manually in our interface. </p>
<p>This will now change with the new gem I am working on called <a href="http://flamontagne.github.com/rrschedule">RRSchedule</a> (code is also on <a href="http://github.com/flamontagne/rrschedule">github</a>). </p>
<p>I realized that most sport leagues were using a <a href="http://en.wikipedia.org/wiki/Round-robin_tournament">round-robin</a> format for their seasons and this is how I had the idea to make a gem out of it. </p>
<p>The gem takes into consideration the number of available &#8220;playing surfaces&#8221; and multiple game times. Say for example that you want to generate a round-robin schedule for your 19-teams volleyball league where games are played every wednesday. If there are 3 volleyball fields available and that games are played at 7:00 PM and 9:00 PM. This means that 6 games can be played every gameday (3 volleyball fields * 2 game times). </p>
<p>Example:<br />
Gameday #1<br />
========<br />
A vs B on Volleyball field &#8220;A&#8221; will play at 7:00 PM<br />
C vs D on Volleyball field &#8220;B&#8221; will play at 7:00 PM<br />
E vs F on Volleyball field &#8220;C&#8221; will play at 7:00 PM<br />
G vs H on Volleyball field &#8220;A&#8221; will play at 9:00 PM<br />
I vs J on Volleyball field &#8220;B&#8221; will play at 9:00 PM<br />
K vs L on Volleyball field &#8220;C&#8221; will play at 9:00 PM</p>
<p>Since the round-robin round can not be completed on a single day, the remaining games in the round will be put on the next gameday and a new round will start right after.</p>
<p>I hope this gem will be useful to some people!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/generate-round-robin-sport-schedules-with-rrschedule/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ruby 1.9 made me remember how I hate the concept of encodings</title>
		<link>http://www.rubyfleebie.com/ruby-1-9-made-me-remember-how-i-hate-the-concept-of-encodings/</link>
		<comments>http://www.rubyfleebie.com/ruby-1-9-made-me-remember-how-i-hate-the-concept-of-encodings/#comments</comments>
		<pubDate>Thu, 13 May 2010 12:11:00 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/?p=137</guid>
		<description><![CDATA[Update: You can follow the discussion on Hacker news

I guess I won&#8217;t make a lot of friends by saying this but my first impression with Ruby 1.9 was awful. Since we had to configure a new server, we thought it was the perfect occasion to install ruby 1.9 and see how our current web applications [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> <em>You can follow the discussion on <a href="http://news.ycombinator.com/item?id=1344195">Hacker news</a><br />
</em><br />
I guess I won&#8217;t make a lot of friends by saying this but my first impression with Ruby 1.9 was awful. Since we had to configure a new server, we thought it was the perfect occasion to install ruby 1.9 and see how our current web applications behave. I can&#8217;t comment on any new features about 1.9 because we got bored after a while and decided to switch back to 1.8.</p>
<p>There is one huge problem with 1.9 and it is how it manages encodings. Sure every ruby fanatics will tell you that it is &#8220;cleaner&#8221;, &#8220;more robust&#8221;,  &#8220;safer&#8221;,  &#8220;clever&#8221; or whatever&#8230; but it breaks working applications! So in my book this is a problem. I know it is just normal to refactor some aspects of your code when a new version of a programming language comes out but&#8230; this? All this pain for what, encodings? What&#8217;s the benefit already? No seriously tell me because I wake up every morning having to remember what they are, what purpose they serve and why application developers still have to worry about them after all those years. What I know however is that with 1.8 you could mix different encodings in the same string instance and the worst that could happen was some weird looking characters in  the resulting web page. But ruby 1.9 makes things different, it throws an exception in your face. Here is a <a href="http://yehudakatz.com/2010/05/05/ruby-1-9-encodings-a-primer-and-the-solution-for-rails/">great article</a> that explains what is happening with string encodings in 1.9.  Beware though, although this article is saying that there is a solution, it is an <em>hypothetical</em> solution. Here is the excerpt :</p>
<blockquote><p><em>Even better, Ruby already has a mechanism that is mostly designed for this purpose. In Ruby 1.9, setting Encoding.default_internal  tells Ruby to encode all Strings crossing the barrier via its IO system into that preferred encoding. <strong>All we’d need, then, is for maintainers of database drivers to honor this convention as well.</strong></em> </p></blockquote>
<p>So, unless I&#8217;m just not getting something (which is highly possible because encodings always confuse the heck out of me), there is no real solution other than to wait for database driver developers to honor the Encoding.default_internal setting of ruby 1.9.</p>
<p><strong>A small rant about encodings</strong><br />
I dream of a world without war or hunger and where I don&#8217;t have to care about character encodings when I&#8217;m programming! Why on earth do we have all those different encodings in 2010? Why not making a huge encoding table UTF-16384 containing every single character in the universe so we can forget about this crazy concept of different encodings and pretend that it never existed? Would a big fat and unique encoding table cause huge performance issues everywhere? I might be mistaken but I really doubt it would. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/ruby-1-9-made-me-remember-how-i-hate-the-concept-of-encodings/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>5 Plugins Or Gems You Could Not Live Without</title>
		<link>http://www.rubyfleebie.com/5-plugins-or-gems-you-could-not-live-without/</link>
		<comments>http://www.rubyfleebie.com/5-plugins-or-gems-you-could-not-live-without/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:50:51 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/5-plugins-or-gems-you-could-not-live-without/</guid>
		<description><![CDATA[Hello everyone,
For the past few months this blog has been pretty much dead. I could give you tons of excuses as for why it has been so but that&#8217;s all they would be, mere excuses! And I assure you that you would not find any of them very convincing.
I received several comments recently telling me [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>For the past few months this blog has been pretty much dead. I could give you tons of excuses as for why it has been so but that&#8217;s all they would be, mere excuses! And I assure you that you would not find any of them very convincing.</p>
<p>I received several comments recently telling me that you liked my blog and asking me when I plan writing again and believe me, it always goes straight to my heart. For some time now I am in the expectation that most of you will give up on me and remove this blog from your list forever but for some reason&#8230; you don&#8217;t! </p>
<p>Since I am a bit rusty at writing blog posts, I chose the easy way : a numbered list of Rails Gems/Plugins that I like. Hmmm, I know&#8230; it&#8217;s soooooo 2007! But, interesting nonetheless. If you don&#8217;t mind, I&#8217;d like that you share in the comment section the plugins that you like the most as well. Perhaps this post could become a reference to discover great plugins. Oh btw, from now on I will use the terms plugins and gems like they were the same thing.</p>
<ol>
<li><a href="http://github.com/thoughtbot/paperclip">Paperclip</a> by Thoughtbot
<p><em>Very easy to install &#038; configure. I use it for thumbnails generation and it works wonder.</em> </p>
</li>
<li><a href="http://github.com/perfectline/locale_routing">locale_routing</a> by Perfectline
<p><em>If you are developing a multilingual app/website (with I18n), don&#8217;t miss this simple plugin. It auto inserts the locale in the url without messing with your routes. </em></p>
</li>
<li><a href="http://freelancing-god.github.com/ts/en/">thinking-sphinx</a> by freelancing-gods
<p><em>A fast and reliable free-text search solution for your rails apps, using the Sphinx daemon.  The only thing that is really unfortunate with sphinx is that is doesn&#8217;t index new database records <strong>live</strong> out of the box. Instead you have to build the index manually or setup a cronjob at a given interval. The workaround is to use delta indexes with the delayed-job plugin but it forces you to have a rake task always running on your server. I had so much problems with the rake task getting killed for no apparent reason that I decided that live indexing was not so important. Instead I have a cronjob running every X hours that rebuild the index from scratch</em></p>
</li>
<li><a href="http://wiki.github.com/mislav/will_paginate/">will_paginate</a> by mislav
<p><em>I guess we all know and use this one but I had to put it in my list anyway. It is such a great and easy to use pagination plugin.</em></p>
</li>
<li><a href="http://github.com/rubyist/aasm">acts_as_state_machine</a> by rubyist</li>
<p><em>This one I use all the time. Everytime an activerecord object can be in more than a single &#8220;state&#8221; (enabled, hidden, locked, whatever)&#8230; think about using it!</em></p>
</ol>
<p>That&#8217;s it! Now, it&#8217;s your turn : what is your own top 5 list?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/5-plugins-or-gems-you-could-not-live-without/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>simplyglobal : A simple globalization plugin for Rails</title>
		<link>http://www.rubyfleebie.com/simplyglobal-a-simple-globalization-plugin-for-rails/</link>
		<comments>http://www.rubyfleebie.com/simplyglobal-a-simple-globalization-plugin-for-rails/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 18:38:58 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/simplyglobal-a-simple-globalization-plugin-for-rails/</guid>
		<description><![CDATA[   simplyglobal : A simple globalization plugin for Rails
The following is a guest post from Dan Simard
Sometimes, you have to reinvent the wheel. It&#8217;s really sad to say and you will probably hate me for saying that (and I know that you&#8217;ll do because I hate myself for it). I&#8217;ve written a new [...]]]></description>
			<content:encoded><![CDATA[<h1>   simplyglobal : A simple globalization plugin for Rails</h1>
<p><strong>The following is a guest post from Dan Simard</strong></p>
<p>Sometimes, you have to reinvent the wheel. It&#8217;s really sad to say and you will probably hate me for saying that (and I know that you&#8217;ll do because I hate myself for it). I&#8217;ve written <strong>a new globalization plugin for Rails</strong>.</p>
<h3>   Why did I reinvented the wheel?</h3>
<p>I searched and tried a lot of <a href="http://agilewebdevelopment.com/plugins/search?search=global" title="other globalisation plugins">other globalisation plugins</a>&#8230; and I really tried them. I spent hours with <a href="http://agilewebdevelopment.com/plugins/globalize" title="Globalize">Globalize</a>. It was just too much. I tried the <a href="http://rubyforge.org/projects/gettextlocalize/" title="gettext_Localize">gettext_Localize</a> that works with the <a href="http://www.gnu.org/software/gettext/" title="Gettext">good ol&#8217; gettext</a> command. Fuck it. Too complicated. It just didn&#8217;t fit my needs at all.</p>
<p>All I wanted was a wheel that you can put a wood-pole in the middle and then it could start spinning. I made one.</p>
<p>You can go on the <a href="http://code.google.com/p/simplyglobal/" title="simplyglobal project homepage">simplyglobal project homepage</a> to learn on to <a href="http://code.google.com/p/simplyglobal/wiki/Install" title="install it">install it</a> and <a href="http://code.google.com/p/simplyglobal/wiki/How" title="use it">use it</a>.</p>
<p>In fact, this is not really a globalization plugin because there&#8217;s no localization handling or anything that can look like it. The name should have been <strong>simplytranslated</strong> but I already created the project with the name <em>simplyglobal</em> and it was an hassle to change it.</p>
<h3>       How to install</h3>
<p><strong>1.</strong> Execute <em>./script/plugin install <a href="http://simplyglobal.googlecode.com/svn/trunk/simplyglobal" rel="nofollow">http://simplyglobal.googlecode.com/svn/trunk/simplyglobal</a></em><br />
<strong>2.</strong> Create a file named <em>simplyglobal.rb</em> in the <em>config/initializers</em> directory<br />
<strong>3.</strong> In <em>simplyglobal.rb</em>, create hashes of language<br />
Add the language hashes to the objectYou will end up with a file named <em>simplyglobal.rb</em> that looks like this :</p>
<pre lang="ruby">#français
fr = {    "hi" =&gt; "bonjour",    "welcome" =&gt; "bienvenue"  }
# espanol
es = {    "hi" =&gt; "hola",    "welcome" =&gt; "bienvenida"}
SimplyGlobal.add_language_hash(:fr, fr)
SimplyGlobal.add_language_hash(:es, es)</pre>
<p>In <strong>development</strong>, this file will be loaded every request. In <strong>production</strong>, it is loaded once.</p>
<h3>       How to use it with strings</h3>
<p>After you <a href="http://code.google.com/p/simplyglobal/wiki/Install" title="installed it">installed it</a>, you can use it in these various ways.</p>
<p>SimplyGlobal adds a <strong>t()</strong> method to all string objects that will return the translated string. Example, if you have defined a language hash that looks like this (<strong>note</strong> : normally, the languages hash are defined in <em>config/initializers/simplyglobal.rb</em> but I put it inline for the sake of the example) :</p>
<pre lang="ruby">fr = {"hi" =&gt; "bonjour"} # Create the language hash
SimplyGlobal.add_language_hash(:fr, fr) # Add the language hash to simplyglobal
SimplyGlobal.locale = :fr # Assigns the locale to use
"hi".t # returns "bonjour"</pre>
<p>As simple as that!</p>
<p>You can use it like the <a href="http://www.ruby-doc.org/core/classes/String.html#M000785" title="% method">% method</a> of the String class.</p>
<pre lang="ruby">fr = {"hi %s%d" =&gt; "bonjour %s%d"} # Create the language hash
SimplyGlobal.add_language_hash(:fr, fr) # Add the language hash to simplyglobal
SimplyGlobal.locale = :fr # Assigns the locale to use
"hi".t("Johnny", 5) # returns "bonjour Johnny5"</pre>
<p>You can also return all translations for a word. That is a special feature developed only for Frank.</p>
<pre lang="ruby">SimplyGlobal.add_language_hash(:fr, {"hi" =&gt; "bonjour"}) # Add the french language hash
SimplyGlobal.add_language_hash(:es, {"hi" =&gt; "hola"}) # Add the spanish language hash
"hi".t(:all) # returns a hash : {:fr =&gt; "bonjour", :es =&gt; "hola"}</pre>
<h3>       Using it with views</h3>
<p>Just create a view ending with <strong>_fr</strong> and simplyglobal will use it.</p>
<pre lang="ruby">def index
  SimplyGlobal.locale = :fr
  # Will try to render index_fr.html.erb
  # rather than index.html.erb
end</pre>
<p>It also works for the partial.</p>
<pre lang="rhtml">&lt;%= render :partial =&gt; "info" %&gt;</pre>
<p>will try to render <strong>_info_fr.html.erb</strong> rather than <strong>_info.html.erb</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/simplyglobal-a-simple-globalization-plugin-for-rails/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>XMPP4r 0.4 has been released</title>
		<link>http://www.rubyfleebie.com/xmpp4r-04-has-been-released/</link>
		<comments>http://www.rubyfleebie.com/xmpp4r-04-has-been-released/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 13:54:25 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/xmpp4r-04-has-been-released/</guid>
		<description><![CDATA[It&#8217;s been a while since the latest release of XMPP4r. I was starting to think that the development for this great library had been stopped.
Fortunately, version 0.4 has been released on August 5th 2008. We&#8217;re going to try this new version internally and eventually use it for TimmyOnTime. I am personnally hoping for less memory [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since the latest release of <a href="http://home.gna.org/xmpp4r/">XMPP4r</a>. I was starting to think that the development for this great library had been stopped.</p>
<p>Fortunately, version 0.4 has been released on August 5th 2008. We&#8217;re going to try this new version internally and eventually use it for TimmyOnTime. I am personnally hoping for less memory consumption, more speed and more stability. This new version highlights are : </p>
<ol>
<li>The beginning of ruby 1.9 support</li>
<li>Refactoring of error classes (I&#8217;m really looking forward to this)</li>
</ol>
<p>Here is the full changelog :</p>
<p>XMPP4R 0.4 (05/08/2008)<br />
=======================<br />
* Initial support for Ruby 1.9 (see README_ruby19.txt)<br />
* Complete PubSub API Change &#8211; more logical and better for<br />
  childclasses, support for collection node creation<br />
* a Helper to assist with XEP-0115 Entity Capabilities<br />
* SASL anonymous support<br />
* File transfer fixes<br />
* MUC room configuration fixes<br />
* initial support for XEP-0118 User Tune<br />
* fix for an xmlrpc exception-during-serialisation bug, which would cause<br />
  a hang<br />
* Support auto-gem generation on GitHub with improved and DRY&#8217;er RakeFile and<br />
  gemspec.<br />
* Add support for the old SSL protocol (needed to connect to GTalk)<br />
* Changed API for Client, Component, Connection, Stream to remove<br />
  need for antiquated &#8216;threaded&#8217; param in the initializer.<br />
* Use a Logger instance instead of directly writing to stdout<br />
* Re-factored &#038; consolidated Error classes.  See xmpp4r/errors.rb for all<br />
  custom errors that can be caught.  All inherit from Jabber::Error which<br />
  itself inherits from Ruby&#8217;s StandardError. This is a first step in<br />
  re-factoring errors.  The next step will be to convert all &#8216;raise&#8217; calls to<br />
  raise a custom Jabber::Error or one of its children instead of anonymous<br />
  RuntimeErrors.  This allows much more granularity in catching and handling<br />
  errors later.<br />
  If you were catching Jabber::ErrorException before you should probably<br />
  change that in your code to now catch Jabber::Error if you want to<br />
  catch everything or one of the custom children of Jabber::Error defined in<br />
  &#8216;lib/xmpp4r/errors.rb&#8217;.  Additionally, the Error class which encapsulated<br />
  the xmpp error response, has been renamed to ErrorResponse to reflect its<br />
  real usage.  This free&#8217;s up &#8216;Jabber::Error&#8217; for use as our base Error class.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/xmpp4r-04-has-been-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Komodo Edit : A great editor for dynamic languages</title>
		<link>http://www.rubyfleebie.com/komodo-edit-a-great-editor-for-dynamic-languages/</link>
		<comments>http://www.rubyfleebie.com/komodo-edit-a-great-editor-for-dynamic-languages/#comments</comments>
		<pubDate>Mon, 26 May 2008 21:17:40 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/komodo-edit-a-great-editor-for-dynamic-languages/</guid>
		<description><![CDATA[Being a Linux/Ubuntu user, i cannot use the praised Textmate editor to develop ruby applications. I tried a lot of editors, some of them being very good ones, but in the end I always end up using gedit.
gedit is great&#8230; but it is rather limited features-wise. Recently I have tried Komodo Edit and I can [...]]]></description>
			<content:encoded><![CDATA[<p>Being a Linux/Ubuntu user, i cannot use the praised <a href="http://macromates.com/">Textmate</a> editor to develop ruby applications. I tried a lot of editors, some of them being very good ones, but in the end I always end up using <a href="http://www.gnome.org/projects/gedit/">gedit</a>.</p>
<p>gedit is great&#8230; but it is rather limited features-wise. Recently I have tried <a href="http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml">Komodo Edit</a> and I can say that this is <strong>the best RubyOnRails editor available on Linux</strong>. It has a lot of features (autocomplete, tons of supported languages, macros, color schemes, etc) but somehow it is still light and minimalist.</p>
<p>Komodo Edit is also available on Mac and Windows</p>
<p><img src="http://www.rubyfleebie.com/wp-content/uploads/2008/05/komodo.png" width="600" alt="Komodo screenshot" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/komodo-edit-a-great-editor-for-dynamic-languages/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Phusion Passenger, you&#8217;re my hero</title>
		<link>http://www.rubyfleebie.com/phusion-passenger-youre-my-hero/</link>
		<comments>http://www.rubyfleebie.com/phusion-passenger-youre-my-hero/#comments</comments>
		<pubDate>Fri, 23 May 2008 00:11:03 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/phusion-passenger-youre-my-hero/</guid>
		<description><![CDATA[I feel so weird. Maybe it&#8217;s just the side-effects of eating that old, pinky-brown colored and talking piece of raw meat that was sitting in the corner of my kitchen since a month or two&#8230; but as strange as it may sound, I think it&#8217;s something else.
I think it is something related to Rails that [...]]]></description>
			<content:encoded><![CDATA[<p>I feel so weird. Maybe it&#8217;s just the side-effects of eating that old, pinky-brown colored and talking piece of raw meat that was sitting in the corner of my kitchen since a month or two&#8230; but as strange as it may sound, I think it&#8217;s something else.</p>
<p>I think it is something related to Rails that makes me so excited. I just tried deploying a rails application with <a href="http://modrails.com">Phusion Passenger</a> (aka mod_rails)&#8230; and I am still shocked. Rails deployment has finally becomes a breeze! At the time I am writing this, I still have this exaggerated dumb smile in my face expressing my satisfaction&#8230; and I am alone in my house.</p>
<p>#UPDATE : I removed the smiling pig image that was put here to &#8220;express my satisfaction&#8221;. I removed it because it was not funny and it made me look like someone who is not funny&#8230; which is something I am not comfortable with. Now that I have removed the image of the smiling pig, I expect to receive my first comment (and tons of others) for this blog post. For those who liked the smiling pig, you can find it <a href="http://www.rubyfleebie.com/wp-content/uploads/2008/05/Pig_Smile.jpg">here</a> and pretend it is funny.</p>
<p>Ok enough stupidities, <a href="http://www.modrails.com/">Phusion Passenger</a> is great. It is built to work with the Apache web server. No port configuration, no complicated vhost configuration, you upload your stuff and guess what? It works. Well, almost&#8230; to restart your rails application you just have to <em>touch</em> tmp/restart.txt. If you&#8217;re using capistrano, it means that you only have to do something like that :</p>
<pre lang="ruby">namespace :deploy do
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end</pre>
<p><strong>And what about the vhost configuration?</strong><br />
<code><br />
&lt;VirtualHost *:80&gt;<br />
  ServerName yourdomain.com<br />
  ServerAlias www.yourdomain.com<br />
  DocumentRoot /home/you/apps/yourapp/current/public<br />
&lt;/VirtualHost&gt;<br />
</code><br />
I didn&#8217;t have time to play with all the settings and read the documentation&#8230; but I have the feeling that this thing is the light, try it!</p>
<p><code><br />
gem install passenger<br />
passenger-install-apache2-module<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/phusion-passenger-youre-my-hero/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Railers Need To Stop Not Caring About The Database</title>
		<link>http://www.rubyfleebie.com/railers-need-to-stop-not-caring-about-the-database/</link>
		<comments>http://www.rubyfleebie.com/railers-need-to-stop-not-caring-about-the-database/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 14:36:38 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/railers-need-to-stop-not-caring-about-the-database/</guid>
		<description><![CDATA[For many of us, databases are no fun&#8230; surely not as fun as ActiveRecord or Rails in general. Every railers I know love the &#8220;dot notation&#8221; offered by ActiveRecord associations immensely&#8230;  while refering to the vast majority of raw SQL queries as &#8220;Some ugly non-sense gibberish that we would all prefer not know the [...]]]></description>
			<content:encoded><![CDATA[<p>For many of us, databases are no fun&#8230; surely not as fun as ActiveRecord or Rails in general. Every railers I know love the &#8220;dot notation&#8221; offered by ActiveRecord associations immensely&#8230;  while refering to the vast majority of raw SQL queries as &#8220;Some ugly non-sense gibberish that we would all prefer not know the existence&#8221;.</p>
<p>Our hate towards the SQL language and databases is not a valid excuse to not assume our responsabilities as application developers. Recently I was working on a Rails plugin when the sentiment of being incompetent struck my body exactly like the lightning strikes an adventurous golfer who happily plays golf during a thunderstorm.</p>
<p>It all happened when I had a query that was generating a lot of results&#8230; and was slow as hell to process&#8230; even though I was using the :include option for Eager Loading.</p>
<p>@stuff = ParentStuff.find(:all, :include => :child_stuff, :order => &#8220;created_at DESC&#8221;)</p>
<p>Then, in my view, I had something like :</p>
<pre lang="ruby">@stuff.each do |parent_stuff|
  bla bla bla <%=parent_stuff.name%>
  parent_stuff.child_stuff.each do |stuff|
     bla bla bla <%=stuff.title%>
  end
end</pre>
<p>It was awfully slow! I started looking at the logs and saw this typical monstruous sql query. Look at it&#8230; you  have to look at it. I know you don&#8217;t want to&#8230; but it won&#8217;t go away :</p>
<p>SELECT parent_stuff.`id` AS t0_r0, parent_stuff.`field1` AS t0_r1, parent_stuff.`field2` AS t0_r2, parent_stuff.`field3` AS t0_r3, parent_stuff.`field4` AS t0_r4, child_stuff.`id` AS t1_r0, child_stuff.`field5` AS t1_r1, child_stuff.`field6` AS t1_r2, child_stuff.`field7` AS t1_r3, child_stuff.`field8` AS t1_r4, child_stuff.`field9` AS t1_r5, child_stuff.`field10` AS t1_r6, child_stuff.`field11` AS t1_r7 FROM parent_stuff LEFT OUTER JOIN child_stuff ON child_stuff.the_foreign_key = parent_stuff.id WHERE (parent_stuff.created_at >= &#8216;2008-04-24 00:00:00&#8242; AND parent_stuff.created_at <= '2008-04-24 09:44:56') ORDER BY parent_stuff.created_at</p>
<p>What's the problem with this? It's just one query... cannot take that much time. I thought it was a "Rails problem" until I ran the query directly in a MySql web interface. It took the same amount of time, meaning that the problem was within the query itself. Oh sh**... it was a database problem! Like many Rails Developers, my database skills are, while not inexistant, inadequate. </p>
<p> I tried to figure out what could be the problem with this query. I replaced every LEFT OUTER JOIN with INNER JOIN and Boom! the query executed in less than half a second. </p>
<p>My urgent desire of leaving the MySql web interface made me go back to my Rails code. I then tried some stupid random stuff like : </p>
<p>@stuff = ParentStuff.find(:all, :include => :child_stuff, :joins => &#8220;INNER JOIN child_stuff ON child_stuff.parent_stuff_id=id&#8221; :order => &#8220;created_at DESC&#8221;) but the slow LEFT OUTER JOINs remain in the query instead of being replace by the faster INNER JOIN. Then, I learned that in Rails 2.0, you could do Eager Loading with INNER JOIN by passing an association name to the :joins option, like that :</p>
<p>@stuff = ParentStuff.find(:all, :joins => :child_stuff, :order => &#8220;created_at DESC&#8221;)</p>
<p>Problem is I was working on a plugin&#8230; and I&#8217;d like it to be compatible with older versions of Rails. So I did what I was scared of doing since the beginning : Going to some MySql forums to read the advice of some DBA&#8217;s &#8230;</p>
<p>Then I found the answer to my problem&#8230; and this answer proved me that I needed to stop playing blindly with ActiveRecord like if the backend database was none of my business&#8230;. because it is. The answer is so obvious&#8230; but given the fact that I never wanted to care about databases since Rails exists, I didn&#8217;t think about it :</p>
<p><strong>Answer : Add an index to the foreign key in the child table!</strong></p>
<p>This is just one case that shows the dangers of not being aware of what&#8217;s going on in the database. It&#8217;s sad, but you cannot blindly let ActiveRecord manage everything that is Database related for you. It&#8217;s only a question of being in control of the entire application&#8230; and the relational database is a part of it.</p>
<p><strong>UPDATE</strong><br />
This post has kind of <a href="http://www.railway.at/articles/2008/04/24/database-agnostic-database-ignorant">turned against me</a>. The only thing I wanted to say with this article is that ActiveRecord needs our supervision&#8230; not that I am a moron who can&#8217;t understand databases. I know what joins are, I know what indexes are&#8230; but in most situations I don&#8217;t have to &#8220;care&#8221; about them with ActiveRecord. Sorry but I felt the need to defend myself about this issue :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/railers-need-to-stop-not-caring-about-the-database/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Rubyize this : 6th edition</title>
		<link>http://www.rubyfleebie.com/rubyize-this-6th-edition/</link>
		<comments>http://www.rubyfleebie.com/rubyize-this-6th-edition/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 00:21:05 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[Easy reading]]></category>

		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this-6th-edition/</guid>
		<description><![CDATA[Oh, my&#8230; God.
What is this? First post in a century? What&#8217;s going on here Fleebie? Our beloved readers are going to stop respecting us, and for good reasons.
For those who care, I am not dead, I am not sick&#8230; I am just working like crazy on Azanka, the company I started with Dan recently.
Ok now [...]]]></description>
			<content:encoded><![CDATA[<p>Oh, my&#8230; God.</p>
<p>What is this? First post in a century? What&#8217;s going on here Fleebie? Our beloved readers are going to stop respecting us, and for good reasons.</p>
<p>For those who care, I am not dead, I am not sick&#8230; I am just working like crazy on <a href="http://www.azankatech.com/en">Azanka</a>, the company I started with Dan recently.</p>
<p>Ok now it&#8217;s time for a brand new edition of Rubyize this. Let&#8217;s get the ball rolling. Hold on&#8230; I&#8217;m going to google images to get a picture of a ball rolling.</p>
<p><img src='http://www.rubyfleebie.com/wp-content/uploads/2008/04/364421257_8cad73e64f.jpg' alt='364421257_8cad73e64f.jpg' /></p>
<p>Hmm&#8230; I&#8217;m afraid this isn&#8217;t going to roll at all</p>
<p>Anyway, consider this :</p>
<p>I am an old and unhappy programmer from the late eighties and you secretly watch me coding the following lines :</p>
<pre lang="ruby">class VotingSystem
  #Hello, I am Rodger the old and unhappy programmer. the variable nbrOfVotes is an array of 2 dimensions. The first dimension contains the number of votes for the answer "YES, IT SUCKS"... and the other dimension contain the number of votes for the answer "NO, IT DOESN'T SUCK". In the near future there will be other possible answers... but I don't care! I retire in 2 days!
  @@nbrOfVotes = Array.new

  #The users who sent their vote arrive in this very top secret method!! (I retire in 2 days!)
  def receiveAVote(theVote)
    if theVote == "YES, IT SUCKS"
     @@nbrOfVotes[0] = 0 if @@nbrOfVotes[0].nil?
     @@nbrOfVotes[0] = @@nbrOfVotes[0] + 1
    else
      if theVote == "NO, IT DOESN'T SUCK"
        @@nbrOfVotes[1] = 0 if @@nbrOfVotes[1].nil?
        @@nbrOfVotes[1] = @@nbrOfVotes[1] + 1
      else
          puts "THIS IS NOT A VALID ANSWER YOU MORON... btw i retire in 2 days!"
      end
    end
  end

  #This is the function that compile ALL the votes... I retire in 2 days!
  def compileAllTheVotes
    for i in (0..1)
      if i == 0
        @@nbrOfVotes[0] = 0 if @@nbrOfVotes[0].nil?
        puts "HERE IS THE NUMBER OF VOTES FOR 'YES IT SUCKS' : " + @@nbrOfVotes[0].to_s
      else
        if i == 1
          @@nbrOfVotes[1] = 0 if @@nbrOfVotes[1].nil?
          puts "HERE IS THE NUMBER OF VOTES FOR 'NO IT DOESN'T SUCKS' : " + @@nbrOfVotes[1].to_s
        end
     end
    end
  end
end
</pre>
<p>Bring the light to this man who retires in 2 days</p>
<p><a href="http://refactormycode.com/codes/283-rubyize-this-6th-edition">Refactor this on RMC!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubyfleebie.com/rubyize-this-6th-edition/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

