<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>blog.</title>
	<atom:link href="http://fernandotakai.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://fernandotakai.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 22 Jul 2009 15:00:03 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='fernandotakai.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/4a13b6bcc1fcfa31e62f60f296615936?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>blog.</title>
		<link>http://fernandotakai.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://fernandotakai.wordpress.com/osd.xml" title="blog." />
		<item>
		<title>Developing The New Herd</title>
		<link>http://fernandotakai.wordpress.com/2009/07/22/developing-the-new-herd/</link>
		<comments>http://fernandotakai.wordpress.com/2009/07/22/developing-the-new-herd/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 14:37:33 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=55</guid>
		<description><![CDATA[As you may, or may not know, for the last week, i&#8217;ve being trying to develop a new version for The Herd &#8211; the Ubiquity command aggregator.
I took this decision because the actual version does not work at all &#8211;  mainly because we&#8217;re having too much problems with CouchDB (not that it&#8217;s a bad [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=55&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As you may, or may not know, for the last week, i&#8217;ve being trying to develop a <a href="http://bitbucket.org/fernandotakai/herd">new version for The Herd</a> &#8211; the Ubiquity command aggregator.</p>
<p>I took this decision because the actual version does not work at all &#8211;  mainly because we&#8217;re having too much problems with CouchDB (not that it&#8217;s a bad database, but our installation is behaving quite strangely).</p>
<p>The Herd today, is developed on top of <a href="http://www.djangoproject.com/">Django</a> &#8211; and after talking to <a href="http://www.toolness.com/wp/">Atul</a> about this, i decided to drop Django entirely and use <a href="http://webpy.org/">web.py</a>.</p>
<p>My main reasons are:</p>
<p>1. Django is a full stack framework that makes you use their templates+their apis+lot&#8217;s of things &#8211; and for Herd, we wanted to do something like a REST-server with a html+css+js frontend<br />
2. Django doesn&#8217;t have a good integration with schema-less databases (we *need* it for herd)</p>
<p>It uses <a href="http://webpy.org/">web.py</a>, <a href="http://www.mongodb.org/">MongoDB</a> (it&#8217;s a great schema-less database) and simplejson for the server and plain html+css+<a href="http://jquery.com/">jquery</a> for the front-end (that i really need to improve).</p>
<p>It&#8217;s been 9 days now, and the new version is quite usable &#8211; it already fetches/parsers the feeds.<br />
You can login (using openid) and comment on feeds (voting is almost complete too).</p>
<p>I hope i can &#8220;finish&#8221; it by the end of the week so i can really focus on the ui. (i will need some help on that).</p>
<p>Some screenshots:<br />
<a href="http://www.flickr.com/photos/37002549@N00/3746387336" title="View 'The New Herd' on Flickr.com"><img src="http://farm4.static.flickr.com/3485/3746387336_9d66974e0d.jpg" alt="The New Herd" border="0" width="500" height="313" align="left" /></a></p>
<p><a href="http://www.flickr.com/photos/37002549@N00/3746387106" title="View 'The New Herd' on Flickr.com"><img src="http://farm4.static.flickr.com/3484/3746387106_53d384cf2f.jpg" alt="The New Herd" border="0" width="500" height="290" align="left" /></a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=55&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2009/07/22/developing-the-new-herd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3485/3746387336_9d66974e0d.jpg" medium="image">
			<media:title type="html">The New Herd</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3484/3746387106_53d384cf2f.jpg" medium="image">
			<media:title type="html">The New Herd</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Oracle Coherence with Grails Part I</title>
		<link>http://fernandotakai.wordpress.com/2008/08/26/using-oracle-coherence-with-grails/</link>
		<comments>http://fernandotakai.wordpress.com/2008/08/26/using-oracle-coherence-with-grails/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 01:01:44 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[coherence]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=45</guid>
		<description><![CDATA[Where i work, each with we&#8217;re assigned to a different tasks. My tasks this week are: test Beehive Webservices (i&#8217;ll post about it later) and test Oracle Coherence and Terracota.
I decided to start with Coherence because it really called my attention &#8212; it&#8217;s a in-memory jcache compliant clustered cache. 
I started reading some docs about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=45&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Where i work, each with we&#8217;re assigned to a different tasks. My tasks this week are: test <a href="http://www.oracle.com/technology/products/beehive/index.html">Beehive</a> Webservices (i&#8217;ll post about it later) and test <a href="http://www.oracle.com/technology/products/coherence/coherencedatagrid/coherence_solutions.html">Oracle Coherence</a> and <a href="http://www.terracotta.org/confluence/display/orgsite/Home">Terracota</a>.</p>
<p>I decided to start with Coherence because it really called my attention &#8212; it&#8217;s a in-memory jcache compliant clustered cache. </p>
<p>I started reading some docs about it and discovered that it can act as an 2nd-level-cache to Hibernate, so why not give a try with grails?</p>
<p>Everything is quite easy:</p>
<p>First, you have to download coherence zip to your machine and extract it. You will have a dir structure like this:</p>
<p><strong><br />
coherence<br />
|&#8211; bin<br />
|&#8211; doc<br />
|&#8211; examples<br />
`&#8211; lib<br />
</strong></p>
<p>To start an Coherence console, just type bin/coherence.sh (with your JAVA_HOME set). It&#8217;ll show a lot of output, but the main thing is:<br />
<code><br />
Services<br />
  (<br />
  TcpRing{TcpSocketAccepter{State=STATE_OPEN, ServerSocket=192.168.0.2:8088}, Connections=[]}<br />
  ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.3, OldestMemberId=1}<br />
  )</code></p>
<p>Here it shows the cluster nodes &#8212; Coherence will always search for nodes on your machine through network broadcasting. So, if you start another console (on another machine, or on the same, you decide) you&#8217;ll see:<br />
<code><br />
Services<br />
  (<br />
  TcpRing{TcpSocketAccepter{State=STATE_OPEN, ServerSocket=192.168.0.2:8089}, Connections=[]}<br />
  ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.3, OldestMemberId=1}<br />
  )</p>
<p>Map (?):<br />
2008-08-25 21:18:10.026 Oracle Coherence GE 3.3.1/389  (thread=TcpRingListener, member=2): TcpRing: connecting to member 1 using TcpSocket{State=STATE_OPEN, Socket=Socket[addr=/192.168.0.2,port=50602,localport=8089]}<br />
</code></p>
<p>Here Coherence shows that it recognized the other node you started. (BTW on the other console you&#8217;ll see a message like this too)</p>
<p>If you type who on any console, coherence will tell you how many machines are on the cluster and who are them:<br />
<code><br />
MasterMemberSet<br />
  (<br />
  ThisMember=Member(Id=2, Timestamp=2008-08-25 21:18:08.241, Address=192.168.0.2:8089, MachineId=26626, Location=process:30900@rome)<br />
  OldestMember=Member(Id=1, Timestamp=2008-08-25 21:16:35.527, Address=192.168.0.2:8088, MachineId=26626, Location=process:30378@rome)<br />
  ActualMemberSet=MemberSet(Size=2, BitSetCount=2<br />
    Member(Id=1, Timestamp=2008-08-25 21:16:35.527, Address=192.168.0.2:8088, MachineId=26626, Location=process:30378@rome)<br />
    Member(Id=2, Timestamp=2008-08-25 21:18:08.241, Address=192.168.0.2:8089, MachineId=26626, Location=process:30900@rome)<br />
    )</code></p>
<p>Now let&#8217;s start with the funny part (playing w/ Grails!)</p>
<p>First, you have to put coherence jars on your app &#8212; coherence.jar, tangosol.jar and coherence-hibernate.jar &#8212; this last one being the one with the 2nd level cache classes.</p>
<p>Then, put on your Datasource.groovy:</p>
<p><code><br />
hibernate {<br />
    cache.use_second_level_cache=true<br />
    cache.use_query_cache=true<br />
<strong>cache.provider_class='com.tangosol.coherence.hibernate.CoherenceCacheProvider'</strong><br />
    show_sql = true<br />
}<br />
</code></p>
<p>The bold part is the main thing &#8212; is the hibernate&#8217;s 2nd level cache implementation. I recommend you to put the show_sql to true, just to see when a query hits the database.</p>
<p>Then create a file called hibernate-cache-config.xml (ok, the actual name doesn&#8217;t really matter&#8230;) and put the following content on it: http://pastebin.com/f7c883504<br />
This file contains the configuration on how the cache should be created, replicated and etc.</p>
<p>Now, put<br />
<code><br />
static mapping = {<br />
      cache true<br />
}<br />
</code></p>
<p>on the domain classes you want to cache. (this is important &#8212; and i didn&#8217;t know that, but thanks to Les Hazlewood&#8217;s explanation on <a href="http://www.nabble.com/forum/ViewPost.jtp?post=19089611&amp;framed=y">this thread</a> i know why i need it)</p>
<p>Now, let&#8217;s test it!</p>
<p>Fire-up a grails console instance with the following command:<br />
<code><br />
grails -Dtangosol.coherence.cacheconfig=./hibernate-cache-config.xml -Dtangosol.coherence.hibernate.cacheconfig=./hibernate-cache-config.xml console<br />
</code></p>
<p>With this command you set two system variables (coherence uses them) that point to the file we created later.</p>
<p>After typing enter (duh!) you will see a lot of messages about coherence (just like the ones you saw when starting the console) (note: i recommend you not to have any other instance of coherence running when doing these tests). When the coherence finally started, save some instances of your domain class(ess) &#8212; i.e.:</p>
<p><code>import com.tangosol.net.CacheFactory</p>
<p>(1..25).each { new Author(firstName:"${it}", lastName:"${it}", birthday:new Date()-1).save() }</p>
<p></code></p>
<p>Then run this code on the same console (assuming your domain class is called Author):</p>
<p><code><br />
import com.tangosol.net.CacheFactory</p>
<p>cache = CacheFactory.getCache(Author.class.name)</p>
<p>Author.get(1)<br />
Author.list()</p>
<p>println "Cache size: ${cache.size()}"<br />
println " ---- Cache Content ---- "<br />
cache.each {k,v -&gt;<br />
    println "Key: ${k} -- Value:${v}"<br />
}</p>
<p>return null<br />
</code></p>
<p>On my machine, i see this output:</p>
<p><code><br />
Hibernate: select author0_.id as id1_0_, author0_.version as version1_0_, author0_.birthday as birthday1_0_, author0_.first_name as first4_1_0_, author0_.last_name as last5_1_0_ from author author0_ where author0_.id=?<br />
Hibernate: select this_.id as id1_0_, this_.version as version1_0_, this_.birthday as birthday1_0_, this_.first_name as first4_1_0_, this_.last_name as last5_1_0_ from author this_<br />
Cache size: 25<br />
 ---- Cache Content ----<br />
Key: Author#1 -- Value:Item{version=0,freshTimestamp=1219712346919<br />
Key: Author#2 -- Value:Item{version=0,freshTimestamp=1219712346928<br />
Key: Author#3 -- Value:Item{version=0,freshTimestamp=1219712346929<br />
Key: Author#4 -- Value:Item{version=0,freshTimestamp=1219712346930<br />
Key: Author#5 -- Value:Item{version=0,freshTimestamp=1219712346931<br />
Key: Author#6 -- Value:Item{version=0,freshTimestamp=1219712346933<br />
Key: Author#7 -- Value:Item{version=0,freshTimestamp=1219712346934<br />
Key: Author#8 -- Value:Item{version=0,freshTimestamp=1219712346935<br />
Key: Author#9 -- Value:Item{version=0,freshTimestamp=1219712346936<br />
Key: Author#10 -- Value:Item{version=0,freshTimestamp=1219712346938<br />
Key: Author#11 -- Value:Item{version=0,freshTimestamp=1219712346939<br />
Key: Author#12 -- Value:Item{version=0,freshTimestamp=1219712346944<br />
Key: Author#13 -- Value:Item{version=0,freshTimestamp=1219712346945<br />
Key: Author#14 -- Value:Item{version=0,freshTimestamp=1219712346947<br />
Key: Author#15 -- Value:Item{version=0,freshTimestamp=1219712346948<br />
Key: Author#16 -- Value:Item{version=0,freshTimestamp=1219712346949<br />
Key: Author#17 -- Value:Item{version=0,freshTimestamp=1219712346951<br />
Key: Author#18 -- Value:Item{version=0,freshTimestamp=1219712346952<br />
Key: Author#19 -- Value:Item{version=0,freshTimestamp=1219712346955<br />
Key: Author#20 -- Value:Item{version=0,freshTimestamp=1219712346956<br />
Key: Author#21 -- Value:Item{version=0,freshTimestamp=1219712346957<br />
Key: Author#22 -- Value:Item{version=0,freshTimestamp=1219712346960<br />
Key: Author#23 -- Value:Item{version=0,freshTimestamp=1219712346961<br />
Key: Author#24 -- Value:Item{version=0,freshTimestamp=1219712346962<br />
Key: Author#25 -- Value:Item{version=0,freshTimestamp=1219712346963<br />
</code></p>
<p>What this means is that we have all 25 objects on cache! Uhuu!</p>
<p>On the next post&#8230;.<br />
- Add this to a real web-app<br />
- Create a web interface to show what objects we have on cache and clean it</p>
<p>See you next time.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=45&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/08/26/using-oracle-coherence-with-grails/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>Auto Increment On A Oracle DB</title>
		<link>http://fernandotakai.wordpress.com/2008/08/07/auto-increment-on-a-oracle-db/</link>
		<comments>http://fernandotakai.wordpress.com/2008/08/07/auto-increment-on-a-oracle-db/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 17:51:27 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=37</guid>
		<description><![CDATA[This week i have a task: explore JHeadstart &#8212; Easy &#8212; specially if you follow their (uncommented) tutorial. But, when you start to build your own app, things start to get a little confusing (and, difficult) &#8212; specially because, by default, the framework creates screens with ids (the user can input whichever id they want) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=37&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This week i have a task: explore <a href="http://www.oracle.com/technology/products/jheadstart/index.html">JHeadstart</a> &#8212; Easy &#8212; specially if you follow their (uncommented) <a href="http://www.oracle.com/technology/products/jdev/tips/muench/jhstutorial/index.html">tutorial</a>. But, when you start to build your own app, things start to get a little confusing (and, difficult) &#8212; specially because, by default, the framework creates screens with ids (the user can input whichever id they want) and this is not the right thing on a real-world-app. Ok, but if the user is not going to input the id, we have to create an auto-increment on the column.</p>
<p>Easy. Just put the auto_increment on the column&#8230;. No, not.<br />
On Oracle DBs, different of MySQL, you cannot set an column to auto_increment, and it&#8217;s not easy to discover how to do it (if you don&#8217;t have an oracle dba in the house).</p>
<p>So, <s>god</s> google showed me a <a href="http://jen.fluxcapacitor.net/geek/autoincr.html">link </a> telling me how to do it. If you don&#8217;t want to click on the link, i&#8217;ll show it for you here.</p>
<p>First, you need to create an sequence &#8212; the sequence is the &#8216;auto-increment-thing&#8217;, the one that&#8217;ll give to you the numbers.</p>
<p><code><br />
create sequence funcs_id_seq<br />
start with 1<br />
increment by 1<br />
nomaxvalue;<br />
</code></p>
<p>Then, you will have to create a trigger, that&#8217;ll be triggered when you insert an new row into the table:</p>
<p><code><br />
create trigger func_id_trigger<br />
before insert on functionaries<br />
for each row<br />
begin<br />
select funcs_id_seq.nextval into :new.id from dual;<br />
end;<br />
/<br />
</code></p>
<p>Then, just to an normal insert into your table (w/o the id, of course) and the id will be setted!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=37&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/08/07/auto-increment-on-a-oracle-db/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>Grails Auto Complete</title>
		<link>http://fernandotakai.wordpress.com/2008/08/05/grails-auto-complete/</link>
		<comments>http://fernandotakai.wordpress.com/2008/08/05/grails-auto-complete/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 12:29:32 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=34</guid>
		<description><![CDATA[Yesterday i finished my script for command completion on grails. It&#8217;s quite complete right now (not perfect, but almost complete).
I thought it would be more difficult to do it, but thanks to tutorials (here and here) and the other script for completion, it was quite easy.
The whole script (along with the installation and how-to-use-it can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=34&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Yesterday i finished my script for command completion on grails. It&#8217;s quite complete right now (not perfect, but almost complete).<br />
I thought it would be more difficult to do it, but thanks to tutorials (<a href="http://www.debian-administration.org/articles/316">here</a> and <a href="http://www.debian-administration.org/articles/317">here</a>) and the <a href="http://naleid.com/blog/2008/03/25/autocomplete-grails-script-names-in-bashzsh/">other script</a> for completion, it was quite easy.</p>
<p>The whole script (along with the installation and how-to-use-it can be found here: http://www.grails.org/Grails+Bash+Completion+Script</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=34&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/08/05/grails-auto-complete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>Ajude a sustentar a Wikipédia e outros projetos, sem colocar a mão no bolso, e concorra a um Eee PC!</title>
		<link>http://fernandotakai.wordpress.com/2008/06/25/promocao-ajude-a-wikipedia-e-outros-projetos/</link>
		<comments>http://fernandotakai.wordpress.com/2008/06/25/promocao-ajude-a-wikipedia-e-outros-projetos/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 11:35:03 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[promocao]]></category>
		<category><![CDATA[wikipedia]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=29</guid>
		<description><![CDATA[…e também a pen drives, card drives, camisetas geeks, livros e mais! O BR-Linux e o Efetividade lançaram uma campanha para ajudar a Wikimedia Foundation e outros mantenedores de projetos que usamos no dia-a-dia on-line. Se você puder doar diretamente, ou contribuir de outra forma, são sempre melhores opções. Mas se não puder, veja as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=29&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>…e também a pen drives, card drives, camisetas geeks, livros e mais! O <a href="http://br-linux.org/">BR-Linux</a> e o <a href="http://efetividade.net/">Efetividade</a> lançaram uma <a href="http://br-linux.org/2008/campanha-wikipedia/">campanha</a> para ajudar a Wikimedia Foundation e outros mantenedores de projetos que usamos no dia-a-dia on-line. Se você puder doar diretamente, ou contribuir de outra forma, são sempre melhores opções. Mas se não puder, veja as regras da promoção e <a href="http://br-linux.org/2008/campanha-wikipedia/">participe</a> &#8211; quanto mais divulgação, maior será a doação do BR-Linux e do Efetividade, e você ainda concorre a diversos brindes!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=29&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/06/25/promocao-ajude-a-wikipedia-e-outros-projetos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding Autocomplete to a Python Console</title>
		<link>http://fernandotakai.wordpress.com/2008/06/17/adding-autocomplete-to-a-python-console/</link>
		<comments>http://fernandotakai.wordpress.com/2008/06/17/adding-autocomplete-to-a-python-console/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 19:47:22 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=25</guid>
		<description><![CDATA[I really love python. It&#8217;s a great language (fyi it&#8217;s one of the languages that google uses &#8212; they are java, python, c and c++) and has a powerful console.
But, it misses an great point: autocomplete. (A think that ruby&#8217;s console has)
So, searching on the internet i found this site that show how to do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=25&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I really love python. It&#8217;s a great language (fyi it&#8217;s one of the languages that google uses &#8212; they are java, python, c and c++) and has a powerful console.<br />
But, it misses an great point: autocomplete. (A think that ruby&#8217;s console has)</p>
<p>So, searching on the internet i found <a href='http://www.razorvine.net/frog/user/irmen/article/2004-11-22/17'>this</a> site that show how to do it:</p>
<p>First, create a new environment variable called PYTHONSTARTUP pointing to a file &#8220;$HOME/.pystartup&#8221; &#8212; you can do that using the command <i>export PYTHONSTARTUP=&#8221;$HOME/.pystartup</i>. (You can add the command to your .bashrc, so you don&#8217;t need to type everytime you startup a console)</p>
<p>Then you create the file .pystartup and add the same content to it:</p>
<pre>
# Add auto-completion and a stored history file of commands to your Python
# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
# bound to the Esc key by default (you can change it - see readline docs).
#
# Store the file in ~/.pystartup, and set an environment variable to point
# to it, e.g. "export PYTHONSTARTUP=/max/home/itamar/.pystartup" in bash.
#
# Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
# full path to your home directory.

import atexit
import os
import readline
import rlcompleter

historyPath = os.path.expanduser("~/.pyhistory")
historyTmp = os.path.expanduser("~/.pyhisttmp.py")

endMarkerStr= "# # # histDUMP # # #"

saveMacro= "import readline; readline.write_history_file('"+historyTmp+"'); \
    print '####&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;'; print ''.join(filter(lambda lineP: \
    not lineP.strip().endswith('"+endMarkerStr+"'),  \
    open('"+historyTmp+"').readlines())[:])+'####&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;'"+endMarkerStr

readline.parse_and_bind('tab: complete')
readline.parse_and_bind('\C-w: "'+saveMacro+'"')

def save_history(historyPath=historyPath, endMarkerStr=endMarkerStr):
    import readline
    readline.write_history_file(historyPath)
    # Now filter out those line containing the saveMacro
    lines= filter(lambda lineP, endMarkerStr=endMarkerStr:
                      not lineP.strip().endswith(endMarkerStr), open(historyPath).readlines())
    open(historyPath, 'w+').write(''.join(lines))

if os.path.exists(historyPath):
    readline.read_history_file(maxhistoryPath)

atexit.register(save_history)

del os, atexit, readline, rlcompleter, save_history, historyPath
del historyTmp, endMarkerStr, saveMacro
</pre>
<p>Now you can start your python console typing python (Duh!) and try to do some autocomplete like:<br />
a = &#8220;Fernando&#8221;<br />
a.<br />
a.is<br />
a.islo</p>
<p>Enjoy!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=25&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/06/17/adding-autocomplete-to-a-python-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>Why i like Groovy</title>
		<link>http://fernandotakai.wordpress.com/2008/06/16/why-i-like-groovy/</link>
		<comments>http://fernandotakai.wordpress.com/2008/06/16/why-i-like-groovy/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 12:02:10 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=24</guid>
		<description><![CDATA[This is why i like groovy. I follow an brazilian java list, and last week, a guy posted some logic exercices in java. One of them was:
Given an array of numbers, create a function that searches all instances of a given number an print the number of occurences of this number.
Another guy posted the answer [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=24&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is why i like groovy. I follow an brazilian java list, and last week, a guy posted some logic exercices in java. One of them was:</p>
<p>Given an array of numbers, create a function that searches all instances of a given number an print the number of occurences of this number.<br />
Another guy posted the answer in java:</p>
<pre><code>public class Modulo{
public static  int EncontraNumero(double[]  vetor, double  x, int count){
for (int i = 0; i &lt; vetor.length; i++) {
if (vetor[i]== x)
count++;//calcula quantas vezes apareceu no vetor

}
return count;
}
public static void main(String[] args) {

double[] vet={2.3,5.7,9.65,3.33,4.10,5.23, 12.5,  12.5};
System.out.println(EncontraNumero(vet, 12.5, 0));
}
}
</code></pre>
<p>I created the same thing with groovy:</p>
<pre><code>
numbers = [2.3,5.7,9.65,3.33,4.10,5.23, 12.5, 12.5]
println numbers.findAll {it == 12.5 }.size
</code></pre>
<p>15 lines in 2. Wonderful</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=24&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/06/16/why-i-like-groovy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>How to consume WebServices with Groovy</title>
		<link>http://fernandotakai.wordpress.com/2008/05/29/how-to-consume-webservices-with-groovy/</link>
		<comments>http://fernandotakai.wordpress.com/2008/05/29/how-to-consume-webservices-with-groovy/#comments</comments>
		<pubDate>Thu, 29 May 2008 02:28:16 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[webservices]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=23</guid>
		<description><![CDATA[Primeiro instale o sdk groovy na sua máquina, usando o tar (ou zip) fornecido em http://groovy.codehaus.org/Download e instale como descrito em http://groovy.codehaus.org/Tutorial+1+-+Getting+started.
Após estar tudo ok, você conseguirá abrir um console de linha de comando digitando groovysh ou um console gráfico digitando groovyConsole.
Para realmente comecar a consumir você deverá baixar um jar da página http://groovy.codehaus.org/GroovyWS [TODO: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=23&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Primeiro instale o sdk groovy na sua máquina, usando o tar (ou zip) fornecido em http://groovy.codehaus.org/Download e instale como descrito em http://groovy.codehaus.org/Tutorial+1+-+Getting+started.</p>
<p>Após estar tudo ok, você conseguirá abrir um console de linha de comando digitando <em>groovysh</em> ou um console gráfico digitando <em>groovyConsole</em>.</p>
<p>Para realmente comecar a consumir você deverá baixar um jar da página http://groovy.codehaus.org/GroovyWS [TODO: explicar para que servem cada jar] e coloca-lo em algum lugar do seu classpath. (que pode ser em $HOME/.groovy/lib &#8212; , em $GROOVY_HOME/lib)</p>
<p>Voce pode já comecar a consumir webservices em wsdl, mas o jeito mais facil de comecar a fazer testes é criar um servidor wsdl local &#8212; para faze-lo, comece criando uma<br />
classe de servico simples como essa:</p>
<p><span style="font-family:Courier New;">class SystemService {</span><br />
<span style="font-family:Courier New;"> String ifconfig(lan){</span><br />
<span style="font-family:Courier New;"> def interface_lan = (lan ? lan : &#8220;-a&#8221;)</span><br />
<span style="font-family:Courier New;"> &#8220;/sbin/ifconfig ${interface_lan}&#8221;.execute().text</span><br />
<span style="font-family:Courier New;"> }</span></p>
<p><span style="font-family:Courier New;"> String top(){</span><br />
<span style="font-family:Courier New;"> &#8220;top -bn1&#8243;.execute().text</span><br />
<span style="font-family:Courier New;"> }</span><br />
<span style="font-family:Courier New;">}</span></p>
<p>Essa é uma classe simples com dois metodos, que retornam os comandos top e ifconfig na máquina local.<br />
Para abrir seu servidor wsdl, simplesmente rode esse script no mesmo diretorio que voce criou a class SystemService:</p>
<p><span style="font-family:Courier New;">import groovyx.net.ws.WSServer</span></p>
<p><span style="font-family:Courier New;">def server = new WSServer()</span><br />
<span style="font-family:Courier New;">server.setNode(&#8220;SystemService&#8221;, &#8220;http://localhost:8888/SystemService&#8221;)</span></p>
<p>Pronto! Seu servidor já está rodando e voce pode acessar os seu wsdl pela url <a id="kgqq" title="http://localhost:8888/SystemService?wsdl" href="http://localhost:8888/SystemService?wsdl">http://localhost:8888/SystemService?wsdl</a></p>
<p>Para realmente ver a &#8220;mágica&#8221; groovy funcionar, abra um terminal digitando <em>groovysh</em> e digite os seguintes comandos:</p>
<p><span style="font-family:Courier New;">import groovyx.net.ws.WSClient</span><br />
<span style="font-family:Courier New;">proxy = new WSClient(&#8220;http://localhost:8888/SystemService?wsdl&#8221;, this.class.classLoader)</span><br />
<span style="font-family:Courier New;">proxy.top()</span><br />
<span style="font-family:Courier New;">proxy.ifconfig()</span><br />
<span style="font-family:Courier New;">proxy.ifconfig(&#8220;eth0&#8243;)</span></p>
<p>Essas linhas fazem exatamente:</p>
<ol>
<li>Importa a classe necessaria para utilizar o webservice</li>
<li>cria as classes proxy on-the-fly utilizando o wsdl</li>
<li>Invoca o metodo top da classe SystemService definida acima na máquina do webservice server</li>
<li>Faz a mesma coisa com o metodo ifconfig (tanto sem parametros, quanto passando uma interface</li>
</ol>
<p>A mesma coisa pode ser feita com outros webservices como <a id="bk4y" title="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" href="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL">http://www.webservicex.net/CurrencyConvertor.asmx?WSDL</a> que é um conversor de currency bem fiel.</p>
<p>(Nota:  para conseguir os códigos das moedas desse webservice, você terá que executar:<br />
<span style="font-family:Courier New;"><br />
symbols = Thread.currentThread().getContextClassLoader().loadClass(&#8220;net.webservicex.Currency&#8221;)</span><br />
<span style="font-family:Courier New;">c.values().each { println it }</span></p>
<p>Já que a classe Currency é uma enumeracao, logo não pode ser instanciada, e nem utilizada diretamente, já que todas as classes necessárias para o webservice ser consumido foram criadas em memória.)</p>
<p>(Nota 2: Caso você queira compilar seu webservice server, para que ela seja &#8220;portável&#8221;, utilize o comando: <em>groovyc SeuScriptWebService</em>. Para rodar a classe resultante, utilize <em>java -classpath /path/para/o/arquivo/groovy-all-1.5.5.jar:/path/para/o/arquivo/groovyws-standalone-0.3.1.jar:. SeuScriptWebServiceCompilado</em> )</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=23&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/05/29/how-to-consume-webservices-with-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>the Holy Grails!</title>
		<link>http://fernandotakai.wordpress.com/2008/04/22/the-holy-grails/</link>
		<comments>http://fernandotakai.wordpress.com/2008/04/22/the-holy-grails/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 22:29:31 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=22</guid>
		<description><![CDATA[What’s it?
Well, Grails is a web-framework based on a JVM (Java Virtual Machine, or just VM that’s how Jonathan Schwartz, Sun’s CEO is calling it) scripting language called Groovy.
Groovy?
I think is better to start explaning what’s Groovy.
Groovy is an scripting language that adds powerful additions to Java language like virtual methods, meta-programming, closures and lot [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=22&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>What’s it?</strong></p>
<p>Well, Grails is a web-framework based on a JVM (Java Virtual Machine, or just VM that’s how Jonathan Schwartz, Sun’s CEO is calling it) scripting language called Groovy.</p>
<p><strong>Groovy?</strong></p>
<p>I think is better to start explaning what’s Groovy.</p>
<p>Groovy is an scripting language that adds powerful additions to Java language like virtual methods, meta-programming, closures and lot more!</p>
<p><strong>Why Groovy?</strong></p>
<p>Well, Groovy is an excelent tool for Java programmers. Why have i said JAVA PROGRAMMERS and not just PROGRAMMERS?<br />
I know that you have already heard of Ruby (and Ruby on Rails), Python (and Turbo Gears/Django) or even Scala (and maybe Lift). They’re incredible powerful scripting languages, and their frameworks are as good as them.</p>
<p>But they’re not Java. Their syntax not even looks like Java.</p>
<p>Ok, they all have counterparts on (J)VM, but… it’s not the same as programming in our favorite language.</p>
<p>Well, now imagine all the power of those language in a Java syntax. That’s Groovy.</p>
<p>A class in Ruby looks like this:</p>
<p>class Person<br />
attr_reader :name, :address</p>
<p>def initialize name,address<br />
@name    = name<br />
@address = address<br />
end</p>
<p>def rent_a_new_house address<br />
@address = address if address<br />
end</p>
<p>def to_s<br />
“Name:#{@name} — Address: #{@address}”<br />
end</p>
<p>end</p>
<p>For an guy comming from Java, that’s hebraic.<br />
Now, if i say this’s a Groovy class:</p>
<p>class Person implements Comparable{<br />
String name<br />
String address</p>
<p>String toString(){<br />
“Name: ${this.name} — Address: ${this.address}”<br />
}</p>
<p>int compareTo(other){<br />
name?.compareTo(other?.name)<br />
}<br />
}<br />
<em><br />
</em>The same guy cannot say he cannot understand this.<br />
It’s Java.<br />
But it’s not.</p>
<p>It’s Groovy!</p>
<p>Groovy adds a thing to Java called code by convention, a thing that came a long time a go in a far language… (that, i have to be honest, i don’t remember the name)</p>
<p>If you look to that Person class, you will say:</p>
<p>Where are the privates?<br />
Where are the getters and setters?<br />
Where is the constructor?<br />
And WTF is that ToString?</p>
<p>Imagine something like that:</p>
<p>Everytime you create a class on your IDE of choice, you have to declare each attribute private, and them, see which one of them needs a getter or a setter. Then, you create a toString, and equals.</p>
<p>That’s boring, and still, you have to do it.</p>
<p>With Groovy’s coding by covention, to declare an private attribute along with its getter and setter all you have to say is: String name. or int age.</p>
<p>That’s it.</p>
<p>I know that there’re other things on that class that are not Java.<br />
I’ll explain those.</p>
<p>First, toString:</p>
<p>String toString(){<br />
“Name: ${this.name} — Address: ${this.address}”<br />
}</p>
<p>The first thing you will notice on that method is there’s no return statement.<br />
(The other thing is the ${} thing.)</p>
<p>On Groovy, as on another languages, you don’t have to explicitly say return name — all you have to do is add the thing you and to return as the last line of your method, i.e.:</p>
<p>def getName(){<br />
this.name //return name!<br />
}</p>
<p>The other thing, the ${} thing is called GString expression and it’s just like an JSP EL or and JSF EL. The variable name inside the curly brackets will be resolved and the string will be a lot prettier than something like:</p>
<p>“Name: ” + name + ” Address : ” + address</p>
<p>And with the benefit of calling methods insed the #{}!</p>
<p>There’s a lot more with Groovy. Too much, i think so from now, that’s it.<br />
For more info: <a href="http://groovy.codehaus.org/">http://groovy.codehaus.org/</a></p>
<p>Stay tuned!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=22&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/04/22/the-holy-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding Auto Complete to A Django-PyDev Project on Eclipse</title>
		<link>http://fernandotakai.wordpress.com/2008/04/22/adding-auto-complete-to-a-django-pydev-project-on-eclipse/</link>
		<comments>http://fernandotakai.wordpress.com/2008/04/22/adding-auto-complete-to-a-django-pydev-project-on-eclipse/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 02:15:38 +0000</pubDate>
		<dc:creator>Fernando Takai</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[pydev]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://fernandotakai.wordpress.com/?p=21</guid>
		<description><![CDATA[Today i was trying to use eclipse 3.3 w/ pydev to develop an app with django, but i really couldn&#8217;t make the code-completion (the main reason (along with the debugger) i was using eclipse!).
The main thing problem was that i had to add ALL folders to the pydev project settings. And, i didn&#8217;t have time [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=21&subd=fernandotakai&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today i was trying to use eclipse 3.3 w/ pydev to develop an app with django, but i really couldn&#8217;t make the code-completion (the main reason (along with the debugger) i was using eclipse!).</p>
<p>The main thing problem was that i had to add ALL folders to the pydev project settings. And, i didn&#8217;t have time (and patience) to add one folder by one to the config screen, sooo, i created this script to do that for me:</p>
<p>#!/usr/bin/env python</p>
<p>import dircache, os</p>
<p>def listdr(_dir):<br />
try:<br />
dir_list  = dircache.listdir(os.path.realpath(_dir))<br />
dir_list = [_dir + "/" + d for d in dir_list]<br />
only_dirs = filter(lambda d: os.path.isdir(d), dir_list)</p>
<p>file = os.path.realpath(_dir)<br />
print &#8220;&lt;path&gt;%s&lt;/path&gt;&#8221; % file</p>
<p>for dir in dir_list:<br />
listdr(dir)</p>
<p>except:<br />
return</p>
<p>if __name__ == &#8220;__main__&#8221;:<br />
listdr(&#8220;/usr/lib/python2.5/site-packages/django/&#8221;)</p>
<p>This script will show all folders under /usr/lib/python2.5/site-packages/django/ with that tags &lt;path&gt;, ready to add to the .pydevproject configuration file (that&#8217;s under your project file).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/fernandotakai.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/fernandotakai.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fernandotakai.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fernandotakai.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fernandotakai.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fernandotakai.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fernandotakai.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fernandotakai.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fernandotakai.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fernandotakai.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fernandotakai.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fernandotakai.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fernandotakai.wordpress.com&blog=2267008&post=21&subd=fernandotakai&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fernandotakai.wordpress.com/2008/04/22/adding-auto-complete-to-a-django-pydev-project-on-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/679bd5e3890ff5ac248f71911592e307?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Fernando Takai</media:title>
		</media:content>
	</item>
	</channel>
</rss>