<?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>Joakim Andersson &#187; ruby</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
	<atom:link href="http://joakimandersson.se/archives/category/programming/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://joakimandersson.se</link>
	<description>Passionate climber, brilliant coder</description>
	<lastBuildDate>Wed, 01 Sep 2010 22:02:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>HotCocoa!</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2010/02/04/hotcocoa/</link>
		<comments>http://joakimandersson.se/archives/2010/02/04/hotcocoa/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 21:43:57 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/?p=2763</guid>
		<description><![CDATA[The latest MacRuby with HotCocoa is amazing! Finally a way to write OS X applications without having to learn Objective-C. require 'rubygems' require 'hotcocoa' include HotCocoa application do &#124;app&#124; win = window :size =&#62; [100,50] b = button :title =&#62; 'Hello' b.on_action { puts 'World!' } win &#60;&#60; b end]]></description>
			<content:encoded><![CDATA[<p>The latest <a href="http://www.macruby.org/">MacRuby</a> with <a href="http://github.com/richkilmer/hotcocoa">HotCocoa</a> is amazing! Finally a way to write OS X applications without having to learn Objective-C.</p>

<p><pre class="brush: ruby; light: true;">
require 'rubygems'
require 'hotcocoa'
include HotCocoa
application do |app|
  win = window :size =&gt; [100,50]
  b = button :title =&gt; 'Hello'
  b.on_action { puts 'World!' }
  win &lt;&lt; b
end
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2010/02/04/hotcocoa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daemons</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2008/03/20/daemons/</link>
		<comments>http://joakimandersson.se/archives/2008/03/20/daemons/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 12:20:05 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2008/03/20/daemons/</guid>
		<description><![CDATA[Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands.]]></description>
			<content:encoded><![CDATA[<blockquote><a href="http://daemons.rubyforge.org/">Daemons</a> provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands.</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2008/03/20/daemons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starling: Twitter’s Persistent Queue Released</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2008/01/15/starling-twitter%e2%80%99s-persistent-queue-released/</link>
		<comments>http://joakimandersson.se/archives/2008/01/15/starling-twitter%e2%80%99s-persistent-queue-released/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 21:00:14 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2008/01/15/starling-twitter%e2%80%99s-persistent-queue-released/</guid>
		<description><![CDATA[Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter’s backend, and is in production across Twitter’s cluster. Starling: Twitter’s Persistent Queue Released I want to play with that!]]></description>
			<content:encoded><![CDATA[<blockquote>
Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter’s backend, and is in production across Twitter’s cluster.</blockquote>

<p><a href="http://www.20seven.org/blog/articles/2008/01/11/starling-twitters-persistent-queue-released/">Starling: Twitter’s Persistent Queue Released</a></p>

<p>I want to play with that!</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2008/01/15/starling-twitter%e2%80%99s-persistent-queue-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dependency injection and why Java sucks</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2007/07/30/dependency-injection-and-why-java-sucks/</link>
		<comments>http://joakimandersson.se/archives/2007/07/30/dependency-injection-and-why-java-sucks/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 12:29:48 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2007/07/30/dependency-injection-and-why-java-sucks/</guid>
		<description><![CDATA[Jamis Buck reminds me why I dislike Java in his Net::SSH revisited post. It&#8217;s not that Java is bad. It&#8217;s quite a nice language with a good solid foundation of available classes and libraries. No, the problem is all the frameworks and design patterns you need to use to be able to work at the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://weblog.jamisbuck.org/">Jamis Buck</a> reminds me why I dislike Java in his <a href="http://weblog.jamisbuck.org/2007/7/29/net-ssh-revisited">Net::SSH revisited</a> post.</p>

<p>It&#8217;s not that Java is bad. It&#8217;s quite a nice language with a good solid foundation of available classes and libraries. No, the problem is all the frameworks and design patterns you need to use to be able to work at the same level as what come as default in a language in Ruby.</p>

<p><a href="http://www.martinfowler.com/articles/injection.html">Dependency injection</a> is a good example. I remember then it was the latest hype in Java-land a few years back. In Java it helps you write modular code without tight coupling between the components. And that&#8217;s a good thing, right?</p>

<p>However, in Ruby this is a non-issue. You can accomplish the same in Ruby without using a framework and extra libraries.</p>

<p>This is what I dislike with Java. It holds me back! With Ruby I feel I have an incredibly amount of power available at my finger tips. I can concentrate on the fun thing; solving the problem at hand. No need to fuss around with frameworks, support libraries and what not, just to have the ground to build upon.</p>

<p>So to summarize. Ruby makes you happy. Ruby makes you smile. Ruby gives you all you need.</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2007/07/30/dependency-injection-and-why-java-sucks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DRb with jruby and normal ruby</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2007/06/13/drb-with-jruby-and-normal-ruby/</link>
		<comments>http://joakimandersson.se/archives/2007/06/13/drb-with-jruby-and-normal-ruby/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 08:57:30 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2007/06/13/drb-with-jruby-and-normal-ruby/</guid>
		<description><![CDATA[If you get weird errors then your normal (i.e. using the ruby implementation in c) ruby program tries to access a DRb resource shared from a DRb server running on jruby try to upgrade to the latest jruby release. I got very mysterious errors with jruby 0.9.8 but the errors went away after I upgraded [...]]]></description>
			<content:encoded><![CDATA[<p>If you get weird errors then your normal (i.e. using the ruby implementation in c) ruby program tries to access a DRb resource shared from a DRb server running on jruby try to upgrade to the latest jruby release.</p>

<p>I got very mysterious errors with jruby 0.9.8 but the errors went away after I upgraded to the 1.0 release.</p>

<p>Oh, and furthermore don&#8217;t test your DRb stuff with a method named &#8216;test&#8217;. It will work with normal ruby but with jruby you&#8217;ll get a &#8216;trying to access private method&#8217; error. It seems like jruby defines a private test method on objects for some reason and you end up with a conflict.</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2007/06/13/drb-with-jruby-and-normal-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SOA and Rails</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2007/06/13/soa-and-rails/</link>
		<comments>http://joakimandersson.se/archives/2007/06/13/soa-and-rails/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 07:40:05 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2007/06/13/soa-and-rails/</guid>
		<description><![CDATA[If you are wondering how to get your Rails application to play together with the rest of the kids in the SOA playground this SOA and Rails article by Russ Miles over at the SOA Ranch will give you a nice introduction.]]></description>
			<content:encoded><![CDATA[<p>If you are wondering how to get your Rails application to play together with the rest of the kids in the SOA playground this <a href="http://www.soaranch.com/articles/2006/7/11/soa-and-rails-part-1.html">SOA and Rails article</a> by Russ Miles over at the <a href="http://www.soaranch.com/">SOA Ranch</a> will give you a nice introduction.</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2007/06/13/soa-and-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby going mainstream</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2007/05/09/jruby-going-mainstream/</link>
		<comments>http://joakimandersson.se/archives/2007/05/09/jruby-going-mainstream/#comments</comments>
		<pubDate>Wed, 09 May 2007 06:53:02 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2007/05/09/jruby-going-mainstream/</guid>
		<description><![CDATA[Apparently ThoughtWorks are going to run their new product Mingle on JRuby. That&#8217;s cool stuff!]]></description>
			<content:encoded><![CDATA[<p>Apparently <a href="http://www.thoughtworks.com">ThoughtWorks</a> are going to run their new product <a href="http://studios.thoughtworks.com/2007/5/7/mingle-to-run-on-jruby">Mingle on JRuby</a>. That&#8217;s cool stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2007/05/09/jruby-going-mainstream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2007/05/01/jruby-2/</link>
		<comments>http://joakimandersson.se/archives/2007/05/01/jruby-2/#comments</comments>
		<pubDate>Tue, 01 May 2007 19:09:59 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2007/05/01/jruby-2/</guid>
		<description><![CDATA[I&#8217;ve played with JRuby a bit lately and it&#8217;s quite marvelous. I wanted to use a library that was only available in Java but the rest of the code I had written was in ruby, jruby then magically solved my problem and saved me a bunch of time. Super!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve played with <a href="http://jruby.codehaus.org/">JRuby</a> a bit lately and it&#8217;s quite marvelous. I wanted to use a library that was only available in Java but the rest of the code I had written was in ruby, jruby then magically solved my problem and saved me a bunch of time. Super!</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2007/05/01/jruby-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Net::HTTP.post_form</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2007/01/18/nethttppost_form/</link>
		<comments>http://joakimandersson.se/archives/2007/01/18/nethttppost_form/#comments</comments>
		<pubDate>Thu, 18 Jan 2007 16:22:43 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2007/01/18/nethttppost_form/</guid>
		<description><![CDATA[Maybe I didn&#8217;t get how it works but I can&#8217;t get the Net::HTTP.post_form method in the ruby library to post to a URL like this, http://foo.bar/foo.php?q=search, i.e. a URL with GET query parameters. The post_form method takes an URI instance (which you get with something like u = URI.parse(“http://foo.bar/foo.php?q=search”)) and then the code works like [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe I didn&#8217;t get how it works but I can&#8217;t get the <strong>Net::HTTP.post_form</strong> method in the ruby library to post to a URL like this, <strong>http://foo.bar/foo.php?q=search</strong>, i.e. a URL with GET query parameters.</p>

<p>The <strong>post_form</strong> method takes an URI instance (which you get with something like u = URI.parse(“http://foo.bar/foo.php?q=search”)) and then the code works like this:</p>

<p>
<span style="font-size: 1em; font-family: courier, monospace;">
    def HTTP.post_form(url, params)<br />
    &nbsp;&nbsp;req = Post.new(url.path)<br />
    &nbsp;&nbsp;req.form_data = params<br />
    &nbsp;&nbsp;req.basic_auth url.user, url.password if url.user<br />
    &nbsp;&nbsp;new(url.host, url.port).start {|http|<br />
    &nbsp;&nbsp;&nbsp;&nbsp;http.request(req)<br />
    &nbsp;&nbsp;}<br />
    end<br />
</span>
</p>

<p>You see the use of <strong>url.path</strong> there then creating the Post object? That won&#8217;t include the <strong>?q=search</strong> part of the url.</p>

<p>I&#8217;m not sure if this is the way it&#8217;s designed to work but I haven&#8217;t been able to figure out a way to mark any parameter I send in to the post_form method in params as a GET parameter. If that was possible this would work fine but for now I&#8217;ve settled on the below piece of code:</p>

<p>
<span style="font-size: 1em; font-family: courier, monospace;">
  def my_post_form(url, params)<br />
  &nbsp;&nbsp;req = Net::HTTP::Post.new(url.request_uri)<br />
  &nbsp;&nbsp;req.form_data = params<br />
  &nbsp;&nbsp;req.basic_auth url.user, url.password if url.user<br />
  &nbsp;&nbsp;Net::HTTP::new(url.host, url.port).start {|http|<br />
  &nbsp;&nbsp;&nbsp;&nbsp;http.request(req)<br />
  &nbsp;&nbsp;}<br />
  end<br />
</span>
</p>

<p>which will do for me until you all tell me how stupid I am and give me a better solution :)</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2007/01/18/nethttppost_form/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Raven</title>

<link rel="stylesheet" href="http://joakimandersson.se/wp-content/plugins/sitepress-multilingual-cms/res/css/language-selector.css?v=0.1" type="text/css" media="all" />
		<link>http://joakimandersson.se/archives/2006/10/19/raven/</link>
		<comments>http://joakimandersson.se/archives/2006/10/19/raven/#comments</comments>
		<pubDate>Thu, 19 Oct 2006 09:28:12 +0000</pubDate>
		<dc:creator>Joakim Andersson</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://joakimandersson.se/archives/2006/10/19/raven/</guid>
		<description><![CDATA[Is Ruby Raven &#8211; Java Build with Rake and Gems the way to go to get away from the horrible time wasting programming in XML that using Ant means? At least it might be for those that already know Ruby and have used Rake and Ruby Gems.]]></description>
			<content:encoded><![CDATA[<p>Is <a href="http://raven.rubyforge.org/">Ruby Raven &#8211; Java Build with Rake and Gems</a> the way to go to get away from the horrible time wasting programming in XML that using <a href="http://ant.apache.org/">Ant</a> means? At least it might be for those that already know <a href="http://www.ruby-lang.org/en/">Ruby</a> and have used <a href="http://docs.rubyrake.org/">Rake</a> and <a href="http://docs.rubygems.org/">Ruby Gems</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://joakimandersson.se/archives/2006/10/19/raven/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
