<?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; ui</title>
	<atom:link href="http://www.anyware.co.uk/2005/tag/ui/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>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>The future of computing UIs &#8211; TV and touch tablets and OS X</title>
		<link>http://www.anyware.co.uk/2005/2009/09/16/the-future-of-computing-uis-tv-and-touch-tablets-and-os-x/</link>
		<comments>http://www.anyware.co.uk/2005/2009/09/16/the-future-of-computing-uis-tv-and-touch-tablets-and-os-x/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 21:40:37 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Moving to Mac]]></category>
		<category><![CDATA[Programming links]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=545</guid>
		<description><![CDATA[I find it hard to imagine we will be plugging away at these cumbersome computers for that much longer, at least not for casual usage. It is noticeable that Mac OS X and related apps are moving to user interface paradigms that will work much better than conventional UIs on (touch controlled?) TVs and multi-touch [...]]]></description>
			<content:encoded><![CDATA[<p>I find it hard to imagine we will be plugging away at these cumbersome computers for that much longer, at least not for casual usage.</p>
<p>It is noticeable that Mac OS X and related apps are moving to user interface paradigms that will work much better than conventional UIs on (touch controlled?) TVs and multi-touch tablets.</p>
<p>Some examples of this growing trend:</p>
<ul>
<li>Front row started it really</li>
<li>Several Apple apps with full screen modes. Especially the new quicktime X and its large transport buttons, iTunes/Front row with Coverflow, iPhoto with multitouch trackpad support</li>
<li>The new exposé screen layout, touchpad gesture and per-app exposé</li>
<li>Spaces &#8211; something that will prove MUCH more useful if every application is full screen, and effectively each Space is a single Application. Then Exposé sort of becomes the current spaces &#8220;zoom out&#8221;</li>
<li>Safari &#8220;Top sites&#8221; is, in my opinion, clearly targetted at touch (tablet) displays.</li>
<li>iTunes LP media format</li>
<li>This is the big one &#8211; iTunes &#8220;Home Sharing&#8221;. This is required to solve the problem of your TV/tablet as a media purchase platform. You will typically buy content at home on a TV/tablet and then expect it to be on your laptop and hence iPod.</li>
</ul>
<p>So I expect, within a few years, for us to see a new paradigm at least for TV and tablets where apps run full screen and you swipe to switch application&#8230; and wonderfully simple UIs as a result.</p>
<p>If we can only do away with the keyboard, we might finally be rid of these rather old fashioned apps with lots of menus and shortcuts and yada yada.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/09/16/the-future-of-computing-uis-tv-and-touch-tablets-and-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An idea to give Grails tags &#8220;E.S.P.&#8221;</title>
		<link>http://www.anyware.co.uk/2005/2009/01/19/an-idea-to-give-grails-tags-esp/</link>
		<comments>http://www.anyware.co.uk/2005/2009/01/19/an-idea-to-give-grails-tags-esp/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 19:58:27 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=402</guid>
		<description><![CDATA[There exists a problem with all current JS UI plugins in that they produce HTML content that is peppered with inline Javascript and/or CSS. This is widely acknowledged as bad practice and greatly increases page load times. This can be reduced to a problem of the inability for custom tags to define the contents of [...]]]></description>
			<content:encoded><![CDATA[<p>There exists a problem with all current JS UI plugins in that they produce HTML content that is peppered with inline Javascript and/or CSS. This is widely acknowledged as bad practice and greatly increases page load times.</p>
<p>This can be reduced to a problem of the inability for custom tags to define the contents of JS and CSS used by the current GSP page. This can be generalised to and inability for a tag invocation in a page to contribute to the production of any related content.</p>
<p>There is also a separate problem of taglibs invoked within a page body being unable to influence the content of the &lt;head&gt; section of an HTML response. This problem could be solved by introducing a two-phase GSP page execution, but most likely this should be handled by external resources, eg .js and .css files added to te &lt;head&gt; section via &lt;link&gt; tags.</p>
<p>The solution is quite simple, but with some subtleties to make it truly rock.</p>
<p>In a nutshell, we use some generic taglib functionality to gather information about what JS and CSS (or other resource) information is to be gathered and served for the current page, and have a controller with a cache to serve it up.</p>
<p>What we&#8217;re doing here is exploiting the fact that the possible race condition of CSS+JS being loaded before the HTML is full loaded by the browser, is not going to happen to pages laid out by SiteMesh, and even for other pages will only be a problem for the first request (see workarounds for this later).</p>
<p><strong>Introducing the concept of &#8220;The E.S.P. Plugin&#8221;</strong></p>
<p>This plugin would provide a taglib and a controller, and either another tag, or a service (See below).</p>
<p>The taglib would offer:</p>
<pre lang="html">&lt;esp:resource group="somepage" type="css"/&gt;</pre>
<p>This tag is used in the &lt;head&gt; section of layouts or pages, to indicate that you want to pull in a resource. The group attribute is optional. If there is none the group will default to &#8220;${controllerName}.${actionName}&#8221;. This is how you control where resources are served up. You can have a resource per page, or you can be smarter and have them grouped in any combinations you like, eg a single CSS file but separate JS files. Some pages may even have more than one such inclusion:</p>
<pre lang="html">&lt;html&gt;
&lt;head&gt;
  &lt;esp:resource group="common" type="css"/&gt;
  &lt;esp:resource group="common" type="js"/&gt;
  &lt;esp:resource group="contactForm" type="js"/&gt;
&lt;/head&gt;
...
&lt;/html&gt;</pre>
<p>This tag simple outputs a &lt;link&gt; tag with the mimetype + relation set according to the &#8220;type&#8221; value, and a link to the ESPController action with params &#8220;group&#8221; and &#8220;type&#8221; and &#8220;template&#8221; &#8211; if there was a &#8220;template&#8221; attribute specified. There could be a URL mapping to prettify this to something like:</p>
<p><strong>/esp/contactForm/js<br />
</strong><br />
Then we have another tag or service to store strings against the group and type, and to detect if such data has already been registered (to prevent tag slow-down for every request).</p>
<p>For example as a tag called as a method from UI taglibs:</p>
<pre lang="groovy">if (!esp.has('contactForm', 'js',
       "grailsui.richtext.${attrs.id}")) {
    esp.store('contactForm', 'js',
       "grailsui.richtext.${attrs.id}") &lt;&lt; "some text"
}</pre>
<p>Whether this is a tag or service makes little difference other than convenience. The data would ultimately need to be stored in a cache in a service &#8211; the value returned from the store is a StringWriter that can be put in a local var and reused across multiple &#8220;&lt;&lt;&#8221; invocations.</p>
<p>The page-unique id is required to prevent the same content being cached more than once for that group.</p>
<p>Order of data stored must be preserved so they are written out in the same order.</p>
<p>Tags will use this form for writing out their JS or CSS, while they simultaneously &#8211; in most cases &#8211; also write out some vanilla and entirely unobtrusive HTML.</p>
<p>NOTE: There should be a form of store() that does not take the &#8220;group&#8221; parameter, only type and id. This would default to the last &#8216;group&#8217; value used in the esp:resource tags in &lt;head&gt; (which would be stored as a request attribute).</p>
<p>Next, the ESPController:</p>
<p>This controller would work by retrieving from the internal datastructure all the strings registered for the specified group and resource type, and then:</p>
<p>1) if there is no &#8220;template&#8221; attribute, simply render them out with a default content type based on the &#8220;type&#8221; stored</p>
<p>2) if there is a &#8220;template&#8221; attribute, it will render the GSP template and put all the strings into a list in the model that can be iterated in the GSP &#8211; so that you can have a base template and do any decorating you want</p>
<p>3) Set appropriate caching headers (probably subject to Config.groovy settings). Although this is not intended to be a substitute for high performance front end caching of the resources.</p>
<p>4) If there is a request for a group and resource type combination for which there is currently no data, we presume this is due to a request race condition or a first request with an eager browser so it either:</p>
<p>i) returns a &#8220;Server busy&#8221; or similar status code</p>
<p>or</p>
<p>ii) uses a filter to know when such a request has first been served (checking request attribute for groups and types used in the page), and have the /esp/ request for same groups+type &#8220;sleep&#8221; until the first request is complete.</p>
<p>or</p>
<p>iii) use a &lt;esp:done/&gt; tag used at the end of the GSP/layout such that this sets a flag in the global data indicating that requests can now be served for the groups+types used in the page.</p>
<p>Hopefully this makes sense. In essence it is quite simple.</p>
<p>It also gives us a new feature &#8211; the ability to define &#8220;static&#8221; data used across different GSP pages and resources, and text fragments for reuse without &lt;g:render&gt;. All it needs is an extra &lt;esp:get&gt; tag to get the content.</p>
<p>I have to say that I prefer option (i). Frankly I couldn&#8217;t give a damn about request zero <img src="http://www.anyware.co.uk/2005/wp-includes/images/smilies/icon_smile.gif?9d7bd4" alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/01/19/an-idea-to-give-grails-tags-esp/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The Co-operative Bank online banking&#8230; again (!)</title>
		<link>http://www.anyware.co.uk/2005/2009/01/14/the-co-operative-bank-online-banking-again/</link>
		<comments>http://www.anyware.co.uk/2005/2009/01/14/the-co-operative-bank-online-banking-again/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 16:16:22 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Programming links]]></category>
		<category><![CDATA[World]]></category>
		<category><![CDATA[co-op]]></category>
		<category><![CDATA[co-op bank fail]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=388</guid>
		<description><![CDATA[The uselessness of Co-op Bank&#8217;s online business banking is a long running saga on my blog. The latest twist, which I noticed some weeks ago, is as follows. Previously lots of problems with CORBA_NO_RESOURCES errors coming back to you when you try to do stuff. It doesn&#8217;t take an IT consultant to guess this means [...]]]></description>
			<content:encoded><![CDATA[<p>The uselessness of Co-op Bank&#8217;s online business banking is a long running saga on my blog.</p>
<p>The latest twist, which I noticed some weeks ago, is as follows. Previously lots of problems with CORBA_NO_RESOURCES errors coming back to you when you try to do stuff.</p>
<p>It doesn&#8217;t take an IT consultant to guess this means their servers are overloaded.</p>
<p>Which is why I am a little cynical when I see that they have changed all the payment reporting screens to default to show only payments from TODAY by default. Where you used to see a history of recent payments immediately, you always have to select a date range and do a report now.</p>
<p>Why cynical? Well you could argue that this was a cheap way to <span style="text-decoration: line-through;">further inconvenience customers</span> reduce load on the database systems.</p>
<p>Dear Co-op bank. I&#8217;m getting more and more people contacting me via blog comments saying how fed up they are. You are going to lose a lot of business if you don&#8217;t sort this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/01/14/the-co-operative-bank-online-banking-again/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>UI Widgets&#8230; oh for something pure Grails</title>
		<link>http://www.anyware.co.uk/2005/2009/01/06/ui-widgets-oh-for-something-pure-grails/</link>
		<comments>http://www.anyware.co.uk/2005/2009/01/06/ui-widgets-oh-for-something-pure-grails/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 10:14:10 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Groovy and Grails]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=377</guid>
		<description><![CDATA[I feel like there is a mismatch in the grails/rails opinionated software approach and the apparent lack of a de facto and impressive UI library for javascript based web-apps built with these frameworks. Sure, Grails has more than its fair share of UI plugins. However they all pull in other libraries, and frankly not even [...]]]></description>
			<content:encoded><![CDATA[<p>I feel like there is a mismatch in the grails/rails opinionated software approach and the apparent lack of a de facto and impressive UI library for javascript based web-apps built with these frameworks.</p>
<p>Sure, <a href="http://grails.org">Grails</a> has more than its fair share of <a href="http://grails.org/Plugins">UI plugins</a>. However they all pull in other libraries, and frankly  not even Yahoo UI stuff looks good enough to me. Libs such as YUI are supposed to be skinnable but the docs on actually creating skins are non-existent.</p>
<p>Even without those issues, you have the thorny problem that choosing a UI widget library usually dictates what JS/DOM helper library your application will use. This is infuriating if say you have an investment and passion for library X (eg Prototype) but the best UI widgets use a different underlying library.</p>
<p>Mixing and matching libraries in the same app is extremely unattractive. Download times become a factor as do compatibility (what if you need to use two in the same page) and last but not least your dev teams have to be fluent in more than one API.</p>
<p>There has to be a better way. I personally feel that out of the box one library should be chosen, and there should be great home-grown widgets. Let&#8217;s be opinionated but have something top quality out of the box.</p>
<p>I mean, Grails enthusiasts like me will happily point out how Rails is not on par in terms of available libraries and enterprise infrastructure stuff, and gloat at the apparent <a href="http://kirindave.tumblr.com/post/60776407/the-opposite-of-momentum">inability to create apps that don&#8217;t leak memory </a>and hence need many restarts &#8211; but you <em>have</em> to admit that a great deal of Rails sites have good widgets, and good clear designs. I believe most of these are home-spun from Prototype+Scriptaculous and cunning use of CSS.</p>
<p>Our Javaland/Grailsland equivalents tend to reuse the standard square tables and buttons and tiny fonts so familiar to Windows users, but anathema to people who have made the switch to Mac.</p>
<p>This is unfortunately what you get when people are knocking together joyless enterprise Java apps and the key thing is to  get something work NOW &#8211; rather than create something that is a pleasure to use. The latter is something that the smarter businesses in the Rails crowd know all about (see the excellent <a href="http://getharvest.com">Harvest</a>, <a href="http://coopapp.com/">Co-op</a>, <a href="http://beanstalkapp.com/">Beanstalk</a> or <a href="http://radiantcms.org">Radiant</a>), and from which all developers, Java enterprise or otherwise, can learn. Its not OK to scrimp on the UI. <a href="http://www.amazon.co.uk/gp/product/0749939753?ie=UTF8&amp;tag=marpalsblo-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=0749939753">Who cares if your manager doesn&#8217;t get it</a>. Take pride in UI!</p>
<p>Call me a snob but universally silver, sharp-edged and small fonted UIs are aesthetically offensive to me!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2009/01/06/ui-widgets-oh-for-something-pure-grails/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>iPhone &#8211; how they forgot the importance of SMS</title>
		<link>http://www.anyware.co.uk/2005/2008/10/14/iphone-how-they-forgot-the-importance-of-sms/</link>
		<comments>http://www.anyware.co.uk/2005/2008/10/14/iphone-how-they-forgot-the-importance-of-sms/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 09:54:58 +0000</pubDate>
		<dc:creator>Marc Palmer</dc:creator>
				<category><![CDATA[Programming links]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.anyware.co.uk/2005/?p=269</guid>
		<description><![CDATA[I love the iPhone. However there are some shocking failings that persist even after several software revisions. They have particularly managed to completely miss out very basic features of SMS (texting) that every phone under the sun has. I don&#8217;t care about MMS and picture message crap &#8211; its the basics that matter. Notable omissions [...]]]></description>
			<content:encoded><![CDATA[<p>I love the iPhone. However there are some shocking failings that persist even after several software revisions. They have particularly managed to completely miss out very basic features of SMS (texting) that every phone under the sun has. I don&#8217;t care about MMS and picture message crap &#8211; its the basics that matter.</p>
<p>Notable omissions include:</p>
<ul>
<li>You cannot forward an SMS you have received to another person</li>
<li>You cannot send a number/vCARD from your address book to somebody else via SMS. Even my 9 year old Nokia 6100 did that.</li>
<li>You cannot send an SMS to a group in your Contacts book, without adding each person from the group manually. They added group SMS in an early firmware revision, but didn&#8217;t add a way to select just the group and have all members added. Sending a message to 20 people in a group is <em>very</em> boring.</li>
<li>When choosing the &#8220;Text Message&#8221; option in address book it does not automatically select their mobile number</li>
<li>SMS is treated as a separate feature from Phone where dialing, contacts, voicemail are. This is a bizarre and false separation. Contacts appear in the main home screen and in Phone &#8211; SMS should be the same.</li>
<li>There is no &#8220;mark all read&#8221; option on the main SMS summary screen &#8211; so even for short messages you&#8217;ve already read in the preview/alert screen, you have to go and view each manually.</li>
</ul>
<p>This functionality is so basic and fundamentally affects the usefulness of SMS on iPhone.</p>
<p>Come on Steve, give us SMS we can be proud of!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anyware.co.uk/2005/2008/10/14/iphone-how-they-forgot-the-importance-of-sms/feed/</wfw:commentRss>
		<slash:comments>0</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 9/18 queries in 1.907 seconds using disk: basic

Served from: www.anyware.co.uk @ 2012-02-05 03:00:17 -->
