<?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>Grails Rocks &#187; Grails</title>
	<atom:link href="http://www.anyware.co.uk/2005/tag/grails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anyware.co.uk/2005</link>
	<description>Grails, Apple, usability and world stuff</description>
	<lastBuildDate>Fri, 27 Jan 2012 13:52:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Resources 1.1(.1) plugin released</title>
		<link>http://www.anyware.co.uk/2005/2011/10/21/resources-1-1-1-plugin-released/</link>
		<comments>http://www.anyware.co.uk/2005/2011/10/21/resources-1-1-1-plugin-released/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 00:31:07 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin release]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=1094</guid>
		<description><![CDATA[After a frantic 12 hours or so of coding and debugging, I managed to release version 1.1.1 of the Resources plugin for Grails today. It was meant to be 1.1 but there was a bug that needed fixing immediately after releasing so 1.1.1 is where we&#8217;re at. This version is tested with Grails 1.3.7 and [...]]]></description>
			<content:encoded><![CDATA[<p>After a frantic 12 hours or so of coding and debugging, I managed to release version 1.1.1 of the <a href="http://grails.org/plugin/resources">Resources plugin</a> for <a href="http://grails.org">Grails</a> today.</p>
<p>It was meant to be 1.1 but there was a bug that needed fixing immediately after releasing so 1.1.1 is where we&#8217;re at. This version is tested with Grails 1.3.7 and Grails 2.0 RC1 which is set to drop this weekend.</p>
<p>What&#8217;s new in this release of Resources?</p>
<p>Well aside from some useful bug fixes there&#8217;s a few interesting changes:</p>
<ol>
<li>If you forget to include r:layoutResources tags, you will get an error in the console. The error may or may not display in the browser currently depending on whether you used site mesh layouts or not. We may be able to improve this in future. This means that people who wondered where their JS code was disappearing to after installing Resources into a 2.0 app will now get an error telling them that they need to add r:layoutResources.</li>
<li>There is now support for laying out arbitrary dispositions by passing a &#8220;disposition&#8221; to the r:layoutResources tag. This means you can position sets of resources wherever you like in the output, using multiple dispositions. Currently this is only relevant for JavaScript but in future we should be able to support images so that you can e.g. have a bunch of &#8220;preloaded&#8221; images that are hidden in the page somewhere.</li>
<li>The integration with Grails 2.0 has been &#8220;finalized&#8221; now. The ResourceService has changed to a &#8220;grailsResourceProcessor&#8221; bean, and all g:javascript invocations result in called to r:require or r:script as necessary. The default layouts in 2.0 now use layoutResources and a default &#8220;application&#8221; module exists in new projects.</li>
</ol>
<p>There are still some outstanding important bugs that I will endeavour to fix soon, as well as improving the error reporting on all fronts.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2011/10/21/resources-1-1-1-plugin-released/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Optimising your Application with Grails Resources Plugin</title>
		<link>http://www.anyware.co.uk/2005/2011/09/12/optimising-your-application-with-grails-resources-plugin/</link>
		<comments>http://www.anyware.co.uk/2005/2011/09/12/optimising-your-application-with-grails-resources-plugin/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 20:16:04 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=906</guid>
		<description><![CDATA[It&#8217;s been nearly a year since we first announced the Resources framework for Grails. It&#8217;s about time we looked at some of the more advanced features that it provides so that you can make the most of this very powerful plugin. The start of this article will go over some of the basics again, as [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been nearly a year since we first announced the <a href="http://grails.org/plugin/resources">Resources framework</a> for <a href="http://grails.org">Grails</a>. It&#8217;s about time we looked at some of the more advanced features that it provides so that you can make the most of this very powerful plugin.</p>
<p><span id="more-906"></span>The start of this article will go over some of the basics again, as they are a prerequisite for understanding the more advance topics covered later in the piece.</p>
<h2>Recap: What is Resources framework for?</h2>
<p style="text-align: center;"><a class="lightbox" href="http://www.anyware.co.uk/2005/wp-content/uploads/2011/09/Resources-article-diagram.png?9d7bd4"><img class="size-full wp-image-968 aligncenter" title="Resources article diagram" src="http://www.anyware.co.uk/2005/wp-content/uploads/2011/09/Resources-article-diagram.png?9d7bd4" alt="" width="464" height="216" /></a></p>
<p>It solves the growing problems around application and plugin static resources. Your CSS, JS and other files have dependencies on each other, and must load in the correct order. You also want to optimize these so that your application loads quickly and caches well for your users.</p>
<p>It provides a way to declare your resources, their dependencies, and a processing chain to modify the resources and response headers to perform all manner of tasks such as bundling multiple resource files into one file, zipping the response, applying long-term client-side caching, or compiling Less or Sass files to regular CSS on the fly.</p>
<h2>Where do I start?</h2>
<p>First you install the &#8220;<a href="http://grails.org/plugin/resources">resources</a>&#8221; plugin. To actually see some magic happening you probably want to also install the <a href="http://grails.org/plugin/cached-resources">cached-resources</a> and/or <a href="http://grails.org/plugin/zipped-resources">zipped-resources</a> plugins also, but this is not a requirement.</p>
<p>Then you declare some resources in your app, or pull some in from a plugin that supports Resources. Let&#8217;s start by declaring a resource that exists in your application, say main.css. To do this you create a file in <strong>grails-app/conf/</strong> with a name that ends in &#8220;<strong>Resources.groovy</strong>&#8220;. So we might create <strong>AppResources.groovy</strong> and use the DSL to declare the resource:</p>
<script src="https://gist.github.com/1211514.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211514">Gist</a>.</p></noscript>
<p>This is a module declaration. For full details see the <a href="http://grails-plugins.github.com/grails-resources">Resources documentation</a>, but in essence this declares a resource module called &#8220;common&#8221; and it has one CSS resource in it, the file supplied by your application in <strong>web-app/css/main.css</strong>, and on JS file.</p>
<p>So far, so good. Now you need to pull this resource into a page. To do this requires using some Resources tags.</p>
<h2>Using resources in your pages</h2>
<p>There are two main tags involved in using resources, with some others that provide extra features. The main two are <strong>r:require</strong> and <strong>r:layoutResources</strong>.</p>
<p>The <strong>r:require</strong> tag tells the framework which resource modules the current GSP requires. The framework will make sure that all the resources declared in those modules are pulled in in the correct order.</p>
<p>To achieve this, you need to include <strong>r:layoutResources</strong> tags in your &lt;head&gt; and &lt;body&gt; sections. Typically you do this in your SiteMesh layout. You use two calls because one will render the resources that you need to link to in the &lt;head&gt; section of your page (all your CSS, and some of your JavaScript, maybe some favico or iPhone icons). The other goes at the end of the &lt;body&gt; of your page, to render any &#8220;deferred&#8221; resources, which is usually just your JavaScript code.</p>
<p>So here&#8217;s an example of a Grails Sitemesh layout using these tags:</p>
<script src="https://gist.github.com/1211550.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211550">Gist</a>.</p></noscript>
<p>Here you see that you still use the normal Grails sitemesh tags to layout the head and body. These provide the route for you GSP page to actually affect the output, including the output of the Resources plugin&#8217;s <strong>r:layoutResources</strong> tags. That&#8217;s because your GSP will call <strong>r:require</strong> and <strong>r:script</strong> tags something like this:</p>
<script src="https://gist.github.com/1211555.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211555">Gist</a>.</p></noscript>
<p>This GSP is set to use a Sitemesh layout like the example one given earlier. It uses the <strong>r:require</strong> tag to say that this page needs the &#8220;app&#8221; resource module. Using this information, the <strong>r:layoutResources</strong> tags will render links to all the CSS, JS and other resources of that &#8220;common&#8221; module, in the correct places.</p>
<p>This means that some may end up in head, and some may end up in body. Remember that we invoked <strong>r:layoutResources</strong> twice, once in each location? Well, that&#8217;s why.</p>
<h2>What is this &#8220;disposition&#8221; stuff?</h2>
<p>The disposition of a resource tells the framework which part of the page it belongs &#8211; its a form of arbitrary grouping. The default dispositions supported are &#8220;head&#8221; and &#8220;defer&#8221; but in fact resources can define any disposition they like &#8211; and this can be useful for declaring resources that are not rendered by the normal layoutResources calls (more about this later).</p>
<p>The framework applies a default disposition based on the type of the resource &#8211; so CSS always defaults to &#8220;head&#8221; but JavaScript always defaults to &#8220;defer&#8221;, so that it runs only when the rest of the page has loaded. Images and icons are also supported to represent favicon and iPhone icons, which render in &#8220;head&#8221;.</p>
<p>Resource modules usually contain multiple resources and the main reason to specify a disposition when declaring a resource is to force JavaScript to load in the &lt;head&gt; section of the page. To achieve that you just update your resource declaration to include a &#8220;disposition&#8221; attribute:</p>
<script src="https://gist.github.com/1211561.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211561">Gist</a>.</p></noscript>
<p>Now your page will load with jQuery in the head section, with no code changes to your layout or GSP!</p>
<h2>Dependencies</h2>
<p>So far, so good but how do we control the order of resources when they are pulled into the page? How can I make sure that my application JS or CSS code always loads after the JS and CSS from a plugin that I&#8217;m using?</p>
<p>This is where Resources dependencies come in. There are two simple rules</p>
<ol>
<li>Resources from a given module are loaded in the order they are defined in the module</li>
<li>Resources from modules are loaded in module dependency order</li>
</ol>
<p>The first rule ensures that when you declare resources you can intuitively see which CSS or JS loads before another.</p>
<p>The second rule uses the &#8220;dependsOn&#8221; method in module declarations to list the names of other resource modules on which the module depends. Those will always be loaded before the module that depends on them. Here&#8217;s an example declaration that alters our specimen module to depend on the jQuery plugin&#8217;s query module instead, and jQuery UI:</p>
<script src="https://gist.github.com/1211581.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211581">Gist</a>.</p></noscript>
<p>Notice that we have specified both jQuery UI and jQuery in the dependsOn. We don&#8217;t need to. However notice that they are also declared in the &#8220;wrong&#8221; order. This is to illustrate that the order you use here is not important &#8211; the &#8216;jquery-ui&#8217; module declared by the Grails jQueryUI plugin depends on on &#8216;jquery&#8217; (provided by the Grails jQuery plugin) as well &#8211; so it will always make sure that is loaded first.</p>
<p>As your application does not define those two modules, you would need to install the Grails jQuery-UI plugin &#8211; or define them yourself. Including the jQuery-UI plugin automatically pulls in the jQuery plugin for you, because of Grails&#8217; transitive plugin dependencies. TheResources framework was designed to work hand in hand with the other Grails dependency mechanisms.</p>
<p>So now you have done this, you still have no changes to make to your GSP! It still just requires the &#8220;common&#8221; module. Notice how this has decoupled your GSPs and layouts from the details of the resources that they need. This is an important feature that gives you great scope to modularise your resources, and even have page-specific modules if you like that contain nothing other than dependencies themselves:</p>
<script src="https://gist.github.com/1211564.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211564">Gist</a>.</p></noscript>
<p>With this, an edit.gsp could just <strong>r:require</strong> the &#8220;editPage&#8221; module and never care about the explicit details of what is required.</p>
<h2>Dealing with your ugly inline Javascript</h2>
<p>You already know that inline Javascript is pretty horrendous, but some things are just plain shameful and yet we can&#8217;t help ourselves. Frequently you want to write a Grails taglib that simplifies using a JS library and to do that it must render some code inline when the tag is invoked.</p>
<p>With Resources you can trivially throw this JS code around to wherever you like. You can have the code render in &lt;head&gt; or at the end of the body, and it will automatically do so after loading the resources that the page depends on. To do this you just use the &lt;<strong>r:script</strong>&gt; tag instead of a normal &lt;script&gt; or &lt;g:javascript&gt; tag:</p>
<script src="https://gist.github.com/1211607.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211607">Gist</a>.</p></noscript>
<p>In this example the script code specified in &lt;head&gt; <em>does not run immediately</em>. The <strong>r:script</strong> tag also uses &#8220;disposition&#8221; and the default is &#8220;defer&#8221; so you will find that the alert only pops up once the rest of the page has loaded, and the HTML source will show the &lt;script&gt; tag at the end of the body, after all other deferred JS code has been pulled in.</p>
<p>All such fragments in the same disposition are concatenated together, so you don&#8217;t get a long list of &lt;script&gt; tags.</p>
<p>To force a fragment of inline JS to execute in &lt;head&gt;, just add <strong>disposition=&#8221;head&#8221;</strong> to the <strong>r:script</strong> tag invocation.</p>
<p>To write your own taglibs that generate code in this way, you just output the result of calling the <strong>r.script(attrs, Closure)</strong> tag from your tag.</p>
<h2>Linking to images</h2>
<p>Images often need to be optimised or set for long-term caching. However you don&#8217;t normally need to declare them in modules. To render images correctly you should use the <strong>&lt;r:img&gt;</strong> tag anywhere in your pages as you would and HTML &lt;img&gt; tag. All you do differently is supply a uri or dir/file attribute to tell it where to load from. Other attributes are passed through:</p>
<script src="https://gist.github.com/1211623.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211623">Gist</a>.</p></noscript>
<p>That&#8217;s all there is to it.</p>
<p>There are however some extra tricks you can pull. Any tag attributes specified in a module resource declaration are honoured when rendering the link. As such this means that you can specify your width &amp; height values if you declare your image &#8211; and never have to specify them when rendering links:</p>
<script src="https://gist.github.com/1211626.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211626">Gist</a>.</p></noscript>
<p>Now any <strong>r:img</strong> links to that logo will automatically include those attributes in the output. Notice that we had to include the disposition &#8220;image&#8221; which is not a predefined disposition &#8211; it is just anything other than &#8220;head&#8221; or &#8220;defer&#8221; to prevent the image being rendered by the <strong>r:layoutResources</strong> tags.</p>
<h2>Bundling: combining files to reduce the number of requests</h2>
<p>Page load time is a combination of many factors. Those that you can control from your application itself include how many requests are needed to load your page and whether you load resource before or after your HTML content.</p>
<p>To reduce the number of requests made, you need to combine one or more resources into a single file. This is called bundling and what you do is tell Resource which files can be bundled together. This is usually dependent on how your application uses the code, and inevitably requires some compromise.</p>
<p>For example you <em>could</em> bundle all your resources into one file across your entire app &#8211; resulting in just one CSS and one JS file for the entire site. With aggressive browser caching this could yield good results, but if you have a few hundred KB of code in these files it could mean it takes a long time for people to see your site the first time they visit or empty their cache.</p>
<p>To specify the bundle that a file belongs to, just add the &#8220;bundle&#8221; attribute to resource declarations. The Resources framework will not bundle together resources that are incompatible: different content types, or those with differing &#8220;attrs&#8221;. For example CSS with <strong>media=&#8217;print&#8217;</strong> will not be bundled with screen media.</p>
<p>It does however allow you to bundle resources <em>across module boundaries</em>. This is important as you will see shortly. It also automatically bundles using the module name by default, and maintains separate bundled files for head and defer dispositions automatically.</p>
<p>That is a lot to take in, but it basically means you don&#8217;t need to worry about anything.</p>
<p>Just set the bundle attribute:</p>
<script src="https://gist.github.com/1211629.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211629">Gist</a>.</p></noscript>
<p>Here the <strong>main.css</strong>, which previously might have auto-bundled into bundle &#8220;common&#8221; if there was more than one resource in the module, will now be bundled into bundle &#8220;core&#8221;.</p>
<p>The difference has no effect for now, but what you can do is override the module declarations that came from the jQuery plugins and make them go into the same bundle. To do this we use the &#8220;overrides&#8221; mechanism to change the properties of the resource modules supplied by the plugins. We can call the <strong>defaultBundle</strong> method to change the default used by them:</p>
<script src="https://gist.github.com/1211633.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211633">Gist</a>.</p></noscript>
<p>Now all the modules will throw their resources together, and you will find your page (again with zero GSP changes) is now pulling in just three files: bundle_core_head.js, bundle_core_head.css and bundle_core_defer.js</p>
<p><span class="Apple-style-span" style="font-size: 20px; font-weight: bold;">Changing how links to resources are rendered</span></p>
<p>Under the hood, the <strong>r:layoutResources</strong> tag uses the <strong>r:external</strong> tag to render links. The <strong>r:external</strong> tag is a smart tag that writes out the &#8220;right kind&#8221; of link for a resource. So for JS files it renders &lt;script src=&#8230;&gt; tags, for CSS it renders &lt;link href=&#8230;&gt;, and so on for favicons and a few other types.</p>
<p>The key thing is that you can pass any other attributes to <strong>r:external</strong> and they will pass through to the output. It so happens that <strong>r:layoutResources</strong> pass the &#8220;attrs&#8221; Map defined in your resource declaration when calling <strong>r:external</strong> for that resource. This means you can pass any extra attributes you like to the declaration and they make it to the output.</p>
<p>A typical usage for this is to specify media:&#8217;print&#8217; on a CSS resource, because the default for this is &#8220;screen, projection&#8221;:</p>
<script src="https://gist.github.com/1211639.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211639">Gist</a>.</p></noscript>
<p>Note that if you specify these extra properties, those files will not be bundled with others, as by definition this isn&#8217;t going to work out well for you.</p>
<h2>Wrapping the link in some other code. AKA MS IE workarounds</h2>
<p>The resource declaration can also supply some wrapper markup that is used to render the link, with the generated link being passed in as a string. You normally use this to wrap a resource such that it is commented out for all browsers except MS IE:</p>
<script src="https://gist.github.com/1211648.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211648">Gist</a>.</p></noscript>
<p>The wrapper Closure is passed the link text as an argument. You are then free to pre/post-fix it with anything you like.</p>
<h2>Linking to specific resources without using the dependency mechanisms</h2>
<p>On occasion you may need to link directly to a resource that is handled by the framework, without using <strong>r:layoutResources</strong> or <strong>r:require</strong>.</p>
<p>To do this you can use <strong>r:resource</strong> to get the URL of a resource, or <strong>r:external</strong> to create a link to it. You can use these to generate absolute links to those resources, for example in an HTML email.</p>
<p>These tags accept the regular uri, url or plugin/file/dir attributes. The <strong>r:external</strong> tag also supports a &#8220;type&#8221; attribute to give it a clue what kind of link to render if it is not obvious from the file extension.</p>
<h2>Overriding resources from plugins</h2>
<p>Plugins that expose modules normally do the right thing, but sometimes you might need to supply different content for a given file, or change some of the tag attributes or the bundle used. To do this you use the overrides mechanism shown earlier in the <strong>defaultBundle</strong> example.</p>
<p>The &#8220;overrides&#8221; closure lets you specify new values for some of the module defaults for a given module, but also lets you tweak individual resources if they can be addressed uniquely. Developers must add an &#8220;id&#8221; attribute to the resource when it is declared for this to work:</p>
<script src="https://gist.github.com/1211650.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211650">Gist</a>.</p></noscript>
<p>This changes the bundle on just the resources with id &#8220;js&#8221; in the original jquery module. There might be one or more resources with that id in the module. Resources in other modules are unaffected.</p>
<p>For full details of what you can override, please see the <a href="http://grails-plugins.github.com/grails-resources">Resources plugin documentation</a>.</p>
<h2>Using r:require in GSP fragments</h2>
<p>Using g:render to render GSP templates to build up your pages is a powerful technique. What you may not have realised is that you can completely modularise these templates now because the enclosing GSP no longer needs to know what libraries they need.</p>
<p>Yes, you can call <strong>r:require</strong> at any time in GSP rendering &#8211; including inside nested GSP templates &#8211; and the dependencies of your code will be stored along with your request and the resources all tallied up when the <strong>r:layoutResources</strong> called in your Sitemesh layout execute.</p>
<p>The only pre-requisite is that your <strong>r:require</strong> must be invoked before the corresponding <strong>r:layoutResources</strong> that you&#8217;d like to use to render it.</p>
<p>Picture how easy it is now to create portlet-like user interfaces where only the resources needed by UI elements displayed to the user will be loaded, and when they are they will be optimised. The portlets they have not installed or disabled will not load their resources if you do not render their GSP template.</p>
<h2>Dynamic requirements</h2>
<p>It is important to realise that the <strong>r:require</strong> tag can support normal GSP EL values in the modules list attribute. This brings great power because you can change the code pulled in by a page at runtime. For example you can make yourself a trivial per-user theme-switching system by storing the name of the theme they want to use in the session, and using a tag like this:</p>
<script src="https://gist.github.com/1211652.js"></script><noscript><p>View the code on <a href="https://gist.github.com/1211652">Gist</a>.</p></noscript>
<p>This will locate the theme module and all its dependencies with no further coding.</p>
<p>You could even switch the entire JS library and supporting code used by your plugin&#8217;s UI so that, for example, the user could choose between jQuery UI or YUI, or their own implementation.</p>
<h2>Including common resources in your layout</h2>
<p>Most likely you have some resources that are used in all pages using your Sitemesh layout. This is no problem because you can call <strong>r:require</strong> inside your Sitemesh layout, with the same proviso as &#8220;Using <strong>r:require</strong> in GSP fragments&#8221; &#8211; they must be invoked before the <strong>r:layoutResources</strong> call that would render them.</p>
<p>This means that in practice your individual GSP pages are likely to have only one or two module requirements as the rest is handled by the Sitemesh layout.</p>
<h2>Patterns for plugin authors</h2>
<p>Here are a few emerging patterns for plugin developers to heed when supporting the resources plugin.</p>
<ul>
<li>Specify id attributes on your resources when declaring them, to maximise the user&#8217;s opportunity to override specific details</li>
<li>Avoid monolithic modules, opting were possible to separate out functional areas such as the jQuery UI theme being separate from the jQuery UI code. This gives developers more flexibility. Obviously you must maintain correct dependencies between these</li>
<li>Put &#8220;development&#8221; un-minified versions of resources in &#8220;&lt;yourmodulename&gt;-dev&#8221; modules, so the user can pull in un-minified versions on demand, per-environment if they wish</li>
<li>Do not specify the bundling of your modules &#8211; at most use defaultBundle. No per-resource bundle attributes. Let the developer control this easily by overriding your defaultBundle settings in each module.</li>
<li>Use module names prefixed with the name of your plugin followed by a hyphen i.e. &#8220;jquery-main&#8221;, &#8220;myplugin-theme&#8221;, &#8220;acmeplugin-ui-styling&#8221;</li>
</ul>
<h2>Summing up</h2>
<p>All the things we&#8217;ve tackled here are core <a href="http://grails.org/plugin/resources">Resources</a> framework features &#8211; no extra plugins are required. The resource mapper that performs bundling is even built into the framework.</p>
<p>The real fun starts when you install some of the other mapper plugins &#8211; they may be renamed, re-encoded or even compiled from one form into another. It all happens at startup for declared resources, and at runtime for ad-hoc resources. Once it&#8217;s been done it is stored on disk on the server in that state and no more processing is done.</p>
<p>I hope you have fun with the Resources framework!</p>
<p>There are some nice refinements and maybe some new features coming in point releases at the time of writing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2011/09/12/optimising-your-application-with-grails-resources-plugin/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How we use Weceem CMS at NoticeLocal</title>
		<link>http://www.anyware.co.uk/2005/2011/02/15/how-we-use-weceem-cms-at-noticelocal/</link>
		<comments>http://www.anyware.co.uk/2005/2011/02/15/how-we-use-weceem-cms-at-noticelocal/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 21:24:01 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[noticelocal]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[startup]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=782</guid>
		<description><![CDATA[We have an online notice boards startup called NoticeLocal that we&#8217;ve written with Grails. In my experience over the years it became obvious that one of the major pain-points of using Java to deploy web apps is the hassle of updating a bit of content here or there, replacing an image &#8211; those kinds of [...]]]></description>
			<content:encoded><![CDATA[<p>We have an <a href="http://noticelocal.com">online notice boards startup called NoticeLocal</a> that we&#8217;ve written with <a href="http://grails.org">Grails</a>.</p>
<p>In my experience over the years it became obvious that one of the major pain-points of using Java to deploy web apps is the hassle of updating a bit of content here or there, replacing an image &#8211; those kinds of things that should be simple but aren&#8217;t. Also a lot of the time this stuff is not subject to the same strict versioning processes that we are using for our code.</p>
<p>As you may know I am paid to work on the <a href="http://weceem.org">Weceem CMS plugin</a> and application, that is also Grails based.</p>
<p>For NoticeLocal I decided that it would suit us well to use an instance of Weceem CMS running on one Tomcat, to supply the marketing/PR site for the service, as well as the multi-language content for UI elements in the main application.</p>
<p>It turned out this was really easy to do, even though Weceem currently has no API to speak of.</p>
<p>To do this we:</p>
<ol>
<li>Have a vanilla WeceemApp WAR running in one Tomcat instance</li>
<li>Have our NoticeLocal application WAR running in another Tomcat instance</li>
<li>Wrote a trivial taglib in the NoticeLocal application to retrieve content nodes from the CMS instance using vanilla HTTP requests to URLs with a predefined prefix, and stores the text them in a local ehcache.</li>
</ol>
<p>So, in Weceem we have a bunch of HTML content nodes that represent different elements of the main NoticeLocal app&#8217;s UI &#8211; we have several different Weceem templates that these different nodes use &#8211; e.g. one for side panels, one for full page content (but laid out inside the main NoticeLocal app sitemesh layout, and one for inline UI messages such as those shown on demand when the user performs some action.</p>
<p>So in our NoticeLocal application we use our taglib to render a &#8220;remote CMS message&#8221; in our pages using the not-so-well-known Grails/SiteMesh g:applyLayout tag that, just like Grails layouts, will parse out the body of the content that we&#8217;ve cached, and render it in situ.</p>
<p>Oh, and for bonus points we use a simple regex replace to give us GSP-like variable expansion when rendering the content from the local cache, so we can perform variable substitutions like ${userName} &#8211; so you can write that in a HTML node in Weceem, and by the time the NoticeLocal app renders it, it has your name in it.</p>
<p>At any point we can log into the CMS, update some UI message, and when the cache expires the users see the new updated stuff. No app redeploys.</p>
<p>Oh, and because its in a CMS we solve the hard problem &#8211; i18n translations of rich content with styling, images etc.</p>
<p>In a nutshell, it&#8217;s great!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2011/02/15/how-we-use-weceem-cms-at-noticelocal/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Smart ETag and Last-Modified handling with cache-headers plugin</title>
		<link>http://www.anyware.co.uk/2005/2010/10/26/smart-etag-and-last-modified-handling-with-cache-headers-plugin/</link>
		<comments>http://www.anyware.co.uk/2005/2010/10/26/smart-etag-and-last-modified-handling-with-cache-headers-plugin/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 15:30:05 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=740</guid>
		<description><![CDATA[I&#8217;ve been working on the next release of Weceem CMS these last few weeks and one of the issues to tackle was that Weceem was not setting any of the useful response headers used by browsers and intermediate proxies/caches. This obviously needed improvement, and this tied in well to work I had already done on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on the next release of <a href="http://weceem.org">Weceem CMS</a> these last few weeks and one of the issues to tackle was that Weceem was not setting any of the useful response headers used by browsers and intermediate proxies/caches.</p>
<p><span id="more-740"></span>This obviously needed improvement, and this tied in well to work I had already done on the small but beautiful Grails <a href="http://grails.org/plugin/cache-headers">cache-headers</a> plugin.</p>
<p>The problem: with a CMS you generally can&#8217;t make the client cache any content, not without some config for the CMS author/administrator to specify how long to cache it for &#8211; this is a problem we will tackle later. However at the very least you want to avoid re-generating content when requested if the client already has the same content.</p>
<p>The solution: Implement ETag and Last-Modified handling correctly so that when you receive requests with If-None-Match or If-Modified-Since you can return &#8220;304 Not Modified&#8221; if the content is the same as that the client last downloaded. This can give you major improvements in client response time and also server load, even in applications with highly dynamic content.</p>
<p>The thing is, implementing this from scratch in every <a href="http://grails.org">Grails</a> controller action you have is rather dull.</p>
<p>So in steps the new <strong>withCacheHeaders</strong> method in the <a href="http://grails.org/plugin/cache-headers">Cache-Headers plugin</a>. This method works a little like Grails&#8217; excellent withFormat method, using a simple DSL to specify:</p>
<ul>
<li>How to generate the ETag for this request</li>
<li>How to calculate the Last-Modified date for this request</li>
<li>How to render the response, if we need to do this because the content has changed since the client last downloaded it.</li>
</ul>
<p>Using this information that you provide, the cache-headers plugin will automatically work out if it can return &#8220;304 Not Modified&#8221; or if it has to render your response for you.</p>
<p>Here&#8217;s a working example from Weceem&#8217;s content rendering controller:<br />
<script type="text/javascript" src="https://gist.github.com/1195792.js">// < ![CDATA[
// < ![CDATA[
// < ![CDATA[</p>
<p>// ]]&gt;</script></p>
<p>As you can see there are three &#8220;method&#8221; calls inside the withCacheHeaders call: etag, lastModified and generate. You simply implement these and the plugin handles the rest.</p>
<p>In the &#8220;generate&#8221; closure we&#8217;re also calling the lastModified method added to controller actions by the cache-headers plugin. This lets us easily set the Last-Modified header of the response, and then we make a token effort at setting client/proxy caching headers with the &#8220;cache&#8221; method. This will be subject to later refinement.</p>
<p>For more details <a href="http://grails.org/plugin/cache-headers">see the docs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2010/10/26/smart-etag-and-last-modified-handling-with-cache-headers-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Javascript and CSS frameworks in Grails plugins</title>
		<link>http://www.anyware.co.uk/2005/2010/04/26/javascript-and-css-frameworks-in-grails-plugins/</link>
		<comments>http://www.anyware.co.uk/2005/2010/04/26/javascript-and-css-frameworks-in-grails-plugins/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 20:38:24 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/2010/04/26/javascript-and-css-frameworks-in-grails-plugins/</guid>
		<description><![CDATA[The Weceem CMS plugin for Grails uses the Blueprint CSS framework, jQuery and jQuery UI Javascript libraries. As the Grails plugin marketplace continues to mature, other plugins will have more polished user interfaces or reusable tags that require certain libraries. This raises an ugly prospect: a new resource dependency problem. Only unlike java dependency problems [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://weceem.org">Weceem CMS plugin</a> for <a href="http://grails.org">Grails</a> uses the <a href="http://blueprintcss.org">Blueprint CSS framework</a>, <a href="http://jquery.com">jQuery</a> and <a href="http://jqueryui.com">jQuery UI</a> Javascript libraries. As the Grails plugin marketplace continues to mature, other plugins will have more polished user interfaces or reusable tags that require certain libraries.</p>
<p>This raises an ugly prospect: a new resource dependency problem. Only unlike java dependency problems this is worse as you end up with multiple copies of resources in your app, even if they are the same version because plugins will typically bundle the resources themselves. Your app may add some of these too and your site becomes slow to load or experiences failures related to clashing library versions.</p>
<p>There is however a staggeringly simple solution to this: lightweight Grails plugins that contain the resources.</p>
<p>Thanks to Grails&#8217; automatic dependency resolution we (the grails community) can just create plugins to wrap up each such library and then we just make any apps or plugins that require them depend on them by installing the library plugin or adding it to the dependsOn clause of other plugins.</p>
<p>An important caveat here is that the library plugins need to use version numbers matching the version of the library they encapsulate. Then if you want jQuery 1.4.2 you depend on/install grails-jquery version 1.4.2 or higher. The grails-jquery plugin authors have already done this.</p>
<p>These plugins should implement a simple tag called &#8220;resources&#8221; in an appropriate namespace e.g.  or .</p>
<p>I strongly believe that such plugins should NOT include other tags or more heavyweight tags wrapping up library features &#8211; do that in another plugin e.g. &#8220;grails-jquery-tools&#8221;.</p>
<p>This approach does provide new challenges for optimizing static content &#8211; minifying JS and CSS and including only required modules from a larger library remains awkward as it is today with non-dependency solutions.</p>
<p>Ultimately I think we need smarter solutions than those currently in use to solve this. I have some ideas forming&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2010/04/26/javascript-and-css-frameworks-in-grails-plugins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My JAX London 2010 talk now online in video form</title>
		<link>http://www.anyware.co.uk/2005/2010/02/25/my-jax-london-2010-talk-now-online-in-video-form/</link>
		<comments>http://www.anyware.co.uk/2005/2010/02/25/my-jax-london-2010-talk-now-online-in-video-form/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 14:29:16 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=692</guid>
		<description><![CDATA[I delivered my talk &#8220;Yes you CAN use Grails&#8221; yesterday at JAX London 2010, and it was well received. Unfortunately nobody was videoing it, and as the slides are &#8220;Presentation Zen&#8221; style you won&#8217;t get much from the official slides from JAX. It talks about Grails basics and how Grails is the perfect fit for [...]]]></description>
			<content:encoded><![CDATA[<p>I delivered my talk &#8220;Yes you CAN use Grails&#8221; yesterday at JAX London 2010, and it was well received. Unfortunately nobody was videoing it, and as the slides are &#8220;Presentation Zen&#8221; style you won&#8217;t get much from the official slides from JAX. It talks about Grails basics and how Grails is the perfect fit for existing Java development shops, and the things you need to know to make it possible to use it in your workplace. Well, at least you can try.</p>
<p>So I recorded myself doing the talk here at home and have uploaded a screencast of it all for those of you who are interested. Its not so good the second try &#8211; you had to be there for the best version <img src="http://www.anyware.co.uk/2005/wp-includes/images/smilies/icon_smile.gif?9d7bd4" alt=':)' class='wp-smiley' /> </p>
<p>Click the thumbnail to download the MOV. Its about 47 minutes. Its probably going to cost me a fortune having it on Amazon S3!</p>
<p><a href="http://s3.amazonaws.com/AnyWare/Blog/Screencasts/Yes%20You%20CAN%20Use%20Grails.mov"><img class="alignnone size-full wp-image-687" title="Yes you CAN use Grails" src="http://www.anyware.co.uk/2005/wp-content/uploads/2008/09/Yes-you-CAN-use-Grails.003.png?9d7bd4" alt="" width="200" height="150" /></a></p>
<p><a href="http://s3.amazonaws.com/AnyWare/Blog/Screencasts/Yes%20You%20CAN%20Use%20Grails.mov"></a>Also <a href="http://s3.amazonaws.com/AnyWare/Blog/Screencasts/Yes%20You%20CAN%20Use%20Grails.mov?torrent">available as a torrent</a>.</p>
<p>People interested in making the case for Grails may be interested in an older post of mine that I&#8217;d completely forgotten about &#8211; <a href="http://www.anyware.co.uk/2005/2007/07/02/10-common-misconceptions-about-grails/">&#8220;10 common misconceptions about Grails&#8221;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2010/02/25/my-jax-london-2010-talk-now-online-in-video-form/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Weceem 0.8 Released &#8211; Highlights and background</title>
		<link>http://www.anyware.co.uk/2005/2010/01/12/weceem-0-8-released-highlights-and-background/</link>
		<comments>http://www.anyware.co.uk/2005/2010/01/12/weceem-0-8-released-highlights-and-background/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 14:01:02 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[weceem]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=670</guid>
		<description><![CDATA[I&#8217;ve just managed to push out version 0.8 of the Weceem CMS for Grails. This is a pretty cool if slightly unglamourous release because it has focussed on some performance and security stuff &#8211; oh and compatibility with the latest and greatest Grails 1.2.0 release. Let me first apologise for the ropey typography on weceem.org [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just managed to push out version <a href="http://weceem.org">0.8 of the Weceem CMS</a> for Grails.</p>
<p>This is a pretty cool if slightly unglamourous release because it has focussed on some performance and security stuff &#8211; oh and compatibility with the <a href="http://grails.org">latest and greatest Grails 1.2.0 release</a>.</p>
<p>Let me first apologise for the ropey typography on weceem.org &#8211; we haven&#8217;t yet had the time/resources to fix up the CSS styles so things are a little ugly in places. We will fix it as soon as we get time!</p>
<p>Anyway, we added a security policy. This is a groovy script (currently only loaded once at startup) that lets you define what different users can do. This uses a DSL that lets you declare roles and then say what they can do in different spaces, including whether they can admin the space, edit/view/delete/create content, and even do this by URI requested. (<a href="http://www.weceem.org/weceem/Documentation/Reference-manual/Security-Authorisation">see more info and example here</a>)</p>
<p>Because we believe strongly that Weceem should not force you to use a particular authentication library, we had to decouple the policy mechanism from authentication. As a result these roles are completely uninterpreted by Weceem. To integrate and authentication system all you have to be able to do is provide the name, email, login and list of roles for the currently logged-in user. (<a href="http://www.weceem.org/weceem/Documentation/Reference-manual/Security-Custom-Authentication">an example here</a>)</p>
<p>This has enabled some cool stuff in <a href="http://fisheye.codehaus.org/browse/grails-plugins/grails-weceem/tags/RELEASE_0_8/grails-app/services/org/weceem/services/WeceemSecurityService.groovy?r=HEAD">WeceemSecurityService</a> which relies on the security policy. The service has utility methods for implementing our security logic, e.g. isUserAllowedToViewContent(Content c). For example in previous versions of Weceem you could not preview content if it was not in a publicContent status (eg not Published).</p>
<p>Thankfully from version 0.8, anybody who has the EDIT permission can view non-published content. the default security policy ensures that the default administrator account has EDIT permission, so you can preview away as much as you like. We plan future updates to this to allow the security policy to control who can manipulate different types of content, which will be really powerful for people using custom content types.</p>
<p>On the performance front, it became obvious that something needed to be done because the default &#8220;index&#8221; page installed by <a href="http://weceem.org">Weceem</a> into new spaces was resulting in huge amounts of SQL queries for a single page.</p>
<p>This is because the page is made up like this:</p>
<ul>
<li>It pulls in a Template node for the styling</li>
<li>It pulls in three Widgets for reusable HEAD section tags and header and footer</li>
<li>The header widget iterates over all root content nodes and their children to render the menu with the wcm:menu tag</li>
<li>The page itself links to various StyleSheet and JavaScript nodes to pull in styling and scripts &#8211; these are processed on separate requests but still add to the overall burden of the page</li>
</ul>
<p>This can result in a lot of SQL chatter because we have (rightly so) made no effort to optimize this until now.</p>
<p>There are a couple of areas here that would make a big difference to the SQL traffic.</p>
<p>It is very important to realise that turning on the 2nd level cache in your Grails app&#8217;s GORM configuration does not magically give you major performance improvements. My understanding of this rather complex area (which frankly I found very disappointing) is:</p>
<ul>
<li>The 2nd level cache is only used for retrieval by object id. This is very important</li>
<li>The query caches are used to cache the ids of objects returned for a given query</li>
<li>Query caches are invalidated frequently by Hibernate if your model is not primarily read-only (<a href="http://tech.puredanger.com/2009/07/10/hibernate-query-cache/">and can cause some threading contention</a>)</li>
</ul>
<p>Luckily a CMS is pretty read-only in terms of number of requests that actually read vs update content, so the 2nd level cache is a good candidate for us here.</p>
<p>One of the major SQL hits for Weceem is resolving a URI to the ultimate content node to render. Due to the model we need to query for each part of the URI, so a request for /a/b/c results in three selects. So that&#8217;s an easy one &#8211; we added URI path -&gt; content id caching (and some other smarts) into the ContentRepositoryService. So once content has been hit, it will always be retrieved by id in future, via the 2nd level cache.</p>
<p>Another issue is iterating over child nodes. This is less trivial. We are using some query caching but I have noticed that some of the criteria were not hitting the caches despite this &#8211; it needs further investigation. I think that due to the polymorphic nature of the content model and query cache invalidation issues, we may stop using these in future (think blog comments being submitted and invalidating ALL your caches).</p>
<p>Next up: Template and Widget nodes are GSP pages that we compile and evaluate. It turned out that due to issues in Grails GSP handling (that persist in 1.2 to my knowledge), there is no internal caching of compiled GSP classes built from non-Resource content e.g. strings. This results in a leak of PermGen space which ultimately results in VM collapse. So we now have a simple cache of compiled Template and Widget GSP pages, which is automatically invalidated as necessary when templates and widgets are edited, so it is transparent to the end user that there is a cache.</p>
<p>Finally with regard to performance, we introduced a nice simple <a href="http://www.weceem.org/weceem/Documentation/Reference-manual/tag-reference/cache">wcm:cache</a> tag. This lets you cache fragments of a Template/Widget and hence get major performance improvements. The cache is currently fixed at 1 hour, but its great for anything that pulls in remote content or for any expensive node iteration tags you might be using. More enhancements will come in future.</p>
<p>A couple of nice little things we squeezed in:</p>
<ol>
<li>The Cancel button is back on the content editor screen, in the &#8220;right&#8221; place for Windows users (meh) and browsers (who made return always select the first button argh!)</li>
<li>The wcm:link tag now passes through any unused attributes eg class=&#8221;whatever&#8221;</li>
<li>We added a JS syntax highlighting script to the default space that you can use to render code snippets in your content easily</li>
</ol>
<p>Anyway, please enjoy this release. Soon time to get started on 0.9 which should see the Blog functionality completed and other refinements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2010/01/12/weceem-0-8-released-highlights-and-background/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>&#8230;and another Grails plugin</title>
		<link>http://www.anyware.co.uk/2005/2009/09/25/and-another-grails-plugin/</link>
		<comments>http://www.anyware.co.uk/2005/2009/09/25/and-another-grails-plugin/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 17:14:26 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=561</guid>
		<description><![CDATA[I have released version 0.1 of Taxonomy plugin for Grails. This new plugin lets you add hierarchical categories (taxons) to any domain object in Grails. Inspired by Graeme&#8217;s excellent Taggable plugin, this uses a similar underlying data structure but adds hierarchy and the extra querying methods you need to find any objects that have a given [...]]]></description>
			<content:encoded><![CDATA[<p>I have released version 0.1 of <a href="http://grails.org/plugin/taxonomy">Taxonomy plugin for Grails</a>.</p>
<p>This new plugin lets you add hierarchical categories (taxons) to any domain object in Grails.</p>
<p>Inspired by <a href="http://grails.org/plugin/taggable">Graeme&#8217;s excellent Taggable plugin</a>, this uses a similar underlying data structure but adds hierarchy and the extra querying methods you need to find any objects that have a given category or any of its sub-categories.</p>
<p>See the <a href="http://grails.org/plugin/taxonomy">docs and examples here</a> and and give it a try.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/09/25/and-another-grails-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;ve released another Grails plugin</title>
		<link>http://www.anyware.co.uk/2005/2009/09/18/ive-released-another-grails-plugin/</link>
		<comments>http://www.anyware.co.uk/2005/2009/09/18/ive-released-another-grails-plugin/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 13:01:05 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Programming links]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=556</guid>
		<description><![CDATA[Witness the power of the bean-fields plugin for Grails! &#60;bean:withBean beanName="form"&#62; &#60;bean:field property="firstName"/&#62; &#60;bean:field property="lastName"/&#62; &#60;bean:field property="company"/&#62; &#60;bean:field property="email"/&#62; &#60;/bean:withBean&#62; This will render input fields of the appropriate type, with sizes set according to the fields&#8217; constraints, select field items from inList etc. It also renders label tags, errors local to the field, and required [...]]]></description>
			<content:encoded><![CDATA[<p>Witness the power of the <a href="http://grails.org/plugin/bean-fields">bean-fields</a> plugin for <a href="http://grails.org">Grails</a>!</p>
<pre lang="groovy">&lt;bean:withBean beanName="form"&gt;
    &lt;bean:field property="firstName"/&gt;
    &lt;bean:field property="lastName"/&gt;
    &lt;bean:field property="company"/&gt;
    &lt;bean:field property="email"/&gt;
&lt;/bean:withBean&gt;</pre>
<p>This will render input fields of the appropriate type, with sizes set according to the fields&#8217; constraints, select field items from inList etc. It also renders label tags, errors local to the field, and required indicators.</p>
<p>You can customize the markup used for all this stuff, so that you get a consistent and noise-free rendering of fields across all your GSP views.</p>
<p><a href="http://grails.org/plugin/bean-fields">Please do check it out</a> and let me know if you have any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/09/18/ive-released-another-grails-plugin/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Development is easy. Creating product is hard.</title>
		<link>http://www.anyware.co.uk/2005/2009/09/17/development-is-easy-creating-product-is-hard/</link>
		<comments>http://www.anyware.co.uk/2005/2009/09/17/development-is-easy-creating-product-is-hard/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 16:47:33 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Programming links]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=552</guid>
		<description><![CDATA[I&#8217;m working very long hours at the moment. By day I work on Weceem CMS and by night I am acting as the architect and producer of a new web service that I am developing with some friends. Of course the web service is being built with Grails &#8211; it would be insane to use [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working very long hours at the moment. By day I work on <a href="http://weceem.org">Weceem CMS</a> and by night I am acting as the architect and producer of a new web service that I am developing with some friends.</p>
<p>Of course the web service is being built with <a href="http://grails.org">Grails</a> &#8211; it would be insane to use anything else! Chris our developer is doing an excellent job &#8211; Grails is massively empowering. In the timescale we&#8217;ve been working to an amazing amount of stuff has been achieved &#8211; even when some of it is being learned on the job.</p>
<p>Oh and of course the core idea is there but the details are being fleshed out as it is developed, but Grails reduces the pain for Chris as changing direction on some features is not as heartbreaking as throwing out weeks of work on thousands of lines of code.</p>
<p>Our designer Pat is also working well with editing GSPs directly, something new for her which she is enjoying, along with learning the joys of Blueprint CSS and jQuery UI.</p>
<p>However, what was obvious to me before starting this project, is painfully obvious to me now. Modern tools like Grails take the classically hard part of making a software product and turn the problem upside down.</p>
<p>We don&#8217;t spend time fiddling around with config and trying to glue various tech together, writing reams of bean accessors and lame JDBC code etc. &#8211; we spend all our time trying to meet the challenge of creating an application that really makes sense to users, hides all the technical detail &#8211; while providing features that a few years ago would have been considered very low priority due to the work required to get even the basics off the ground.</p>
<p>Expectations of modern web apps, especially the expectations that come from ourselves as designers and users of such services, are very high.</p>
<p>This is however a &#8220;high quality problem&#8221; compared to chipping away at a massive mountain of code just to get something half-assed ready, and deferring all the parts that are important and useful to end users (and hence ultimately the business) until later.</p>
<p>Time is of the essence. Grails cuts out maybe first 3 months of dev, and we focus on the business problems.</p>
<p>It&#8217;s a no-brainer in that sense.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/09/17/development-is-easy-creating-product-is-hard/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 11/18 queries in 0.170 seconds using disk: basic

Served from: www.anyware.co.uk @ 2012-02-10 03:19:47 -->
