<?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>Serabe Reloaded &#187; jruby</title>
	<atom:link href="http://www.serabe.com/tag/jruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serabe.com</link>
	<description>Conecto ergo sum. Non conecto ergo urgueo.</description>
	<lastBuildDate>Sun, 09 Oct 2011 21:30:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Writing your own JRuby extension. Part II: Creating your first class.</title>
		<link>http://www.serabe.com/2010/03/12/writing-your-own-jruby-extension-part-ii-creating-your-first-class/</link>
		<comments>http://www.serabe.com/2010/03/12/writing-your-own-jruby-extension-part-ii-creating-your-first-class/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 23:06:04 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=481</guid>
		<description><![CDATA[What&#8217;s the point of coding a JRuby extension if you don&#8217;t create classes? Well, I cannot think of any case, but if you find one, please, let me know. Do you remember Java&#8217;s classes hierarchy? If so, you&#8217;ll realize  that Java objects inherit from java.lang.Object by default but that is not actually what we need. [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="nofollow" href="http://www.flickr.com/photos/53326337@N00/3783473433/" title="More Mormon Matryoshki"  target="_blank"><img class="alignright" style="border: 0px initial initial;" src="http://farm4.static.flickr.com/3057/3783473433_98d837343a_m.jpg" border="0" alt="3783473433 98d837343a m Writing your own JRuby extension. Part II: Creating your first class." width="240" height="143" title="Writing your own JRuby extension. Part II: Creating your first class." /></a><br />
What&#8217;s the point of coding a JRuby extension if you don&#8217;t create classes? Well, I cannot think of any case, but if you find one, please, let me know.</p>
<p>Do you remember Java&#8217;s classes hierarchy? If so, you&#8217;ll realize  that Java objects inherit from java.lang.Object by default but that is not actually what we need. But how can we tell JRuby that our object inherits from Object, the king of Ruby world? The answer is so simple: just extend RubyObject! (There is a RubyBasicObject too) Taken from Nokogiri::XML::Node:</p>
<p><script src="http://gist.github.com/281421.js"></script></p>
<p>Of course, you can extend any other class, as long as it is a &#8220;Ruby object&#8221;. For example, Nokogiri::XML::Document extends from Nokogiri::XML::Node, and we do not need to do anything special to reflect it, just extend XmlNode like XmlDocument does:</p>
<p><script src="http://gist.github.com/281426.js"></script></p>
<p>After talking a bit about hierarchy, let&#8217;s talk about Java constructors. At least two parameters are needed: a org.jruby.Ruby object and a org.jruby.RubyClass object. Being the importance of the former quite obvious, the reason for the latter may not be so clear. Let me show you some real world code: Nokogiri::XML::Node&#8217;s dup method. Take a look at the following test:</p>
<p><script src="http://gist.github.com/284316.js"></script></p>
<p>Both new and dup methods in subclass rely on Nokogiri::XML::Node&#8217;s. In <a href="http://github.com/tenderlove/nokogiri/blob/master/ext/nokogiri/xml_node.c#L281" >here</a>, you can see the this snippet of code:</p>
<p><script src="http://gist.github.com/284318.js"></script></p>
<p>The <code>rb_obj_class</code> method returns the class of an object, in this case, <em>self</em>. This way, the new node will be an instance of the same class as the original node. That&#8217;s the reason a RubyClass is needed in the constructor, in order to know which is the actual class being instantiated.</p>
<p>By the way, do not forget to call super with the Ruby and RubyClass objects.</p>
<p>Next step: creating methods.</p>
<p><a href="http://creativecommons.org/licenses/by-sa/2.0/" title="Attribution-ShareAlike License"  target="_blank"><img src="http://www.serabe.com/wp-content/plugins/photo-dropper/images/cc.png" border="0" alt="cc Writing your own JRuby extension. Part II: Creating your first class." width="16" height="16" align="absmiddle" title="Writing your own JRuby extension. Part II: Creating your first class." /></a> <a href="http://www.photodropper.com/photos/"  target="_blank">photo</a> credit: <a rel="nofollow" href="http://www.flickr.com/photos/53326337@N00/3783473433/" title="quinn.anya"  target="_blank">quinn.anya</a></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Writing your own JRuby extension. Part II: Creating your first class. on Serabe Reloaded',url: 'http://www.serabe.com/2010/03/12/writing-your-own-jruby-extension-part-ii-creating-your-first-class/',contentID: 'post-481',suggestTags: 'Java,jruby,programming,Ruby,tutorial',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Writing your own JRuby extension. Part II: Creating your first class." alt="article clipper Writing your own JRuby extension. Part II: Creating your first class." />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2010%2F03%2F12%2Fwriting-your-own-jruby-extension-part-ii-creating-your-first-class%2F&amp;title=Writing%20your%20own%20JRuby%20extension.%20Part%20II%3A%20Creating%20your%20first%20class." id="wpa2a_2"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Writing your own JRuby extension. Part II: Creating your first class."  title="Writing your own JRuby extension. Part II: Creating your first class." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/03/12/writing-your-own-jruby-extension-part-ii-creating-your-first-class/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing your own JRuby extension. First problem.</title>
		<link>http://www.serabe.com/2010/01/11/writing-your-own-jruby-extension-first-problem/</link>
		<comments>http://www.serabe.com/2010/01/11/writing-your-own-jruby-extension-first-problem/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 23:09:22 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[jruby extension tutorial]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=478</guid>
		<description><![CDATA[Maybe, when requiring your just created extension, you get a LoadError. If it is the first time you require it, it is quite likely that you have not followed JRuby requiring conventions. If you want to know how require works, you can find the best documentation ever about it in the comment before org.jruby.runtime.load.LoadService class. [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="nofollow" href="http://www.flickr.com/photos/99909414@N00/3981364314/" title="Denial"  target="_blank"><img class="alignleft" style="border: 0px initial initial;" src="http://farm3.static.flickr.com/2422/3981364314_d4b30cb739_m.jpg" border="0" alt="3981364314 d4b30cb739 m Writing your own JRuby extension. First problem." width="240" height="159" title="Writing your own JRuby extension. First problem." /></a><br />
Maybe, when requiring your just created extension, you get a LoadError. If it is the first time you require it, it is quite likely that you have not followed JRuby requiring conventions. If you want to know how require works, you can find the best documentation ever about it in the comment before <a href="http://github.com/jruby/jruby/blob/master/src/org/jruby/runtime/load/LoadService.java#L42" title="Github" >org.jruby.runtime.load.LoadService</a> class.</p>
<p><small><a href="http://creativecommons.org/licenses/by/2.0/" title="Attribution License"  target="_blank"><img src="http://www.serabe.com/wp-content/plugins/photo-dropper/images/cc.png" border="0" alt="cc Writing your own JRuby extension. First problem." width="16" height="16" align="absmiddle" title="Writing your own JRuby extension. First problem." /></a> <a href="http://www.photodropper.com/photos/"  target="_blank">photo</a> credit: <a rel="nofollow" href="http://www.flickr.com/photos/99909414@N00/3981364314/" title="cesarastudillo"  target="_blank">cesarastudillo</a></small></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Writing your own JRuby extension. First problem. on Serabe Reloaded',url: 'http://www.serabe.com/2010/01/11/writing-your-own-jruby-extension-first-problem/',contentID: 'post-478',suggestTags: 'Java,jruby,jruby extension tutorial,programming,Ruby',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Writing your own JRuby extension. First problem." alt="article clipper Writing your own JRuby extension. First problem." />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2010%2F01%2F11%2Fwriting-your-own-jruby-extension-first-problem%2F&amp;title=Writing%20your%20own%20JRuby%20extension.%20First%20problem." id="wpa2a_4"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Writing your own JRuby extension. First problem."  title="Writing your own JRuby extension. First problem." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/01/11/writing-your-own-jruby-extension-first-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing your own JRuby extension. Part I: BasicLibraryService.</title>
		<link>http://www.serabe.com/2010/01/08/writing-your-own-jruby-extension-part-i/</link>
		<comments>http://www.serabe.com/2010/01/08/writing-your-own-jruby-extension-part-i/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 00:22:44 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=445</guid>
		<description><![CDATA[Note: not code in this post, but you can see the code in Github. Follow the links! Writing a JRuby extension is very easy, but there are almost not post out there about it. As far as I know, there is only one, Ola&#8217;s. It is a really good tutorial indeed, but it lacks some [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note:</strong> not code in this post, but you can see the code in Github. Follow the links!</p>
<p>Writing a JRuby extension is very easy, but there are almost not post out there about it. As far as I know, there is only one, <a rel="nofollow" href="http://ola-bini.blogspot.com/2006/10/jruby-tutorial-4-writing-java.html" title="JRuby Tutorial 4. Ola Bini's blog." >Ola&#8217;s</a>. It is a really good tutorial indeed, but it lacks some details that might be not-that-easy to solve. Please, take some time to read it and, if some details are different, do follow Ola&#8217;s way.</p>
<p>Everything&#8217;s ready now, so let&#8217;s start talking about <a href="http://github.com/jruby/jruby/blob/master/src/org/jruby/runtime/load/BasicLibraryService.java" title="Github" >BasicLibraryService</a>. If you take a look at <a href="http://github.com/tenderlove/nokogiri/tree/java" title="Github repo" >Nokogiri4J sourcecode</a>, in <a href="http://github.com/tenderlove/nokogiri/tree/java/ext/java/nokogiri/" title="Github repo" >ext/java/nokogiri</a> folder, you will see a <a href="http://github.com/tenderlove/nokogiri/blob/java/ext/java/nokogiri/NokogiriService.java" title="Github repo" >NokogiriService.java</a> file. NokogiriService implements <a href="http://github.com/jruby/jruby/blob/master/src/org/jruby/runtime/load/BasicLibraryService.java" title="Github repo" >BasicLibraryService</a>. This interface consists only of the method basicLoad which receives a Ruby object.</p>
<p>We will use this method to define classes and methods in the Ruby world. For defining a module, defineModule method is used with the name of the module. After that, modules and classes under that module can be defined easily by using the methods defineModuleUnder, which takes the name as parameter, and defineClassUnder, which takes the name and few parameters more. Let&#8217;s dive into it.</p>
<p>defineClassUnder needs three arguments. The first one is the class&#8217; name. The second, is the parent class. If you have defined it previously, just passed it,  otherwise use RubyObject by calling the method getObject on the Ruby instance. The third parameter is an ObjectAllocator. ObjectAllocators returns intances of the classes in Java world. When instantiating Nokogiri::XML::Comment in Ruby world, JRuby will ask the ObjectAllocator for an instance of the Java class. It passes a Ruby object and the RubyClass being instantiated to the allocate method in the ObjectAllocator (more on RubyClass in following posts).</p>
<p>Finally, we will need to define some methods. Easiest way is by using the defineAnnotatedMethods. It takes a Java class as parameter. For knowing what this method does, you need to know a bit more about @JRubyMethod annotation (more on it in following post, have you realized the &#8220;Part I&#8221; in the title?). As you define methods, you may need to undefine some in a subclass. So easy! Use the undefineMethod method, which takes the name of the method as parameter (surprisingly, it undefines a method by redefining it!).</p>
<p>Next time, <a href="http://bit.ly/b5vZMp" >Implementing your first class</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Writing your own JRuby extension. Part I: BasicLibraryService. on Serabe Reloaded',url: 'http://www.serabe.com/2010/01/08/writing-your-own-jruby-extension-part-i/',contentID: 'post-445',suggestTags: 'extensions,jruby,programming,Ruby',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Writing your own JRuby extension. Part I: BasicLibraryService." alt="article clipper Writing your own JRuby extension. Part I: BasicLibraryService." />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2010%2F01%2F08%2Fwriting-your-own-jruby-extension-part-i%2F&amp;title=Writing%20your%20own%20JRuby%20extension.%20Part%20I%3A%20BasicLibraryService." id="wpa2a_6"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Writing your own JRuby extension. Part I: BasicLibraryService."  title="Writing your own JRuby extension. Part I: BasicLibraryService." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/01/08/writing-your-own-jruby-extension-part-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Helping Nokogiri. Take II</title>
		<link>http://www.serabe.com/2009/12/31/helping-nokogiri-take-ii/</link>
		<comments>http://www.serabe.com/2009/12/31/helping-nokogiri-take-ii/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 22:42:51 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[nokogiri]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=455</guid>
		<description><![CDATA[Nokogiri and Pizza, what else can you ask for? Ok. My fault. Now, let&#8217;s go get some work done. First, if you haven&#8217;t done it, read the previous post about helping nokogiri and forgot about the script and memory leak. It seems that there are more important issues, so let&#8217;s fix them first. First run [...]]]></description>
			<content:encoded><![CDATA[<div class="mceTemp">
<dl class="wp-caption alignright" style="width: 250px;">
<dt class="wp-caption-dt"><a rel="nofollow" href="http://www.flickr.com/photos/8168925@N02/4218563829/" title="PIZZA PRO 3000"  target="_blank"><img style="border: 0px initial initial;" title="Nokogiri and Pizza, what else can you ask for?" src="http://farm5.static.flickr.com/4040/4218563829_bf9f5519dd_m.jpg" border="0" alt="4218563829 bf9f5519dd m Helping Nokogiri. Take II" width="240" height="174" /></a></dt>
<dd class="wp-caption-dd">Nokogiri and Pizza, what else can you ask for?<a title="&lt;/dd"></a></dd>
</dl>
<p><a title="&lt;/dd"></a></p>
</div>
<p>Ok. My fault. Now, let&#8217;s go get some work done.</p>
<p>First, if you haven&#8217;t done it, read the <a href="http://www.serabe.com/2009/12/01/do-you-wanna-help-us-with-pure-java-nokogiri/" title="Do you wanna help us with pure-Java Nokogiri?" >previous post about helping nokogiri</a> and forgot about the script and memory leak. It seems that there are more important issues, so let&#8217;s fix them first. First run <code>jruby test/test_jruby.rb</code> from Nokogiri root. You&#8217;ll see a lot of errors (27 by now) and failures (14). Choose one, and get it green. After that, send me a pull request.</p>
<p>Ok. That sounds simple, but what if  the number of errors or failures raises? The rule I use is simple: keep the sum of both numbers going down and having a failure is better than having an error.</p>
<p>On the other hand, if you take a look at <a href="http://github.com/tenderlove/nokogiri/blob/java/test/test_jruby.rb" title="Github" >test/test_jruby.rb</a>, you&#8217;ll see that not every test is in there. There is a reason for that. Even keeping the number of test low, you get a lot of errors/failures. If that annoys me with just 50 failures, imagine if I had a couple of hundreds errors. When all is right, I&#8217;ll add some more to keep the fun on.</p>
<p>Photo by <a rel="nofollow" href="http://www.flickr.com/photos/unkiepaul/" title="Flickr" >Paul Johnston</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Helping Nokogiri. Take II on Serabe Reloaded',url: 'http://www.serabe.com/2009/12/31/helping-nokogiri-take-ii/',contentID: 'post-455',suggestTags: 'jruby,nokogiri',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Helping Nokogiri. Take II" alt="article clipper Helping Nokogiri. Take II" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2009%2F12%2F31%2Fhelping-nokogiri-take-ii%2F&amp;title=Helping%20Nokogiri.%20Take%20II" id="wpa2a_8"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Helping Nokogiri. Take II"  title="Helping Nokogiri. Take II" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/12/31/helping-nokogiri-take-ii/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Do you wanna help us with pure-Java Nokogiri?</title>
		<link>http://www.serabe.com/2009/12/01/do-you-wanna-help-us-with-pure-java-nokogiri/</link>
		<comments>http://www.serabe.com/2009/12/01/do-you-wanna-help-us-with-pure-java-nokogiri/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 22:07:39 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[nokogiri]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=449</guid>
		<description><![CDATA[First things first, if you wanna help, you&#8217;ll need to clone the git repo. Just: git clone git://github.com/tenderlove/nokogiri.git cd nokogiri git checkout --track -b java origin/java Install the dependencies. Just: rake install:deps Because it uses some native libraries, you&#8217;ll need to do that with MRI. Finally, you&#8217;ll need to generate some files, just run jruby [...]]]></description>
			<content:encoded><![CDATA[<p>First things first, if you wanna help, you&#8217;ll need to clone the git repo. Just:</p>
<p><code>git clone git://github.com/tenderlove/nokogiri.git</code><br />
<code>cd nokogiri</code><br />
<code>git checkout --track -b java origin/java</code></p>
<p>Install the dependencies. Just:</p>
<p><code>rake install:deps</code></p>
<p>Because it uses some native libraries, you&#8217;ll need to do that with MRI. Finally, you&#8217;ll need to generate some files, just run <code>jruby -S rake java:spec</code>. For having a hprof file, you&#8217;ll need to run <a href="http://gist.github.com/245784" >this script</a> with the following command:</p>
<p><code>jr -J-Xmx32m -J-XX:+HeapDumpOnOutOfMemoryError nokogiri_doc_frag.rb</code></p>
<p><em>-J-Xmx32m</em> limits the heap space to 32 Mb, and the other options makes the JVM to write a hprof file when a OutOfMemoryError is thrown. After that, you can inspect that file with the profiler you can find in NetBeans.</p>
<p>In next post, I&#8217;ll comment where I think the problem is.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Do you wanna help us with pure-Java Nokogiri? on Serabe Reloaded',url: 'http://www.serabe.com/2009/12/01/do-you-wanna-help-us-with-pure-java-nokogiri/',contentID: 'post-449',suggestTags: 'help,jruby,nokogiri',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Do you wanna help us with pure Java Nokogiri?" alt="article clipper Do you wanna help us with pure Java Nokogiri?" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2009%2F12%2F01%2Fdo-you-wanna-help-us-with-pure-java-nokogiri%2F&amp;title=Do%20you%20wanna%20help%20us%20with%20pure-Java%20Nokogiri%3F" id="wpa2a_10"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Do you wanna help us with pure Java Nokogiri?"  title="Do you wanna help us with pure Java Nokogiri?" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/12/01/do-you-wanna-help-us-with-pure-java-nokogiri/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Final Status Update (or How to get Nokogiri in JRuby without FFI)</title>
		<link>http://www.serabe.com/2009/08/26/final-status-update/</link>
		<comments>http://www.serabe.com/2009/08/26/final-status-update/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 17:59:41 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[nokogiri]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=433</guid>
		<description><![CDATA[Hi, all, sorry for the silence all these months, but I&#8217;ve been working hard on Nokogiri. First things first, it is not complete yet. Anyway, I&#8217;m gonna tell you how to build a gem and start working with it. photo credit: Matthew Byrne Clone the repo and checkout the java branch. git clone git://github.com/tenderlove/nokogiri.git git [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, all,</p>
<p>sorry for the silence all these months, but I&#8217;ve been working hard on Nokogiri. First things first, it is not complete yet. Anyway, I&#8217;m gonna tell you how to build a gem and start working with it.</p>
<p><a rel="nofollow" href="http://www.flickr.com/photos/58643664@N00/3848826571/" title="Wooden vice - sharpening saw"  target="_blank"><img src="http://farm3.static.flickr.com/2485/3848826571_e2da6c85ed_m.jpg" border="0" alt="3848826571 e2da6c85ed m Final Status Update (or How to get Nokogiri in JRuby without FFI)"  title="Final Status Update (or How to get Nokogiri in JRuby without FFI)" /></a><br />
<small><a href="http://creativecommons.org/licenses/by-nc/2.0/" title="Attribution-NonCommercial License"  target="_blank"><img src="http://www.serabe.com/wp-content/plugins/photo-dropper/images/cc.png" border="0" alt="cc Final Status Update (or How to get Nokogiri in JRuby without FFI)" width="16" height="16" align="absmiddle" title="Final Status Update (or How to get Nokogiri in JRuby without FFI)" /></a> <a href="http://www.photodropper.com/photos/"  target="_blank">photo</a> credit: <a rel="nofollow" href="http://www.flickr.com/photos/58643664@N00/3848826571/" title="Matthew Byrne"  target="_blank">Matthew Byrne</a></small></p>
<p>Clone the <a href="http://github.com/tenderlove/nokogiri/tree/master" >repo</a> and checkout the <em><a href="http://github.com/tenderlove/nokogiri/tree/java" >java</a></em> branch.<br />
<code><br />
git clone git://github.com/tenderlove/nokogiri.git<br />
git checkout --track -b java origin/java<br />
</code><br />
Next step: build the gem. As easy as <code>jruby -S rake java:gem</code>. Maybe, you need to install rexical and racc. <code>jruby -S rake install:deps</code> would do.</p>
<p>Finally, you have a gem in the <em>pkg</em> folder. Install it, and you&#8217;re done.</p>
<p>Updated: Take a look <a href="http://www.serabe.com/2009/12/01/do-you-wanna-help-us-with-pure-java-nokogiri/" >here</a> if you wanna help.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Final Status Update (or How to get Nokogiri in JRuby without FFI) on Serabe Reloaded',url: 'http://www.serabe.com/2009/08/26/final-status-update/',contentID: 'post-433',suggestTags: 'gem,jruby,nokogiri,xml',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Final Status Update (or How to get Nokogiri in JRuby without FFI)" alt="article clipper Final Status Update (or How to get Nokogiri in JRuby without FFI)" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2009%2F08%2F26%2Ffinal-status-update%2F&amp;title=Final%20Status%20Update%20%28or%20How%20to%20get%20Nokogiri%20in%20JRuby%20without%20FFI%29" id="wpa2a_12"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Final Status Update (or How to get Nokogiri in JRuby without FFI)"  title="Final Status Update (or How to get Nokogiri in JRuby without FFI)" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/08/26/final-status-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Status Update: RMagick4J, Nokogiri, ruby2java and a possible MagickWand4J</title>
		<link>http://www.serabe.com/2009/06/06/status-update-rmagick4j-nokogiri-ruby2java-and-a-possible-magickwand4j/</link>
		<comments>http://www.serabe.com/2009/06/06/status-update-rmagick4j-nokogiri-ruby2java-and-a-possible-magickwand4j/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 10:00:30 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[magickwand]]></category>
		<category><![CDATA[nokogiri]]></category>
		<category><![CDATA[rmagick4j]]></category>
		<category><![CDATA[ruby2java]]></category>
		<category><![CDATA[siesta]]></category>
		<category><![CDATA[status update]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=429</guid>
		<description><![CDATA[It&#8217;s been long time since last status update, but there are some things to tell, so here I am. Thankfully, this year I&#8217;m a GSoC student again (and my mentor is Tom too). The main part of my project would be porting Nokogiri to JRuby, so I haven&#8217;t code for RMagick for a while now. [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been long time since last <a href="http://www.serabe.com/2009/03/23/rmagick4j-037-happy-birthmonth-released/" >status update</a>, but there are some things to tell, so here I am.</p>
<p>Thankfully, this year I&#8217;m a GSoC student again (and my mentor is Tom too). The main part of my project would be porting Nokogiri to JRuby, so I haven&#8217;t code for RMagick for a while now.</p>
<p>Let&#8217;s start with the status update then.</p>
<p><strong>Nokogiri</strong></p>
<p>I&#8217;ve been working on Nokogiri for a while. I forked <a href="http://github.com/headius/nokogiri/tree/master" >Charles&#8217; repo</a> in Github, and I&#8217;ve implemented some cool features. For example, today I got my <a href="http://github.com/Serabe/nokogiri/commit/9634a4509ba77e6062c2bad5cfc742a557b46717" >XML::Reader implementation to pass all tests in test_reader.rb</a>. I hope I&#8217;ll be able to make a release this month (cross your fingers).</p>
<p>On the other hand, I got my <a href="http://github.com/tenderlove/nokogiri/commit/53a62edb8bf057b1a85e2af8462b01aa3fafee16" >first patch accepted in Nokogiri&#8217;s main repo</a>.</p>
<p><strong>RMagick4J</strong></p>
<p>Not to much work done here, sorry. I haven&#8217;t code anything for a while now. Migrating from mercurial to git is already planned, but before that I would like to do a few commits more. Anyway, I&#8217;m quite happy with this project. Some people are using it and <a href="http://kenai.com/jira/browse/RMAGICK4J-9" >reporting bugs</a> (in the end, those little things are all that matters). What else can I ask for?</p>
<p>Please, if you find a bug, report it <a href="http://kenai.com/jira/browse/RMAGICK4J" >here</a>.</p>
<p><strong>MagickWand</strong></p>
<p>Tim Hunter (creator of <a href="http://rmagick.rubyforge.org/" >RMagick</a>) released <a href="http://magickwand.rubyforge.org/" >MagickWand</a> recently. I&#8217;ve been considering porting it to JRuby too. I have to take a deeper look at the C code, but, by now, I think it could be a good way to lead RMagick4J development. If finally I port it, I will split <a href="http://kenai.com/projects/rmagick4j" >RMagick4J</a> in two projects (Magick4J and RMagick4J). This way, MagickWand4J and <a href="http://kenai.com/projects/rmagick4j" >RMagick4J</a> would share the same java codebase, as <a href="http://magickwand.rubyforge.org/" >MagickWand</a> and <a href="http://rmagick.rubyforge.org/" >RMagick</a> share <a href="http://www.imagemagick.org/script/index.php" >ImageMagick</a>.</p>
<p><strong>ruby2java</strong></p>
<p>Take a look <a href="http://kenai.com/projects/ruby2java/pages/Home" >here</a>. Awesome, isn&#8217;t it? And as soon as I have some time to work on it, <a href="http://kenai.com/projects/siesta" >siesta</a> will be out too&#8230;</p>
<p><strong>P.D.</strong> By the way, no more personal stuff in this blog. That stuff is now <a href="http://sergio.arbeo.net" >here</a>, and only in Spanish (sorry about that).</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Status Update: RMagick4J, Nokogiri, ruby2java and a possible MagickWand4J on Serabe Reloaded',url: 'http://www.serabe.com/2009/06/06/status-update-rmagick4j-nokogiri-ruby2java-and-a-possible-magickwand4j/',contentID: 'post-429',suggestTags: 'gsoc,jruby,magickwand,nokogiri,rmagick4j,ruby2java,siesta,status update',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Status Update: RMagick4J, Nokogiri, ruby2java and a possible MagickWand4J" alt="article clipper Status Update: RMagick4J, Nokogiri, ruby2java and a possible MagickWand4J" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2009%2F06%2F06%2Fstatus-update-rmagick4j-nokogiri-ruby2java-and-a-possible-magickwand4j%2F&amp;title=Status%20Update%3A%20RMagick4J%2C%20Nokogiri%2C%20ruby2java%20and%20a%20possible%20MagickWand4J" id="wpa2a_14"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Status Update: RMagick4J, Nokogiri, ruby2java and a possible MagickWand4J"  title="Status Update: RMagick4J, Nokogiri, ruby2java and a possible MagickWand4J" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/06/06/status-update-rmagick4j-nokogiri-ruby2java-and-a-possible-magickwand4j/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMagick4J 0.3.7 Happy Birthmonth released.</title>
		<link>http://www.serabe.com/2009/03/23/rmagick4j-037-happy-birthmonth-released/</link>
		<comments>http://www.serabe.com/2009/03/23/rmagick4j-037-happy-birthmonth-released/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 23:38:08 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[0.3.7]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[rmagick4j]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=413</guid>
		<description><![CDATA[RMagick4J 0.3.7 Happy Birthmonth has been released! RMagick is a Ruby binding to ImageMagick and GraphicsMagick. RMagick4J implements ImageMagick functionality and the C portions of RMagick for use with JRuby. Current stable version: 0.3.7 Project URL: http://kenai.com/projects/rmagick4j Installation: gem install rmagick4j New effects: Charcoal Edge Implode Negate Normalize Shade Solarize Wave (I think that&#8217;s all [...]]]></description>
			<content:encoded><![CDATA[<p>RMagick4J 0.3.7 Happy Birthmonth has been released!</p>
<p>RMagick is a Ruby binding to ImageMagick and GraphicsMagick. RMagick4J implements ImageMagick functionality and the C portions of RMagick for use with JRuby.</p>
<p>Current stable version: 0.3.7<br />
Project URL: <a href="http://kenai.com/projects/rmagick4j" >http://kenai.com/projects/rmagick4j</a><br />
Installation: gem install rmagick4j</p>
<p>New effects:</p>
<ul>
<li>Charcoal</li>
<li>Edge</li>
<li>Implode</li>
<li>Negate</li>
<li>Normalize</li>
<li>Shade</li>
<li>Solarize</li>
<li>Wave</li>
</ul>
<p>(I think that&#8217;s all that you need to use simple_captcha)</p>
<p>Major bugs resolved:</p>
<ul>
<li>blur_image produced different images from RMagick.</li>
<li>Draw#push and Draw#pop  didn&#8217;t work correctly in some cases.</li>
</ul>
<p>Furthermore, RMagick4J does not depend on jhlabs library anymore (the gem has lost some weight!).</p>
<p>Thanks to:</p>
<ul>
<li>Tim Hunter and the ImageMagick team (obviously).</li>
<li>JRuby community for its support.</li>
<li>Everyone that has reported a bug, ask for help in the #jruby channel or suggest a new library compatibility.</li>
</ul>
<p>Please try out your applications with rmagick4j and help us provide feedback (even birthmonth cake!).  It is our goal to make a fully-compatible implementation of RMagick4j in JRuby.</p>
<p>You have some image examples here: <a href="http://www.serabe.com/rmagick4j" >http://www.serabe.com/rmagick4j</a></p>
<p>This is a very special release, cause March is my birthmonth.</p>
<p>Happy Birthmonth to:</p>
<ul>
<li>SuperTaz</li>
<li>everyone else whose birthmonth is march</li>
<li>and me!</li>
</ul>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RMagick4J 0.3.7 Happy Birthmonth released. on Serabe Reloaded',url: 'http://www.serabe.com/2009/03/23/rmagick4j-037-happy-birthmonth-released/',contentID: 'post-413',suggestTags: '0.3.7,jruby,release,rmagick4j',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="RMagick4J 0.3.7 Happy Birthmonth released." alt="article clipper RMagick4J 0.3.7 Happy Birthmonth released." />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2009%2F03%2F23%2Frmagick4j-037-happy-birthmonth-released%2F&amp;title=RMagick4J%200.3.7%20Happy%20Birthmonth%20released." id="wpa2a_16"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 RMagick4J 0.3.7 Happy Birthmonth released."  title="RMagick4J 0.3.7 Happy Birthmonth released." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/03/23/rmagick4j-037-happy-birthmonth-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I like JRuby</title>
		<link>http://www.serabe.com/2008/11/07/why-i-like-jruby/</link>
		<comments>http://www.serabe.com/2008/11/07/why-i-like-jruby/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 16:47:22 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gruff]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[mri]]></category>
		<category><![CDATA[rmagick4j]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=275</guid>
		<description><![CDATA[Some days ago Tom forwarded me an email from Mikael Lammentausta. Mikael found an issue with rmagick4j. Using this Mikael's script PLAIN TEXT RUBY: require 'rubygems' require 'gruff' &#160; &#160; def basic_graph&#40;&#41; &#160; &#160; g = Gruff::Line.new &#160; &#160; g.theme = &#123; &#160; &#160; &#160; :colors =&#62; &#91;'#7F0099', '#2F85ED', '#2FED09','#EC962F'], &#160; &#160; &#160; :marker_color =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago <a href="http://www.bloglines.com/blog/ThomasEEnebo" title="Tom's blog" >Tom</a> forwarded me an email from <a rel="nofollow" href="http://blogger-mikael.blogspot.com/" title="Mikael's blog" >Mikael Lammentausta</a>. Mikael found an issue with rmagick4j. Using this Mikael's script</p>
<div class="igBar"><span id="lruby-5"><a href="#" onclick="javascript:showPlainTxt('ruby-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-5">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'rubygems'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'gruff'</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> basic_graph<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g = Gruff::Line.<span style="color:#9900CC;">new</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">theme</span> = <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :colors =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span>'<span style="color:#008000; font-style:italic;">#7F0099', '#2F85ED', '#2FED09','#EC962F'],</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :marker_color =&gt; '<span style="color:#008000; font-style:italic;">#aaa',</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; :background_colors =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span>'<span style="color:#008000; font-style:italic;">#E8E8E8','#B9FD6C']</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">hide_title</span> = <span style="color:#0000FF; font-weight:bold;">true</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">legend_font_size</span> = <span style="color:#006666;color:#800000;">12</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">marker_font_size</span> = <span style="color:#006666;color:#800000;">16</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">hide_dots</span> = <span style="color:#0000FF; font-weight:bold;">false</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> g</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> bmi<span style="color:#006600; font-weight:bold;">&#40;</span>params=<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g = basic_graph<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">y_axis_label</span> = 'BMI'</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; bmis = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;color:#800000;">24</span>.<span style="color:#006666;color:#800000;">3</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">9</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">7</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">7</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">6</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">9</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">6</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">7</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">4</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">4</span>, <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">4</span>, <span style="color:#006666;color:#800000;">22</span>.<span style="color:#006666;color:#800000;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">data</span><span style="color:#006600; font-weight:bold;">&#40;</span> 'BMI', bmis <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; g.<span style="color:#9900CC;">hide_legend</span> = <span style="color:#0000FF; font-weight:bold;">true</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> g</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">g=bmi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">g.<span style="color:#9900CC;">write</span> 'graph.<span style="color:#9900CC;">jpg</span>' </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You get two different outputs.</p>
<div id="attachment_276" class="wp-caption alignnone" style="width: 310px"><a href="http://www.serabe.com/wp-content/uploads/2008/11/graph.jpg" ><img src="http://www.serabe.com/wp-content/uploads/2008/11/graph-300x225.jpg" alt="graph 300x225 Why I like JRuby" title="MRI-generated graph" width="300" height="225" class="size-medium wp-image-276" /></a><p class="wp-caption-text">MRI-generated</p></div>
<div id="attachment_277" class="wp-caption alignnone" style="width: 310px"><a href="http://www.serabe.com/wp-content/uploads/2008/11/graph1.jpg" ><img src="http://www.serabe.com/wp-content/uploads/2008/11/graph1-300x225.jpg" alt="graph1 300x225 Why I like JRuby" title="JRuby-generated graph" width="300" height="225" class="size-medium wp-image-277" /></a><p class="wp-caption-text">JRuby</p></div>
<p>As you may see, the numbers are wrong in JRuby... or not.</p>
<p>Looking at gruff code, I saw the problem was in the label method.</p>
<div class="igBar"><span id="lruby-6"><a href="#" onclick="javascript:showPlainTxt('ruby-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-6">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> label<span style="color:#006600; font-weight:bold;">&#40;</span>value<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>@spread.<span style="color:#9900CC;">to_f</span> % @marker_count.<span style="color:#9900CC;">to_f</span> == <span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> || !@y_axis_increment.<span style="color:#0000FF; font-weight:bold;">nil</span>?</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> value.<span style="color:#9900CC;">to_i</span>.<span style="color:#9900CC;">to_s</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> @spread&gt; <span style="color:#006666;color:#800000;">10</span>.<span style="color:#006666;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">sprintf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">"%0i"</span>, value<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">elsif</span> @spread&gt;= <span style="color:#006666;color:#800000;">3</span>.<span style="color:#006666;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">sprintf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">"%0.2f"</span>, value<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; value.<span style="color:#9900CC;">to_s</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The problem can be found in line 10. With a right input, you can make</p>
<div class="igBar"><span id="lruby-7"><a href="#" onclick="javascript:showPlainTxt('ruby-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-7">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span>@spread.<span style="color:#9900CC;">to_f</span> % @marker_count.<span style="color:#9900CC;">to_f</span> == <span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> || !@y_axis_increment.<span style="color:#0000FF; font-weight:bold;">nil</span>? </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>false and have a @spread < 3.0. Then look at this code:</p>
<div class="igBar"><span id="lruby-8"><a href="#" onclick="javascript:showPlainTxt('ruby-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-8">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">i = <span style="color:#006666;color:#800000;">23</span>.<span style="color:#006666;color:#800000;">599999999999998</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> i </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>In JRuby, you get what you expect <em>23.599999999999998</em> but, in MRI, you get <em>23.6</em>. So, that was the problem. JRuby is more precise than MRI.</p>
<p>NOTE:<br />
<em>jruby 1.1.5 (ruby 1.8.6 patchlevel 114) (2008-11-03 rev 7996) [i386-java]</em><br />
<em>ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]</em></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Why I like JRuby on Serabe Reloaded',url: 'http://www.serabe.com/2008/11/07/why-i-like-jruby/',contentID: 'post-275',suggestTags: 'gruff,jruby,mri,rmagick4j',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Why I like JRuby" alt="article clipper Why I like JRuby" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F11%2F07%2Fwhy-i-like-jruby%2F&amp;title=Why%20I%20like%20JRuby" id="wpa2a_18"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Why I like JRuby"  title="Why I like JRuby" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/11/07/why-i-like-jruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMagick4J 0.3.6</title>
		<link>http://www.serabe.com/2008/08/16/rmagick4j-036/</link>
		<comments>http://www.serabe.com/2008/08/16/rmagick4j-036/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 23:03:38 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[rmagick4j]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=228</guid>
		<description><![CDATA[I am glad to announce a new version of rmagick4j. RMagick4J aims to implement the ImageMagick funcionality and the C portions of RMagick for make it works in JRuby. Current stable version: 0.3.6 Project URL: http://code.google.com/p/rmagick4j/ Installation: gem install rmagick4j Google Summer of Code project should be thanked for making this new release possible. In [...]]]></description>
			<content:encoded><![CDATA[<p>I am glad to announce a new version of rmagick4j.</p>
<p>RMagick4J aims to implement the ImageMagick funcionality and the C<br />
portions of RMagick for make it works in JRuby.</p>
<p>Current stable version: 0.3.6<br />
Project URL: <a rel="nofollow" href="http://code.google.com/p/rmagick4j/" >http://code.google.com/p/rmagick4j/</a><br />
Installation: <code>gem install rmagick4j</code></p>
<p>Google Summer of Code project should be thanked for making this new<br />
release possible.</p>
<p>In release 0.3.6 you can find the next improvements:</p>
<ul>
<li>More Draw primitives (clip-path [creatin a clip-path and using a<br />
clip-path], fill-rule, rotate, scale [reimplemented], skewX, slewY,<br />
stroke-linecap, stroke-linejoin, stroke-miterlimit, translate).</li>
<li>Solve a bug with transparent stroke and line primitive.</li>
<li> Added the following Draw instance methods:</li>
<ul>
<li>annotate</li>
<li>get_multiline_type_metrics</li>
</ul>
<li>Solved a bug that caused the background become black while resizing<br />
images with alpha channel.</li>
</ul>
<p>Please try out your applications with rmagick4j and help us provide<br />
feedback.  It is our goal to make a fully-compatible implementation of<br />
RMagick4j in JRuby.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RMagick4J 0.3.6 on Serabe Reloaded',url: 'http://www.serabe.com/2008/08/16/rmagick4j-036/',contentID: 'post-228',suggestTags: 'jruby,Programming,programming,rmagick,rmagick4j,Ruby',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="RMagick4J 0.3.6" alt="article clipper RMagick4J 0.3.6" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F08%2F16%2Frmagick4j-036%2F&amp;title=RMagick4J%200.3.6" id="wpa2a_20"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 RMagick4J 0.3.6"  title="RMagick4J 0.3.6" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/08/16/rmagick4j-036/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

