<?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; Java</title>
	<atom:link href="http://www.serabe.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serabe.com</link>
	<description>Conecto ergo sum. Non conecto ergo urgueo.</description>
	<lastBuildDate>Wed, 14 Jul 2010 18:12:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>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&#8217;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&#8217;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&#8217;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="EquationPoint type hierarchy" 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="EquationElement type hierarchy" 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="Screeenshot" 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>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></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>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="More Mormon Matryoshki" 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="Creative Commons License" 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>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></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[JRuby]]></category>
		<category><![CDATA[Java]]></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="Denial" 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="Creative Commons License" 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>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></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>Tweets del 29-02-2008</title>
		<link>http://www.serabe.com/2008/02/29/tweets-del-29-02-2008/</link>
		<comments>http://www.serabe.com/2008/02/29/tweets-del-29-02-2008/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 22:59:59 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[multithreading]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/02/29/tweets-del-29-02-2008/</guid>
		<description><![CDATA[Tutorial de Threads de Control http://www.programacion.net/java/tutorial/threads/ # Ventanas translÃºcidas y con forma en Java http://tinyurl.com/37aoqy #]]></description>
			<content:encoded><![CDATA[<ul>
<li>Tutorial de Threads de Control <a href="http://www.programacion.net/java/tutorial/threads/"  rel="nofollow">http://www.programacion.net/java/tutorial/threads/</a> <a href="http://twitter.com/Serabe/statuses/764845150" >#</a></li>
<li>Ventanas translÃºcidas y con forma en Java <a href="http://tinyurl.com/37aoqy"  rel="nofollow">http://tinyurl.com/37aoqy</a> <a href="http://twitter.com/Serabe/statuses/764846295" >#</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/02/29/tweets-del-29-02-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweets del 18-02-2008</title>
		<link>http://www.serabe.com/2008/02/18/tweets-del-18-02-2008/</link>
		<comments>http://www.serabe.com/2008/02/18/tweets-del-18-02-2008/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 21:59:59 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[junit4]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/02/18/tweets-del-18-02-2008/</guid>
		<description><![CDATA[JUnit 4.x en Eclipse http://www.vogella.de/articles/JUnit/article.html #]]></description>
			<content:encoded><![CDATA[<ul>
<li>JUnit 4.x en Eclipse <a href="http://www.vogella.de/articles/JUnit/article.html"  rel="nofollow">http://www.vogella.de/articles/JUnit/article.html</a> <a href="http://twitter.com/Serabe/statuses/727942692" >#</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/02/18/tweets-del-18-02-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
