<?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>My own tech words... &#187; Nenhuma</title>
	<atom:link href="http://blog.lucastex.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lucastex.com</link>
	<description></description>
	<lastBuildDate>Fri, 07 Jan 2011 12:43:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Blog paused</title>
		<link>http://blog.lucastex.com/2010/04/12/blog-paused/</link>
		<comments>http://blog.lucastex.com/2010/04/12/blog-paused/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 12:01:41 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=447</guid>
		<description><![CDATA[Hey all,
This blog will be &#8216;paused&#8217; for a while.
I&#8217;m running on some new apps for clients and this is taking my most time.
I&#8217;ll be back soon, thanks a lot, and keep on.
@lucastex
]]></description>
			<content:encoded><![CDATA[<p>Hey all,</p>
<p>This blog will be &#8216;paused&#8217; for a while.<br />
I&#8217;m running on some new apps for clients and this is taking my most time.</p>
<p>I&#8217;ll be back soon, thanks a lot, and keep on.</p>
<p><a href="http://twitter.com/lucastex">@lucastex</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2010/04/12/blog-paused/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Grails and Groovy related online board</title>
		<link>http://blog.lucastex.com/2009/09/05/new-grails-and-groovy-related-online-board/</link>
		<comments>http://blog.lucastex.com/2009/09/05/new-grails-and-groovy-related-online-board/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 15:51:39 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=445</guid>
		<description><![CDATA[Hello all,
A new Online Board is running up! GR8Forums.org is an online board to group questions, tips, discussions, knowlodge sharing and other stuff that are around Groovy Stuff&#8230; This means

Grails
Groovy
Gradle
Gaelyk
Gant
Any other gr8 stuff it should be there

C&#8217;mon, register online and introduce yourself here: http://gr8forums.org/viewtopic.php?f=21&#038;t=3.
Come join and bring your groovy friends to the newest gr8 family.
[]s,
]]></description>
			<content:encoded><![CDATA[<p>Hello all,</p>
<p>A new Online Board is running up! <a href="http://gr8forums.org">GR8Forums.org</a> is an online board to group questions, tips, discussions, knowlodge sharing and other stuff that are around Groovy Stuff&#8230; This means</p>
<ul>
<li>Grails</li>
<li>Groovy</li>
<li>Gradle</li>
<li>Gaelyk</li>
<li>Gant</li>
<li>Any other gr8 stuff it should be there</li>
</ul>
<p>C&#8217;mon, register online and introduce yourself here: <a href="http://gr8forums.org/viewtopic.php?f=21&#038;t=3">http://gr8forums.org/viewtopic.php?f=21&#038;t=3</a>.<br />
Come join and bring your groovy friends to the newest gr8 family.</p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/09/05/new-grails-and-groovy-related-online-board/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Viewing XML files in Safari</title>
		<link>http://blog.lucastex.com/2009/09/02/viewing-xml-files-in-safari/</link>
		<comments>http://blog.lucastex.com/2009/09/02/viewing-xml-files-in-safari/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 23:17:56 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=442</guid>
		<description><![CDATA[Oh, if you use Mac and Safari, viewing XML files is definitely one of worst things ever.
You have to open it and then use the &#8216;view source&#8217; option to handle it.
This Safari Plugin called XMLView Plugin can make things easier.   Just download it and uncompress it on your $HOME/Library/Internet Plug-Ins folder.
Close and reopen [...]]]></description>
			<content:encoded><![CDATA[<p>Oh, if you use Mac and Safari, viewing XML files is definitely one of worst things ever.<br />
You have to open it and then use the &#8216;view source&#8217; option to handle it.</p>
<p><a href="http://www.entropy.ch/software/MacOSX/xmlviewplugin/">This Safari Plugin</a> called XMLView Plugin can make things easier. <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Just download it and uncompress it on your <strong>$HOME/Library/Internet Plug-Ins</strong> folder.</p>
<p>Close and reopen your Safari, and open <a href="http://www.entropy.ch/software/MacOSX/xmlviewplugin/test.xml">any xml</a>. You&#8217;ll se a well-formated XML with syntax highlight and expand/colapse options.</p>
<p>If you&#8217;re not <a href="http://twitter.com/lucastex">following me on twitter</a>, you own me a dollar for this one.</p>
<p> <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/09/02/viewing-xml-files-in-safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defining load order and dependencies to your grails plugins</title>
		<link>http://blog.lucastex.com/2009/07/22/defining-load-order-and-dependencies-to-your-grails-plugins/</link>
		<comments>http://blog.lucastex.com/2009/07/22/defining-load-order-and-dependencies-to-your-grails-plugins/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 18:04:31 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[quicktips]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=429</guid>
		<description><![CDATA[Hello all,
I&#8217;m buiding a simple Grails Plugin that will use GORM dynamic finders and methods, but as we should know, the create-plugin grails command just install a fresh skeleton of your grails application, without any other dependencies.
First of all, you shoud install the hibernate plugin inside your plugin. Don&#8217;t worry, the hibernate will not be [...]]]></description>
			<content:encoded><![CDATA[<p>Hello all,</p>
<p>I&#8217;m buiding a simple Grails Plugin that will use GORM dynamic finders and methods, but as we should know, the create-plugin grails command just install a fresh skeleton of your grails application, without any other dependencies.</p>
<p>First of all, you shoud install the hibernate plugin inside your plugin. Don&#8217;t worry, the hibernate will not be packaged with your plugin, but will be there to your plugin classes use.</p>
<pre class="brush: groovy;">grails install-plugin hibernate</pre>
<p>So, now your plugin have the hibernate plugin installed and will be capable to use GORM facilities. But, if people wants to use your plugin, they will have to have hibernate plugin installed, correct? I know it cames by default in our grails application, but can be uninstalled. So we have to find some way to make our plugin dependent on hibernate plugin. Asking on the <a href="http://www.nabble.com/grails---user-f11861.html">grails-user list</a> and reading <a href="http://www.grails.org/Plugin+Dependencies">this topic in grails.org wiki</a>, I remembered on two plugin configurations that can help us:</p>
<ul>
<li>dependsOn</li>
<li>loadAfter</li>
</ul>
<p>The dependsOn it&#8217;s a map inside our XptoGrailsPlugin that tells witch plugins our one depends, it takes the name of the respective plugin and its version, in my case, that&#8217;s what I did:</p>
<pre class="brush: groovy;">def dependsOn = [&quot;hibernate&quot;:&quot;1.1 &gt; *&quot;]</pre>
<p>So, our plugin will depend on grails hibernate plugin, and at least the 1.1 version of it, none previous will be accepted and any future ones will be ok!</p>
<p>But sometimes this is not enougth, besides being dependent, our plugin uses dynamic finders, and runtime added method on our domain classes, so, it&#8217;ll only be successfully loaded after hibernate plugin load and adds this methods. To achieve this, we&#8217;ll use the other tag, the loadAfter to tell that our plugin will wait hibernate plugin to be loaded and the load itself.</p>
<pre class="brush: groovy;">def loadAfter = ['hibernate']</pre>
<p>That&#8217;s it. Doing this we&#8217;ll make things work as we wanted.</p>
<p>PS.: just noticed, right now that Graeme Rocher pushed to github&#8217;s grails master branch, a commit that will install de default plugins into new plugin projetcs too. This sounds cool, and will avoid us the first step above, the plugin installation. Here is the commit id and link: <a href="http://github.com/grails/grails/commit/9cb23f5b835b633cf43079ca7e58e29c64bd3b3c">9cb23f5b835b633cf43079ca7e58e29c64bd3b3c</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/07/22/defining-load-order-and-dependencies-to-your-grails-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A metaprogramação em linguagens dinâmicas</title>
		<link>http://blog.lucastex.com/2009/07/16/a-metaprogramacao-em-linguagens-dinamicas/</link>
		<comments>http://blog.lucastex.com/2009/07/16/a-metaprogramacao-em-linguagens-dinamicas/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 13:46:11 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=425</guid>
		<description><![CDATA[Vamos imaginar que gostaríamos de &#8220;adicionar comportamentos específicos&#8221; aos nossos objetos já escritos. Neste caso, usando a pura, tradicional, cafona e obsoleta orientação a objetos, estaríamos travados e acabaríamos por optar por uma composição de objetos, ou quem sabe uma generalização, certo? Uma das maiores vantagens (e perigos caso o programador seja na verdade um [...]]]></description>
			<content:encoded><![CDATA[<p>Vamos imaginar que gostaríamos de &#8220;adicionar comportamentos específicos&#8221; aos nossos objetos já escritos. Neste caso, usando a pura, tradicional, cafona e obsoleta orientação a objetos, estaríamos travados e acabaríamos por optar por uma composição de objetos, ou quem sabe uma generalização, certo? Uma das maiores vantagens (e perigos caso o programador seja na verdade um macaco de código), é o uso da <span>metaprogramação</span>. A metaprogramaçao nos permite exatamente isto, adicionar funções, e alterar o &#8220;esqueleto comportamental&#8221; de classes e objetos, por exemplo.</p>
<p>Para uma classe onde temos nosso cachorro, que anda:<br />
<span style="font-size: xx-small;"><br />
<span style="font-family: courier new,monospace;">class Dog {</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;"> &nbsp;&nbsp;def walk() {</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;"> &nbsp;&nbsp;&nbsp;&nbsp;println &#8220;walking&#8230;&#8221;</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;"> &nbsp;&nbsp;}</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">}</span></span><br style="font-family: courier new,monospace;" /><br />
se quisessemos definir um método para que ele latisse em runtime, faríamos da seguinte maneira:</p>
<p><span style="font-size: xx-small;"><span style="font-family: courier new,monospace;">def dog = new Dog()</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">dog.walk() //walking&#8230;</span><br style="font-family: courier new,monospace;" /><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">//Neste ponto, se fizermos a chamada dog.bark() teremos</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">//uma exception por estarmos chamando um método inexistente.</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">//Poderíamos contornar o erro com a implementação do methodMissing</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">//como dito no outro post, ou então da seguinta maneira</span><br style="font-family: courier new,monospace;" /><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">dog.metaClass.bark = {</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;"> &nbsp;&nbsp;println &#8220;au.&#8221;</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;" /> <br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">//Pronto, após isto, é só latir</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">dog.bark() //au.</span><br style="font-family: courier new,monospace;" /> </span><br />
Poderíamos também trabalhar com parâmetros da função</p>
<p><span style="font-size: xx-small;"><span style="font-family: courier new,monospace;">dog.metaClass.bark = { vezes -&gt;</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;"> vezes.times {</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;"> println &#8220;au.&#8221;</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;" /><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">dog.bark(5)</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">//au.</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">//au.</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">//au.</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">//au.</span><br style="font-family: courier new,monospace;" /> <span style="font-family: courier new,monospace;">//au.</span><br style="font-family: courier new,monospace;" /></span><br />
Neste caso, definimos o comportamento do método bark() em runtime, para um objeto já existente. Se quisessemos agora, unir os comportamentos de um objeto, em outro, poderíamos usar o recurso de mixin de objetos, que traz as definições de métodos e funçoes de um objeto para outro. Tendo a definição de um pato, onde:</p>
<p><span style="font-size: xx-small;">class Duck {<br />
&nbsp;&nbsp;def quack() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;println &#8220;quack!&#8221;<br />
&nbsp;&nbsp;}<br />
}<br />
</span><br />
Fica fácil fazer com que o pato ande como um cachorro! (absorvendo a função definida na classe Dog) <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span style="font-size: xx-small;">def duck = new Duck()</span><br />
<span style="font-size: xx-small;">duck.quack() //quack!</span></p>
<p><span style="font-size: xx-small;">//dedo de deus</span><br />
<span style="font-size: xx-small;">duck.metaClass.mixin Dog</span></p>
<p><span style="font-size: xx-small;">duck.walk() //walking</span></p>
<p>É isso aí.</p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/07/16/a-metaprogramacao-em-linguagens-dinamicas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Excel and Grails</title>
		<link>http://blog.lucastex.com/2009/04/30/working-with-excel-and-grails/</link>
		<comments>http://blog.lucastex.com/2009/04/30/working-with-excel-and-grails/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 19:40:37 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[grailsbrasil]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=382</guid>
		<description><![CDATA[I found this 2 links in grailsbrasil.com forum.
It&#8217;s a nice feature to include in your system for that situations when user have to input a large amount of data.
First example shows how user can upload the excel file, and your system automatically load all the spreadsheet data into domain objects. And this one, shows the [...]]]></description>
			<content:encoded><![CDATA[<p>I found this 2 links in <a href="http://grailsbrasil.com">grailsbrasil.com</a> forum.<br />
It&#8217;s a nice feature to include in your system for that situations when user have to input a large amount of data.</p>
<p><a href="http://josh-in-antarctica.blogspot.com/2008/03/grails-excel-file-upload.html">First example shows how user can upload the excel file, and your system automatically load all the spreadsheet data into domain objects</a>. <a href="http://josh-in-antarctica.blogspot.com/2008/03/grails-excel-file-download.html">And this one, shows the reverse way, by loading your domain objects into an excel file</a> using <a href="http://jexcelapi.sourceforge.net/">JExcelAPI</a>.</p>
<p>Recommend!</p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/30/working-with-excel-and-grails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>issues on my dreamhost hosting.</title>
		<link>http://blog.lucastex.com/2009/04/19/issues-on-my-dreamhost-hosting/</link>
		<comments>http://blog.lucastex.com/2009/04/19/issues-on-my-dreamhost-hosting/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 06:45:13 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[dreamhost]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=376</guid>
		<description><![CDATA[Some of you may &#8216;ve noticed that my blog was not responsing the hole day&#8230; Sorry about that. I just moved from a shared hosting to a private server (so I can run grails here) and DH just broke my server config.
Terrible&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Some of you may &#8216;ve noticed that my blog was not responsing the hole day&#8230; Sorry about that. I just moved from a shared hosting to a private server (so I can run grails here) and DH just broke my server config.</p>
<p>Terrible&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/19/issues-on-my-dreamhost-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making a readeable code, more and more readeable</title>
		<link>http://blog.lucastex.com/2009/04/14/making-a-readeable-code-more-and-more-readeable/</link>
		<comments>http://blog.lucastex.com/2009/04/14/making-a-readeable-code-more-and-more-readeable/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 01:34:50 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=351</guid>
		<description><![CDATA[One thing groovy and grails really rocks, is the legibility of the generated code. It&#8217;s amazing how this Java code below
Contact boringObject = new Contact();
boringObject.setNome(&#34;Lucas&#34;);
boringObject.setIdade(24);
boringObject.setEmail(&#34;lucastex@gmail.com&#34;);
boringObject.setPhone(&#34;55 11 9999.9999&#34;);
boringObject.setDateCreated(new java.util.Date());
can turn into this beautiful code:
def c = new Contact()
c.name = &#34;Lucas&#34;
c.age = 24
c.email = &#34;lucastex@gmail.com&#34;
c.phone = &#34;55 11 9999.9999&#34;
c.dateCreated = new Date()
Yeah, I know, this is simple [...]]]></description>
			<content:encoded><![CDATA[<p>One thing groovy and grails really rocks, is the legibility of the generated code. It&#8217;s amazing how this Java code below</p>
<pre class="brush: java;">Contact boringObject = new Contact();
boringObject.setNome(&quot;Lucas&quot;);
boringObject.setIdade(24);
boringObject.setEmail(&quot;lucastex@gmail.com&quot;);
boringObject.setPhone(&quot;55 11 9999.9999&quot;);
boringObject.setDateCreated(new java.util.Date());</pre>
<p>can turn into this beautiful code:</p>
<pre class="brush: groovy;">def c = new Contact()
c.name = &quot;Lucas&quot;
c.age = 24
c.email = &quot;lucastex@gmail.com&quot;
c.phone = &quot;55 11 9999.9999&quot;
c.dateCreated = new Date()</pre>
<p>Yeah, I know, this is simple and it&#8217;s already done in most frameworks via <a href="http://en.wikipedia.org/wiki/OGNL">OGNL</a> and <a href="http://java.sun.com/docs/books/tutorial/reflect/index.html">reflection</a>, but groovy bring this feature natively and makes the code human-readeable removing all unnecessary commas, parenthesis and other symbols. Groovy brings the code to the closest natural reading language I ever saw! You can see this by studying the <a href="http://www.grails.org/doc/1.1.x/guide/5.%20Object%20Relational%20Mapping%20(GORM).html">GORM dynamic finders</a>, that is a real good example of what I&#8217;m saying; you think, you transcript and that&#8217;s the code.</p>
<p>Another useful feature, to make the code more readeable, is the with builder block. Imagine the snippet above, all properties that we&#8217;re setting, we&#8217;re setting in the same object, so why do we have to mention the object everytime? So, you can use this block to set everything in the same object. Try the code above:</p>
<pre class="brush: groovy;">def cb = new Contact()
cb.with {
   name = &quot;Katie&quot;
   age = 24
   email = &quot;katie@xpto.com&quot;
   phone = &quot;55 11 8888.8888&quot;
   dateCreated = new Date()
}</pre>
<p>That&#8217;s why I like groovy so much, you won&#8217;t waste your time on &#8220;syntax learning&#8221;. All you need to do is read the code! <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://twitter.com/lucastex">Follow me on twitter</a> and <a href="http://feeds2.feedburner.com/lucastex">subscribe my blog&#8217;s feed!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/14/making-a-readeable-code-more-and-more-readeable/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Multi-Tenant plugin. Incredible!</title>
		<link>http://blog.lucastex.com/2009/04/06/multi-tenant-plugin-incredible/</link>
		<comments>http://blog.lucastex.com/2009/04/06/multi-tenant-plugin-incredible/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:55:34 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>
		<category><![CDATA[customer]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[multi-tenant]]></category>
		<category><![CDATA[multiple clients]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/2009/04/06/multi-tenant-plugin-incredible/</guid>
		<description><![CDATA[Today I was reading the old mails that I couldn&#8217;t read from last week and I read about the Multi-Tenant plugin for grails. 
It&#8217;s an awesome plugin that solves your biggest problem if you have an simple application that you&#8217;ll sell its service for a bunch of people. You always think about having multiple instances [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was reading the old mails that I couldn&#8217;t read from last week and I read about the Multi-Tenant plugin for grails. </p>
<p>It&#8217;s an awesome plugin that solves your biggest problem if you have an simple application that you&#8217;ll sell its service for a bunch of people. You always think about having multiple instances of it, one for each user, correct? And you say:</p>
<p>&#8211; Ohhh no, I&#8217;ll have to have a lot of app servers!</p>
<p>So you start thinking about having a &#8220;customerId&#8221; for each domain class of your application. You&#8217;ll be lucky if you do not forget to use this identifier in some query&#8230;</p>
<p>Multi-Tenant plugin does all this boring job for you, you just annotate your domain class and configures a DNS resolver, telling the plugin that any request coming from www.xpto1.com will be the first customer and www.xpto2.com the second one.</p>
<p>Everything will be carefully watched so you&#8217;ll not have to worry about.</p>
<p>Don&#8217;t forget about this plugin, will save me. Hope it can help you! Read all docs about it here: http://grails.org/plugin/multi-tenant </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/06/multi-tenant-plugin-incredible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[3/25] Building a RSS Reader with Quartz Plugin &#8211; Grails Tutorial</title>
		<link>http://blog.lucastex.com/2009/04/02/3of25-building-a-rss-reader-with-quartz-plugin-a-simple-grails-tutorial/</link>
		<comments>http://blog.lucastex.com/2009/04/02/3of25-building-a-rss-reader-with-quartz-plugin-a-simple-grails-tutorial/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 03:40:36 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Nenhuma]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[google reader]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[quartz]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=317</guid>
		<description><![CDATA[Are you reading my blog&#8217;s feed? Be the first to know when I publish some interesting articleÂ signing up to my feedÂ andÂ following me on twitter!
Â 
Groovy Version: 1.6
Grails Version: 1.1
Plugin Version: 0.4.1-SNAPSHOT
Plugin Docs: http://grails.org/plugin/quartz
Download Resources: source code screencast 1Â screencast 2
Hello,
In this tutorial, we&#8217;ll talk about the Quartz plugin used to schedule jobs executions in your application. The [...]]]></description>
			<content:encoded><![CDATA[<p>Are you reading my blog&#8217;s feed? Be the first to know when I publish some interesting articleÂ <a href="http://feeds2.feedburner.com/lucastex">signing up to my feed</a>Â andÂ <a href="http://www.twitter.com/lucastex">following me on twitter</a>!</p>
<p>Â </p>
<p><span style="text-decoration: underline;">Groovy Version</span>: 1.6<br />
<span style="text-decoration: underline;">Grails Version</span>: 1.1<br />
<span style="text-decoration: underline;">Plugin Version</span>: 0.4.1-SNAPSHOT<br />
<span style="text-decoration: underline;">Plugin Docs</span>: http://grails.org/plugin/quartz<br />
<span style="text-decoration: underline;">Download Resources</span>: <a href="http://flv.lucastex.com/quartz/feedreader.zip">source code</a> <a href="http://flv.lucastex.com/quartz/quartz_1.swf">screencast 1</a>Â <a href="http://flv.lucastex.com/quartz/quartz_2.swf">screencast 2</a></p>
<p>Hello,</p>
<p>In this tutorial, we&#8217;ll talk about the <a href="http://www.grails.org/plugin/quartz">Quartz plugin</a> used to schedule jobs executions in your application. The plugin is build on top of the <a href="http://www.opensymphony.com/quartz/">Quartz Job Scheduler Library</a> from <a href="http://www.opensymphony.com/">OpenSymphony</a>. OpenSympony is the company that built the <a href="http://www.opensymphony.com/webwork">WebWork</a> framework, that is now called Struts2 after Apache &#8220;aquisition&#8221;.</p>
<p>&#8220;Scheduling jobs&#8221; is very useful in your application to cover background needs. Some tasks you&#8217;ll need to execute undercover your application some times (invalidating old users that have not logged for more than 1 month) or even async processes that you&#8217;ll have to do if you do not have a JMS infrastructure, for example, sending e-mails to a lot of people.</p>
<p>In our example, we&#8217;ll build a simple RSS Reader that will use the quartz plugin to schedule fetchs it will be done in the feeds and insert in the database. Our application will mainly have one domain class called Post (seen in the <a href="http://tinyurl.com/2of5-searchable">last tutorial</a>), a Feed domain class to store our feeds and a similar RSS Parser from technorati. Â (Yes, I love the RSS format).</p>
<p>Initially, we&#8217;ll create the app, install the quartz plugin, create the domain classes and the Feed scaffold structure</p>
<pre class="brush: groovy;">grails create-app feedreader
cd feedreader
grails install-plugin quartz
grails create-domain-class Post</pre>
<p>We&#8217;ll insert the Post domain class code</p>
<pre class="brush: groovy;">class Post {
Â Â  Â String title
Â Â  Â String link
Â Â  Â String body
}</pre>
<p>We have to create the Feed domain class and its scaffold structure.</p>
<pre class="brush: groovy;">grails create-domain-class Feed</pre>
<pre class="brush: groovy;">class Feed {
Â Â  Â String word
Â Â  Â String url
}</pre>
<p>Scaffolding&#8230;</p>
<pre class="brush: groovy;">grails generate-all Feed</pre>
<p><strong>screencast-1</strong><br />
<a href="http://flv.lucastex.com/quartz/quartz_1.swf"><img src="http://blog.lucastex.com/sc.jpg" alt="screencast" /></a></p>
<p>After this, we&#8217;ll create our Technorati Feed Parser from this code above.</p>
<pre class="brush: groovy;">class TechnoratiService {
Â Â  Â boolean transactional = false
Â Â  Â def parseAndSave(rss) {
Â Â  Â Â Â  Â def rssObj = new XmlSlurper().parse(rss)
Â Â  Â Â Â  Â rssObj.channel.item.each {
Â Â  Â Â Â  Â Â Â  Â def post = new Post(title: it.title.toString(),
Â Â  Â Â Â  Â Â Â  Â Â Â  Â Â Â  Â link: it.link.toString(),
Â Â  Â Â Â  Â Â Â  Â Â Â  Â Â Â  Â body: it.description.toString())
Â Â  Â Â Â  Â Â Â  Â post.save()
Â Â  Â Â Â  Â Â Â  Â println &quot;Post [${post}] saved.&quot;
Â Â  Â Â Â  Â }
Â Â  Â }
}</pre>
<p>We&#8217;ll run our application using the <strong>grails run-app</strong> command and insert some feeds. Note that we&#8217;ve configured our datasource to use hsqldb storing in the filesystem instead of regular memory setup.Â </p>
<p>Note that we have one JobController that Quartz install for us, forget about it, ok? We&#8217;ll create our own job after the second screencast.</p>
<p><strong>screencast-2</strong><br />
<a href="http://flv.lucastex.com/quartz/quartz_2.swf"><img src="http://blog.lucastex.com/sc.jpg" alt="screencast" /></a></p>
<p>Now, we have to understant some quartz properties and commands.Â </p>
<p>When we install the quatz plugin, it installs another command for us the <strong>grails create-job MyJob</strong>, with it we&#8217;ll create our FeedParserJob. Note that we use convention over configuration with all jobs having <em>*Job</em>Â names.Â </p>
<pre class="brush: groovy;">grails create-job FeedParser</pre>
<p>Job classes have to implement the execute() method. This method is the one that Quartz will trigger when it&#8217;s time to execute the job. To define when the job it will be executed and what&#8217;s the interval between executions, I suggest you read the <a href="http://grails.org/plugin/quartz">plugin documentation</a> witch shows N ways to do this. In our example we&#8217;ll use a <a href="http://en.wikipedia.org/wiki/CRON_expression">cron expression</a> similar to *N*X OS systems setting our job to execute once in five minutes.</p>
<p>Our cron expression will be like this: Â <strong>&#8220;0 0/5 * * * ?&#8221;</strong></p>
<p>Depending on your jobs requisites, it may run concurrently with another instance of it or not. In our case, we&#8217;ll not start other job execution if the last on is still running. To prevent thisÂ behavior, we can set the concurrent property to false</p>
<pre class="brush: groovy;">def concurrent = false</pre>
<p>Our job will essentially look for the feeds we&#8217;ve inserted on the database, and for each one it will call the Technorati service asking for new Posts. The final source for our job is the one below:</p>
<pre class="brush: groovy;">class FeedParserJob {
Â Â  Â def concurrent = false
Â Â  Â def cronExpression = &quot;0 0/5 * * * ?&quot;
Â Â  Â 
Â Â  Â def technoratiService

Â Â  Â def execute() {
Â Â  Â  Â  Â def feedList = Feed.findAll()
Â Â  Â Â Â  Â for (Feed feed : feedList) {
Â Â  Â Â Â  Â Â Â  Â println &quot;Reading feed ${feed.word} @ ${feed.url}&quot;
Â Â  Â Â Â  Â Â Â  Â technoratiService.parseAndSave(feed.url)
Â Â  Â Â Â  Â }
Â Â Â  }
}</pre>
<p>As you can see in the example above, you can inject any spring bean in your job, just declare it as I did with my TechnoratiService! <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (this is really great!)</p>
<p>That&#8217;s it, if you run you application you&#8217;ll see that every 5 minutes (minutes 0,5,10,15&#8230;) the job will be called and every posts technorati returns will be inserted on your database. Note that in this simple example we did not check if the post had been already inserted in the database before inserting it, this will just grow our database with a lot of instances representing the same post. This can be avoided checking if the post already exists before inserting it Â (just check if you have any Post with the same link), but I&#8217;ll left this for you!</p>
<p>Before finish this, let&#8217;s just improve a little bit our post list view.</p>
<p>Â </p>
<div class="mceTemp mceIEcenter">
<dl class="wp-caption aligncenter" style="width: 780px;">
<dt class="wp-caption-dt"><img title="Tela de posts" src="http://blog.lucastex.com/wp-content/uploads/2009/03/quartz.png" alt="Tela de posts" width="770" height="831" /></dt>
</dl>
</div>
<p>Â </p>
<p>Â </p>
<p>Now, try to enrich its interface, adding some ajax to get only the new posts since the last fech! Maybe you can start from this your new Google Reader killer! <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Now, let me know, are you using this plugin in your production environment? What for? What kind of jobs you do with it?Â </p>
<p>Thanks!</p>
<p>Are you reading my blog&#8217;s feed? Be the first to know when I publish some interesting articleÂ <a href="http://feeds2.feedburner.com/lucastex">signing up to my feed</a>Â andÂ <a href="http://www.twitter.com/lucastex">following me on twitter</a>!</p>
<p>Â </p>
<p>Next tutorial: [4of25] Jasper Plugin</p>
<p>Past tutorials:<br />
Â Â  Â Â Â  Â <a href="http://tinyurl.com/2of25-searchable">[2of25] Searchable Plugin</a><br />
Â Â  Â Â Â  Â <a href="http://tinyurl.com/1of25-acegi">[1of25] AcegiSecurity Plugin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/02/3of25-building-a-rss-reader-with-quartz-plugin-a-simple-grails-tutorial/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

