<?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; Tech</title>
	<atom:link href="http://blog.lucastex.com/category/tech/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>Open position for Grails Developer</title>
		<link>http://blog.lucastex.com/2011/01/07/open-position-for-grails-developer/</link>
		<comments>http://blog.lucastex.com/2011/01/07/open-position-for-grails-developer/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 12:43:33 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Grails]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=449</guid>
		<description><![CDATA[Hello,
Just returning here to announce an open position for Grails Developer, if you want, or know someone who may want, follow up:
The person must have hands on experience with GRAILS.

Experience with Oracle (plus)
Experience developing highly visited and highly scalable websites
Experience using the Grails Web Framework
Excellent communication skills

Location: Redwood City, CA
Duration: 3+ months
Start: ASAP
Rate: Open
Please send [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>Just returning here to announce an open position for Grails Developer, if you want, or know someone who may want, follow up:</p>
<p>The person must have hands on experience with GRAILS.</p>
<ul>
<li>Experience with Oracle (plus)</li>
<li>Experience developing highly visited and highly scalable websites</li>
<li>Experience using the Grails Web Framework</li>
<li>Excellent communication skills</li>
</ul>
<p><strong>Location</strong>: Redwood City, CA<br />
<strong>Duration</strong>: 3+ months<br />
<strong>Start</strong>: ASAP<br />
<strong>Rate</strong>: Open</p>
<p>Please send resumes to cwelch [at] bluewolf [dot] com (<strong>Charlotte</strong>)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2011/01/07/open-position-for-grails-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grails 1.2 Milestone 2 is out!</title>
		<link>http://blog.lucastex.com/2009/08/11/grails-1-2-milestone-2-is-out/</link>
		<comments>http://blog.lucastex.com/2009/08/11/grails-1-2-milestone-2-is-out/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 11:21:14 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=439</guid>
		<description><![CDATA[Yeah!! Graeme just announced rigth now that grails 1.2-M2 is out!
I&#8217;ve already talked about some changes and improvements in my twitter, but now is officially!
Check the release notes here: http://www.grails.org/1.2-M2+Release+Notes, the changelog, and download it to upgrade your applications!  
Docs, as usual available here: http://grails.org/doc/latest
Later, I&#8217;ll write a post about the new features, probably [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah!! Graeme <a href="http://twitter.com/graemerocher/status/3243636664">just announced</a> rigth now that grails 1.2-M2 is out!<br />
I&#8217;ve already talked about some changes and improvements in <a href="http://twitter.com/lucastex">my twitter</a>, but now is officially!</p>
<p>Check the release notes here: <a href="http://www.grails.org/1.2-M2+Release+Notes">http://www.grails.org/1.2-M2+Release+Notes</a>, the <a href="http://jira.codehaus.org/browse/GRAILS?report=com.atlassian.jira.plugin.system.project:changelog-panel">changelog</a>, and <a href="http://grails.org/Download">download it</a> to <a href="http://grails.org/doc/latest/ref/Command%20Line/upgrade.html">upgrade your applications</a>!  </p>
<p>Docs, as usual available here: <a href="http://grails.org/doc/latest">http://grails.org/doc/latest</a></p>
<p>Later, I&#8217;ll write a post about the new features, probably one by one, come back!</p>
<p><a href="http://twitter.com/lucastex">Following me on twitter?</a></p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/08/11/grails-1-2-milestone-2-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple grails custom validator</title>
		<link>http://blog.lucastex.com/2009/08/10/a-simple-grails-custom-validator/</link>
		<comments>http://blog.lucastex.com/2009/08/10/a-simple-grails-custom-validator/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 23:52:42 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[constraints]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=436</guid>
		<description><![CDATA[While writing a simple CRUD with #grails, client asked me to validate pogo&#8217;s birth date (had to be in the last year). In this cases, we can&#8217;t just use regular validators, cause their are static. So we can solve this using our own custom validators, so simple and useful.
static constraints = {
	//...
	borned(validator: {
		return (it &#62; [...]]]></description>
			<content:encoded><![CDATA[<p>While writing a simple CRUD with #grails, client asked me to validate pogo&#8217;s birth date (had to be in the last year). In this cases, we can&#8217;t just use regular validators, cause their are static. So we can solve this using our own custom validators, so simple and useful.</p>
<pre class="brush: groovy;">static constraints = {
	//...
	borned(validator: {
		return (it &gt; new Date()-365)
	})
	//...
}</pre>
<p>That&#8217;s it, this way every time a new instance is validated (during save or manually), a new date will be created and compared to it. (no I don&#8217;t care about leap years).</p>
<p>Already <a href="http://twitter.com/lucastex">following me on twitter</a>?</p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/08/10/a-simple-grails-custom-validator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Interceptando métodos inexistentes em Groovy</title>
		<link>http://blog.lucastex.com/2009/07/06/interceptando-metodos-inexistentes-em-groovy/</link>
		<comments>http://blog.lucastex.com/2009/07/06/interceptando-metodos-inexistentes-em-groovy/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 18:15:14 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[builder]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=410</guid>
		<description><![CDATA[As linguagens dinâmicas estão ganhando um espaço considerável hoje em dia. Para dar um exemplo do poder dessas linguagens, criei um exemplo simples em Groovy (linguagem Java que roda &#8220;em cima&#8221; da JVM).
Uma das características dessas linguagens, é poder aproveitar a criatividade do desenvolvedor. Daí temos como exemplo uma função que pode ser definida em [...]]]></description>
			<content:encoded><![CDATA[<p>As linguagens dinâmicas estão ganhando um espaço considerável hoje em dia. Para dar um exemplo do poder dessas linguagens, criei um exemplo simples em Groovy (linguagem Java que roda &#8220;em cima&#8221; da JVM).</p>
<p>Uma das características dessas linguagens, é poder aproveitar a criatividade do desenvolvedor. Daí temos como exemplo uma função que pode ser definida em nossos objetos chamada <strong>methodMissing</strong>. Essa função é chamada quando algum método não encontrado é chamado em algum objeto. Caso não seja definida, aí sim temos o comportamento padrão do Java, uma exception apontando a falta do método.</p>
<p>No <a href="http://twitter.com/lucastex">twitter</a>, o <a href="http://twitter.com/cmilfont/status/2441669599">@cmilfont perguntou ao @fabiokung</a> sobre um builder de HTML que ele tinha feito em ruby com o mesmo princípio. Usar o methodMissing. Quando eu vi <a href="http://gist.github.com/72852">este builder</a>, fiquei pasmo com a simplicidade e objetividade, e tudo isso originou este post. Coloquei alguns tratamentos que não existiam, para valores de atributos das tags.</p>
<p>O exemplo utiliza o poder da função methodMissing para criar um &#8220;Builder&#8221;, ou então um construtor de HTML dinâmico com base em pseudo-métodos chamados pelo cliente. Imaginem a função abaixo:</p>
<pre>def methodMissing(String name, params) {
	if (params[0] instanceof Closure) {
		println "< ${name}>"
		params[0].call()
		println "< / ${name}>"
	} else if (params[0] instanceof String) {
		println "< ${name}>${params[0]}< ${name}>"
	} else if (params[0] instanceof Map) {
		print "< ${name}"
		params[0].each() {chave, valor ->
			print " ${chave}=\"${valor}\""
		}
		if (params.length > 1) {
			if (params[1] instanceof Closure) {
				println ">"
				params[1].call()
				println ""
			}
		} else println " />"
	}
}</pre>
<p>No primeiro if, resgatando o parâmetro do tipo closure, apenas faz a chamada a esta closure, para que o novo método seja chamado entre &#8220;TAGS&#8221; que são o nome do método criado dinâmicamente&#8230; Já no caso do parâmetro ser uma String, é encarada como conteúdo  inteno da tag e renderizada desta maneira.</p>
<p>Se um map for passado como parâmetro, a interpretação é tida como vários atributos da tag html (método inexistente), e caso ainda tenhamos uma outra closure ali como parâmetro, o comportamento é repetido <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Com este exemplo, poderíamos construir um simples HTML com o seguinte trecho de código (script) groovy:</p>
<pre>html {
    head {
        title "teste de titulo"
    }
    body {
        div(id:3, class:"odd") {
            p "meu texto"
        }
        div id:5, class:"xpto"
    }
}</pre>
<p>Prontinho, a JVM com o trecho acima cria nosso super-mega-ultra-elaborado trecho de HTML:</p>
<pre>
< html >
< head >
< title >teste de titulo< / title >
< / head >
< body >
< div id="3" class="odd" >
< p >meu texto< / p >< / div >
< div id="5" class="xpto" / >
< / body >
< / html >
</pre>
<p>Groovy é uma linguagem de script muito bacana e poderosa, e como roda em cima da JVM, não é nada mais que Java puro. Pode com certeza e MUITA eficiência substituir aqueles scripts shell que temos em algumas aplicações, trazendo para os desenvolvedores mais liberdade (de chamar um jar com funcionalidades, por exemplo), e conforto (de não depender de alguém de infra estrutura, ou de conhecimento em shell script).</p>
<p>Fica aí a dica e o exemplo do poder&#8230;</p>
<p>Valeu!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/07/06/interceptando-metodos-inexistentes-em-groovy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Yuuuuh!!!! We got Grails 1.1.1!</title>
		<link>http://blog.lucastex.com/2009/05/14/yuuuuh-we-got-grails-111/</link>
		<comments>http://blog.lucastex.com/2009/05/14/yuuuuh-we-got-grails-111/#comments</comments>
		<pubDate>Thu, 14 May 2009 15:26:31 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[1.1.1]]></category>
		<category><![CDATA[mail thread]]></category>
		<category><![CDATA[mailing list]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=408</guid>
		<description><![CDATA[As I said earlier, we got Grails 1.1.1 today!!
Take a look in the links below:

Release Notes
JIRA tasks for this version (changelog)
Download
Documentation
Official announce
My happy announce


But watch out! People in the grails mailing list noticed some broken stuff in the build when trying to upgrade. A little workaround is availabe in this mail thread, just keep looking [...]]]></description>
			<content:encoded><![CDATA[<p>As I said earlier, we got Grails 1.1.1 today!!</p>
<p>Take a look in the links below:</p>
<blockquote><ul>
<li><a href="http://grails.org/1.1.1+Release+Notes">Release Notes</a></li>
<li><a href="http://jira.codehaus.org/browse/GRAILS?report=com.atlassian.jira.plugin.system.project:changelog-panel">JIRA tasks for this version (changelog)</a></li>
<li><a href="http://grails.org/Download">Download</a></li>
<li><a href="http://grails.org/doc/1.1.x/">Documentation</a></li>
<li><a href="http://grails.org/blog/graemerocher/Grails+1.1.1+Released">Official announce</a></li>
<li><a href="http://twitter.com/lucastex/status/1794936148">My happy announce</a></li>
</ul>
</blockquote>
<p>But watch out! People in the grails mailing list noticed some broken stuff in the build when trying to upgrade. A little workaround is availabe in <a href="http://www.nabble.com/Exception-while-trying-to-upgrade-webapp-from-Grails-1.1-to-1.1.1-to23541298.html">this mail thread</a>, just keep looking <a href="http://www.nabble.com/Exception-while-trying-to-upgrade-webapp-from-Grails-1.1-to-1.1.1-to23541298.html">this Thread</a>, probably we&#8217;ll get something here!</p>
<p>Thanks!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/05/14/yuuuuh-we-got-grails-111/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Looking forward Grails 1.1.1</title>
		<link>http://blog.lucastex.com/2009/05/14/looking-forward-grails-111/</link>
		<comments>http://blog.lucastex.com/2009/05/14/looking-forward-grails-111/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:19:48 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[1.1.1]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=397</guid>
		<description><![CDATA[Hi,
Yesterday Guillaume Laforge annouced that finally groovy 1.6.3 is out. That means we&#8217;ll have the Grails 1.1.1 release in a few days (hoping this for today). Graeme Rocher said that with groovy 1.6.3 released, Grails 1.1.1 is imminent. 
So let&#8217;s wait!
I&#8217;m specially waiting this release since it corrects a little bug in WAR generation using [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Yesterday Guillaume Laforge <a href="http://twitter.com/glaforge/status/1785140957">annouced</a> that finally groovy 1.6.3 is out. That means we&#8217;ll have the Grails 1.1.1 release in a few days (hoping this for today). Graeme Rocher said that with groovy 1.6.3 released, <a href="http://twitter.com/graemerocher/status/1785238604">Grails 1.1.1 is imminent</a>. </p>
<p>So let&#8217;s wait!</p>
<p>I&#8217;m specially waiting this release since it corrects a little bug in WAR generation using the &#8211;nojars options.<br />
Ohhh, and of course, with Grails 1.1.1 we&#8217;ll have support to use Grails in the Google Java App Engine!!</p>
<p>Thanks <a href="http://twitter.com/glaforge">Guillaume</a> and <a href="http://twitter.com/graemerocher">Graeme</a>!</p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/05/14/looking-forward-grails-111/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Esperando o Grails 1.1.1</title>
		<link>http://blog.lucastex.com/2009/05/14/esperando-o-grails-111/</link>
		<comments>http://blog.lucastex.com/2009/05/14/esperando-o-grails-111/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:09:22 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Portuguese]]></category>
		<category><![CDATA[1.1.1]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=394</guid>
		<description><![CDATA[Hum,
Ontem saiu oficialmente o Groovy 1.6.3, e isto quer dizer que hoje ou no máximo ainda essa semana estaremos com a release oficial do Grails 1.1.1.
Como disse o Graeme Rocher ontem no twitter, com o release do Groovy 1.6.3, o Grails 1.1.1 é iminente. 
Estou esperando esta versão pois corrige um bug na criação de [...]]]></description>
			<content:encoded><![CDATA[<p>Hum,</p>
<p>Ontem saiu oficialmente o Groovy 1.6.3, e isto quer dizer que hoje ou no máximo ainda essa semana estaremos com a release oficial do Grails 1.1.1.</p>
<p>Como disse o Graeme Rocher ontem no twitter, com o release do Groovy 1.6.3, o Grails 1.1.1 é iminente. <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
Estou esperando esta versão pois corrige um bug na criação de WARs usando a opção &#8211;nojars</p>
<p>Além de que é claro, com o Grails 1.1.1 poderemos usar o plugin do GAE para criar aplicações Grails no Google Java App Engine!!</p>
<p>Estamos aguardando ansiosamente.</p>
<p>[]s,</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/05/14/esperando-o-grails-111/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding Groovy Categories</title>
		<link>http://blog.lucastex.com/2009/05/02/understanding-groovy-categories/</link>
		<comments>http://blog.lucastex.com/2009/05/02/understanding-groovy-categories/#comments</comments>
		<pubDate>Sat, 02 May 2009 05:28:18 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=384</guid>
		<description><![CDATA[Have you ever used Groovy Categories? Do you even know what its stands for? 
Groovy Categories is a great feature from Groovy (inherted from Objective-C) that allows you to have some kind of &#8220;extended&#8221; control on a class. The category just &#8220;add&#8221; some more funcionality to your class when you want. It&#8217;s different from creating [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever used Groovy Categories? Do you even know what its stands for? </p>
<p>Groovy Categories is a great feature from Groovy (inherted from <a href="http://en.wikipedia.org/wiki/Objective-C">Objective-C</a>) that allows you to have some kind of &#8220;extended&#8221; control on a class. The category just &#8220;add&#8221; some more funcionality to your class when you want. It&#8217;s different from creating another class that extends from the first one, this approach holds a little more functionality-oriented talk&#8230; <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Categories is nothing more than a Groovy class that you&#8217;ve implemented before that effectly adds your functionality. The syntax is very simple and all you have to do, is tell to the runtime environment you&#8217;re now using the category.</p>
<pre class="brush: groovy;">use (the category class you want to use) {
    //all your code here can access the category funcionality
}
//back to normal code</pre>
<p>That&#8217;s it. Groovy Core comes with some Categories (<a href="http://groovy.codehaus.org/api/index.html?groovy/servlet/ServletCategory.html">ServletCategory</a>, <a href="http://groovy.codehaus.org/api/index.html?groovy/xml/dom/DOMCategory.html">DOMCategory</a> and <a href="http://groovy.codehaus.org/api/index.html?org/codehaus/groovy/runtime/TimeCategory.html">TimeCategory</a>). The one we use more is the TimeCategory, that adds some calculation methods for us. </p>
<p>Let&#8217;s imagine we want to add some days in our current date, using Java you remember how you should do, don&#8217;t you? </p>
<p>Get a Calendar Instance, retrieve this calendar&#8217;s date, add the ammount of days using the strangest and creepiest method ever and then get the calendar&#8217;s date again (actually, get only its time and create a date with it):</p>
<pre class="brush: java;">//creepiest method
myCalendarInstance.add(Calendar.DAY_OF_MONTH, 10);</pre>
<p>You can see in the TimeCategory&#8217;s javadoc (link above) that it defines some methods like &#8220;getHours(), getDays(), getMinutes()&#8221;. This methods we don&#8217;t have in some usual Date class, but when we use the TimeCategory object, they just get available for us. The example below show us what should happen when we use the TimeCategory:</p>
<pre class="brush: groovy;">Date now = new Date()
println now //just show when am I <img src='http://blog.lucastex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> 

use(org.codehaus.groovy.runtime.TimeCategory) {
    now = now + 15.days
}

println now //shows us when we'll be in 15 days!
</pre>
<p>This will be our output after running this small script:</p>
<pre class="brush: bash;">Sat May 02 02:25:57 BRT 2009
Sun May 17 02:25:57 BRT 2009</pre>
<p>That&#8217;s it, try the code above and the others methods the TimeCategory gives to you: years, months, hours, minutes and seconds.</p>
<p>Thanks! Be the first to know when I publish some interesting article <a href="http://feeds2.feedburner.com/lucastex">signing up my feed</a> and <a href="http://twitter.com/lucastex">following me on twitter</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/05/02/understanding-groovy-categories/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Changing the default locale for your grails application</title>
		<link>http://blog.lucastex.com/2009/04/20/changing-the-default-locale-for-your-grails-application/</link>
		<comments>http://blog.lucastex.com/2009/04/20/changing-the-default-locale-for-your-grails-application/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 17:57:41 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[locale]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=378</guid>
		<description><![CDATA[Thank god grails has a wonderful i18n native support. It&#8217;s great change all your application language just by setting one more parameter in the URL (lang). If you do not know this behaviour, check this out. 
But sometimes you have to preset the default language because not all your applications will be in english, yap [...]]]></description>
			<content:encoded><![CDATA[<p>Thank god <a href="http://www.grails.org">grails</a> has a wonderful i18n native support. It&#8217;s great change all your application language just by setting one more parameter in the URL (lang). If you do not know this behaviour, <a href="http://grails.org/doc/1.1/guide/single.html#10.%20Internationalization">check this out</a>. </p>
<p>But sometimes you have to preset the default language because not all your applications will be in english, yap ? To make this you&#8217;ll have to set your localeResolver in your resources.groovy spring configuration file. just add this code to it. (note that my code is setting my language to brazilian portuguese &#8211; pt_BR)</p>
<pre class="brush: groovy;">
//this is your resources.groovy file
//
beans = {
   localeResolver(org.springframework.web.servlet.i18n.SessionLocaleResolver) {
      defaultLocale = new Locale(&quot;pt&quot;,&quot;BR&quot;)
      java.util.Locale.setDefault(defaultLocale)
   }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/20/changing-the-default-locale-for-your-grails-application/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>[4/25] Jasper Reports in Grails with Dynamic-Jasper</title>
		<link>http://blog.lucastex.com/2009/04/16/4of25-jasper-reports-in-grails-with-dynamic-jasper/</link>
		<comments>http://blog.lucastex.com/2009/04/16/4of25-jasper-reports-in-grails-with-dynamic-jasper/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 14:45:29 +0000</pubDate>
		<dc:creator>lucastex</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[dynamic-jasper]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[jasper]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[reportable]]></category>

		<guid isPermaLink="false">http://blog.lucastex.com/?p=336</guid>
		<description><![CDATA[This tutorial will talk about producing Jasper PDF reports (or any other format you&#8217;d like) in you grails app.Â  I took a look in grails plugins portal I found two plugins that could be used to do this.Â  The Jasper Plugin and the DynamicJasper Plugin. Depending on what you really need you&#8217;ll choose one.
I see [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will talk about producing Jasper PDF reports (or any other format you&#8217;d like) in you grails app.Â  I took a look in <a href="http://grails.org/plugins">grails plugins portal</a> I found two plugins that could be used to do this.Â  The <a href="http://grails.org/plugin/jasper">Jasper Plugin</a> and the <a href="http://grails.org/plugin/dynamic-jasper">DynamicJasper Plugin</a>. Depending on what you really need you&#8217;ll choose one.</p>
<p>I see the JasperPlugin as a more customizable plugin since you&#8217;ll use it o link to an existing jasper report (.jrxml / .jasper) you have. You&#8217;ll have some work building it, modeling it and sometimes even &#8220;drawing&#8221; it, but if you really need to do your and just your jasper, I recommend this one (congratulations for the Brazilians responsible for this plugin).</p>
<p>Otherwise (and covered in this tutorial), if you just need a simple report for your domain classes (an poor-but-effective PDF view of your scaffold listing) like I need in one project here, the DynamicJasper Plugin is gonna let you rock!</p>
<p>It&#8217;s a simple, and versatile plugin that generate its output entirely dynamic. This means that you won&#8217;t need to open iReport and show us your drawing skills (as a good programmer, you may suck drawing!).</p>
<p>We&#8217;ll work only with the Entities Report that Dynamic Jasper offer us, if you need complex queries on the reports, I recommend you reading the &#8220;named reports&#8221; in the plugins official documentation.</p>
<p>Are you following me and 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>
<h3>Tutorial Info</h3>
<p>Groovy Version: 1.6<br />
Grails Version: 1.1<br />
Plugin Version: 0.5<br />
Plugin Documentation: <a href="http://grails.org/plugin/dynamic-jasper">http://grails.org/plugin/dynamic-jasper</a><br />
Download: <a href="http://flv.lucastex.com/jasper/agenda.zip">source code </a></p>
<h3>Basic setup</h3>
<p>Well, our example this time will be a simple agenda, so, let&#8217;s create our agenda app, install the dynamic jasper plugin and then create our domain class with some constraints.</p>
<pre class="brush: groovy;">grails create-app agenda
grails install-plugin dynamic-jasper
grails create-domain-class Contact</pre>
<p>Our initial Contact class will be this one</p>
<pre class="brush: groovy;">class Contact {
   String name
   String nickname
   Date bornAt
   String email
   String website
   String phone
   String mobilePhone
   String gender

   static constraints = {
      name(maxLength: 255)
      nickname(nullable: true)
      bornAt(nullable:true)
      email(email:true)
      website(link:true, nullable:true)
      phone()
      mobilePhone()
      gender(inList:[&amp;quot;M&amp;quot;,&amp;quot;F&amp;quot;])
   }
}</pre>
<h3>Running the application and making it reportable</h3>
<p>That&#8217;s it, you can run your application and test it if you want. Now we&#8217;re going to create our first report, the simplest one we can have. To do this just add this code to your domain class:</p>
<pre class="brush: groovy;">static def reportable = [:]</pre>
<p>This <a href="http://groovy.codehaus.org/JN1035-Maps">map notation</a> will tell what fields will be shown in the report and what options of it you&#8217;re configuring. As we do not specified any, all propeties will be there and the default report will be generated.</p>
<p>After this you can visit the report generator url at <a href="http://localhost:8080/agenda/djReport/index?entity=contact">http://localhost:8080/agenda/djReport/index?entity=contact</a> and this will generate a simple report file (no extension, you should add .pdf) of your contacts.</p>
<p>Very very simple, hÃ£!</p>
<h3>More options (personalization)</h3>
<p>Now let&#8217;s configure some basic options of our report. First of all, I&#8217;ll not get all this properties in our agenda report, let&#8217;s get only the main fields (nick, phone, email):</p>
<pre class="brush: groovy;">def static reportable = [
   columns: ['nickname', 'email', 'phone']
]</pre>
<p>You can run again the report, it will be similar to this one:</p>
<p style="text-align: center;"><img class="size-full wp-image-358 aligncenter" title="report" src="http://blog.lucastex.com/wp-content/uploads/2009/04/report.png" alt="report" width="538" height="62" /></p>
<p>Now, there are some other basic options you might want to configure, like the filename, the report title and other stuff:</p>
<p><strong>title</strong>: The report&#8217;s title, by default if you do not set anything it will be &#8220;[entity-name] report&#8221;.<br />
<strong>fileName</strong>: The name that the response file generated will have<br />
<strong>columns</strong>: the columns shown<br />
</p>
<pre class="brush: groovy;">def static reportable = [
   title: 'My agenda',
   fileName: 'agenda',
   columns: ['nickname', 'email', 'phone']
]</pre>
<p><img class="aligncenter size-full wp-image-371" title="Second report" src="http://blog.lucastex.com/wp-content/uploads/2009/04/screen-capture.png" alt="Second report" width="563" height="69" /></p>
<p>This three will help you start in this great plugin. Take a look in the plugin&#8217;s page to see all you can do.</p>
<p>It&#8217;s a simple but powerful plugin, you can adjust all the page layout, group properties, change the column titles, everything that does not involve the usual iReport drawing process.</p>
<h3>Important Note<strong><br />
</strong></h3>
<p>This note may be valid to other plugins either, but since grails 1.1, the installed plugins is not available in the project&#8217;s folder but in your <strong>HOME_DIR/.grails/1.1/projects/&lt;project&gt;/plugins</strong></p>
<p>So, if you want to use advanced configuration of this (and others) plugin, you shoud enter its folder in <strong>~/.grails/1.1/projects/agenda/plugins/</strong>, and get the configuration file of it, (in our case, <strong>DynamicJasperConfig.groovy</strong>) in its conf folder and save in our <strong>agenda/conf</strong> folder.</p>
<p>This file holds all plugin configuration and it can be used to setup the report layout and configure the named reports I said before.</p>
<p>Again, take a look in the plugin page and you&#8217;ll find everything you need! This is just an introduction of the plugin!</p>
<p>[]s,</p>
<p>Are you following me and 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>
]]></content:encoded>
			<wfw:commentRss>http://blog.lucastex.com/2009/04/16/4of25-jasper-reports-in-grails-with-dynamic-jasper/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

