<?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>LolocoJr &#187; Home</title>
	<atom:link href="http://www.railsguru.com/articles/category/home/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.railsguru.com</link>
	<description>Andy Lo-A-Foe&#039;s blog</description>
	<lastBuildDate>Thu, 21 Jul 2011 13:31:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Getting rid of KPN</title>
		<link>http://www.railsguru.com/articles/2008/11/10/getting-rid-of-kpn/</link>
		<comments>http://www.railsguru.com/articles/2008/11/10/getting-rid-of-kpn/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 11:40:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[kpn suckage]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/11/10/getting-rid-of-kpn</guid>
		<description><![CDATA[So, we moved and I canceled all our subscriptions at the old address. So I thought, it turns out KPN has /dev/null&#8217;d my cancellation request for the fixed line twice in a row. Each time customer relations assured me it &#8230; <a href="http://www.railsguru.com/articles/2008/11/10/getting-rid-of-kpn/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, we moved and I canceled all our subscriptions at the old address. So I thought, it turns out KPN has /dev/null&#8217;d my cancellation request for the fixed line <strong>twice</strong> in a row. Each time customer relations assured me it would take 5 working days for the request to be processed. I just called them a third time now, because the line was active. The kind lady  gave me a reference number for the cancellation order. So, whenever you deal with KPN I think it&#8217;s a good idea to ask for the reference number of the case or order.</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2008/11/10/getting-rid-of-kpn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone 3G secured.. the wait starts</title>
		<link>http://www.railsguru.com/articles/2008/07/11/iphone-3g-secured-the-wait-starts/</link>
		<comments>http://www.railsguru.com/articles/2008/07/11/iphone-3g-secured-the-wait-starts/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 15:51:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[iphone apple hype]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/09/24/iphone-3g-secured-the-wait-starts</guid>
		<description><![CDATA[After reading about all the trouble folks went through in getting an iPhone I felt super lucky!! Yesterday I phoned the local BelCompany store to see if they were getting any delivered. There seems to be a reservation list so &#8230; <a href="http://www.railsguru.com/articles/2008/07/11/iphone-3g-secured-the-wait-starts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After reading about all the <a href="http://www.bright.nl/boom-iphone-3g-op-eerste-dag-uitverkocht" target="_blank">trouble folks went through</a> in getting an iPhone I felt super lucky!! Yesterday I phoned the local BelCompany store to see if they were getting any delivered. There seems to be a reservation list so I asked the guy if it still made sense to sign up. He said sure.. I was number 20 on the list (what, only 20 ppl??). Early this morning I got a call saying I was the <strong>last</strong> one to secure a phone in the from first batch!! Woaw! The T-Mobile activation system was severely overloaded so the only thing I could do is sign a pre-agreement and wait untill tomorrow (12th) to pick it up. If only I was so lucky <a href="http://www.staatsloterij.nl">playing the lotto!</a>. More as soon as I actually have it in physical possession!<br/><br />
<br/><br />
<strong>Update:</strong> Well got the iPhone 2 months ago. Apart from the terrible battery life, dropped calls, horrible 3G reception and Apple&#8217;s draconian developer restrictions,  a wonderful phone! Time to jailbreak it&#8230;</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2008/07/11/iphone-3g-secured-the-wait-starts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting XS4ALL HSDPA/UMTS working on OS X Leopard</title>
		<link>http://www.railsguru.com/articles/2008/05/31/getting-xs4all-umts-hsdpa-working-on-os-x-leopard-2/</link>
		<comments>http://www.railsguru.com/articles/2008/05/31/getting-xs4all-umts-hsdpa-working-on-os-x-leopard-2/#comments</comments>
		<pubDate>Sat, 31 May 2008 08:46:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[xs4all umts hsdpa modem leopard option]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/09/25/getting-xs4all-umts-hsdpa-working-on-os-x-leopard</guid>
		<description><![CDATA[Article was updated. See below, the Option software should work out-of-the-box for Leopard 10.5.5 or higher! Last week I received my HSDPA/UMTS/GPRS card from XS4ALL. After the major ADSL outtage fiasco It really dawned on me that not having net &#8230; <a href="http://www.railsguru.com/articles/2008/05/31/getting-xs4all-umts-hsdpa-working-on-os-x-leopard-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Article was updated. See below, the Option software should work out-of-the-box for Leopard 10.5.5 or higher!</strong></p>
<p>Last week I received my HSDPA/UMTS/GPRS card from XS4ALL. After the <a href="http://www.xs4all.nl/nieuws/bericht.php?msect=nieuws&amp;id=979&amp;taal=nl" target="_blank">major ADSL outtage fiasco</a> It really dawned on me that not having net access for a day actually costs more than  the whole wireless plan per month! Think about it, as I telecommute 4 days in the week I would actually have to drive to the office to get work done (luckily our offices were spared from the outtage!), the parking money alone is almost more than the whole plan (go Amsterdam!). Enough justification for the new toy. It arrrived, weeh!</p>
<p><span id="more-2845"></span></p>
<p>The specs clearly state it should work fine an OS X 10.3.x or later. Unfortunatly the instructions from XS4ALL are completely <strong>useless</strong> when you are running on Leopard. It probably has more to do with Option and their drivers or OS X and its (shoddy) support for the hardware which is the Globetrotter Express 7.2 card btw.</p>
<p><img src="http://www.railsguru.com/assets/2008/5/26/gt_express.jpg" alt="" /></p>
<p>After 2 hours of fiddling with various releases of drivers and trying all the the blog tricks from people around the world with the same card I was almost ready to give up when I stumbled upon this <a href="http://www.xs4all.nl/~ernstagn/GPRS-HOWTO/" target="_blank">HOWTO for Linux</a>. As always Linux to the rescue. It turns out the card is basically just a glorified modem and you just need the right AT commands and some pppd magic to get things going.. Grrrreat, familiar territory! (I have to confess, OS X dumbs you down, so having things breaking once in a while is gooooood!!)</p>
<p>After some searching I found the following devices:</p>
<p><img src="http://www.railsguru.com/assets/2008/5/26/dev.jpg" alt="" /></p>
<p>Cool, connecting to the <strong>cu.GT HSDPA Modem</strong> tty device should work:</p>
<p><em>$ screen /dev/cu.GT\ HSDPA\ Modem</em></p>
<p><em>AT&lt;return&gt;</em></p>
<p><strong>OK</strong></p>
<p>Yes! The device is alive. Now, to find out if there is some combination of settings in the Network Preferences that actually make it work. Some further blogging shows that the Option » GSM configurations comes closest to what this cards expects.</p>
<p><img src="http://www.railsguru.com/assets/2008/5/31/config.jpg" alt="" /></p>
<p>Wow, 5 entries for the card. Just pick one which gives you a modem icon. Then choose &#8220;Advanced&#8230;&#8221; and pick model &#8220;Option&#8221; and then choose &#8220;GSM&#8221; (should be the only option anyway). In the &#8220;APN&#8221; field you should fill in &#8220;umts.xs4all.nl&#8221;.</p>
<p><img src="http://www.railsguru.com/assets/2008/5/31/option.jpg" alt="" /></p>
<p>Back to the connection setup screen. Fill in &#8220;*99***1#&#8221; in the Telephone number field, although this is not strictly needed I think. Fill in your XS4ALL username and password in the field. <strong>Note:</strong> even though XS4ALL states you don&#8217;t need your account password to connect at least I had to fill in the correct password. The pppd connection would immediately be dropped otherwise. Also, select the &#8220;Show modem status in menu bar&#8221; for convenience.</p>
<p><img src="http://www.railsguru.com/assets/2008/5/31/system.jpg" alt="" /></p>
<p>Now it&#8217;s time to connect. Select the &#8220;Connect Globetrotter HSDPA Modem&#8221; from the dropdown modem menu bar. You should see the modem connecting..</p>
<p><img src="http://www.railsguru.com/assets/2008/5/31/connect.jpg" alt="" /></p>
<p>You can open up the console and monitor &#8220;system.log&#8221; and also filter on &#8220;pppd&#8221; to see the relevant lines</p>
<p><img src="http://www.railsguru.com/assets/2008/5/31/console.jpg" alt="" /></p>
<p>If everything went well you should now be connected to the Internet and have an IP address in the mobile.xs4all.nl range. Enjoy! I have the Mobile start plan which currently gives you 768/128 and I&#8217;m happy to say that from all the locations I&#8217;ve tried so far in and around Amsterdam I always get the full bandwidth. Ping times are also quite reasonable, most of the time around 90ms, sometimes in the 300ms range (perhaps when it drops back to GPRS?). Anyway, SSH and web browsing are perfectly doable. Next up.. OpenVPN setup&#8230; another day..</p>
<p><strong>Update:</strong> Forgot to mention this, but you need to disable the PIN on your SIM card for all of this to work. You can do this by putting it in your mobile phone and disable it using the phone&#8217;s config menus.</p>
<p><strong>Update 2:</strong> After upgrading Leopard to 10.5.5 the above instructions were completely invalidated for me. However!!! The GT Mac Connect 1.3d0-164 software (downloadable from <a href="http://www.option.com/support/globetrotter_fe/fe_downloads.shtml">Option</a> worked for me out of the box, where previously it failed mysteriously!! Try it!!</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2008/05/31/getting-xs4all-umts-hsdpa-working-on-os-x-leopard-2/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>A daughter!</title>
		<link>http://www.railsguru.com/articles/2008/04/17/busy-with-a-daughter/</link>
		<comments>http://www.railsguru.com/articles/2008/04/17/busy-with-a-daughter/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 18:16:42 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/04/17/busy-with-a-daughter</guid>
		<description><![CDATA[It has been very quiet on this blog, but not so much here at home. On March 2th 2008 our daughter Mia Morena Elisabeth Lo-A-Foe was born. Mia is a healthy baby girl who regularly eats every 3 hours, around &#8230; <a href="http://www.railsguru.com/articles/2008/04/17/busy-with-a-daughter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It has been very quiet on this blog, but not so much here at home. On March 2th 2008 our daughter Mia Morena Elisabeth Lo-A-Foe was born. Mia is a healthy baby girl who regularly eats every 3 hours, around the clock. After 6 weeks we&#8217;re completely comfortable with the new schedule. <a href="http://www.railsguru.com/articles/2007/9/16/keeping-things-in-perspective">Andrew</a> loves his baby sister very much but still pokes here once in a while just to see what&#8217;s she&#8217;s made of <img src='http://www.railsguru.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2008/04/17/busy-with-a-daughter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A baby girl!!!</title>
		<link>http://www.railsguru.com/articles/2008/04/17/a-baby-girl/</link>
		<comments>http://www.railsguru.com/articles/2008/04/17/a-baby-girl/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 15:06:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[baby mia andrew home sleepless diapers]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/10/20/a-baby-girl</guid>
		<description><![CDATA[It has been very quiet on this blog, but not so much here at home. On March 2nd 2008 our daughter Mia Morena Elisabeth Lo-A-Foe was born. Mia is a healthy baby girl who regularly eats every 3 hours, around &#8230; <a href="http://www.railsguru.com/articles/2008/04/17/a-baby-girl/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
It has been very quiet on this blog, but not so much here at home. On March 2nd 2008 our daughter Mia Morena Elisabeth Lo-A-Foe was born.
</p>
<p>
<img src="http://www.railsguru.com/assets/2008/4/17/andy_mia2_small.jpg" />
</p>
<p>
Mia is a healthy baby girl who regularly eats every 3 hours, around the clock. After 6 weeks we&#8217;re completely comfortable with the new schedule. <a href="http://www.railsguru.com/articles/2007/9/16/keeping-things-in-perspective">Andrew</a> loves his baby sister very much but still pokes here once in a while just to see what&#8217;s she&#8217;s made of <img src='http://www.railsguru.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
<p>
<img src="http://www.railsguru.com/assets/2008/4/17/andy_mia1_small.jpg" /></p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2008/04/17/a-baby-girl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>has_many_polymorphs tagging snafu</title>
		<link>http://www.railsguru.com/articles/2008/01/17/has_many_polymorphs-tagging-snafu/</link>
		<comments>http://www.railsguru.com/articles/2008/01/17/has_many_polymorphs-tagging-snafu/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 20:40:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[has_many_polymorphs]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/01/17/has_many_polymorphs-tagging-snafu</guid>
		<description><![CDATA[I&#8217;m working on a Rails 2.0.x project which is a port of a 1.2.x based one. Since acts_as_taggable was obsoleted in 2.0.x I&#8217;m using the ultra wicked has_many_polymorphs plugin which comes with a neat Tagging generator. I ran in a &#8230; <a href="http://www.railsguru.com/articles/2008/01/17/has_many_polymorphs-tagging-snafu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a Rails 2.0.x project which is a port of a 1.2.x based one. Since acts_as_taggable was obsoleted in 2.0.x I&#8217;m using the ultra wicked <strong>has_many_polymorphs</strong> plugin which comes with a neat Tagging generator. I ran in a bit of problem when I tried tagging an object with the tags &#8220;cool mac 2008&#8243;. It turned out the &#8220;2008&#8243; is the culprit since the tag_with method that&#8217;s introduced tries to be really smart about things. I.e. it assumes that if you pass a number in the tag_with string you actually want to use the Tag object with ID=2008. Of course we don&#8217;t have 2008 tags yet so it breaks down with an exception. The solution was really simple. Just remove the Fixnum check in the lib/lagging_extensions.rb ..</p>
<p>
P.S. Better late than never: <strong>Happy 2008!!!</strong></p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2008/01/17/has_many_polymorphs-tagging-snafu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby saves the day</title>
		<link>http://www.railsguru.com/articles/2007/11/29/jruby-saves-the-day/</link>
		<comments>http://www.railsguru.com/articles/2007/11/29/jruby-saves-the-day/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 11:19:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[jruby ruby drb java]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/09/24/jruby-saves-the-day</guid>
		<description><![CDATA[So I&#8217;m rewriting yet another subsystem which consists of a mismash of several languages and programmer ego&#8217;s (hardcore C being the largest one, aargh) to what else .. Ruby. Everythings going smoothly. Every line of Ruby code replaces about 10 &#8230; <a href="http://www.railsguru.com/articles/2007/11/29/jruby-saves-the-day/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
So I&#8217;m rewriting yet another subsystem which consists of a mismash of several languages and programmer ego&#8217;s (hardcore C being the largest one, aargh) to what else .. Ruby. Everythings going smoothly. Every line of Ruby code replaces about 10 lines of &#8220;put other language here&#8221; cruft. Life couldn&#8217;t be more beautiful. But then I hit the wall, the Java wall. Here I&#8217;m confronted with a full enterprisy Service Manager complete with dependencies on Java-only libs. Now what? I could rewrite the whole thing in Ruby. But then there would be 2 implementations of the same thing to maintain, not to mention reading through Java code, bad.</p>
<p>
Enter <strong>JRuby</strong>. Since the main code blob of this project is captured in a Mongrel plugin I thought about just deploying the whole of Mongrel on JRuby. Unfortunately JRuby Mongrel support was not there yet (<a href="http://mongrel.rubyforge.org/news.html" target="_blank">Mongrel 1.1</a> supports JRuby). So the next best thing was to build some kind bridge between JRuby and Ruby + Mongrel + Plugin. Distributed Ruby (DRb) is a perfect fit:
</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt>12<tt>
</tt>13<tt>
</tt>14<tt>
</tt>15<tt>
</tt>16<tt>
</tt>17<tt>
</tt>18<tt>
</tt>19<tt>
</tt><strong>20</strong><tt>
</tt>21<tt>
</tt>22<tt>
</tt>23<tt>
</tt>24<tt>
</tt>25<tt>
</tt>26<tt>
</tt>27<tt>
</tt>28<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="c">#</span><tt>
</tt><span class="c"># server.rb (this)</span><tt>
</tt><span class="c"># jars/big-bad-service.jar</span><tt>
</tt><span class="c">#</span><tt>
</tt><span class="co">APP_ROOT</span> = <span class="co">File</span>.join(<span class="co">File</span>.dirname(<span class="pc">__FILE__</span>), <span class="s"><span class="dl">'</span><span class="k">.</span><span class="dl">'</span></span>)<tt>
</tt><tt>
</tt>require <span class="s"><span class="dl">'</span><span class="k">java</span><span class="dl">'</span></span><tt>
</tt>require <span class="s"><span class="dl">'</span><span class="k">drb</span><span class="dl">'</span></span><tt>
</tt><tt>
</tt>require <span class="s"><span class="dl">&quot;</span><span class="il"><span class="dl">#{</span><span class="co">APP_ROOT</span><span class="dl">}</span></span><span class="k">/jars/big-bad-service.jar</span><span class="dl">&quot;</span></span><tt>
</tt><tt>
</tt><span class="co">BigBadService</span> = com.blah.<span class="co">BigBadService</span><tt>
</tt><tt>
</tt><span class="r">class</span> <span class="cl">JRubyServer</span><tt>
</tt>  <span class="r">def</span> <span class="fu">initialize</span><tt>
</tt>    <span class="iv">@bbs</span> = <span class="co">BigBadService</span>.new<tt>
</tt>    <span class="iv">@bbs</span>.initialize_service<tt>
</tt>  <span class="r">end</span><tt>
</tt><tt>
</tt>  <span class="r">def</span> <span class="fu">bbs_call</span>(param) <tt>
</tt>     <span class="iv">@bbs</span>.bbs_call(param)<tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span><tt>
</tt><tt>
</tt><span class="r">if</span> <span class="pc">__FILE__</span> == <span class="gv">$0</span><tt>
</tt>  <span class="co">DRb</span>.start_service <span class="s"><span class="dl">'</span><span class="k">druby://127.0.0.1:6666</span><span class="dl">'</span></span>, <span class="co">JRubyServer</span>.new<tt>
</tt>  <span class="co">DRb</span>.thread.join<tt>
</tt><span class="r">end</span></pre>
</td>
</tr>
</table>
<p>
Execute like <i>ruby server.rb</i>, and then you&#8217;ll have the server listening on port 6666 of localhost. Nice, we can now call our Java service from other Ruby code with this simple snippet:
</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">require <span class="s"><span class="dl">'</span><span class="k">drb</span><span class="dl">'</span></span><tt>
</tt><span class="co">DRb</span>.start_service<tt>
</tt><tt>
</tt>java_bbs = <span class="co">DRbObject</span>.new(<span class="pc">nil</span>, <span class="s"><span class="dl">'</span><span class="k">druby://127.0.0.1:6666</span><span class="dl">'</span></span>)<tt>
</tt><tt>
</tt>puts  java_bbs.bbs_call(<span class="s"><span class="dl">&quot;</span><span class="k">Whack!</span><span class="dl">&quot;</span></span>) <span class="c">#=&gt; &quot;Whacked!&quot;</span></pre>
</td>
</tr>
</table>
<p>
Kewl! Except for one big caveat. As of JRuby 1.0.x Java objects cannot be marshalled correctly so passing them to your Ruby code will cause all sorts of interesting hangs and crashes when you access them concurrently (see <a href="http://jira.codehaus.org/browse/JRUBY-1235" target="_blank">JRUBY-1235</a>). Untill JRuby 1.1 is out you can synchronize all your calls to JRuby and making sure you convert any results to proper Ruby objects before using them elsewhere in your Ruby code.
</p>
<p>
This hack saved me loads of (Java hacking) time!</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2007/11/29/jruby-saves-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GMail expanded</title>
		<link>http://www.railsguru.com/articles/2007/10/25/gmail-expanded/</link>
		<comments>http://www.railsguru.com/articles/2007/10/25/gmail-expanded/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 07:49:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[gmail]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2007/11/29/gmail-expanded</guid>
		<description><![CDATA[Today I noticed the following: GMail&#8217;s mailbox growth rate is still faster than my fill one, sweeeeeet!]]></description>
			<content:encoded><![CDATA[<p>Today I noticed the following:</p>
<p>
<img src="http://www.railsguru.com/assets/2007/10/25/gmail_4GB.png" />
</p>
<p>GMail&#8217;s mailbox growth rate is still faster than my fill one, sweeeeeet!</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2007/10/25/gmail-expanded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping things in perspective</title>
		<link>http://www.railsguru.com/articles/2007/09/16/keeping-things-in-perspective/</link>
		<comments>http://www.railsguru.com/articles/2007/09/16/keeping-things-in-perspective/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 22:21:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[programming life]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2007/09/28/keeping-things-in-perspective</guid>
		<description><![CDATA[Someone pointed out an article on How programming can ruin your life. I really enjoyed reading it and could definitely find myself in some (but not all) of the conclusions. The best remedy is IMHO replication. Nothing like your own &#8230; <a href="http://www.railsguru.com/articles/2007/09/16/keeping-things-in-perspective/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Someone pointed out an article on <a href="http://devizen.com/blog/2007/09/11/ruin/" target="_blank">How programming can ruin your life</a>. I really enjoyed reading it and could definitely find myself in some (but not all) of the conclusions. The best remedy is IMHO replication. Nothing like your own version 2.0 to keep things in perspective:</p>
<p>
<img src="http://www.railsguru.com/assets/2007/9/16/andrew_at_sjoerds.jpg" />
</p>
<p> <img src='http://www.railsguru.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2007/09/16/keeping-things-in-perspective/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>4 years in the making: SCO Group Files Chapter 11</title>
		<link>http://www.railsguru.com/articles/2007/09/14/4-years-in-the-making-sco-group-files-chapter-11/</link>
		<comments>http://www.railsguru.com/articles/2007/09/14/4-years-in-the-making-sco-group-files-chapter-11/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 21:11:00 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[sco leeches linux]]></category>

		<guid isPermaLink="false">http://www.railsguru.com/2008/01/13/4-years-in-the-making-sco-group-files-chapter-11</guid>
		<description><![CDATA[Not much to add, except mwuhaha.]]></description>
			<content:encoded><![CDATA[<p>Not much to add, except <a href="http://biz.yahoo.com/ap/070914/sco_group_bankruptcy.html?.v=2">mwuhaha</a>.</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-6322765154114793";
/* 300x250, created 7/3/11 */
google_ad_slot = "6228709946";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.railsguru.com/articles/2007/09/14/4-years-in-the-making-sco-group-files-chapter-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

