<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mrinal Wadhwa &#187; Gears</title>
	<atom:link href="http://weblog.mrinalwadhwa.com/category/gears/feed/" rel="self" type="application/rss+xml" />
	<link>http://weblog.mrinalwadhwa.com</link>
	<description>en route to a richer Internet</description>
	<lastBuildDate>Sun, 28 Feb 2010 09:39:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Enhancing Flex applications with Google Gears</title>
		<link>http://weblog.mrinalwadhwa.com/2008/06/27/flex-and-gears/</link>
		<comments>http://weblog.mrinalwadhwa.com/2008/06/27/flex-and-gears/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 18:41:29 +0000</pubDate>
		<dc:creator>Mrinal Wadhwa</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Gears]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[google gears]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[shortcut]]></category>

		<guid isPermaLink="false">http://weblog.mrinalwadhwa.com/?p=313</guid>
		<description><![CDATA[<p><a href="http://gears.google.com">Google Gears</a> is a very interesting platform.  It&#8217;s a browser plugin that is aimed at extending the abilities of web browsers to satiate the needs of modern day rich web applications. The Gears website defines it as follows ..</p>
<blockquote><p>Gears is an open source project that enables more powerful web applications, by adding new features to your web browser:</p>
<ul>
<li>Let web applications interact naturally with your desktop</li>
<li>Store data locally in a fully-searchable database</li>
<li>Run JavaScript in the background to improve performance</li>
</ul>
</blockquote>
<p>Gears today provides some very <a href="http://code.google.com/apis/gears/api_summary.html">interesting features</a> like a <a href="http://code.google.com/apis/gears/api_workerpool.html">WorkerPool</a> module to run JavaScript code in the background, without blocking the main page&#8217;s script execution, a <a href="http://code.google.com/apis/gears/api_localserver.html">LocalServer</a> module that allows a web application to cache and serve its HTTP resources locally without a network connection, a <a href="http://code.google.com/apis/gears/api_database.html">Database</a> module that provides browser-local relational data storage, a <a href="http://code.google.com/apis/gears/api_desktop.html">Desktop</a> module that allows you to create desktop shortcuts for your web applications and more.</p>
<p>There are some very interesting <a href="http://sites.google.com/site/io/improving-browsers-in-new-ways-gears">features in the works</a> as well like Desktop Notifications from browser apps, Multiple file select, resuming uploads, geolocation support etc.</p>
<p>All the above features have the potential of drastically changing the experience users have when using applications in the browser and that excites me <img src='http://weblog.mrinalwadhwa.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  </p>
<p>Many of these features can be very useful for applications that run in other plugins like Flash Player or Silverlight Player as well&#8230;<!--more--> while ideally all these abilities should be available within these other plugins natively, but the world of web development isn&#8217;t that ideal, is it?. Both Flash and Silverlight have the ability to communicate with the wrapping html page and hence they could potentially use the abilities that Gears provides via the wrapper. The obvious argument against this approach though would be that your application will become dependent on the availability of two plugins in place of one and that&#8217;s a bad move. However, that does not mean you should not take advantage of Gears in your Flex/Silverlight applications, it only means that you should use Gears in a way that your app does not become dependent on it. One approach, for example, could be to expose Gears dependent functionality to a user only when Gears is available on his machine and if its not available quietly and gracefully degrade the functionality. You could check if gears is present using the following code ..<br />
&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">google</span> <span style="color: #339933;">&amp;&amp;</span> google.<span style="color: #660066;">gears</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
       <span style="color: #006600; font-style: italic;">//gears is installed</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
     <span style="color: #006600; font-style: italic;">//gears is not installed</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I&#8217;m sure you could come up with other such approaches, so I&#8217;d love to know your suggestions.</p>
<p>Meanwhile, I cooked up this little <a href="http://experiments.mrinalwadhwa.com/Gears/FlexDesktopShortcut/FlexGears.html">example Flex app</a> that checks to see if Gears is installed and then allows the user to place a shortcut to the app on his desktop.<br />
&nbsp;<br />
<a href='http://experiments.mrinalwadhwa.com/Gears/FlexDesktopShortcut/FlexGears.html'><img src="http://weblog.mrinalwadhwa.com/wp-content/uploads/2008/06/2008-06-26_1602.png" alt="" title="Create Desktop Shortcut from a Flex app" width="500" height="192" class="aligncenter size-full wp-image-316" /></a></p>
<p><a href='http://weblog.mrinalwadhwa.com/wp-content/uploads/2008/06/2008-06-26_1601.png'><img src="http://weblog.mrinalwadhwa.com/wp-content/uploads/2008/06/2008-06-26_1601.png" alt="" title="" width="500" height="129" class="aligncenter size-full wp-image-317" /></a></p>
<p>&nbsp;<br />
Although <a href="http://experiments.mrinalwadhwa.com/Gears/FlexDesktopShortcut/srcview/index.html">the code</a> is well commented and self explanatory here are a few things I would like to point out &#8230;</p>
<ul>
<li>I have used the ExternalInterface class to communicate with the html wapper, you can read more about how this is done <a href="http://livedocs.adobe.com/flex/3/html/passingarguments_1.html">here in the docs. </a>  </li>
<li>The gears api is needed to communicate with Gears, you can read about using the gears api <a href="http://code.google.com/apis/gears/design.html">here</a> </li>
<li>The first thing you will need to do to start communicating with Gears is include the <a href="http://code.google.com/apis/gears/tools.html#gears_init">gears_init.js</a> in the html wrapper. You can do this by downloading the file to your source folder and including the below line of code in the index.template.html file in your Flex project
</li>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot;  src=&quot;gears_init.js&quot;&gt;&lt;/script&gt;</pre></div></div>

<li>I have used Abdul&#8217;s very cool <a href="http://www.abdulqabiz.com/blog/archives/macromedia_flex/a_mxml_componen.php">JavaScript MXML component</a> to include all my JavaScript code in my mxml file itself.</li>
</ul>
<h1>
<ul>
<li><a href="http://experiments.mrinalwadhwa.com/Gears/FlexDesktopShortcut/FlexGears.html">Check out the example application</a></li>
<li><a href="http://experiments.mrinalwadhwa.com/Gears/FlexDesktopShortcut/srcview/index.html">View Source </a></li>
</ul>
</h1>
<h2>Known Bug</h2>
<p>The flex app temporarily blanks out when the Gears conformation dialog appears on FireFox 3 on  MacOS. I&#8217;m not sure why this happens but it seems like a bug with FireFox.</p>
<p>Finally, do let me know your views on using Gears to enhance applications already dependent on another plugin like Flash Player or Silverlight Player.</p>
<p>&nbsp;&nbsp;</p>
<h2>Update:</h2>
<p>The above blanking out problem could be an issue with flash player as well so I have submitted the issue as a bug to bugs.adobe.com, <a href="https://bugs.adobe.com/jira/browse/FP-376">please vote it up.</a></p>
]]></description>
		<wfw:commentRss>http://weblog.mrinalwadhwa.com/2008/06/27/flex-and-gears/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
