<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tomás Lin's Programming Brain Dump</title>
	<atom:link href="http://fbflex.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://fbflex.wordpress.com</link>
	<description>Flex, Grails, Facebook, iPhone and all that Jazz</description>
	<lastBuildDate>Sat, 14 Nov 2009 14:18:05 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='fbflex.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0d428802512af21a285dd2fc171357da?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tomás Lin's Programming Brain Dump</title>
		<link>http://fbflex.wordpress.com</link>
	</image>
			<item>
		<title>A semi-static content CMS for Grails with Adobe AIR / Flex</title>
		<link>http://fbflex.wordpress.com/2009/11/14/a-semi-static-content-cms-for-grails-with-adobe-air-flex/</link>
		<comments>http://fbflex.wordpress.com/2009/11/14/a-semi-static-content-cms-for-grails-with-adobe-air-flex/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 14:10:56 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=647</guid>
		<description><![CDATA[In this post, I want to share my experience building a content management solution for a Grails application using Adobe AIR and XML bundles. This solution allows semi-static content to be kept externally. Main benefits are ease of deployment and desktop integration.
The Problem with Semi-static Content in Grails domain objects
Back when I was working for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=647&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In this post, I want to share my experience building a content management solution for a Grails application using Adobe AIR and XML bundles. This solution allows semi-static content to be kept externally. Main benefits are ease of deployment and desktop integration.<span id="more-647"></span></p>
<h2>The Problem with Semi-static Content in Grails domain objects</h2>
<p>Back when I was working for <a href="http://www.mindblossom.com">Mindblossom</a>, I explored using Grails domain objects to build content management views for content-intensive websites. This approach worked fine as long as the content we were mapping were fairly deep and consistent. A list of <a href="http://www.danaykroydwines.com">wines</a>, <a href="http://www.refundroadtrip.ca">travel destinations </a>or <a href="http://www.blueembergrills.com">babecues</a> usually had a set of attributes that were well known and defined prior to building the application.</p>
<p>There were two types of data, however, that constantly gave us problems.</p>
<ol>
<li><strong>Products with arbitrary attributes:</strong> Many of these features were optional and not well-mapped. For <a href="http://www.suzuki.ca">a large automotive manufacturer</a>, for example, these attributes would change from year to year and model to model. Adjusting to them would either mean building a robust dynamic attribute management system into the domain model ( complex ), or extending the domain model each time a new product arrived.I remember long nights at work when a client would send us car information at the last minute, and hearing cursing in German from across the desk from the poor guy that was constantly changing our domain models to match the new information.</li>
<li><strong>Information was that used to support user-interface elements</strong>. Page information needed for SEO, structured information needed for just a handful of pages, etc. This information was too big to keep in configuration files and didn&#8217;t warrant building a specific Grails domain object for them.</li>
</ol>
<p>Two questions always came up when we were discussing pure Grails domain object-based CMS solutions. Our slick talking sales and product people will always talk their way around them with clients, but they always left a nagging question in my head as a technologist.</p>
<ol>
<li><strong>Deployment. </strong>How are we going to ensure that we&#8217;re testing content with at least a similar set of values? While this didn&#8217;t matter much for product information, it was important for UI content that was constantly updated and changed. Can we make changes without re-deployment?</li>
<li><strong>Flexibility. </strong>The second one was flexibility. Despite all the advances in Grails, GORM and its hibernate based infrastructure still statically maps domain objects to databases. This infrastructure is heavily biased towards initial development. If I was building my own application from scratch, adding or removing attributes simply means changing my domain object and redeploying. To maintain this form of development, however, would mean that we would have to use a tool like autobase to manage database changes.</li>
</ol>
<h2>A Sketch of our current Editorial Content solution</h2>
<p>When I first arrived at Pixsta and started working on the <a href="http://www.empora.com">Empora</a> fashion search website, we already had an editorial solution in place based on XML bundles and Plain Old Java Objects. Any content that was not classified as product information was kept in XML files that were pulled in by the Grails application.</p>
<p>At first, this system seemed a little clunky. As a geek, it was very hard to resist solving the problem by throwing more technology at it. We could solve the XML bundle problem by using a schema-less NoSQL  solution like CouchDB. Then we can store all this stuff in a database!</p>
<p>As I got to work with this setup for the next few months, I began to appreciate the simplicity of this design. Having XML bundles stripped a database dependency for content that was constantly changing. We could deploy new versions of this content by simply copying this information over. If you have ever worked with external images in Grails applications, this was the same mechanism, except that instead of just jpg and png files, you were moving structured data that contained information about views and products.</p>
<p>I have nothing good to say about the POJO part of the implementation. It worked, but adding a new attribute would involve modifying both the POJO and the XML serializer it used to convert the XML into something usable by Groovy. Over the next few months, we quickly migrated the POJO solution to a simple Groovy XML slurper solution, where the data structure would be loosely defined as an XML document that was passed around.</p>
<p>At the end, we ended up with a system for editorial content that looked like this:</p>
<p><img class="aligncenter size-full wp-image-650" title="Our editorial solution" src="http://fbflex.files.wordpress.com/2009/10/prodinfo.png?w=495&#038;h=208" alt="Our editorial solution" width="495" height="208" /></p>
<p>We still kept our important product information in a database and performed our proprietary image search operations on them, but this setup allowed us to add additional editorial content to results based on the request URL. Our Grails controllers simply aggregated the information that best fit in a database with the information from the XML files.</p>
<h2>Building a CMS</h2>
<p>Our editorial content solution worked for the most part. However, because the editorial information was kept in XML files, it meant that our content team was constantly editing XML files by hand. This was not good. We saw encoding errors, malformed XML and problems that arrived from copy and pasting from Word files.</p>
<p>Our next task was to build a Content Management solution to handle this editorial content. Most of our content already lived in the form of XML files and local files. We wanted a platform that could easily be updated, allow us to use existing skills in-house and be easy to extend. We chose Adobe Air.</p>
<h2>Benefits of Adobe AIR</h2>
<p>After considering a web-based Grails approach, Griffon/JNLP and Adobe AIR, we settled for Adobe AIR for the following reasons.</p>
<ul>
<li>Direct access to the file system.</li>
<li>Already know AIR / Flex programming.</li>
<li>Easy to update via the automatic update mechanism.</li>
<li>E4X support for XML editing.</li>
<li>No need convert XML to domain objects.</li>
<li>Good library of direct UI Manipulation Libraries.</li>
</ul>
<h2>A few screenshots of the CMS:</h2>
<p>After about two weeks of work ( sandwiched between other priorities ), I had written an initial version of our editorial content CMS. It had a few interesting features:</p>
<ul>
<li><strong>Direct image map manipulation</strong> using the ObjectHandles library &#8211; I wrote a simple imagemap renderer that allowed our content team to define and edit existing imagemaps and generate the necessary HTML.</li>
</ul>
<p><img class="aligncenter size-full wp-image-664" title="Sienna Miller being edited" src="http://fbflex.files.wordpress.com/2009/11/sienna1.jpg?w=700&#038;h=421" alt="Sienna Miller being edited" width="700" height="421" /></p>
<ul>
<li><strong>Automatic updates</strong> &#8211; Adobe AIR provides an automatic update mechanism, it enables changes to made quickly and pushed out to clients ( think JNLP ). This proved very useful in the initial use of the content tool, as it allowed us to make changes to the CMS independent of other product tools. It also enables us to extend the CMS quickly whenever new features are added to the web application.<br />
<img class="aligncenter size-full wp-image-665" title="Automatic updates " src="http://fbflex.files.wordpress.com/2009/11/update.jpg?w=563&#038;h=413" alt="Automatic updates " width="563" height="413" /></li>
<li><strong>Read and write from XML -</strong> instead of converting objects into ActionScript objects, I simply used <a href="http://learn.adobe.com/wiki/display/Flex/E4X">e4x</a>. This allowed me to quickly map XML fragments to ActionScript components and edit files directly.</li>
</ul>
<p><img class="aligncenter size-full wp-image-667" title="Homepage" src="http://fbflex.files.wordpress.com/2009/11/effron.jpg?w=700&#038;h=423" alt="Homepage" width="700" height="423" /></p>
<p><img class="aligncenter size-full wp-image-666" title="Product Carousel" src="http://fbflex.files.wordpress.com/2009/11/carrousel.jpg?w=700&#038;h=422" alt="Product Carousel" width="700" height="422" /><img class="aligncenter size-full wp-image-668" src="http://fbflex.files.wordpress.com/2009/11/watches.jpg?w=700&#038;h=422" alt="" width="700" height="422" /></p>
<ul>
<li><strong>Links to image and content check directories. </strong>One of the benefits of a custom CMS is to be able to create links to a data test bed. The CMS had direct links to a staging server that pointed to the data being edited directly. This allows our content team to see their data exactly as it would appear live. This functionality also means less changes to the web application, since there was not a messy cycle needed to support preview and direct GSP manipulation.</li>
</ul>
<ul>
<li><strong>File Locking -</strong> added a simple file lock wrapper around each file being edited. Since our content team is small, the chances of the same people editing the same file was very slim. A file-based lock would simply notify them that the file was being edited by someone else.</li>
</ul>
<p><strong>Lessons Learned In This Approach</strong></p>
<ul>
<li>Sometimes, the database is just not the right solution.</li>
<li>Deployment as static files is much easier than from a database.</li>
<li>Configuration files can be made much easier by externalising into files as well.</li>
<li>Web services get more complicated, but not by much.</li>
<li>It doesn&#8217;t take that much time. With a pure server-based approach, you have to constantly worry about migrating data, deploying and setting up the right infrastructure. Sometimes simple is better.</li>
<li>Auto-update is a joy.</li>
</ul>
<h2>Possible Helpful Grails Plugins if you want to do it yourself</h2>
<p>In the course of investigating this solution, I came across a few plugins that could potentially make this process easier. None of these plugins were used in this solution because our infrastructure already supported most of this functionality. But I would definitively consider these when starting a new project where I would be creating a new set of dynamic attributes from scratch.</p>
<ul>
<li><a href="http://grails.org/Static+Resources+Plugin">Static Resources Plugin</a> &#8211; Runs a web service that deploys your static content as an XML file. Combined with the new XML form creation features of Flash Builder 4, this might allows us to use client-side scaffolding of data.</li>
<li><a href="http://grails.org/Contribute+a+Tag#transform">XSL Transformation Tag</a> &#8211; Allows you to apply a XSLT to a XML fragment and render into a GSP view.</li>
<li><a href="http://grails.org/plugin/export">Export Plugin</a> &#8211; Enables the export of grails data into other formats like Excel.</li>
<li><a href="http://grails.org/plugin/weceem">Weceem</a> &#8211; A CMS that provides a easy way to manage changing content. If Weceem had attribute management, most of these problems would go away.</li>
<li><a href="http://grails.org/plugin/gorm-couchdb">Gorm-couchdb</a> &#8211; Another approach would be for to use the AIR app to connect to couchDB and have our grails app retrieve the data it needs via CouchDB. However, this still has the drawback of statically mapping our domain objects to a database definition.</li>
</ul>
<h2>Static Content Wish List</h2>
<p>So what would make managing this semi-static content easier? I can see a couple of plugins that might make all the work and effort done here obsolete:</p>
<ol>
<li><strong>A Data export / import plugin.</strong> A simple plugin that would enable backing up and exporting a grails project done at the UI level.</li>
<li><strong>A Dynamic Attribute Management Plugin</strong>. A plugin that will allow for the creation and management of domain object attributes at runtime.</li>
</ol>
<h2>Conclusions</h2>
<p>I like this approach much better than a pure Grails approach. Content management, to me, fits better within a client. Using Flex and Air means that I would be able to re-use many of the display components. It enables separating the portions of the web application used for display and the tools needed to edit these.</p>
<p>There are many usability benefits available to a desktop interface: drag and drop of files into the editor, ability to save drafts and revisions via the built-in SQLLite database and offline/online content synchronisation.</p>
<p>Moreover, compared to a <a href="http://fbflex.wordpress.com/2009/02/06/anatomy-of-a-custom-grails-cms/">CMS built purely in Grails GSPs</a>, a system like this can be built to edit GSPs and domain objects on the fly without worrying about application re-loading and making dramatic changes to Grails core.</p>
<p>I still would like to see a robust attribute management mechanism similar to the one available for <a href="http://www.elasticpath.com/">Elastic Path</a>.</p>
<p>It would also be interesting to start experimenting with either a Griffon or AIR-based desktop application for managing Grails content for the <a href="http://www.weceem.org/weceem/">Weceem</a> CMS ( I can dream, can&#8217;t I? ).</p>
<p>Maybe someday I&#8217;ll find time ( or a sponsor ) to write one.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/647/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=647&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/11/14/a-semi-static-content-cms-for-grails-with-adobe-air-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/10/prodinfo.png" medium="image">
			<media:title type="html">Our editorial solution</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/11/sienna1.jpg" medium="image">
			<media:title type="html">Sienna Miller being edited</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/11/update.jpg" medium="image">
			<media:title type="html">Automatic updates </media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/11/effron.jpg" medium="image">
			<media:title type="html">Homepage</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/11/carrousel.jpg" medium="image">
			<media:title type="html">Product Carousel</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/11/watches.jpg" medium="image" />
	</item>
		<item>
		<title>Automatic Background Removal With Pixel Bender</title>
		<link>http://fbflex.wordpress.com/2009/11/13/automatic-background-removal-with-pixel-bender/</link>
		<comments>http://fbflex.wordpress.com/2009/11/13/automatic-background-removal-with-pixel-bender/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 03:40:50 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=656</guid>
		<description><![CDATA[How do you get rid of the product backgrounds?
This was a problem that has plagued me and the other user interface developers at Pixsta ever since I started working here. Our efforts to build nice homepages and cool Facebook / Twitter apps seems almost hampered every try by the limitation that our product images always [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=656&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>How do you get rid of the product backgrounds?</p>
<p>This was a problem that has plagued me and the other user interface developers at Pixsta ever since I started working here. Our efforts to build nice homepages and cool Facebook / Twitter apps seems almost hampered every try by the limitation that our product images always had a white background.</p>
<p>I decided to spend a little time investigating how we could remove backgrounds on the client-side, and immediately thought of <a href="http://labs.adobe.com/technologies/pixelbender/">Pixel Bender.</a> In this post, I share the results of my experimentation and show that Pixel Bender is a viable alternative to server-side image manipulation and calculation. It really highlights the power of Flash and Flex over other client technologies like JavaScript. <span id="more-656"></span></p>
<p>Pixel Bender is a technology by Adobe that enables image processing at the pixel level introduced with Flash 10. It is fast and uses the native graphic capabilities of the machine. It is much faster and optimized than plain ActionScript.</p>
<p>I started with a naive approach, copying a colour-based pixel removal algorithm from an old <a href="http://stackoverflow.com/questions/659476/pixel-bender-white-to-transparent">stackoverflow</a> thread. This algorithm simply replaces the white pixels of the image within a certain threshold with a transparent pixel. The kernel code is as follows:</p>
<pre><code>input image4 src;
output float4 dst;

// How close of a match you want
parameter float threshold
&lt;
  minValue:     0.0;
  maxValue:     1.0;
  defaultValue: 0.4;
&gt;;

// Color you are matching against.
parameter float3 color
&lt;
  defaultValue: float3(1.0, 1.0, 1.0);
&gt;;

void evaluatePixel()
{
  float4 current = sampleNearest(src, outCoord());
  if(</code><code>(distance(current.rgb, color) &lt; threshold) ){
      dst = float4( 0.0 );
  } else {
      dst = current;
  }
</code><code>}
</code></pre>
<p>This algorithm works well for a big chunk of the time and uses Pixel Bender&#8217;s capabilities fully. However, it fails when the item itself has a lot of white and doesn&#8217;t do a very good job of removing the edges. The other problem here is that a threshold that might work for some images might look horrible on other images.</p>
<p>After finally getting the hang of Pixel Bender, I walked over to my well respected collegue Tuncer, who is a mad image processing PhD genius and asked him if he could recommend something we could use for  client side background removal. He sent me a version of the background removal algorithm we currently use in the Empora site, and I went ahead trying to see if it could work on Pixel Bender.</p>
<p>After tweaking it for a day and converting it from Matlab and Java into ActionScript, I arrived at a nice solution that worked with Pixel Bender, Flex and Flash.</p>
<p>Unfortunately, I cannot post the code for this as it involves some algorithms that a) I don&#8217;t really understand, b) are the brainchild of somebody else and c) are probably proprietary for the company. However, I can share some results.</p>
<p>The following rows show the original image, the white background removed image with an arbitrary threshold, and the automatically calculated image.</p>
<p><img class="aligncenter size-full wp-image-658" title="Original / White Removal / Pixsta Special" src="http://fbflex.files.wordpress.com/2009/11/pixelbender.png?w=700&#038;h=634" alt="Original / White Removal / Pixsta Special" width="700" height="634" /></p>
<p>As you can see, this works really well and shows the possibility of the Adobe Pixel Bender technology in processing images on the client side.</p>
<p>There were a few limitations and challenges that I ran into implementing these algorithms in Pixel Bender, which were the following:</p>
<ul>
<li>Pixel Bender works at a per pixel level. Some of the pre-computations in these algorithms worked with the entire image. This means that a pure Pixel Bender implementation would be almost impossible to do. However, once these automatic thresholds were calculated, the rendering speed of Pixel Bender was simply amazing.</li>
<li>There are a few kinks in the Flash player implementation of Pixel Bender. Most annoyingly, it doesn&#8217;t allow For loops. I had to write a simple groovy script to unravel my scripts. Hopefully this technology matures more and the language becomes a little more than a crippled toy language.</li>
<li>The path to integrating Pixel Bender Shaders into Flex were not very clear. Neither the Pixel Bender page nor the official Adobe documentation goes into these technologies in depth. Fortunately, Mike Chambers has blogged about integrating Pixel Bender into Flex, and I would be completely lost without his blog posts. [ <a href="http://www.mikechambers.com/blog/2008/09/17/creating-re-distributable-actionscript-libraries-of-pixel-bender-filters/">1</a> ] [ <a href="http://www.mikechambers.com/blog/2008/09/08/embedding-pixel-bender-filters-within-a-swf/">2</a> ] [ <a href="http://www.mikechambers.com/blog/2008/09/08/encapsulating-custom-pixel-bender-filters-in-actionscript-3/">3</a> ]</li>
<li>To make it better, I would probably add another shader that will blend the edges into the image more. But this would be easy with Pixel Bender. The background in the example is very dark, we would display our images in a white or semi-white background, reducing the contrast of the edges.</li>
<li>The algorithm is a little aggressive sometimes, removing more than it needs. But the Flex UI would allow for either a slider to be incorporated to manage individual thresholds or enable a more dynamic background removal approach such as the one presented <a href="http://structuralsegm.sourceforge.net/">here</a>.</li>
</ul>
<p>It was really neat to be able to explore these kind of image manipulations and see the limits of this technology. Makes me really appreciate working with people that actually know how to use Mathematics for good. It&#8217;s really exciting to see Pixel Bender and the possibility it brings to image processing.</p>
<p>If you are interested in reading more about the image processing work done at Pixsta, visit the homepage of our research team, <a href="http://sites.google.com/site/canaysal/tuncer.can.aysal">Dr. Tuncer Aysal</a> and <a href="http://www.daniel-heesch.com/">Dr. Daniel Heesch</a>. It contains all their publications to date.</p>
<p>To see some of this stuff at work in a real live product, visit <a href="http://www.empora.com/women/">Empora.com</a>.</p>
<p><strong>Please note:</strong> I cannot and will not share the code to the Pixel Bender Kernel for background removal.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/656/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/656/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/656/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=656&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/11/13/automatic-background-removal-with-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/11/pixelbender.png" medium="image">
			<media:title type="html">Original / White Removal / Pixsta Special</media:title>
		</media:content>
	</item>
		<item>
		<title>I will be speaking at the Groovy / Grails Exchange in London</title>
		<link>http://fbflex.wordpress.com/2009/09/15/i-will-be-speaking-at-the-groovy-grails-exchange-in-london/</link>
		<comments>http://fbflex.wordpress.com/2009/09/15/i-will-be-speaking-at-the-groovy-grails-exchange-in-london/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 19:18:10 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=641</guid>
		<description><![CDATA[It&#8217;s a little overdue, but I am excited to announce that I&#8217;ll be speaking at the Groovy / Grails Exchange in London on Dec 9 and 10.
The topic of my talk will be &#8216;Building Killer RIAs with Flex and Grails&#8217;, and you can read all about it on the Conference website. Building Killer RIAs with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=641&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It&#8217;s a little overdue, but I am excited to announce that I&#8217;ll be speaking at the Groovy / Grails Exchange in London on Dec 9 and 10.</p>
<p>The topic of my talk will be &#8216;Building Killer RIAs with Flex and Grails&#8217;, and you can read all about it on the Conference website. <a href="http://skillsmatter.com/podcast/java-jee/building-killer-rias-with-flex-and-grails">Building Killer RIAs with Flex and Grails.</a></p>
<p>It&#8217;s my first conference presentation, so please be gentle&#8230;</p>
<p>See you all there!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/641/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/641/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/641/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/641/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/641/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/641/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/641/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/641/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/641/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/641/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=641&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/09/15/i-will-be-speaking-at-the-groovy-grails-exchange-in-london/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>
	</item>
		<item>
		<title>Lessons Learned: Building a simple Ad Host with Grails on the Google App Engine</title>
		<link>http://fbflex.wordpress.com/2009/09/01/lessons-learned-building-a-simple-ad-host-with-grails-on-the-google-app-engine/</link>
		<comments>http://fbflex.wordpress.com/2009/09/01/lessons-learned-building-a-simple-ad-host-with-grails-on-the-google-app-engine/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 23:57:34 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Banner Hosting]]></category>
		<category><![CDATA[Empora]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[grails]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=633</guid>
		<description><![CDATA[In this post, I share my experiences building a simple Content Host with Grails and the Google App Engine.

We&#8217;ve been pumping up the volume at Pixsta promoting Empora &#8211; our visual search engine for fashion items written in Grails.
One of the recent tasks I&#8217;ve worked on was to build a series of banner ads in Flash [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=633&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In this post, I share my experiences building a simple Content Host with Grails and the Google App Engine.</p>
<p><a style="text-decoration:none;" href="http://www.empora.com"><img style="display:block;margin-left:auto;margin-right:auto;border:0 initial initial;" title="banner_300_250" src="http://fbflex.files.wordpress.com/2009/09/banner_300_2503.gif?w=300&#038;h=250" alt="banner_300_250" width="300" height="250" /></a></p>
<p><span id="more-633"></span>We&#8217;ve been pumping up the volume at Pixsta promoting <a href="http://www.empora.com">Empora</a> &#8211; our visual search engine for fashion items written in Grails.</p>
<p>One of the recent tasks I&#8217;ve worked on was to build a series of banner ads in Flash to showcase the colour search feature. Within the site, you can specify a colour or category, and it would let you browse similar items via our unique PhD-powered visual search algorithms.</p>
<p>It was very interesting that nobody in our teams had worked with ads or ad networks before. So we had to quickly learn all about this business very quickly. Fortunately, it also meant that we could make some mistakes &#8211; which fortunately there were few &#8211; and learn from them.</p>
<p><strong>Building the Ads</strong></p>
<p>The final ad that Mike, our graphic designer, and our product team came up with looks like <a href="http://emporaads.appspot.com/ads/banner_300_250.swf">this</a>. ( Warning &#8211; flash file, original size is 300 x 250pxs ). You can see one in action at <a href="http://www.mylovelybigfeetblog.com/">my lovely big feet</a>.</p>
<p>The ads themselves were not difficult and took less than a couple of days to do in Flash. I used the standard Flash components for the display objects and the <a href="http://code.google.com/p/tweener">Tweener</a> library to animate the transitions.</p>
<p>What was challenging was really meeting the different and undocumented requirements from different ad networks about Flash ad formats. It was hard not to lose your temper after getting two or three conflicting versions from the same company, or getting documentation sent to you by an ad network a couple of days after you have finished building your flash files. I definitively learned a lot more about <a href="http://www.adobe.com/resources/richmedia/tracking/designers_guide/">clickTags</a>, flash versions and the world of ad networks than I ever really wanted to know.</p>
<p>I had built an initial prototype in Flex, but quickly rewrote it in Flash as we couldn&#8217;t get file sizes small enough even after using the RSL mechanism. Flex still has a lot of work to do to make Swf files smaller.</p>
<p><strong>Hosting the Ads.</strong></p>
<p>Most of the bigger ad networks had their own tracking mechanisms and would host our ads on their networks as long as they met certain size restrictions ( 40k and 100k ). Some of our ads needed to be retooled to fit within certain guidelines, and I had to create several versions of each ad in different sizes, colour combinations and click out requirements.</p>
<p>For smaller blogs, they requested that we host the swf and backup image files ourselves. We had to come up with a solution that was quick, efficient and powerful enough to handle large amounts of traffic.</p>
<p>I had come across an article about <a href="http://24ways.org/2008/using-google-app-engine-as-your-own-cdn">using the google app engine as a content delivery network</a> about a few months ago and have been wanting to try out this approach on Flex / Flash files. I&#8217;ve been playing with Grails and the App Engine a lot on my spare time, and suggested this to the team.</p>
<p><strong>Google App Engine &#8211; Advantages</strong></p>
<p>There were several advantages I saw to using the App Engine that made it perfect for our simple ad server:</p>
<ul>
<li><strong><em>Almost unlimited bandwidth on demand:</em></strong> We could always buy more, and with an initial allotment of 4 gigabytes free a day (paid quota ) and $.12 per gigabyte transfer over that, it seemed like a perfect solution for us. We weren&#8217;t sure how much traffic we were gong to use, so the app engine provided a no-commitment answer for our ad hosting.
<p>Compared to cloud solutions like Amazon ( $70 per month ) or  content hosting like Akami ( contracts / service terms required ), the app engine made sense as an initial testing bed for our ad hosting.</li>
<li><strong><em>No Server Setup Required:</em> </strong> With a traditional hosting solution, we would have had to set up a FTP account or an Apache server to deliver this content. If we wanted any sort of server side scripting, this would have had to been set up and would have taken time away from our system administrator.</li>
</ul>
<ul>
<li><strong><em>Grails integration:</em> </strong>We have a lot of in-house expertise in Grails &#8211; and it was nice that the AppEngine plugin allowed us to use this expertise, just in case we needed to add something more robust. With this project, we were uncertain about some of the  tracking requirements, so it was nice to have the option of having GSPs, templates and all the other Grails goodies just in case we needed to expand the functionality of the ad host. It&#8217;s never a bad idea to have an enterprise level solution in the back pocket, just in case.</li>
</ul>
<ul>
<li><strong><em>Quick deployment:</em> <span style="font-weight:normal;">T</span><span style="font-weight:normal;">he app engine plugin allowed us to quickly add our content to be hosted, package it into a war file and have it running on the server within less than 20 minutes of creating the initial application.<br />
</span></strong></li>
<li><span style="font-weight:normal;"><strong><em>Ease of Administration:</em> </strong>Compared to many build-your-own solutions, it was very easy to add additional developers into the application. </span><span style="font-weight:normal;"> </span></li>
</ul>
<p><strong>Embedding Flash Files</strong></p>
<p>In the code we provided our ad hosts, we simply used <a href="http://code.google.com/p/swfobject/">SWFObject</a> to include our SWF file. Using SWFObject allowed our ads to fallback into gif files in the case where Flash or JavaScript was disabled. We wrote a little bit of additional javascript so that we could differentiate which client and campaign were being tracked.</p>
<p><strong>Ad Tracking</strong></p>
<p>I wrote a simple grails page that would invoke <a href="http://www.google.com/analytics">google analytics</a> with the correct tracking details. We were already using Google Analytics to track clicks, and it was very easy to just include a piece of javascript that would track all our ad impressions. [ <a href="http://emporaads.appspot.com/js/track_ads.js">code here</a> ]</p>
<p><strong>Did it Work?</strong></p>
<p><strong></strong>What started as a simple experiment in hosting a few flash files that had to go up quickly rapidly became a test of how the Google App Engine would perform as a RIA hosting server.</p>
<p>Our marketing team got our banners on one of the newspapers websites, and we went from serving about one thousand ads a day to five digits ad impressions in one day.</p>
<p>The App Engine performed admirably. The only hiccup we experienced was setting the initial quota too low, and we quickly ran out of bandwidth. After a simple billing change on the server that took effect in 15 minutes, the ad serving continued.</p>
<p>On some days, the outbound traffic would hit more than fifteen gigabytes, but we had not had to restart our Grails server at all since the initial deployment and while we see spikes in memory and CPU use, there seems to be very few issues with the app engine as a content delivery server. Also, it is reassuring to see that fifteen gigabytes cost less than $2 in the billing reports.</p>
<p>It was definitively a good choice to do this in Grails. We had vague tracking requirements at the beginning of the project, and were able to implement a fairly robust if simple tracking system in less than a day.</p>
<p><strong>Going Forward </strong></p>
<p>This project shows that the Google App Engine is a solid solution for hosting dynamic, high bandwidth content such as Flash movies. Given the ease by which we can develop Grails applications, it would be interesting to build out a nice simple GUI for managing and uploading ads into the Engine without requiring a server restart.</p>
<p>One of my main frustrations working with Rich Media ads is that the specs given by current ad hosts make them nothing more than glorified animated gifs. It would be interesting to explore the building of more robust tracking and clickTag mechanisms for RIAs and widgets. It would also be interesting to explore alternative ways of displaying ads such as via HTML5&#8217;s canvas and video tags and see how they compare to Flash.</p>
<p>The prices of the ad engine definitively make it a very good candidate for rich, dynamic content. We see that Grails is able to scale up to many clients for simple GSPs that spit out data. However, it is still unclear as to how versatile dynamic flex applications with a complex domain model would perform on a platform such as the App Engine. Given that the app engine would time out a request if it takes too long to complete, it would be interesting to see how data-heavy RIAs would perform in this environment.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/633/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=633&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/09/01/lessons-learned-building-a-simple-ad-host-with-grails-on-the-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/09/banner_300_2503.gif" medium="image">
			<media:title type="html">banner_300_250</media:title>
		</media:content>
	</item>
		<item>
		<title>Google App Engine as a Super Aggressive Cache Service for Grails Apps.</title>
		<link>http://fbflex.wordpress.com/2009/07/25/google-app-engine-as-a-super-aggressive-cache-service-for-grails-apps/</link>
		<comments>http://fbflex.wordpress.com/2009/07/25/google-app-engine-as-a-super-aggressive-cache-service-for-grails-apps/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 13:27:23 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=622</guid>
		<description><![CDATA[I&#8217;ve been thinking a bit about how to use the Google App Engine in a Grails deployment infrastructure. In the following post, I want to sketch out how to use the Google App Engine as an aggressive cache mechanism for Grails applications to reduce the cost of Grails experiments. 
Let&#8217;s look at some of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=622&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve been thinking a bit about how to use the Google App Engine in a Grails deployment infrastructure. In the following post, I want to sketch out how to use the Google App Engine as an aggressive cache mechanism for Grails applications to reduce the cost of Grails experiments. <span id="more-622"></span></p>
<p>Let&#8217;s look at some of the pros and cos of using the Google App Engine for Grails Application Development.<br />
<strong><br />
Good:</strong> Lots of memory, memcache, bandwidth and disk space.<br />
<strong>Bad:</strong> No threads, no hibernate, no full JRE, limited GORM, can&#8217;t write to file. Many plugins don&#8217;t work.</p>
<p>A possible way around these problems, of course, is to get a low cost hosting provider and use the Google App Engine to amplify the available bandwidth and processing power available to your web applications. Instead of thinking of the App Engine as another complete deployment platform, this just becomes a loudspeaker to help scale your tiny little app.</p>
<p>Here is an idea of how something like this might look like:</p>
<p><img class="aligncenter size-full wp-image-623" title="By The Power of App Engine, I am a Grails App!" src="http://fbflex.files.wordpress.com/2009/07/processing.png?w=455&#038;h=295" alt="By The Power of App Engine, I am a Grails App!" width="455" height="295" /></p>
<p>Building the caching part of this is not terribly difficult, Google App Engine already provides us with all the pieces we need via the <a href="http://code.google.com/appengine/docs/java/memcache/">MemCache</a> Service and the <a href="http://code.google.com/appengine/docs/java/urlfetch/">URLFetch</a> Service.</p>
<p>I would imagine that a typical request handler would look something like this in Groovy:</p>
<h2><strong>Set up your Cache</strong></h2>
<pre><span>import</span><span> java</span><span>.</span><span>util</span><span>.</span><span>Collections</span><span>;</span><span>
</span><span>import</span><span> javax</span><span>.</span><span>cache</span><span>.</span><span>Cache</span><span>;</span><span>
</span><span>import</span><span> javax</span><span>.</span><span>cache</span><span>.</span><span>CacheException</span><span>;</span><span>
</span><span>import</span><span> javax</span><span>.</span><span>cache</span><span>.</span><span>CacheFactory</span><span>;</span><span>
</span><span>import</span><span> javax</span><span>.</span><span>cache</span><span>.</span><span>CacheManager</span><span>;</span><span>

</span><span> </span><span>Cache</span><span> cache</span><span>;</span><span>
</span>
<pre><span>// expires cache in one hour
Map</span><span> props </span><span>=</span><span> </span><span>new</span><span> </span><span>Map</span><span>;</span><span>
props</span><span>.</span><span>put</span><span>(</span><span>GCacheFactory</span><span>.</span><span>EXPIRATION_DELTA</span><span>,</span><span> </span><span>3600</span><span>);</span></pre>
<p><span>try</span><span> </span><span>{</span><span></p>
<p></span><span>CacheFactory</span><span> cacheFactory </span><span>=</span><span> </span><span>CacheManager</span><span>.</span><span>getInstance</span><span>().</span><span>getCacheFactory</span><span>();</span><span></p>
<p>cache </span><span>=</span><span> cacheFactory</span><span>.</span><span>createCache</span><span>(</span><span>props</span><span>);</span><span></p>
<p></span><span>}</span><span> </span><span>catch</span><span> </span><span>(</span><span>CacheException</span><span> e</span><span>)</span><span> </span><span>{</span><span></p>
<p></span><span>// ...</span><span></p>
<p></span><span>}<strong></p>
<p></strong></span></pre>
<h2><span><strong>Handle Requests<br />
</strong></span></h2>
<pre>
<pre><span><img class="aligncenter size-full wp-image-627" title="Simple Sketch of a Cache Service" src="http://fbflex.files.wordpress.com/2009/07/cached1.png?w=442&#038;h=364" alt="Simple Sketch of a Cache Service" width="442" height="364" />
</span>
<pre>processRequest(){

    // get cache ...

   def key = buildRemoteGrailsAppRequest( params )
   def page

   if( cache.containsKey( key ) ){
       page = (String) cache.get(key)}
   } else {
       page = new URL( key ).getText()
       cache.put( key, page )
   }
<pre>
<pre>   render page
}</pre>
</pre>
</pre>
</pre>
</pre>
<p>In the above code, we basically just issue a call to an externally hosted Grails server unconstrained by the file and thread restrictions of the app engine. This allows to quickly take an existing Grails application and scale it up using the App Engine. It offloads much of the page serving to the App Engine.</p>
<p>You could also set up  a more intelligent caching mechanism for your application that expires your caches based on a write. I would simply set this up as a onUpdate or onSave Hibernate Events listener on your externally hosted Grails application.</p>
<p>Given that you get ten application instances for each Google App Engine account, it becomes very viable to also offload processing intensive operations into services that are hosted on the App Engine. Say you have an App that does a lot of image manipulation and resizing. You could simply write a few simple services on the App Engine that use the supplied Image Manipulation API and store these into cache.</p>
<p>It helps conserve your server resources ( expensive ) and offload them onto the App Engine ( cheap ).</p>
<p>The App Engine affords a really neat service oriented infrastructure for Grails developers because we no longer need to consider bandwidth and server resources as an issue. By front-ending our bandwidth-intensive apps with an App-Engine Service and offloading computationally expensive operations into it, we can provide highly scalable, powerful applications at a low cost.</p>
<p>Of course, it requires a little bit more planning and engineering, but this type of infrastructure allows us to keep all the productivity gains of Grails without having to deal with the constrained App-Engine development environment.</p>
<p>What do you guys think?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/622/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=622&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/07/25/google-app-engine-as-a-super-aggressive-cache-service-for-grails-apps/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/07/processing.png" medium="image">
			<media:title type="html">By The Power of App Engine, I am a Grails App!</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/07/cached1.png" medium="image">
			<media:title type="html">Simple Sketch of a Cache Service</media:title>
		</media:content>
	</item>
		<item>
		<title>9 Tips to Planning and Building Maintainable Grails UIs</title>
		<link>http://fbflex.wordpress.com/2009/07/21/9-tips-to-planning-and-building-maintainable-grails-user-interfaces/</link>
		<comments>http://fbflex.wordpress.com/2009/07/21/9-tips-to-planning-and-building-maintainable-grails-user-interfaces/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 19:48:19 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=582</guid>
		<description><![CDATA[How can we build user interfaces using GSP that are manageable and easy to update? Many of the books on Grails focus on the technology available in Grails, but very few give rules and techniques to make GSPs manageable.
Grails templates and the out-of-the-box functionality is great. But once you start trying to integrate layouts and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=582&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>How can we build user interfaces using GSP that are manageable and easy to update? Many of the books on Grails focus on the technology available in Grails, but very few give rules and techniques to make GSPs manageable.</p>
<p>Grails templates and the out-of-the-box functionality is great. But once you start trying to integrate layouts and designs for real world websites, you&#8217;ll find that bad coding practices can quickly lead to a chaotic and unmaintainable mess of spaghetti code.</p>
<p>In this post, I want to share some tips, lessons and ideas I have learned from projects worked in the last year and a half of Grails UI development.</p>
<p><span id="more-582"></span></p>
<h2>Planning Your UI</h2>
<h3><strong><strong>1. Build a Skeleton with Layouts, Taglibs, Codecs and Templates.</strong></strong></h3>
<p>For one of our projects, we made the mistake of giving a PSD template to an HTML/CSS contractor. He started putting things together in the way that a traditional HTML developer would, worrying more about positioning and squeezing the right graphics in place. Big chunks of code were copied and pasted into other areas so that it looked right and he would get paid. We then spent the next three weeks retrofitting his HTML mess into our GSP files and had to throw a lot of his code away.</p>
<p>If you&#8217;re starting a new project and are not very familiar with Grails, spend a bit of time learning and educating your team about how to properly use Sitemesh layouts, codecs, tag libraries and templates.</p>
<p>Once you have learned them, build a <strong>Skeleton</strong> for your site. Based on wire frames or other design artifacts, create templates and views that simply render out a string. Use layouts to organize these simple templates and views and map them to your URLMapping. Try navigating your site. This will help you identify missing functionality and better organize your project&#8217;s UI structures before changing much of your code.</p>
<h3><strong><span style="font-weight:normal;"><strong>2. Figure Out The Plugins You Need Early.</strong></span></strong></h3>
<p><strong><span style="font-weight:normal;">One of the big hurdles that get in the way of creating and maintaining Grails projects is trying to insert a plugin after some of the code and page functionality has been scripted. Different plugins will lead to different tags and UI strategies. Ask yourself the following questions:</span></strong></p>
<ul>
<li>Are you going to use Ajax?</li>
<li>Which JavaScript libraries or UI frameworks are you going to use?</li>
<li>Which kind of template engine are you going to use? Sitemesh (default) or <a href="http://www.grails.org/plugin/freemarker">FreeMaker</a>?</li>
<li>Does your site need security and authentication?</li>
<li>Do you need a blog, shopping cart solution or third party payment gateway</li>
<li>Are you going to use the <a href="http://www.grails.org/plugin/ui-performance">UI Performance</a> Plugin?</li>
<li>Are you going to use rich client technology like <a href="http://www.grails.org/plugin/flex">Flex</a>, <a href="http://www.grails.org/plugin/gwt">GWT</a> or <a href="http://grails.org/OpenLaszlo+plugin">OpenLaszlo</a>?</li>
<li>Are you going to provide alternative views for mobile devices such as the iPhone via the <a href="http://www.grails.org/plugin/iwebkit">iWebKit</a> plugin?</li>
</ul>
<h3><strong>3. Have a Strategy for Updating Semi-static Content.</strong></h3>
<p><strong><span style="font-weight:normal;">There are certain parts of your website that will be updated only once in a while. These might include corporate information, about pages, contact information, etc. This content might be different than the main functionality of your website but might need frequent updates. <span style="font-weight:normal;"> </span></span></strong></p>
<p><strong><span style="font-weight:normal;"><span style="font-weight:normal;">Depending on the complexity of your project, you might want to consider building a content management system and admin interface that is separate from your main application. This will allow you to easily maintain this type of data without having to restart or redeploy your application. </span></span></strong></p>
<p><strong><span style="font-weight:normal;"><span style="font-weight:normal;">Consider hooking up to a Content Management interface like <a href="http://www.weceem.org">Weceem</a> or the <a href="http://www.grails.org/plugin/cms">Grails CMS plugin</a>. Or you might want to design your application so you&#8217;re editing this content with established platforms with beautiful editing interfaces like WordPress, and then pulling in this data via the <a href="http://grails.org/plugin/wordpress">WordPress Plugin</a>.</span></span></strong></p>
<p><strong><span style="font-weight:normal;">When thinking about static content, also think about where and how you are going to host and update images and other media on your Grails application. Are you going to host them externally in a separate server? Would you need a plugin like</span> <a href="http://grails.org/plugin/static-resources"><span style="font-weight:normal;">static resources</span></a><span style="font-weight:normal;">? Are you going to deploy a content delivery network for videos? Thinking out and planning these steps will simplify your UI development process and will prevent you from having to make changes later.</span></strong></p>
<h2><strong>Coding Your UI</strong></h2>
<h3><strong><strong>4. Build Top-Level Templates That Map To Domain Objects</strong></strong></h3>
<p>Let&#8217;s assume you have a complex book listing GSP file:</p>
<p style="text-align:center;"><img class="aligncenter" title="structure of the pate" src="http://fbflex.files.wordpress.com/2009/07/one.png?w=226&#038;h=310" alt="structure of the pate" width="226" height="310" />Because this all renders into one page, you might start by adding each of the areas, perhaps separating each section with html markup. You&#8217;ll end up with a gsp page that looks like this:</p>
<p style="text-align:center;"><img class="aligncenter" title="full page gsp" src="http://fbflex.files.wordpress.com/2009/07/two.png?w=220&#038;h=421" alt="full page gsp" width="220" height="421" /></p>
<p style="text-align:left;">This GSP can get very hard to manage after a while. Worst yet, it is not immediately evident when you come to the page which section actually belongs to which domain classes. You&#8217;ll end up spending a lot of time tracking each bit and section.</p>
<p>A better solution might be to break down the larger HTML into <strong>templates that map to the domain classes</strong> they represent. This allows you to create views used for navigation ( usually homepages and top level category pages ) and those used to display data. This helps keep views simple, allows for re-use and makes updating future pages more manageable.</p>
<p style="text-align:center;"><img class="aligncenter" title="separated files" src="http://fbflex.files.wordpress.com/2009/07/three.png?w=457&#038;h=302" alt="separated files" width="457" height="302" /></p>
<p style="text-align:left;">So for this example, we might break down the sidebar into further smaller gsp templates, while for things that are fairly atomic like the booklist, just render the template.</p>
<p>( In the example above, you would probably have also separated header, footer and sidebars into a layout. )</p>
<h3><strong>5. Generate As Much Code As Possible.</strong></h3>
<p>One of the very powerful things about Grails is the ability to generate code based on domain objects. However, this mechanism is also one that is rarely used outside of the typical CRUD templates. In past projects, what I ended up doing was to edit the resulting gsp file, losing the ability to regenerate my views when I needed to change domains.</p>
<p>If you follow the last tip, you will see that your data views become fairly individualized, atomic containers for data. You can then use a plugin like the <a href="http://www.grails.org/Xtemplates+Plugin">xTemplate</a> plugin to define more views than the default CRUD views provided by Grails. I find that you usually want a read-only list browser, a read-only individual item browser.</p>
<p>This is also an excellent way to extend plugins and other functionality.</p>
<p>Let&#8217;s say you want to provide AJAX functionality to your domain objects and connect this into the Grails-UI plugin. Once you have built one that works, you can take this functionality and extract it so that you can use this functionality to generate more views. At the end of the day, you will be able to update individual views via the <em>generate-views</em> command whenever your domain object changes, and not to worry about doing this manually. Less manual labour = less mistakes.</p>
<h3><strong>6. Build Helper Libraries.</strong></h3>
<p>A trick that has served me well is to build taglibs for links and images that you are going to put on your gsp pages with a custom tag that wraps the default Grails tags. I&#8217;ve found that many websites have succint SEO and tracking requirements. By keeping an utility library that generates your links, you don&#8217;t have to worry about forgetting to add analytics or title/alt tags.</p>
<p>For code that you find yourself writing across projects, consider wrapping these into utility plugins that you can then share across your projects ( and contribute to the community! ).</p>
<p>For example, if you find yourself embedding a lot of flash files in your projects, you might want to create a tag that also writes out the alternative content and noscript tags and put it into a plugin. If your script library updates, you simply need to update your plugin instead of updating all your codebases by hand.</p>
<h3><strong>7. Preserve Names Across Technologies.</strong></h3>
<p><strong><span style="font-weight:normal;">This one is pretty simple. Let&#8217;s assume you have a bunch of gsp files that also call css and javaScript files. Come up with a common convention to associate them. For example, you might have a set of css files for Book called <em>book.css, book_ie6.css</em> and <em>book_ie7.css</em>, and a set of JavaScripts called <em>book.js</em>.</span></strong></p>
<p><strong><span style="font-weight:normal;">If the layouts of your pages change often, consider also having css and javascript files called <em>book_external.css</em> and <em>book_external.js</em> that are served from an external source and override the files deployed with your web application. This will let you change your site without having to re-deploy, assuming that this is what is dictated by your semi-static content strategy.</span></strong></p>
<p><strong><span style="font-weight:normal;">If you have complex views, consider writing a helper service that has the same name as the views. For a read-only bookList, for example, build a method called <em>getBookList()</em> in your BookService. This prevents you from repeating this code across many controllers, and helps you keep this code maintainable. ( Also think about putting as a code template in src/templates, so you can generate helper services easily without affecting your controller ).</span></strong></p>
<h3><strong><span style="font-weight:normal;"><strong>8. Keep Your Technologies Uncoupled.</strong></span></strong></h3>
<p><span style="font-weight:normal;">With scriptlets and the g:if tag, it becomes very tempting to resort to all sorts of inline code generation madness to customize css and javascript views. The problem comes when you need to replace or refactor this code later on.</span> <span style="font-weight:normal;">Let&#8217;s say that you wrote a css that calculates widths according to the a value in your domain objects like this:</span></p>
<pre style="text-align:center;"><span style="color:#800000;">.book{ width: ${ book.narrow ? 40 : 120 } px }</span></pre>
<p>What happens when you suddenly find out that you need to use this component somewhere else with a different margin? You would need to rewrite this section and find all the places where your code has been inlined. <span style="font-weight:normal;">Instead, keep your code and style separate by strictly forcing domain objects to generate id tags in Divs, then style these divs according to your UI specifications:</span></p>
<pre style="text-align:center;"><span style="color:#800000;"><span style="font-weight:normal;">&lt;div id=" ${ book.narrow ? 'narrowBook' : 'wideBook' } " /&gt;
</span></span></pre>
<p><span style="font-weight:normal;"><br />
This way, you can simply overwrite the css file for the new page.</span></p>
<p>Similarly, it&#8217;s easy to try to insert values directly into inline JavaScript files. Just don&#8217;t. Instead, what I&#8217;ve found works is to declare variables in your GSP files,</p>
<pre style="text-align:left;padding-left:30px;"><span style="color:#800000;"><span style="font-weight:normal;">&lt;g:javascript&gt;
	var bookCount = ${ Book.count() }; </span></span><span style="font-weight:normal;"><span style="color:#800000;">
&lt;/g:javascript&gt;
</span>
</span></pre>
<p><span style="font-weight:normal;"><br />
Then use them in your javascript code.</span> The reason for this is twofold.</p>
<p><span style="font-weight:normal;">First, you can look at the variables you&#8217;re using and passing back and forth right away, allowing you to catch if a variable has been missed or is returning the wrong value.</span> <span style="font-weight:normal;"> </span></p>
<p><span style="font-weight:normal;">Second, you can then keep the bulk of your javascript inside a separate js file. This allows you to quickly replace it with another library or test it out with fake data during development. It removes the dependency to your backend. It also enables this to be compressed via utilities like <em>ui-performance</em>.</span></p>
<h3><strong><span style="font-weight:normal;"><strong>9. Write Tests.</strong></span></strong></h3>
<p>Test, we all know we should write them, but it&#8217;s easiest to forget about them when you&#8217;re working with the UI layer. After all, you&#8217;ve already written all your controller and unit tests. Why bother spending time testing out things that can be caught by a website run-through?</p>
<p>You will find that writing at least a minimal set of tests will enable you to keep sane once a whole whack of UI code has been written. There are a lot of plugins that can help you with catching accidental 404s and 500 errors, specially when it comes to complex HTML websites.</p>
<p>The list of plugins keep growing, but currently you can choose between:</p>
<ul>
<li> <a href="http://www.grails.org/Functional+Testing">Canoo Webtest Plugin</a></li>
<li> <a href="http://www.grails.org/Selenium+plugin%20">Selenium Plugin</a></li>
<li> <a href="http://www.grails.org/Grails%20Functional%20Testing">Grails Functional Testing Plugin</a> (HtmlUnit)</li>
</ul>
<p>Additionally, you can use external tools like JMeter, VisualVM or Perf4J to track your page performance and memory usage. Don&#8217;t forget about tools like YSlow and Google Page Speed.</p>
<p><strong><span style="font-weight:normal;"><strong><span style="font-weight:normal;">At the minimum, write a set of tests that map to your URL mappings to check for 404s and 500 errors. Check your links and use a plugin like <a href="http://www.grails.org/plugin/build-test-data">build-test-data</a> to see that your components are working the way they are supposed to.</span></strong></span></strong></p>
<p>Anyway, these are the lessons I have learned from Grails UI development. I hope they are useful to you. What are yours?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/582/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=582&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/07/21/9-tips-to-planning-and-building-maintainable-grails-user-interfaces/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/07/one.png" medium="image">
			<media:title type="html">structure of the pate</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/07/two.png" medium="image">
			<media:title type="html">full page gsp</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/07/three.png" medium="image">
			<media:title type="html">separated files</media:title>
		</media:content>
	</item>
		<item>
		<title>Grails Hosting Solutions? Here&#8217;s a list&#8230;</title>
		<link>http://fbflex.wordpress.com/2009/07/14/grails-hosting-solutions-heres-a-list/</link>
		<comments>http://fbflex.wordpress.com/2009/07/14/grails-hosting-solutions-heres-a-list/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 16:14:33 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=578</guid>
		<description><![CDATA[Inspired by a recent post in the mailing list, I&#8217;ve decided to gather a list of web hosts that are Grails friendly or recommended by Developers&#8230;

Google App Engine
Amazon EC2
eApps
Morph
A2
Hetzner.de

Know any more? What do you use for your Grails hosting? ( List from Grails.org )
Discussions about this on the Grails Mailing List:http://www.nabble.com/Grails-Hosting%3A-Which-Company%2C-Which-Application-Server-td24860653.html
     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=578&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Inspired by a recent post in the mailing list, I&#8217;ve decided to gather a list of web hosts that are Grails friendly or recommended by Developers&#8230;</p>
<ul>
<li><a href="http://code.google.com/appengine/">Google App Engine</a></li>
<li><a href="http://aws.amazon.com/ec2/">Amazon EC2</a></li>
<li><a href="http://www.eapps.com">eApps</a></li>
<li><a href="http://www.mor.ph">Morph</a></li>
<li><a href="http://www.a2hosting.com/">A2</a></li>
<li><a href="http://www.hetzner.de/">Hetzner.de</a></li>
</ul>
<p>Know any more? What do you use for your Grails hosting? ( <a href="http://www.grails.org/hosting">List from Grails.org</a> )</p>
<p>Discussions about this on the Grails Mailing List:<a href="http://www.nabble.com/Grails-Hosting%3A-Which-Company%2C-Which-Application-Server-td24860653.html">http://www.nabble.com/Grails-Hosting%3A-Which-Company%2C-Which-Application-Server-td24860653.html</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/578/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=578&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/07/14/grails-hosting-solutions-heres-a-list/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex on Grails Book Update: Making it Free!</title>
		<link>http://fbflex.wordpress.com/2009/06/20/flex-on-grails-book-update-making-it-free/</link>
		<comments>http://fbflex.wordpress.com/2009/06/20/flex-on-grails-book-update-making-it-free/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 22:30:02 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=565</guid>
		<description><![CDATA[I&#8217;ve decided to share what I&#8217;ve written about Flex on Grails as a book online under the Creative Commons License.
http://sites.google.com/site/flexongrails/
Right now, only the preface and the hello world chapters are online. In the coming weeks, I&#8217;ll update the content on my hard drive, write new content and post them online. Feedback is highly appreciated.
This book [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=565&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve decided to share what I&#8217;ve written about Flex on Grails as a book online under the Creative Commons License.</p>
<p><a href="http://sites.google.com/site/flexongrails/">http://sites.google.com/site/flexongrails/</a></p>
<p>Right now, only the preface and the hello world chapters are online. In the coming weeks, I&#8217;ll update the content on my hard drive, write new content and post them online. Feedback is highly appreciated.</p>
<p>This book will target Flex 4 and either Grails 1.2. or Grails 2.0, depending on it&#8217;s release schedule.<span id="more-565"></span></p>
<p><strong>30 Second Elevator Pitch</strong></p>
<p>This book is about combining the power of Flex 4 with the ease of use of Grails.</p>
<p>With Flex, we can build powerful desktop applications like <a href="http://tweetdeck.com/">Tweetdeck</a> or incredibly useful web applications like those available at <a href="http://aviary.com/">http://www.aviary.com/</a>.</p>
<p>With Grails, we can harness the power of Java in a rapid development framework with the features and advantages of Ruby on Rails.</p>
<p>Best of all, with recent efforts like the <a href="http://www.grails.org/GraniteDS+Flex+Plugin">GraniteDS</a> plugin and the <a href="http://www.springsource.org/spring-flex">Spring-BlazeDS</a> integration initiative, we can seamlessly integrate Flex front-ends with Grails back-ends. Development has never been so effortless.</p>
<p><strong>Motivation For the Creative Commons Release.</strong></p>
<p>There are just not enough people that see the potential in combining Grails and Flex.</p>
<p>I know that as a Java developer, I was scared away by the notion of Flex being this complex beast that forced me to work in symbols and a Flash timeline. When I started playing with it, I realized that it was more like HTML and JavaScript than this foreign Macromedia director thing I had in mind.</p>
<p>I can imagine the same thing is true for Grails. One of my friends described it as PHP on steroids. Java, JavaScript and ActionScript are closer in syntax to each other. The JVM and the Flash Player are similar architecturally. But not a lot of Flex developers know about Grails and not a lot Grails developers want to try Flex. We&#8217;ve been too scarred by the bad past experiences with broken Java projects or think that Flash is nothing but just a tool to build banner ads.</p>
<p>My experience with Grails and Flex is that it works. And it works charmingly. Most importantly, it lets old Java devs quickly move their skills to Grails and HTML/JavaScript devs quickly move their skills to Flex. It gets rid of mundane tasks like configuring hibernate XML files and having to test five different versions of each browser for each interface.</p>
<p>By releasing the information under the creative commons license, I hope that more people would be aware of this killer combination. Adobe has done a lot by releasing much of the Flex SDK into open source. And Grails builds on the great open source ethos. I hope that this book contributes to Flex developers being more curious about Grails, and Grails developers considering Flex as a viable alternative.</p>
<p>I think we are at the cusp of something wonderful. The new Data Service support introduced in Flex Builder 4 will make a lot of the pain and code generation troubles go away. We&#8217;re at a point where writing complex web services and deploying them onto new platforms like the Google App Engine can take a matter of days, not months. If I can only help one more Java dev not have to configure Hibernate manually or one more front-end dev not have to deal with IE6 stupidity, then my job is done.</p>
<p><strong>A Little History on This Book</strong></p>
<p>This book started as an idea on my blog post <a href="http://fbflex.wordpress.com/2008/07/26/nine-lessons-from-building-a-grails-flex-flash-website/">Nine Lessons from a Flex and Grails site </a>. I was soon contacted by the good people of Apress to put together a book for their FirstPress format. I started working on it, then I fumbled. I ended up in a situation where I was sometimes working 18 hours a day to meet deadlines and was just too drained to work on anything else. I contacted the editor and told him I had to put the book on ice until I could find some time to continue working on it.</p>
<p>Fast forward a few months, I had moved to London to work in a very interesting startup company that does amazing stuff with visual search technology. The hours were sane and I had time to digest and process the things I had learned in the previous year. The tech community here is very inspiring. Walking to Grails talks at Skills Matter or learning about the latest Flash techniques at the London Flash Platform User Group reminded me of the excitement and wonder that these technologies could bring. I felt that I was finally in a place where I could work on the ideas of this book in peace.</p>
<p>All the tech pieces started to come into place too. All the floating questions when I was working on the first draft of this book solidified with more and more people interested in getting Flash/Flex and Java working together. I felt the urgency to stand on the street corner and yell : &#8216;hey, check out flex and grails together!&#8217; once again.</p>
<p>Anyway, I&#8217;m gonna keep thinking about this book and writing content, and I hope to get ideas, suggestions and feedback from you.</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/565/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/565/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/565/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=565&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/06/20/flex-on-grails-book-update-making-it-free/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>
	</item>
		<item>
		<title>A Cooliris CMS for the Google App Engine: Manage and Host XML-based Flash and Flex Components with Grails</title>
		<link>http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/</link>
		<comments>http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 21:31:34 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=522</guid>
		<description><![CDATA[There is an incredible wealth of amazing looking Flash components in the market today. Tools like Cooliris and the 3D Wall provide visually stunning components that can quickly make any website come alive. With Grails and the Google App Engine, we can build simple, secure and powerful content management engines for these components with very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=522&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There is an incredible wealth of amazing looking Flash components in the market today. Tools like <a href="http://www.cooliris.com/">Cooliris</a> and the <a href="http://www.flashloaded.com/flashcomponents/3dwall/">3D Wall </a>provide visually stunning components that can quickly make any website come alive. With Grails and the Google App Engine, we can build simple, secure and powerful content management engines for these components with very little effort.</p>
<p>In this post, I walk you through all the steps you need in hosting, deploying and securing a Cooliris CMS for the Google App Engine using Grails.</p>
<p><strong>Tip:</strong> Flex is also <a href="http://www.adobe.com/devnet/flex/quickstart/accessing_xml_data/">XML friendly</a>, so you can use this technique to add CMS-ed apps on Flex.</p>
<p><a href="http://grailsgae.appspot.com"><img src="http://fbflex.files.wordpress.com/2009/06/picture-7.png?w=700&#038;h=272" alt="Things you can't really do well with javascript" width="700" height="272" /></a><br />
<span id="more-522"></span></p>
<h2>Videos</h2>
<p>Videos are best viewed in HD and full screen.</p>
<ol>
<li><strong>XML-driven Flash Components, Content Management Systems and the App Engine</strong><br />
<span style="text-align:center; display: block;"><a href="http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/"><img src="http://img.youtube.com/vi/WP2JpIMrDGY/2.jpg" alt="" /></a></span></li>
<li><strong>Building a simple CMS with Grails<br />
<span style="text-align:center; display: block;"><a href="http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/"><img src="http://img.youtube.com/vi/Chv5SrjQ5Rk/2.jpg" alt="" /></a></span></strong></p>
<p><strong> </strong></li>
<li><strong>Outputing XML from Grails<br />
<span style="text-align:center; display: block;"><a href="http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/"><img src="http://img.youtube.com/vi/i7v-_YV3T6E/2.jpg" alt="" /></a></span></strong></p>
<p><strong> </strong></li>
<li><strong>Integrating and connecting the Cooliris component into Grails and deployment to Google App Engine<br />
<span style="text-align:center; display: block;"><a href="http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/"><img src="http://img.youtube.com/vi/_OCPiDRpl0k/2.jpg" alt="" /></a></span></strong></p>
<p><strong> </strong></li>
<li><strong>Building a simple Image Proxy service for Flash Components to overcome Flash Security Exceptions<br />
<span style="text-align:center; display: block;"><a href="http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/"><img src="http://img.youtube.com/vi/qQrzOOLrr7E/2.jpg" alt="" /></a></span></strong></p>
<p><strong> </strong></li>
<li><strong>Access Control on the Google App Engine with Grails</strong><br />
<span style="text-align:center; display: block;"><a href="http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/"><img src="http://img.youtube.com/vi/vTe34HmQseE/2.jpg" alt="" /></a></span></li>
</ol>
<h3><strong>Links:</strong></h3>
<ul>
<li>The Library Application: <a href="http://grailsgae.appspot.com">http://grailsgae.appspot.com</a></li>
<li>Source Code on GitHub: <a href="http://github.com/tomaslin/Cooliris-CMS-for-AppEngine">http://github.com/tomaslin/Cooliris-CMS-for-AppEngine</a></li>
</ul>
<h3>Flash Components</h3>
<ul>
<li><a href="http://www.flashloaded.com/">Flashloaded</a>: Makers of 3dWall and other cool effects</li>
<li><a href="http://www.FlashDen.net">FlashDen.net</a>: Component Marketplace</li>
<li><a href="http://www.cooliris.com">Cooliris.com</a>: Maker of the application we use.</li>
</ul>
<h3>Groovy and Grails</h3>
<ul>
<li><a href="http://www.grails.org">Grails website</a></li>
<li><a href="http://www.grails.org/plugin/app-engine">Google App Engine Plugin</a></li>
<li><a href="http://blog.springsource.com/2009/05/14/grails-111-released-with-google-appengine-support/">SpringSource blog and screencast on GAE deployment</a></li>
<li> <a href="http://groovy.codehaus.org/Creating+XML+using+Groovy%27s+MarkupBuilder">Groovy Markup Builders</a></li>
<li><a href="https://fisheye.codehaus.org/browse/GRAILSPLUGINS-1209">Authentication Patch</a></li>
</ul>
<h3>Google App Engine</h3>
<ul>
<li><a href="http://code.google.com/appengine/docs/java/overview.html">Google App Engine for Java</a></li>
<li><a href="http://code.google.com/appengine/docs/java/config/webxml.html#Security_and_Authentication">Security and Access Control</a></li>
</ul>
<p>There is also a <a href="http://www.youtube.com/watch?v=wJfYAJJYMqg">$2 Deluxe Version</a> of these videos.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/522/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=522&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/06/06/cooliris-cms-on-grails-and-google-app-engine-xml-based-flash-component-hosting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>

		<media:content url="http://fbflex.files.wordpress.com/2009/06/picture-7.png" medium="image">
			<media:title type="html">Things you can't really do well with javascript</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/WP2JpIMrDGY/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/Chv5SrjQ5Rk/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/i7v-_YV3T6E/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/_OCPiDRpl0k/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/qQrzOOLrr7E/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/vTe34HmQseE/2.jpg" medium="image" />
	</item>
		<item>
		<title>Book Review: Grails 1.1 Web Application Development</title>
		<link>http://fbflex.wordpress.com/2009/06/05/book-review-grails-1-1-web-application-development/</link>
		<comments>http://fbflex.wordpress.com/2009/06/05/book-review-grails-1-1-web-application-development/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 20:01:39 +0000</pubDate>
		<dc:creator>Tomas Lin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fbflex.wordpress.com/?p=524</guid>
		<description><![CDATA[I received a free review copy of Grails 1.1 Web Application Development from Packt Press. They asked me to provide a review for it. Unfortunately, this review will be less than glowing ( sorry Packt ).

The book&#8217;s website is here, you can order from Amazon here, and there is a free sample chapter here.
It&#8217;s refreshing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=524&subd=fbflex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I received a free review copy of <a href="http://www.amazon.com/gp/product/1847196683?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1847196683">Grails 1.1 Web Application Development</a> from Packt Press. They asked me to provide a review for it. Unfortunately, this review will be less than glowing ( sorry Packt ).<br />
<span id="more-524"></span></p>
<p>The book&#8217;s website is <a href="http://www.packtpub.com/grails-1-0-web-application-development/book">here</a>, you can order from Amazon <a href="http://www.amazon.com/gp/product/1847196683?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1847196683">here</a>, and there is a free sample chapter <a href="http://www.packtpub.com/files/grails-1-1-web-application-development-sample-chapter-10-managing-content-through-tagging.pdf">here</a>.</p>
<p>It&#8217;s refreshing to see more introduction books to come into the Grails market in the last few months. When I started working with Grails a year ago, there were few references other than the Definitive Guide to Grails. Today, Apress, Manning, Packt and other individual publishers have really seen the need for good reference books. It&#8217;s also nice to see that specialized books such as Robert Fischer&#8217;s <a href="http://www.amazon.com/gp/product/1430219262?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1430219262">Grails Persistence with GORM and GSQL</a>, Bashal Abdul-Jawad&#8217;s <a href="http://www.amazon.com/gp/product/143021600X?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=143021600X">Groovy and Grails Recipes</a> or books in other languages such as Nacho Brito&#8217;s Spanish language <a href="http://www.manual-de-grails.es/">Manual de desarrollo web con Grails</a>.</p>
<h2>About the Book</h2>
<p>This book is an introduction to web development with Grails. It competes in the same space with Apress&#8217; <a href="http://www.amazon.com/gp/product/1430210451?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1430210451">Beginning Groovy and Grails</a> and Manning&#8217;s recently published <a href="http://www.amazon.com/gp/product/1933988932?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1933988932">Grails in Action</a>. I would say that it&#8217;s geared towards beginners who want to learn more about the platform, and does contain a robust example of a web application being developed &#8211; a team communication portal.</p>
<h2>Things I liked about this book:</h2>
<ol>
<li>Content-wise, the book is sufficient. If you have never heard about Grails and want to sit through a good tutorial &#8211; and can get this book for cheap &#8211; it&#8217;s a welcome addition to any library. It covers all you would expect from a Grails book. Unfortunately, I think it&#8217;s done better elsewhere.</li>
<li>The example application here is relatable, in the form of a team communication project.</li>
<li>The author does cover Grails 1.1. features such as template namespaces and RESTful mappings, but unfortunately does not do so consistently across the entire book. I would have liked to see features like database password encryption mentioned in the database chapter, for example.</li>
<li>I like the reference to the rich plugin infrastructure of Grails. In the testing chapter, he mentions Marc Palmer&#8217;s excellent Functional Testing plugin, for example.</li>
<li>The file sharing ( not p2p ) chapter was very interesting. It is perhaps the one strength of this book. It&#8217;s something that is not well covered by the documentation, and the author provides a clear concise implementation here that answers a lot of the questions.</li>
</ol>
<h2>Things I didn&#8217;t like:</h2>
<ol>
<li>I am not sure who Jon Dickinson is, which is unfortunate. A lot of the other books in this space have been written by people who have contributed plugins or are known in the mailing lists. When I pick up Robert Fischer&#8217;s book, for example, I can associate in my mind the autobase and liquibase plugins. Glen Smith, one of the authors of Grails in Action, is the host of the grails podcast and has written groovyblogs. Peter Ledbrook, the other author of Grails in Action works for SpringSource and wrote the JSecurity plugin referenced in this book. They are people known in the community for their reputation. But I couldn&#8217;t find a blog or any info bearing his name.
<p>I get a sense by reading the book that Jon is more of a backend developer, dealing heavily with the business logic side of things. I think this book would have benefited from another author that deals more with front-end technogies that would have helped fleshed out the book more. It feels like some of the chapters are straight out rehashes of the user manual. Which is not a good thing. You don&#8217;t hear about things like the ui-performance plugin, xTemplates or other really nice tools that make developing frontends with Grails a joy. There is also no mention of the OpenLaszlo, Flex or GraniteDS plugins in the RIA chapter. Which is a shame.</li>
<li>The writing is a little dry. Grails in Action has a chapter called Advanced GORM Kung Fu and another one called Grails in a Hurry. The enthusiasm for the technology is apparent in that book. The writing here is very matter of fact and purposeful. But to me it&#8217;s hard to see the benefits of reading this against the excellent Grails Reference Manual.</li>
<li>The chapter organization was very strange. Groovy, the programming language used in Grails, has always been at the first or second chapters of all the other intro books. To me, it sets the stage for understanding the code in the rest of the books. Here, Groovy is introduced in chapter 4. After a long talk about setting up the application and scaffolding. It didn&#8217;t make sense to me.</li>
<li>Then there is lax terminology. To give you an example, the author lists &#8216;Less configuration&#8217; as one of the advantages of Grails. I wish the author would have stuck with the more popular term  &#8216;Convention over Configuration&#8217;, which is an actual software pattern &#8211; so that users reading the book can take note of this and google this if they wanted.</li>
<li>The way code is presented in the book is horrid:
<p>code code code<strong><br />
line in bold<br />
</strong>code code code<br />
In Grails in Action, there are cueballs that the authors then reference. This makes it feel more like &#8216;hey look at this part of code&#8217;. The way code is laid out in this book makes it feel lazy and I wish more attention would have been paid to the typesetting of this book.</li>
<li>The plugin chapter is weak compared to other books. While it&#8217;s nice to put your code into plugins, the author misses the fact that the plugin system allows for integration with other libraries, making Grails the perfect glue language. I recommend watching Russ Miles&#8217; grails plugins <a href="http://skillsmatter.com/podcast/java-jee/when-spring-projects-met-grails-bringing-killer-new-features-to-grails-with-grails-plugins-and-the-spring-portfolio">podcast</a></li>
<li>It&#8217;s $40.</li>
</ol>
<h2>Conclusion</h2>
<p>If this was a cheap book, I would recommend it as an extra resource to your library. It has some gems, but nothing you could not find documented on the <a href="http://www.grails.com">grails.org</a> site or <a href="http://www.grails.org/doc/1.1/">the reference manual</a>. If this book was available a year ago, it would have done really well. But today, do not waste your money on it as your primary reference. Instead, try to get a copy of either Graeme Rocher and Jeff Brown&#8217;s excellent <a href="http://www.amazon.com/gp/product/1590599950?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590599950">Definitive Guide to Grails ( 2nd edition )</a>, or Peter Ledbrook and Glen Smith&#8217;s <a href="http://www.amazon.com/gp/product/1933988932?ie=UTF8&amp;tag=misa09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1933988932">Grails in Action</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fbflex.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fbflex.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fbflex.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fbflex.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fbflex.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fbflex.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fbflex.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fbflex.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fbflex.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fbflex.wordpress.com/524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fbflex.wordpress.com&blog=3300005&post=524&subd=fbflex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fbflex.wordpress.com/2009/06/05/book-review-grails-1-1-web-application-development/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4cdec8dc311c5d0b00d44413175bcf85?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chinito</media:title>
		</media:content>
	</item>
	</channel>
</rss>