<?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>Piraguablog</title>
	<atom:link href="http://www.piragua.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.piragua.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 28 Jan 2010 12:51:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Building Grails Apps with SVN and Hudson and fighting with application.properties</title>
		<link>http://www.piragua.com/2010/01/27/building-grails-apps-with-svn-and-hudson-and-fighting-with-application-properties/</link>
		<comments>http://www.piragua.com/2010/01/27/building-grails-apps-with-svn-and-hudson-and-fighting-with-application-properties/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 23:24:40 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.piragua.com/?p=40</guid>
		<description><![CDATA[It&#8217;s incredibly easy to set up a Hudson project to build a Grails application with the available Grails plugin for Hudson.  Every once in a while, however, there&#8217;s a little problem that&#8217;s been nagging me &#8211; merge conflicts within that pesky little application.properties file.
There are several things that cause application.properties to get re-written by Grails, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s <a href="http://today.java.net/pub/a/today/2009/06/23/Grails-and-Continuous-Integration.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/today.java.net');">incredibly easy</a> to set up a <a href="http://hudson-ci.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/hudson-ci.org');">Hudson</a> project to build a Grails application with the available Grails plugin for Hudson.  Every once in a while, however, there&#8217;s a little problem that&#8217;s been nagging me &#8211; merge conflicts within that pesky little application.properties file.</p>
<p>There are several things that cause application.properties to get re-written by Grails, the most common of which for me is installing / uninstalling plugins.  Since this is a properties file, the order of the lines is unimportant (they&#8217;re just key value pairs, after all), until your build machine does an &#8217;svn up&#8217; and encounters all sorts of conflicts that can&#8217;t be resolved automagically.<img class="alignright size-medium wp-image-42" title="Option #1 - uncheck that use update box" src="http://www.piragua.com/wp-content/uploads/2010/01/hudsonUseUpdate1-300x205.png" alt="hudsonUseUpdate" width="300" height="205" /></p>
<p>There are two (well, OK, three) ways to workaround this:</p>
<ol>
<li>Tell hudson do to a clean checkout with each build.  To do this just make sure the &#8220;Use update&#8221; box is NOT checked under the subversion modules section of your build configuration.  This works well if your project is relatively small and you have a fast connection to your source code repository.</li>
<li>Revert the application.properties file before the build happens.</li>
<li>Stop using SVN.  Well, I don&#8217;t actually know if other SCMs handle this better, but it wouldn&#8217;t surprise me.  I certainly know of a few that handle it worse!</li>
</ol>
<p>For the most part I&#8217;ve been using option #1 &#8211; until I recently added a very large project to the Hudson build&#8230;  The build time more than doubled &#8211; and that&#8217;s just unacceptable.</p>
<p>Enter Option #2.  In your build configuration, add an &#8220;Execute Shell&#8221; Build Step that happens BEFORE your Grails build that reverts the file so that the workspace always has the latest and greatest &#8211; without conflicts.</p>
<p style="text-align: center;"><img class="aligncenter size-full  wp-image-45" title="buildStep" src="http://www.piragua.com/wp-content/uploads/2010/01/buildStep1.png" alt="buildStep" width="415" height="218" /></p>
<p>Note that depending on how your checkout works, you may need to add the checkout path in front of application.properties, for example:</p>
<blockquote><p>svn revert yourGrailsApp/application.properties</p></blockquote>
<p>If there&#8217;s a better way, I&#8217;d love to hear it.  In the mean time, this extra little build step works great!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piragua.com/2010/01/27/building-grails-apps-with-svn-and-hudson-and-fighting-with-application-properties/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One week with WhenWorksForYou.com</title>
		<link>http://www.piragua.com/2009/07/13/one-week-with-whenworksforyoucom/</link>
		<comments>http://www.piragua.com/2009/07/13/one-week-with-whenworksforyoucom/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 11:25:07 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.piragua.com/?p=37</guid>
		<description><![CDATA[Last week I launched http://www.whenworksforyou.com, a new Grails website that lets you coordinate schedules with other people to find the best date for your next event.  Our first week provided lots of great feedback from users.  One of the biggest gripes was not being able to subscribe to updates on an event.  [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I launched <a href="http://www.whenworksforyou.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.whenworksforyou.com');">http://www.whenworksforyou.com</a>, a new Grails website that lets you coordinate schedules with other people to find the best date for your next event.  Our first week provided lots of great feedback from users.  One of the biggest gripes was not being able to subscribe to updates on an event.  Well, thanks to the <a href="http://grails.org/plugin/feeds" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">feeds</a> and <a href="http://grails.org/plugin/mail" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">mail</a> plugins, now you can!  It was dead simple to implement, and now I can focus my attention on the next feature rather than having to re-invent the wheel on RSS and email.</p>
<p>The site also takes advantage of several other plugins, including</p>
<ul>
<li><a href="http://grails.org/plugin/acegi" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">Spring Security</a></li>
<li><a href="http://grails.org/plugin/ui-performance" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">UI Performance</a></li>
<li><a href="http://grails.org/plugin/recaptcha" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">Recaptcha</a></li>
<li><a href="http://grails.org/plugin/build-test-data" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">Build Test Data</a></li>
<li>Test Code Coverage (of course)</li>
</ul>
<p>Thanks to all the plugin developers who took the time to build and document plugins for the Grails framework!</p>
<p>I also wrote one other plugin that wraps GreenMail and acts as a transient &#8220;Inbox&#8221; for sending emails during development.  I&#8217;m putting the finishing touches on that now, stay tuned for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piragua.com/2009/07/13/one-week-with-whenworksforyoucom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Announcing WhenWorksForYou.com</title>
		<link>http://www.piragua.com/2009/07/05/announcing-whenworksforyoucom/</link>
		<comments>http://www.piragua.com/2009/07/05/announcing-whenworksforyoucom/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 03:06:35 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.piragua.com/?p=36</guid>
		<description><![CDATA[WhenWorksForYou.com allows you to ask your friends exactly that question: &#8220;When works for you?&#8221;   You can easily create an event and enter a few dates that work for you. Then invite your friends to visit the site and let you know which of those options work best for them. Once you have feedback [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://WhenWorksForYou.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/WhenWorksForYou.com');">WhenWorksForYou.com</a> allows you to ask your friends exactly that question: &#8220;When works for you?&#8221;   You can easily create an event and enter a few dates that work for you. Then invite your friends to visit the site and let you know which of those options work best for them. Once you have feedback from your potential guests, you can make a decision on the best date and time to schedule the actual event.  </p>
<p>Check it out and give it a try!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piragua.com/2009/07/05/announcing-whenworksforyoucom/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Grails, p6spy and Sql Profiler</title>
		<link>http://www.piragua.com/2009/06/17/grails-p6spy-and-sql-profiler/</link>
		<comments>http://www.piragua.com/2009/06/17/grails-p6spy-and-sql-profiler/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 04:46:21 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.piragua.com/?p=35</guid>
		<description><![CDATA[There are several ways to have Grails log SQL statements that Hibernate is sending to the database under the covers of GORM.  The first is the loggingSql flag in DataSource.groovy:

loggingSql=true

This will show you the prepared statement that Hibernate is generating, like this:

SELECT
        this_.id AS id6_0_,
    [...]]]></description>
			<content:encoded><![CDATA[<p>There are several ways to have Grails log SQL statements that Hibernate is sending to the database under the covers of GORM.  The first is the loggingSql flag in DataSource.groovy:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy">loggingSql<span style="color: #66cc66;">=</span><span style="color: #000000; font-weight: bold;">true</span></pre></div></div>

<p>This will show you the prepared statement that Hibernate is generating, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span>
        this_.id <span style="color: #993333; font-weight: bold;">AS</span> id6_0_,
        this_.version <span style="color: #993333; font-weight: bold;">AS</span> version6_0_,
        this_.authority <span style="color: #993333; font-weight: bold;">AS</span> authority6_0_,
        this_.description <span style="color: #993333; font-weight: bold;">AS</span> descript4_6_0_
    <span style="color: #993333; font-weight: bold;">FROM</span>
        role this_
    <span style="color: #993333; font-weight: bold;">WHERE</span>
        this_.authority<span style="color: #66cc66;">=</span>?</pre></div></div>

<p>This is a good first step &#8211; but what if I want to see the parameter that is being sent as well?  You could turn logging for the org.hibernate.type package to TRACE level:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy"><span style="color: #808080; font-style: italic;">//in Config.groovy</span>
log4j <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
    trace  <span style="color: #ff0000;">'org.hibernate.type'</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>YIKES!  That gets REALLY noisy, really fast:</p>

<div class="wp_syntax"><div class="code"><pre class="apache">Hibernate:
    select
        this_.id as id6_0_,
        this_.version as version6_0_,
        this_.authority as authority6_0_,
        this_.description as descript4_6_0_
    <span style="color: #00007f;">from</span>
        role this_
    where
        this_.authority=?
TRACE type.StringType  - binding <span style="color: #7f007f;">'ROLE_USER'</span> to parameter: <span style="color: #ff0000;">1</span>
TRACE type.LongType  - returning <span style="color: #7f007f;">'1'</span> as column: id6_0_
TRACE type.LongType  - returning <span style="color: #7f007f;">'1'</span> as column: version6_0_
TRACE type.StringType  - returning <span style="color: #7f007f;">'ROLE_USER'</span> as column: authority6_0_
TRACE type.StringType  - returning <span style="color: #7f007f;">'Default user role'</span> as column: descript4_6_0_</pre></div></div>

<p>Besides, what I really want is the ability to copy and paste a query, with the parameters bound, directly into a SQL editor to execute the query and see the results myself.  Enter the <a href="http://grails.org/plugin/p6spy" onclick="javascript:pageTracker._trackPageview('/outbound/article/grails.org');">p6spy plugin for Grails</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="text">grails install-plugin p6spy</pre></div></div>

<p>Swap the driver in your DataSource.groovy file from your driver to the p6spy driver (the plugin will automatically add this, you just need to comment it in):</p>

<div class="wp_syntax"><div class="code"><pre class="groovy">environments <span style="color: #66cc66;">&#123;</span>
  development <span style="color: #66cc66;">&#123;</span>
    dataSource <span style="color: #66cc66;">&#123;</span>
      <span style="color: #808080; font-style: italic;">//driverClassName = &quot;org.hsqldb.jdbcDriver&quot;</span>
      driverClassName <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;com.p6spy.engine.spy.P6SpyDriver&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Fire up your Grails application &#8211; p6spy will create a spy.log file in your application directory and log a pipe delimited line &#8211; the last column has the actual SQL being executed, with the parameters!</p>

<div class="wp_syntax"><div class="code"><pre class="text">select this_.id as id2_0_, this_.version as version2_0_, this_.authority as authority2_0_, this_.description as descript4_2_0_ from role this_ where this_.authority='ROLE_USER'</pre></div></div>

<p>This is a great start, and most people stop here.  But sometimes there are so many queries being executed that it&#8217;s difficult to wade through spy.log to find the one you&#8217;re looking for.  Thanks to a tip from the excellent <a href="http://www.manning.com/gsmith/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.manning.com');">Grails In Action</a> book that was recently released &#8211; SQL Profiler can help!</p>
<p>Download SQL Profiler (<a href="http://sourceforge.net/projects/sqlprofiler" onclick="javascript:pageTracker._trackPageview('/outbound/article/sourceforge.net');">http://sourceforge.net/projects/sqlprofiler</a>) and add these lines to grails-app/conf/spy.properties:</p>

<div class="wp_syntax"><div class="code"><pre class="text">log4j.appender.SQLPROFILER_CLIENT=org.apache.log4j.net.SocketAppender
log4j.appender.SQLPROFILER_CLIENT.RemoteHost=localhost
log4j.appender.SQLPROFILER_CLIENT.Port=4445
log4j.appender.SQLPROFILER_CLIENT.LocationInfo=true</pre></div></div>

<p>Add the appender to the logger definition:</p>

<div class="wp_syntax"><div class="code"><pre class="text">log4j.logger.p6spy=INFO,STDOUT,SQLPROFILER_CLIENT</pre></div></div>

<p>Finally, make sure the Log4j Appender is enabled:</p>

<div class="wp_syntax"><div class="code"><pre class="text">#specifies the appender to use for logging
appender=com.p6spy.engine.logging.appender.Log4jLogger
#appender=com.p6spy.engine.logging.appender.StdoutLogger
#appender=com.p6spy.engine.logging.appender.FileLogger</pre></div></div>

<p>Then, in the directory in which you downloaded the SQL Profiler jar, launch the GUI with this line:</p>

<div class="wp_syntax"><div class="code"><pre class="text">java -jar sqlprofiler.jar</pre></div></div>

<p>Now, p6spy will log SQL to the SQL Profiler GUI!  You can use it to profile SQL statements, but you can also use the &#8216;Logger&#8217; tab to filter the log.  I click the little trash can icon in the upper left to clear the log, run a test in the application, then filter the results using the filter fields available.  For instance, if I only want to see queries related to the &#8216;ROLE&#8217; table, just put the word &#8216;role&#8217; in the Filter message text box, and you&#8217;ll only see queries related to that table.  It&#8217;s a great way to get straight at a particular SQL query when you&#8217;re drowning in tons and tons of SQL messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piragua.com/2009/06/17/grails-p6spy-and-sql-profiler/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Grails Code Coverage Plugin 1.1.4 Released!</title>
		<link>http://www.piragua.com/2009/03/05/code-coverage-upgrade/</link>
		<comments>http://www.piragua.com/2009/03/05/code-coverage-upgrade/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 03:54:28 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.piragua.com/?p=34</guid>
		<description><![CDATA[The Grails Code Coverage plugin has been upgraded to work with Grails 1.1 RC2.  Please give it a shot and create JIRA issues (http://jira.codehaus.org/browse/GRAILSPLUGINS/component/13147) if you encounter any problems.

This release of the plugin removes the test-app-cobertura script and utilizes changes in Grails 1.1 RC2 to hook into the test-app script instead.  In order to run [...]]]></description>
			<content:encoded><![CDATA[<p>The Grails Code Coverage plugin has been upgraded to work with Grails 1.1 RC2.  Please give it a shot and create JIRA issues (<a href="http://jira.codehaus.org/browse/GRAILSPLUGINS/component/13147" onclick="javascript:pageTracker._trackPageview('/outbound/article/jira.codehaus.org');" target="_blank">http://jira.codehaus.org/browse/GRAILSPLUGINS/component/13147</a>) if you encounter any problems.</p>
<div></div>
<div>This release of the plugin removes the test-app-cobertura script and utilizes changes in Grails 1.1 RC2 to hook into the test-app script instead.  In order to run coverage, simply install the plugin (grails install-plugin code-coverage) and run &#8220;grails test-app&#8221;.  There are several other changes in this release as well:</div>
<div>
<ul>
<li>Upgraded Cobertura to 1.9</li>
<li>Ability to override the default exclusions list</li>
<li>Ability to bypass coverage instrumentation and report generation with the -nocoverage flag (e.g. grails test-app -nocoverage)</li>
</ul>
<div>Full docs available on the Grails.org wiki:  <a href="http://www.grails.org/Test+Code+Coverage+Plugin" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.grails.org');" target="_blank">http://www.grails.org/Test+Code+Coverage+Plugin</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.piragua.com/2009/03/05/code-coverage-upgrade/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
