<?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; General</title>
	<atom:link href="http://www.serabe.com/category/general/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>Tries: la pronunciación se deja como ejercicio para el lector.</title>
		<link>http://www.serabe.com/2011/04/28/tries-la-pronunciacion-se-deja-como-ejercicio-para-el-lector/</link>
		<comments>http://www.serabe.com/2011/04/28/tries-la-pronunciacion-se-deja-como-ejercicio-para-el-lector/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 19:00:30 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=582</guid>
		<description><![CDATA[El repositorio de github de trie. Tomad y usad todos de él. Para ver el artículo de succint trie, añadid en Google Reader el feed http://stevehanov.ca/blog/index.php?atom El artículo se llama &#8220;Succint Data Structures: Cramming 80,000 words into a Javascript file&#8220;. Próximamente la presentación en slideshare. Próximamente el vídeo. Cuando vea en qué formato sale lo de [...]]]></description>
			<content:encoded><![CDATA[<p>El repositorio de github de <a href="https://github.com/Serabe/trie" >trie</a>. Tomad y usad todos de él.</p>
<p>Para ver el artículo de succint trie, añadid en Google Reader el feed <code>http://stevehanov.ca/blog/index.php?atom</code> El artículo se llama &#8220;<em>Succint Data Structures: Cramming 80,000 words into a Javascript file</em>&#8220;.</p>
<p>Próximamente la presentación en slideshare.</p>
<p>Próximamente el vídeo.</p>
<p>Cuando vea en qué formato sale lo de OvationApp, lo subo también (y también próximamente)</p>
<p>&nbsp;</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Tries: la pronunciación se deja como ejercicio para el lector. on Serabe Reloaded',url: 'http://www.serabe.com/2011/04/28/tries-la-pronunciacion-se-deja-como-ejercicio-para-el-lector/',contentID: 'post-582',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Tries: la pronunciación se deja como ejercicio para el lector." alt="article clipper Tries: la pronunciación se deja como ejercicio para el lector." />
				</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%2F2011%2F04%2F28%2Ftries-la-pronunciacion-se-deja-como-ejercicio-para-el-lector%2F&amp;title=Tries%3A%20la%20pronunciaci%C3%B3n%20se%20deja%20como%20ejercicio%20para%20el%20lector." 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 Tries: la pronunciación se deja como ejercicio para el lector."  title="Tries: la pronunciación se deja como ejercicio para el lector." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2011/04/28/tries-la-pronunciacion-se-deja-como-ejercicio-para-el-lector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing rinzelight 0.0.2</title>
		<link>http://www.serabe.com/2010/10/17/introducing-rinzelight-0-0-2/</link>
		<comments>http://www.serabe.com/2010/10/17/introducing-rinzelight-0-0-2/#comments</comments>
		<pubDate>Sun, 17 Oct 2010 11:49:56 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[rinzelight]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=545</guid>
		<description><![CDATA[I started writing rinzelight long time ago. Exactly, I started on February. Sadly, since I wasn&#8217;t getting a few points about Clojure, I stopped working on it twenty days after for half a year. But do not let me digress. Rinzelight is finally released! Actually, rinzelight 0.0.2 is released! But let me introduce you to [...]]]></description>
			<content:encoded><![CDATA[<p>I started writing <a href="http://github.com/Serabe/rinzelight" >rinzelight</a> long time ago. Exactly, I started on February. Sadly, since I wasn't getting a few points about Clojure, I stopped working on it twenty days after for half a year.</p>
<p>But do not let me digress. Rinzelight is finally released! Actually, rinzelight 0.0.2 is released! But let me introduce you to rinzelight.</p>
<h3>Opening an image.</h3>
<p>Just use <code>rinzelight.image</code> namespace. Then, just provide <code>read-image</code> of a filepath or an InputStream. Just like this:</p>
<script><html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.0.4</center>
</body>
</html>
</script><div style='margin-bottom:1em;padding:0;'><noscript><code><pre style='overflow:auto;margin:0;padding:0;border:1px solid #DDD;'>&lt;html&gt;
&lt;head&gt;&lt;title&gt;301 Moved Permanently&lt;/title&gt;&lt;/head&gt;
&lt;body bgcolor=&quot;white&quot;&gt;
&lt;center&gt;&lt;h1&gt;301 Moved Permanently&lt;/h1&gt;&lt;/center&gt;
&lt;hr&gt;&lt;center&gt;nginx/1.0.4&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></code></noscript></div>
<h3>A hash?</h3>
<p>Yes. Four fields: image, format, width and height.</p>
<h3>It's an image. Let me see it!</h3>
<p>Command your repl to <code>display-image</code>.</p>
<h3>What about saving it?</h3>
<p>The correct spell is <code>write-image</code>. Just give it an image and an uri.</p>
<h3>I want to change an image's nature.</h3>
<p>If you want to, you can. Just look for namespaces under <code>rinzelight.effects</code>. Lookup tables and affine transforms are already available. There are even <code>map-image</code> and <code>map-pixel-location</code> functions. If you want to use <code>map-pixel-location</code>, take a look at <code>rinzelight.effects.helper-functions</code> for a helping hand.</p>
<h3>What about a few examples?</h3>
<p>I hide them under examples. They are a bit obfuscated using <code><a href="http://github.com/hugoduncan/criterium" >criterium</a></code> for benchmarking, but they are not hard to understand. For running them, use <code>lein run</code>. They'll take a bit, since I use them as benchmarks.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Introducing rinzelight 0.0.2 on Serabe Reloaded',url: 'http://www.serabe.com/2010/10/17/introducing-rinzelight-0-0-2/',contentID: 'post-545',suggestTags: 'clojure,rinzelight',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Introducing rinzelight 0.0.2" alt="article clipper Introducing rinzelight 0.0.2" />
				</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%2F10%2F17%2Fintroducing-rinzelight-0-0-2%2F&amp;title=Introducing%20rinzelight%200.0.2" 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 Introducing rinzelight 0.0.2"  title="Introducing rinzelight 0.0.2" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/10/17/introducing-rinzelight-0-0-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The One where I spent a morning because -0.5 turned to be parsed as 1/2</title>
		<link>http://www.serabe.com/2010/09/05/the-one-where-i-spent-a-morning-because-0-5-turned-to-be-parsed-as-12/</link>
		<comments>http://www.serabe.com/2010/09/05/the-one-where-i-spent-a-morning-because-0-5-turned-to-be-parsed-as-12/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 19:54:52 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[GeoGebra]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[geogebra]]></category>
		<category><![CDATA[jas]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=536</guid>
		<description><![CDATA[This summer, I have been doing some amazing stuff for GeoGebra. First of all, I would like to thank two people: Miguel, my mentor, who guided me through all that really advanced mathematical stuff; and Heinz Kredel, JAS creator and developer, who answered all my questions and implemented my suggestions as quickly as I could [...]]]></description>
			<content:encoded><![CDATA[<p>This summer, I have been doing some amazing stuff for GeoGebra. First of all, I would like to thank two people: Miguel, my mentor, who guided me through all that really advanced mathematical stuff; and Heinz Kredel, <a href="http://krum.rz.uni-mannheim.de/jas/" title="Java Algebraic System" >JAS</a> creator and developer, who answered all my questions and implemented my suggestions as quickly as I could write them.</p>
<p>This story is about a problem we found in JAS. It was really subtle, so I may need a brief introduction to the project I worked on: LocusEqu. That project retrieves the equation of "any" geometrical locus. If you don't know what a locus is, Wolfram Math World defines it as "<em>the set of all points (usually forming a curve or surface) satisfying some condition</em>" . LocusEqu generates a few EquationExpression, and then, by using a EquationTranslator, it generates a GenPolynomial&lt;BigRational&gt; object.</p>
<p>For translating doubles, it calls the BigRational constructor whose only argument is a String. This is the code:</p>
<p><script src="http://gist.github.com/566265.js"> </script></p>
<p>Can you spot the bug? Look at the 21st line. If <em>s</em> is "-0.5", then <em>n </em>is <strong>new BigInteger("-0")</strong>, and that's what makes "-0.5" be parsed as 1/2.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'The One where I spent a morning because -0.5 turned to be parsed as 1/2 on Serabe Reloaded',url: 'http://www.serabe.com/2010/09/05/the-one-where-i-spent-a-morning-because-0-5-turned-to-be-parsed-as-12/',contentID: 'post-536',suggestTags: 'bug,geogebra,jas,Java,programming',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="The One where I spent a morning because  0.5 turned to be parsed as 1/2" alt="article clipper The One where I spent a morning because  0.5 turned to be parsed as 1/2" />
				</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%2F09%2F05%2Fthe-one-where-i-spent-a-morning-because-0-5-turned-to-be-parsed-as-12%2F&amp;title=The%20One%20where%20I%20spent%20a%20morning%20because%20-0.5%20turned%20to%20be%20parsed%20as%201%2F2" 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 The One where I spent a morning because  0.5 turned to be parsed as 1/2"  title="The One where I spent a morning because  0.5 turned to be parsed as 1/2" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/09/05/the-one-where-i-spent-a-morning-because-0-5-turned-to-be-parsed-as-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Status update for GeoGebra.</title>
		<link>http://www.serabe.com/2010/07/12/status-update-for-geogebra/</link>
		<comments>http://www.serabe.com/2010/07/12/status-update-for-geogebra/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 20:41:04 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[GeoGebra]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[geogebra]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=522</guid>
		<description><![CDATA[My contributions for the first part of the first part of GSoC 2010 can be divided in two: general improvements and coding. General improvements I made a few general improvements on GeoGebra: Refactored build.dir in ant build file. Previously, build.dir wasn't in the root directory. A few ant tasks were added, such compile-grammar, compile-oe (outside [...]]]></description>
			<content:encoded><![CDATA[<p>My contributions for the first part of the first part of GSoC 2010 can be divided in two: general improvements and coding.</p>
<h3>General improvements</h3>
<p>I made a few general improvements on GeoGebra:</p>
<ol>
<li>Refactored build.dir in ant build file. Previously, build.dir wasn't in the root directory.</li>
<li>A few ant tasks were added, such compile-grammar, compile-oe (outside Eclipse), run-easyb and run-easyb-outside-eclipse.</li>
<li>SVN properties were set in order to work outside Eclipse. This way, .class files will be kept out of the repo without the intervention of any Eclipse plugin.</li>
<li>Easyb, a BDD groovy-based framework, has been included in order to test GeoGebra. It is not RSpec, but I guess it'll do.</li>
</ol>
<h3>Coding</h3>
<p>First, I started creating a few <strong>EquationPoint</strong> classes,  currently there are six <strong>EquationPoint </strong>children classes:</p>
<p><a href="http://www.serabe.com/wp-content/uploads/2010/07/Selección_003.png" ><img class="alignnone size-full wp-image-524" title="EquationPoint type hierarchy" src="http://www.serabe.com/wp-content/uploads/2010/07/Selección_003.png" alt="Selección 003 Status update for GeoGebra." width="384" height="254" /></a></p>
<ul>
<li><strong>EquationFreePoint</strong> represents an independent point.</li>
<li><strong>EquationSymbolicPoint</strong> represents a dependent point,  <strong>EquationSpecialSymbolicPoint</strong> standing only for the locus point.</li>
<li><strong>EquationNormalPoint</strong> and <strong>EquationPointVectorPoint</strong> are only auxiliar elements.</li>
</ul>
<p>Then, a few <strong>EquationElement</strong> classes were added, these stand for the different constructions:</p>
<p><a href="http://www.serabe.com/wp-content/uploads/2010/07/Selección_001.png" ><img class="alignnone size-full wp-image-525" title="EquationElement type hierarchy" src="http://www.serabe.com/wp-content/uploads/2010/07/Selección_001.png" alt="Selección 001 Status update for GeoGebra." width="384" height="364" /></a></p>
<p><strong>EquationElement</strong> is an abstract class containing a few basic methods:</p>
<ul>
<li><strong>forPoint</strong>: Given an EquationPoint, returns a String with the equation that means that the point is in the construction.</li>
<li><strong>isAlgebraic</strong>: returns true if the construction is algebraic, and false otherwise.</li>
</ul>
<p>Both <strong>EquationGenericCircle</strong> and <strong>EquationGenericLine</strong> are abstractions of specific line and circle contructions, all of them algebraic. <strong>EquationGenericSegment</strong> is to segment what <strong>EquationGenericLine</strong> is to lines. Obviously, <strong>EquationGenericSegment</strong> is not algebraic.</p>
<p>All of these classes are used together by<strong> EquationScope</strong>.</p>
<h3>A pause for a screenshot.</h3>
<p><a href="http://www.serabe.com/wp-content/uploads/2010/07/Selección_002_modificada.png" ><img title="Screenshot" src="http://www.serabe.com/wp-content/uploads/2010/07/Selección_002_modificada-300x132.png" alt="Selección 002 modificada 300x132 Status update for GeoGebra." width="300" height="132" /></a></p>
<p>Click for enlarge.</p>
<h3>A glimpse into the future.</h3>
<p>What to do next?:</p>
<ul>
<li><span style="text-decoration: line-through;">Maybe Equation should be a proper class, not just a String.</span></li>
<li>More equations.</li>
<li>Working out the locus equation.</li>
<li><span style="text-decoration: line-through;">Not using an algorithm twice.</span></li>
</ul>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Status update for GeoGebra. on Serabe Reloaded',url: 'http://www.serabe.com/2010/07/12/status-update-for-geogebra/',contentID: 'post-522',suggestTags: 'geogebra,gsoc,Java,programming',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Status update for GeoGebra." alt="article clipper Status update for GeoGebra." />
				</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%2F07%2F12%2Fstatus-update-for-geogebra%2F&amp;title=Status%20update%20for%20GeoGebra." 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 Status update for GeoGebra."  title="Status update for GeoGebra." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/07/12/status-update-for-geogebra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About WordPress automatic upgrade.</title>
		<link>http://www.serabe.com/2010/06/30/about-wordpress-automatic-upgrade/</link>
		<comments>http://www.serabe.com/2010/06/30/about-wordpress-automatic-upgrade/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 23:06:44 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=517</guid>
		<description><![CDATA[I'm stupid, and here is why: Long, long time ago,  when WordPress 2.7 was released I got excited about  the automatic upgrade feature. I never got to get it working, but I didn't care at all. I don't have that many plug-ins, and sometimes in a while, I just uploaded all the files via FTP. [...]]]></description>
			<content:encoded><![CDATA[<p>I'm stupid, and here is why:</p>
<p>Long, long time ago,  when WordPress 2.7 was released I got excited about  the automatic upgrade feature. I never got to get it working, but I didn't care at all. I don't have that many plug-ins, and sometimes in a while, I just uploaded all the files via FTP. But I moved sergio.arbeo.net to WordPress after 3.0 release and then I realize that it was working there!</p>
<p>Then, wondering why, found out <a href="http://paheli.net/blog/2009/07/22/solved-wordpress-automatic-upgrade-problem/" >this post</a> with its really easy solution: just add the following two lines to the WordPress .htaccess:</p>
<blockquote><p><code># Ensure PHP5 being used</p>
<p># For WordPress auto upgrade</p>
<p>AddType x-mapp-php5 .php</p>
<p>AddHandler x-mapp-php5 .php</p>
<p></code></p></blockquote>
<p>As I said, I'm stupid.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'About WordPress automatic upgrade. on Serabe Reloaded',url: 'http://www.serabe.com/2010/06/30/about-wordpress-automatic-upgrade/',contentID: 'post-517',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="About WordPress automatic upgrade." alt="article clipper About WordPress automatic upgrade." />
				</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%2F06%2F30%2Fabout-wordpress-automatic-upgrade%2F&amp;title=About%20WordPress%20automatic%20upgrade." 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 About WordPress automatic upgrade."  title="About WordPress automatic upgrade." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2010/06/30/about-wordpress-automatic-upgrade/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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's the point of coding a JRuby extension if you don't create classes? Well, I cannot think of any case, but if you find one, please, let me know. Do you remember Java's classes hierarchy? If so, you'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's the point of coding a JRuby extension if you don'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's classes hierarchy? If so, you'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 "Ruby object". 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'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'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'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'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_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 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>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'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'll need to do that with MRI. Finally, you'll need to generate some files, just run jruby [...]]]></description>
			<content:encoded><![CDATA[<p>First things first, if you wanna help, you'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'll need to do that with MRI. Finally, you'll need to generate some files, just run <code>jruby -S rake java:spec</code>. For having a hprof file, you'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'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_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 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>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's been long time since last status update, but there are some things to tell, so here I am. Thankfully, this year I'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't code for RMagick for a while now. [...]]]></description>
			<content:encoded><![CDATA[<p>It'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'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't code for RMagick for a while now.</p>
<p>Let's start with the status update then.</p>
<p><strong>Nokogiri</strong></p>
<p>I've been working on Nokogiri for a while. I forked <a href="http://github.com/headius/nokogiri/tree/master" >Charles' repo</a> in Github, and I'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'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's main repo</a>.</p>
<p><strong>RMagick4J</strong></p>
<p>Not to much work done here, sorry. I haven'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'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'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'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...</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_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 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>It&#8217;s all about expectations.</title>
		<link>http://www.serabe.com/2009/04/25/its-all-about-expectations/</link>
		<comments>http://www.serabe.com/2009/04/25/its-all-about-expectations/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 23:59:42 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Vi­deos]]></category>
		<category><![CDATA[expectation]]></category>
		<category><![CDATA[i do not like susan boyle]]></category>
		<category><![CDATA[susan boyle]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=416</guid>
		<description><![CDATA[Two days ago, I was talking about Susan Boyle with a friend. I do not like her, my friend didn't even know who she is. I told her about Susan, she has a good voice (not a great one) and she can sing pretty well. The only difference is that she is quite ugly (in [...]]]></description>
			<content:encoded><![CDATA[<p>Two days ago, I was talking about <a rel="nofollow" href="http://www.youtube.com/watch?v=9lp0IWv8QZY" title="Susan Boyle on YouTube" >Susan Boyle</a> with a friend. I do not like her, my friend didn't even know who she is. I told her about Susan, she has a good voice (not a great one) and she can sing pretty well. The only difference is that she is quite ugly (in Spanish I would say that she is uglier than hitting your own father with a sweaty sock). Her answer was pretty simple: It's all about expectations.</p>
<p>She said that by looking at her, my expectations were low, so when she sang even with a good-but-not-extraordinary-as-they-want-us-to-believe voice.</p>
<p>Other way of making things look better is the Bluetooth-Cooper theorem ("Averything is better with bluetooth"), in this case, with the Jackson-Vader corollary:<br />
<p><a href="http://www.serabe.com/2009/04/25/its-all-about-expectations/"><em>Aquí va un vídeo</em></a></p></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'It\&#039;s all about expectations. on Serabe Reloaded',url: 'http://www.serabe.com/2009/04/25/its-all-about-expectations/',contentID: 'post-416',suggestTags: 'expectation,i do not like susan boyle,susan boyle',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Its all about expectations." alt="article clipper Its all about expectations." />
				</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%2F04%2F25%2Fits-all-about-expectations%2F&amp;title=It%26%238217%3Bs%20all%20about%20expectations." 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 Its all about expectations."  title="Its all about expectations." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/04/25/its-all-about-expectations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMagick4J: Status Update 15/03/09</title>
		<link>http://www.serabe.com/2009/03/16/rmagick4j-status-update-150309/</link>
		<comments>http://www.serabe.com/2009/03/16/rmagick4j-status-update-150309/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 12:12:09 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=402</guid>
		<description><![CDATA[This week I've been fixing some bugs, adding some minor effects and adding wave effect. In order to add wave effect I've had to read a lot of ImageMagick code. Lucky me, there was an if that made all too much simpler. Unlucky me, I didn't realize until the third reading-code day. Anyway, after sweating [...]]]></description>
			<content:encoded><![CDATA[<p>This week I've been fixing some bugs, adding some minor effects and adding wave effect.<br />
In order to add wave effect I've had to read a lot of ImageMagick code. Lucky me, there was an if that made all too much simpler. Unlucky me, I didn't realize until the third reading-code day.<br />
Anyway, after sweating blood, here you are the images:</p>
<table>
<tr>
<td>RMagick</td>
<td>RMagick4J</td>
</tr>
<tr>
<td colspan="2">original</td>
</tr>
<tr>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/jruby.jpg" alt="jruby RMagick4J: Status Update 15/03/09" title="JRuby logo" width="150" height="148" class="alignnone size-full wp-image-394" /></td>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/jruby.jpg" alt="jruby RMagick4J: Status Update 15/03/09" title="JRuby logo" width="150" height="148" class="alignnone size-full wp-image-394" /></td>
</tr>
<tr>
<td colspan="2">charcoal 0.75</td>
</tr>
<tr>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/charcoalrmi.jpg" alt="charcoalrmi RMagick4J: Status Update 15/03/09" title="charcoal RMI" width="150" height="148" class="alignnone size-full wp-image-393" /></td>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/charcoaljruby.jpg" alt="charcoaljruby RMagick4J: Status Update 15/03/09" title="charcoal JRuby" width="150" height="148" class="alignnone size-full wp-image-392" /></td>
</tr>
<tr>
<td colspan="2">negate</td>
</tr>
<tr>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/negatermi.jpg" alt="negatermi RMagick4J: Status Update 15/03/09" title="negate RMI" width="150" height="148" class="alignnone size-full wp-image-396" /></td>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/negatejruby.jpg" alt="negatejruby RMagick4J: Status Update 15/03/09" title="negate JRuby" width="150" height="148" class="alignnone size-full wp-image-395" /></td>
</tr>
<tr>
<td colspan="2">normalize</td>
</tr>
<tr>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/normalizermi.jpg" alt="normalizermi RMagick4J: Status Update 15/03/09" title="normalize RMI" width="150" height="148" class="alignnone size-full wp-image-398" /></td>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/normalizejruby.jpg" alt="normalizejruby RMagick4J: Status Update 15/03/09" title="normalize JRuby" width="150" height="148" class="alignnone size-full wp-image-397" /></td>
</tr>
<tr>
<td colspan="2">blur_image 2</td>
</tr>
<tr>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/blurrmi.jpg" alt="blurrmi RMagick4J: Status Update 15/03/09" title="blur RMI" width="150" height="148" class="alignnone size-full wp-image-391" /></td>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/blurjruby.jpg" alt="blurjruby RMagick4J: Status Update 15/03/09" title="blur JRuby" width="150" height="148" class="alignnone size-full wp-image-390" /></td>
</tr>
<tr>
<td colspan="2">wave</td>
</tr>
<tr>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/wavermi.jpg" alt="wavermi RMagick4J: Status Update 15/03/09" title="wave RMI" width="150" height="198" class="alignnone size-full wp-image-401" /></td>
<td><img src="http://www.serabe.com/wp-content/uploads/2009/03/wavejruby.jpg" alt="wavejruby RMagick4J: Status Update 15/03/09" title="wave JRuby" width="150" height="198" class="alignnone size-full wp-image-400" /></td>
</tr>
</table>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'RMagick4J: Status Update 15/03/09 on Serabe Reloaded',url: 'http://www.serabe.com/2009/03/16/rmagick4j-status-update-150309/',contentID: 'post-402',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="RMagick4J: Status Update 15/03/09" alt="article clipper RMagick4J: Status Update 15/03/09" />
				</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%2F16%2Frmagick4j-status-update-150309%2F&amp;title=RMagick4J%3A%20Status%20Update%2015%2F03%2F09" 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: Status Update 15/03/09"  title="RMagick4J: Status Update 15/03/09" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2009/03/16/rmagick4j-status-update-150309/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

