<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
   <channel>
      <title>Adobe Evangelists</title>
      <description>Pipes Output</description>
      <link>http://pipes.yahoo.com/pipes/pipe.info?_id=9986e99f8fddeca8b8249cdc645583d2</link>
      <atom:link rel="next" href="http://pipes.yahoo.com/pipes/pipe.run?_id=9986e99f8fddeca8b8249cdc645583d2&amp;_render=rss&amp;page=2" />
      <pubDate>Sat, 26 May 2012 15:59:33 +0000</pubDate>
      <generator>http://pipes.yahoo.com/pipes/</generator>
      <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AdobeEvangelists" /><feedburner:info uri="adobeevangelists" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
         <title>Preventing vertical scrolling bounce of websites on iOS using JavaScript</title>
         <link>http://gregsramblings.com/2012/05/23/preventing-vertical-scrolling-bounce-using-javascript-on-ios-devices/</link>
         <description>I recently created a web site for reading Twitter called http://lottatweets.com.   As mentioned in an earlier blog post, the site uses CSS3 columns and scrolls horizontally.  If you use your iPad and access any websites, you&amp;#8217;ll notice that if you pull down on the content, you can drag the top of the page down [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3452</guid>
         <pubDate>Wed, 23 May 2012 04:46:00 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://lottatweets.com"><img class="alignright size-full wp-image-3459" title="LottaTweets Scrolling" src="http://gregsramblings.com/wp-content/uploads/2012/05/ipad-hand.png" alt="" width="400" height="288"/></a>I recently created a web site for reading Twitter called <a rel="nofollow" target="_blank" href="http://lottatweets.com">http://lottatweets.com</a>.   As mentioned in an <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2012/05/20/lottatweets-com-web-app-for-speed-reading-tweets/">earlier blog post</a>, the site uses CSS3 columns and scrolls horizontally.  If you use your iPad and access any websites, you&#8217;ll notice that if you pull down on the content, you can drag the top of the page down an inch and then it will bounce back.  This is fine for websites, but for my site, the partial-vertical scrolling with bounce is annoying because the site has no content above or below what you see on the screen.</p>
<p>I did some research and found a few ways to disable scrolling altogether by intercepting the <strong>touchstart</strong> and/or <strong>touchmove</strong> events and calling <strong>preventDefault()</strong> on the event.   After some experimentation and studying the <a rel="nofollow" target="_blank" href="http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html">touch events documentation</a>, I found a near-perfect solution.</p>
<p>In simple terms, when your finger touches the screen, it fires the <strong>touchstart</strong> event.  I then capture the X/Y coordinates. As soon as your finger moves across the screen, it fires the <strong>touchmove</strong> event where I capture the new X/Y coordinates. I then check to see which way you are trying to move the page by comparing the movement along the X and Y axis.  If it&#8217;s vertical (change in Y &gt; change in X), I call preventDefault(), which prevents the scroll.</p>
<p>Here&#8217;s the code:</p>
<pre>
var xStart, yStart = 0;

document.addEventListener('touchstart',function(e) {
    xStart = e.touches[0].screenX;
    yStart = e.touches[0].screenY;
});

document.addEventListener('touchmove',function(e) {
	var xMovement = Math.abs(e.touches[0].screenX - xStart);
	var yMovement = Math.abs(e.touches[0].screenY - yStart);
    if((yMovement * 3) &gt; xMovement) {
		e.preventDefault();
    }
});
</pre>
<p>Tweaks &#8212; I found that simply checking for change in Y &gt; change in X wasn&#8217;t enough because I could drag diagonally at a near-45 degree angle and it would still tug my title bar down.  I wanted it to be more of a 20 degree check, so I added a multiplier of 3 on the y-axis movement (I don&#8217;t remember enough trig to know that 3  was the right multiplier to use &#8212; it was a bit of trial and error).</p>
<p>The results are good.  Grab your iPad and go to <a rel="nofollow" target="_blank" href="http://lottatweets.com">http://lottatweets.com</a>, login, and once the tweets are displayed, try to scroll vertically.  The title bar and footer are locked in place nicely.  If you try hard enough, you can find an angle that will allow you to drag diagonally, but it&#8217;s good enough!</p>
<p><strong><span style="color:#ff0000;">NOTE</span></strong>:  If you&#8217;re building an app with PhoneGap, there is a better solution that I <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2012/05/14/phonegap-howto-prevent-bounce-uiwebviewbounce/">blogged about earlier</a>.  The above solution is for web apps accessed via iOS Safari.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F05%2F23%2Fpreventing-vertical-scrolling-bounce-using-javascript-on-ios-devices%2F&amp;title=Preventing%20vertical%20scrolling%20bounce%20of%20websites%20on%20iOS%20using%20JavaScript" id="wpa2a_2"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Upcoming Speaking Engagements</title>
         <link>http://coenraets.org/blog/2012/05/upcoming-speaking-engagements/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=upcoming-speaking-engagements</link>
         <description>I&amp;#8217;m looking forward to speaking about HTML 5 Mobile Development, PhoneGap, JavaScript frameworks, REST with Java (JAX-RS) and PHP, and other topics at some great conferences and Meetups in the coming weeks. Here is the list so far: Amsterdam May 24th GOTO conference more info London May 24th Skillsmatter more info Las Vegas May 30th [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Upcoming Speaking Engagements http://coenraets.org/blog/?p=3750"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F05%2Fupcoming-speaking-engagements%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3750</guid>
         <pubDate>Tue, 22 May 2012 16:44:51 +0000</pubDate>
         <content:encoded><![CDATA[<p>I&#8217;m looking forward to speaking about HTML 5 Mobile Development, PhoneGap, JavaScript frameworks, REST with Java (JAX-RS) and PHP, and other topics at some great conferences and Meetups in the coming weeks. </p>
<p>Here is the list so far:</p>
<table>
<tr>
<td style="padding-right:50px;">Amsterdam</td>
<td style="padding-right:30px;">May 24th</td>
<td style="padding-right:30px;">GOTO conference</td>
<td><a rel="nofollow" target="_blank" href="http://gotocon.com/amsterdam-2012/presentation/Cross-Platform%20Mobile%20Apps%20with%20HTML,%20JavaScript%20and%20PhoneGap">more info</a></td>
</tr>
<tr>
<td>London</td>
<td>May 24th</td>
<td>Skillsmatter</td>
<td><a rel="nofollow" target="_blank" href="http://skillsmatter.com/podcast/ajax-ria/cross-platform-mobile-apps/js-4272">more info</a></td>
</tr>
<tr>
<td>Las Vegas</td>
<td>May 30th</td>
<td>Meetup</td>
<td><a rel="nofollow" target="_blank" href="http://www.meetup.com/adobeweb/events/59269662/?eventId=59269662&#038;action=detail">more info</a></td>
</tr>
<tr>
<td>Dallas</td>
<td>June 5th</td>
<td>Meetup</td>
<td>more info soon</td>
</tr>
<tr>
<td>San Francisco</td>
<td>June 12th</td>
<td>Meetup</td>
<td><a rel="nofollow" target="_blank" href="http://www.meetup.com/PhoneGap-SF/events/61957972/">more info</a></td>
</tr>
<tr>
<td>New York</td>
<td>June 20th</td>
<td>QCon NYC</td>
<td><a rel="nofollow" target="_blank" href="http://qconnewyork.com/qcon-nyc-2012/presentation/Cross-Platform+Mobile+Apps+with+HTML%2C+JavaScript+and+PhoneGap">more info</a></td>
</tr>
<tr>
<td>Boston</td>
<td>June 27th</td>
<td>Meetup</td>
<td>more info soon</td>
</tr>
<tr>
<td>San Francisco</td>
<td>July 10th</td>
<td>JAX Conference</td>
<td><a rel="nofollow" target="_blank" href="http://jaxconf.com/2012/timetable">more info</a></td>
</tr>
</table>
<p><br/>I hope to see you in one of these places if you are in the area.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Upcoming Speaking Engagements http://coenraets.org/blog/?p=3750">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F05%2Fupcoming-speaking-engagements%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
         <category>Uncategorized</category>
      </item>
      <item>
         <title>LottaTweets.com – web app for speed reading tweets</title>
         <link>http://gregsramblings.com/2012/05/20/lottatweets-com-web-app-for-speed-reading-tweets/</link>
         <description>As a developer evangelist for Adobe, I use Twitter often to keep up with the latest trends, announcements, and more.  I&amp;#8217;ve often been frustrated that the Twitter website and twitter apps all use one column that takes advantage of only about 1/9th of my large monitor.  I&amp;#8217;ve been looking for a good project to beef [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3428</guid>
         <pubDate>Sun, 20 May 2012 20:55:16 +0000</pubDate>
         <content:encoded><![CDATA[<p>As a developer evangelist for Adobe, I use Twitter often to keep up with the latest trends, announcements, and more.  I&#8217;ve often been frustrated that the Twitter website and twitter apps all use one column that takes advantage of only about 1/9th of my large monitor.  I&#8217;ve been looking for a good project to beef up my jQuery skills, and decided to see if I could build something to meet my own requirements for a tweet rapid-reader.</p>
<h3>What is it?</h3>
<p><a rel="nofollow" target="_blank" href="http://lottatweets.com">LottaTweets</a> is a web-based tool that fills your screen with tweets in a multi-column, newspaper-style layout allowing super fast reading.  In addition to being able to quickly scan tweets, there are a few neat features:</p>
<ul>
<li><strong>Color coded retweet rate</strong> &#8212; Tweets are color-coded based on the number of re-tweets per minute.  It&#8217;s a quick way to visually identify tweets that others have found important enough to share.  There is also a button that will toggle filtering based on the retweet rate.  I originally was only using the re-tweet count, but I realized that it&#8217;s not a good measure since older tweets will always have more retweets than new tweets.  The re-tweet rate seems to work well.</li>
<li><strong>Noise factor</strong> &#8212; Each tweet shows the noise factor of the tweeter.  The theory is that if you have tweeted 2000 times but only have 50 followers, you are &#8220;noisy&#8221;.  The noise factor is computed by <strong>number_of_tweets / number_of_followers</strong>.  There is also a button that will toggle filtering based on noise factor.</li>
<li><strong>Infinite horizontal scrolling</strong> &#8212; you can keep scrolling right and it continues to load more tweets for you to read.</li>
<li><strong>Auto-refresh</strong> &#8212; if you check the box for auto-refresh, it will prepend any new tweets every 60 seconds.</li>
<li><strong>It&#8217;s read-only</strong> &#8211;  I configured my Twitter API endpoint to be read-only, so you don&#8217;t have to worry about the app tweeting anything on your behalf.  Each tweet has a link (timestamp) to the tweet on Twitter.com so you can reply, retweet, etc.  Each thumbnail image is a link to that user&#8217;s Twitter page.</li>
</ul>
<div><a rel="nofollow" target="_blank" href="http://lottatweets.com"><img class="aligncenter size-full wp-image-3450" title="LottaTweets Twitter Tweet Viewer" src="http://gregsramblings.com/wp-content/uploads/2012/05/lottatweets-map.png" alt="" width="887" height="439"/></a></div>
<p>&nbsp;</p>
<h3>Technical Details and the Development Experience:</h3>
<ul>
<li>Lotta tweets is a pure JavaScript app with no server infrastructure other than a web server and <a rel="nofollow" target="_blank" href="https://dev.twitter.com/docs/anywhere/welcome">Twitter&#8217;s Anywhere APIs</a>.</li>
<li>The layout is using <a rel="nofollow" target="_blank" href="http://www.w3schools.com/css3/css3_multiple_columns.asp">CSS3 columns</a> and works great with latest versions of Chrome, Firefox, and Safari.  It&#8217;s about 90% functional with Opera (there are some re-layout issues when filters are applied).  CSS3 columns are not supported by IE6/7/8/9, but should be available in IE10.  In order to support IE 6/7/8/9, I would need to use another means of multi-column formatting such as the <a rel="nofollow" target="_blank" href="http://plugins.jquery.com/project/Columnizer">jQuery columnizer plugin</a>.  For now, I&#8217;m leaving it as-is.</li>
<li>I had a great head start on this project from <a rel="nofollow" target="_blank" href="https://twitter.com/#!/tomg">Tom Germeau&#8217;s</a> <a rel="nofollow" target="_blank" href="http://fatc.onilabs.com/">Fork-a-Twitter-Client (FATC) project</a>.  This provided the basic Twitter API interactions and saved me some hours of hacking.  The project uses a <a rel="nofollow" target="_blank" href="http://onilabs.com/stratifiedjs">StratifiedJS</a> implementation called <a rel="nofollow" target="_blank" href="http://onilabs.com/apollo">OniApollo</a>.  This was the first time I&#8217;ve seen StratifiedJS.  It&#8217;s a clever way to simplify complicated asynchronous applications.</li>
<li>I found a few browser bugs (no web dev project would be complete without finding new browser bugs!):</li>
<ul>
<li>Safari &#8212; I originally set each tweet div with <strong>overflow:hidden</strong> in case the tweet wrapped beyond the confines of the div.  This worked fine on Chrome, but on Safari, everything in columns two through <em>n</em> was hidden!  There were a lot of blank boxes with hidden text.  Only column one was correctly displayed.  I abandoned overflow:hidden for now since it&#8217;s very rarely needed.</li>
<li>Firefox &#8212; Firefox doesn&#8217;t use up all of the vertical space when laying out the divs.  I always had a blank space that was a few pixels taller than what is required to hold another row.  I believe that this is a layout issue because it only happens with Firefox.  As a workaround, if the user is using Firefox, I manually increase the height of the wrapper div to trick Firefox into thinking another row will fit.</li>
<li>Opera &#8212; when you resize the screen, or apply a filter, Opera doesn&#8217;t handle the re-layout correctly and things get a bit scrambled.</li>
</ul>
<li>Mobile &#8212; The site runs great on desktop Chrome, Safari, Firefox and Opera.  It runs OK in Safari on iPad, but the scrolling is a bit un-refined and slow.  I&#8217;ll work on this soon.  I haven&#8217;t tested yet on an Android tablet.  iPhone and other mobile phones are really too small for this type of layout.</li>
<li>The font in the top bar is <a rel="nofollow" target="_blank" href="https://typekit.com/fonts/felt-tip-roman">Felt Tip Roman</a>, a font available on <a rel="nofollow" target="_blank" href="http://typekit.com">TypeKit.com</a>, a fantastic service that I&#8217;ve only used once before on <a rel="nofollow" target="_blank" href="http://phraffle.com">Phraffle.com</a>.</li>
<li>I use <a rel="nofollow" target="_blank" href="http://modernizr.com/">Modernizr</a> to check if the user&#8217;s browser supports CSS3 columns.  A simple alert() is displayed if not.</li>
<li>The Twitter Anywhere API uses OAuth to authenticate the user, but the cookie it drops is a session-only cookie, so you will have to re-connect each time you access the page after closing the browser.  The subsequent connects should only require a simple confirmation click and not your email/password.  If the site gets decent traction, I&#8217;ll look into using the &#8220;Sign into Twitter&#8221; APIs, which will give me more control over it.</li>
<li>Yes, I know, I need a designer! (don&#8217;t we all?!)</li>
<li>There is currently a bug &#8211; if you turn on a filter and it results in zero tweets, it will crash.  The workaround is to follow more people! <img src='http://gregsramblings.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley'/> </li>
<li>The code is a bit messy and still fairly hack-ish, but it&#8217;s fairly easy to understand.  View the source, and let me know if you have any suggestions.</li>
</ul>
<p>Any suggestions on features?</p>
<p>Any suggestions on code/architecture?</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F05%2F20%2Flottatweets-com-web-app-for-speed-reading-tweets%2F&amp;title=LottaTweets.com%20%E2%80%93%20web%20app%20for%20speed%20reading%20tweets" id="wpa2a_4"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Simple Offline Data Synchronization for Mobile Web and PhoneGap Applications</title>
         <link>http://coenraets.org/blog/2012/05/simple-offline-data-synchronization-for-mobile-web-and-phonegap-applications/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=simple-offline-data-synchronization-for-mobile-web-and-phonegap-applications</link>
         <description>Being able to work offline is an expected feature of mobile applications. For data-driven applications, it means that you &amp;#8212; the developer &amp;#8212; will have to store (a subset of) your application data locally, and implement a data synchronization mechanism that keeps your local and server data in sync. In this article, I describe a [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Simple Offline Data Synchronization for Mobile Web and PhoneGap Applications http://coenraets.org/blog/?p=3652"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F05%2Fsimple-offline-data-synchronization-for-mobile-web-and-phonegap-applications%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3652</guid>
         <pubDate>Wed, 16 May 2012 19:36:45 +0000</pubDate>
         <content:encoded><![CDATA[<p>Being able to work offline is an expected feature of mobile applications. For data-driven applications, it means that you &#8212; the developer &#8212; will have to store (a subset of) your application data locally, and implement a data synchronization mechanism that keeps your local and server data in sync.</p>
<p>In this article, I describe a simple data synchronization strategy that uses the device&#8217;s (or browser&#8217;s) SQLite database. The implementation currently leverages the Web SQL API (even though the W3C is no longer actively maintaining the spec) because both iOS and Android support it, but they don&#8217;t support IndexedDB, the official alternative. However, the API described below &#8212; getLastSync(), getChanges(), applyChanges() &#8212; defines a generic synchronization contract, and the solution can be expanded and made &#8220;pluggable&#8221;: You could create different synchronization objects, each providing a different implementation of these methods. You could then choose which object to plug in based on the context and the platform your application is running on.</p>
<h4>Try it in the Playground</h4>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/offline-sync/client-app"><img src="http://coenraets.org/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-16-at-21.jpg" alt="" title="Screen Shot 2012-05-16 at 2" width="640" height="760" class="aligncenter size-full wp-image-3734"/></a><br />
<span id="more-3652"></span><br />
Before looking at the code, you can try some offline syncing in this a hosted playground:</p>
<ol>
<li>Open the <a rel="nofollow" target="_blank" href="http://coenraets.org/offline-sync/client-app">Offline Client Playground</a> in Chrome or Safari (they both support Web SQL).</li>
<li>Click the Synchronize button.</li>
<li>Look at the log (the textarea in the middle of the screen): Because it&#8217;s the first time you use the application, all the employees have been downloaded from the server and inserted in your local SQLite database.</li>
<li>Clear the log, click the Synchronize button, and look at the log again: because you now have an up-to-date local version of the data, the server didn&#8217;t return any change and your local database remains unchanged.</li>
<li>In another tab, open the <a rel="nofollow" target="_blank" href="http://coenraets.org/offline-sync/server-app">Server Admin PlayGround</a>.</li>
<li>Modify an existing employee and click Save. (Don&#8217;t worry, it&#8217;s using your own session-based data set).</li>
<li>Go back to the Offline Client tab, click Synchronize, and notice that the server returned one change,  and that it was applied to your local database.</li>
<li>Go back to the Server Admin tab and modify (create, update, delete) other employees. Switch back to the Offline Client tab, click Synchronize, and see how these changes are applied to your local database.</li>
<li>You can also use the Resources Tab in the Chrome Developer Tools to inspect your local database.</li>
</ol>
<h4>Server API</h4>
<p>The only piece of infrastructure you need at the server side is an API that returns the items that have changed (created, updated, or deleted) since a specific moment in time expressed as a timestamp. </p>
<p>Here is the RESTful API call used in my application:</p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/offline-sync/api/employees?modifiedSince=2012-03-01 10:20:56">http://coenraets.org/offline-sync/api/employees?modifiedSince=2012-03-01 10:20:56</a></p>
<p>The format of the data returned by the server is up to you and is part of the contract between the client and the server. In this application, the server returns the changes as an array of JSON objects. The server-side technology (RoR, PHP, Java, .NET, &#8230;) and database system (SQL, NoSQL, &#8230;) you use to generate the list of changes is also totally up to you. I provide a simple PHP implementation as part of the source code. That implementation manages a session-based data set that provides an isolated and transient playground. In a real-life application, you&#8217;d obviously get the data from some sort of database.</p>
<h5>Client API</h5>
<p>At the client side, our synchronization API consists of three methods.</p>
<h6>getLastSync()</h6>
<p>A method that returns a timestamp to be used as the query parameter for the next synchronization request. A common practice is to persist a timestamp after each synchronization request. But things can go wrong and the timestamp itself can get out-of-sync. I prefer to &#8220;recalculate&#8221; the lastSync timestamp before each synchronization request.   </p>
<pre>
getLastSync: function(callback) {
    this.db.transaction(
        function(tx) {
            var sql = &quot;SELECT MAX(lastModified) as lastSync FROM employee&quot;;
            tx.executeSql(sql, this.txErrorHandler,
                function(tx, results) {
                    var lastSync = results.rows.item(0).lastSync;
                    callback(lastSync);
                }
            );
        }
    );
}
</pre>
<h6>getChanges()</h6>
<p>This is a wrapper around an Ajax call to the server-side API that returns the items that have changed (created, updated, or deleted) since a specific moment in time defined in the modifiedSince parameter. </p>
<pre>
getChanges: function(syncURL, modifiedSince, callback) {

    $.ajax({
        url: syncURL,
        data: {modifiedSince: modifiedSince},
        dataType:&quot;json&quot;,
        success:function (changes) {
            callback(changes);
        },
        error: function(model, response) {
            alert(response.responseText);
        }
    });

}
</pre>
<h6>applyChanges()</h6>
<p>A method that persists the changes in your local data store. Notice that SQLite supports a convenient &#8220;INSERT OR REPLACE&#8221; statement so that you don&#8217;t have to determine if you are dealing with a new or existing employee before persisting it.</p>
<pre>
applyChanges: function(employees, callback) {
    this.db.transaction(
        function(tx) {
            var l = employees.length;
            var sql =
                &quot;INSERT OR REPLACE INTO employee (id, firstName, lastName, title, officePhone, deleted, lastModified) &quot; +
                &quot;VALUES (?, ?, ?, ?, ?, ?, ?)&quot;;
            var e;
            for (var i = 0; i &lt; l; i++) {
                e = employees[i];
                var params = [e.id, e.firstName, e.lastName, e.title, e.officePhone, e.deleted, e.lastModified];
                tx.executeSql(sql, params);
            }
        },
        this.txErrorHandler,
        function(tx) {
            callback();
        }
    );
}
</pre>
<h4>Synchronization Logic</h4>
<p>With these server and client APIs in place, you can choreograph a data synchronization process as follows: </p>
<pre>
sync: function(syncURL, callback) {

    var self = this;
    this.getLastSync(function(lastSync){
        self.getChanges(syncURL, lastSync,
            function (changes) {
                self.applyChanges(changes, callback);
            }
        );
    });

}
</pre>
<h4>Final Notes</h4>
<ul>
<li>This solution currently supports unidirectional (server to client) data synchronization. It could easily be expanded to support bidirectional synchronization.</li>
<li>This solution currently implements &#8220;logical deletes&#8221;: items are not physically deleted from the table, but the value of their &#8220;deleted&#8221; column is set to true.</li>
<li>As mentioned above, you could replace the Web SQL implementation with another data access strategy. For example, take a look at <a rel="nofollow" target="_blank" href="http://brian.io/lawnchair/">Brian Leroux&#8217; Lawnchair</a> for another local persistence solution.</li>
</ul>
<h4>Source Code</h4>
<p>The source code is available in <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/offline-sync">this GitHub repository</a>.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Simple Offline Data Synchronization for Mobile Web and PhoneGap Applications http://coenraets.org/blog/?p=3652">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F05%2Fsimple-offline-data-synchronization-for-mobile-web-and-phonegap-applications%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>PhoneGap and iOS – www folder creation tip</title>
         <link>http://devgirl.org/2012/05/16/phonegap-and-ios-www-folder-creation-tip/</link>
         <description>When building your first PhoneGap (aka Cordova) project using XCode, there&amp;#8217;s something to be aware of that could potentially cause confusion so I wanted to address it quickly with a post. First of all, to get started with PhoneGap and iOS, you can follow the detailed instructions here. This post is meant to supplement these [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3849</guid>
         <pubDate>Wed, 16 May 2012 18:40:25 +0000</pubDate>
         <content:encoded><![CDATA[<p>When building your first PhoneGap (aka Cordova) project using XCode, there&#8217;s something to be aware of that could potentially cause confusion so I wanted to address it quickly with a post. First of all, to <a rel="nofollow" target="_blank" href="http://phonegap.com/start">get started with PhoneGap and iOS</a>, you can follow the detailed instructions <a rel="nofollow" target="_blank" href="http://phonegap.com/start">here</a>. This post is meant to supplement these instructions. If you are at the point where you have <a rel="nofollow" target="_blank" href="http://phonegap.com/download">downloaded and installed PhoneGap</a> (ran the PhoneGap-xx.dmg or Cordova-xx.dmg from the <strong>ios</strong> folder in the downloaded phonegap.zip etc) and opened XCode to create your first project, you will see a new option for <strong>Create a new Cordova-based Applicatio</strong>n (or Create a new PhoneGap-based Application depending on what version of PhoneGap you downloaded) such as below:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-1.26.10-PM.png"><img class="aligncenter size-full wp-image-3880" title="Screen shot 2012-05-16 at 1.26.10 PM" src="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-1.26.10-PM.png" alt="" width="726" height="485"/></a></p>
<p>The trick is, once you select that option a project is created and opened just fine, but you MUST actually <strong>Run</strong> the application first to cause the special <strong>www</strong> folder (specific to PhoneGap projects and containing the main .js file PhoneGap needs to work) to be created in the same folder as the .xcodeproject file just created.</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-2.10.29-PM.png"><img class="aligncenter size-full wp-image-3891" title="Screen shot 2012-05-16 at 2.10.29 PM" src="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-2.10.29-PM.png" alt="" width="100" height="74"/></a></p>
<p>The <a rel="nofollow" target="_blank" href="http://phonegap.com/start">instructions</a> do mention executing the project and that you will get an error at that point, but don&#8217;t make it entirely clear that the important <strong>www</strong> folder will actually be created at that step. If you&#8217;re like me, you might decide to <em>skip</em> that instruction because you know it&#8217;s not going to work yet anyway since PhoneGap needs the <strong>www</strong> folder copied in. Yes, I can admit I did this the first time <img src='http://devgirl.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> . Then you will probably try to follow the rest of the instructions to copy that www folder in and find that it&#8217;s not there. My personal assumption when I did this the first time is that the <strong>www</strong> folder was getting created for me when I selected the new <strong>Cordova-based Application</strong> option. Now that I have more experience, I can see how you may not ALWAYS want that <strong>www</strong> folder created upon project creation, such as the case where you are copying an existing one in, however I will have to follow-up more on this to see if there are changes coming in this workflow.  </p>
<p>To illustrate, after creating your <strong>Cordova-based Application</strong> in XCode, if you right click on the root of the project in XCode and say <em>Show in Finder</em>, you will see this:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-1.56.32-PM.png"><img class="aligncenter  wp-image-3881" title="Screen shot 2012-05-16 at 1.56.32 PM" src="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-1.56.32-PM.png" alt="" width="699" height="372"/></a></p>
<p>But after you actually <strong>Run</strong> the project in XCode and receive errors, then stop and right-click again on that root project in XCode to <em>Show in Finder</em>, you will the <strong>www</strong> folder was in fact created and is ready to copy in to XCode:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-2.19.46-PM.png"><img class="aligncenter  wp-image-3902" title="Screen shot 2012-05-16 at 2.19.46 PM" src="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-16-at-2.19.46-PM.png" alt="" width="698" height="371"/></a></p>
<p>If you&#8217;re a developer that has run into this yourself (not one of those that always follows specific directions and never makes ANY assumptions <img src='http://devgirl.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley'/> ) then I hope this helped you quickly get to the bottom of it <img src='http://devgirl.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> .</p>
<p><strong>NOTE:</strong> This is specific to creating a brand new project, not porting over an existing www folder that already had the necessary contents where there is no need for a default one to be created.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F05%2F16%2Fphonegap-and-ios-www-folder-creation-tip%2F&amp;title=PhoneGap%20and%20iOS%20%E2%80%93%20www%20folder%20creation%20tip" id="wpa2a_2"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>How to prevent bounce of PhoneGap app container in iOS apps – UIWebViewBounce</title>
         <link>http://gregsramblings.com/2012/05/14/phonegap-howto-prevent-bounce-uiwebviewbounce/</link>
         <description>I&amp;#8217;ve noticed that a lot of apps built with PhoneGap have a weird behavior on iPhone and iPad &amp;#8212; You can tug at the main app and move it around slightly and let it bounce back into place.  It&amp;#8217;s as if the PhoneGap container is connected to the device with springs!  I quickly found several [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3411</guid>
         <pubDate>Tue, 15 May 2012 03:05:27 +0000</pubDate>
         <content:encoded><![CDATA[<p><img class="size-full wp-image-3419 alignright" title="PhoneGap Tips" src="http://gregsramblings.com/wp-content/uploads/2012/05/phonegaptips.png" alt="" width="278" height="200"/>I&#8217;ve noticed that a lot of apps built with <a rel="nofollow" target="_blank" href="http://phonegap.com">PhoneGap</a> have a weird behavior on iPhone and iPad &#8212; You can tug at the main app and move it around slightly and let it bounce back into place.  It&#8217;s as if the PhoneGap container is connected to the device with springs!  I quickly found several solutions to the problem, some of which require either catching the JavaScript touchStart event at the top-level, or modifying the PhoneGap code.</p>
<p>However, I also discovered that starting with PhoneGap 1.5 (<a rel="nofollow" target="_blank" href="http://phonegap.com/2012/03/06/phonegap-1-5-released/">release notes</a>), a new key was added to the <strong>PhoneGap.plist</strong> (now <strong>Cordova.plist</strong>) called <strong>UIWebViewBounce</strong>.  It&#8217;s set to YES by default (I have no idea why).  If you set it to NO, your app will be anchored in with nails and the bounce removed.</p>
<p>This is also now configurable with <a rel="nofollow" target="_blank" href="http://build.phonegap.com">PhoneGap Build</a> by setting <strong>webviewbounce</strong> to <strong>false</strong> in your <strong>config.xml</strong> (documented <a rel="nofollow" target="_blank" href="https://build.phonegap.com/docs/config-xml">here</a>).</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F05%2F14%2Fphonegap-howto-prevent-bounce-uiwebviewbounce%2F&amp;title=How%20to%20prevent%20bounce%20of%20PhoneGap%20app%20container%20in%20iOS%20apps%20%E2%80%93%20UIWebViewBounce" id="wpa2a_6"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>PhoneGap for Flex/AIR Mobile Developers</title>
         <link>http://devgirl.org/2012/05/14/phonegap-for-flexair-mobile-developers/</link>
         <description>If you&amp;#8217;re a Flex/AIR developer or any developer focused on mobile for that matter, I believe it&amp;#8217;s worth your while to spend some time reading this first post in a series of posts I will be writing on using PhoneGap (aka Cordova) for building mobile apps. It&amp;#8217;s another great technology choice for rapid cross-platform mobile [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3786</guid>
         <pubDate>Mon, 14 May 2012 19:19:46 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/phonegaplogo.png"><img src="http://devgirl.org/wp-content/uploads/2012/05/phonegaplogo.png" alt="" title="phonegaplogo" width="200" height="200" class="alignleft size-full wp-image-3853"/></a>If you&#8217;re a Flex/AIR developer or any developer focused on mobile for that matter, I believe it&#8217;s worth your while to spend some time reading this first post in a series of posts I will be writing on using <a rel="nofollow" target="_blank" href="http://phonegap.com">PhoneGap</a> (aka Cordova) for building mobile apps. It&#8217;s another great technology choice for rapid cross-platform mobile development and becoming more and more popular. I&#8217;ve heard some developers express how they feel like they&#8217;re going back in time with HTML/JS development, or simply don&#8217;t want to &#8216;go there&#8217; but it&#8217;s worth checking out how it can be used to quickly build a mobile application with HTML/JS and PhoneGap and you should consider this option for building mobile apps.</p>
<h3>What is it?</h3>
<p>The crux of PhoneGap is essentially a big &#8216;ol .js file (per platform, separate one for iOS vs Android etc) along with some simple native code to enable it to work. In the main JavaScript file (phonegap.js or cordova.js) are a bunch of functions that give you access to native features including the <strong><em>camera, compass, accelerometer, file system, storage access, media capture, audio playback, notifications, contacts and network connection status</em></strong> etc, similar to what Adobe AIR APIs offer, with the addition of a couple more. You write your applications in HTML/JavaScript and use CSS to style them. PhoneGap apps are wrapped in a native web container component, which is why your HTML/JS/CSS work. This also means there is a dependency for your phone&#8217;s browser to be based on the WebKit engine. This really isn&#8217;t an issue though since WebKit is the default for iOS, Android, BlackBerry Tablet OS and webOS currently. A great overview of <a rel="nofollow" target="_blank" href="http://www.tricedesigns.com/2012/02/14/what-is-phonegap-other-common-questions/">commonly asked questions about PhoneGap</a> can be found on my teammate Andy Trice&#8217;s blog, as well as a bunch of other great PhoneGap posts, so definitely check out <a rel="nofollow" target="_blank" href="http://www.tricedesigns.com/">his blog</a> for heaps of good content. </p>
<h3>How Does it Work?</h3>
<p>The API functions in the phonegap.js (or most recently cordova.js) files call native plugin/extension code to provide the access to the native features through JavaScript <em><strong>exec</strong></em> calls. If you&#8217;re an AIR developer, it&#8217;s similar to the AIR Native Extensions model, except in PhoneGap they&#8217;re called <em>plugins</em>, and the set of APIs listed above (notifications, compass etc) are included and set up for you by default in the PhoneGap download. There are a <a rel="nofollow" target="_blank" href="https://github.com/phonegap/phonegap-plugins">bunch of other open source plugins available</a> too which can easily be added to your project, or if you don&#8217;t find one you need, they&#8217;re easy to write. Here you can find <a rel="nofollow" target="_blank" href="http://wiki.phonegap.com/w/page/36753494/How%20to%20Create%20a%20PhoneGap%20Plugin%20for%20Android">instructions on how to write one for Android</a>, and<a rel="nofollow" target="_blank" href="http://wiki.phonegap.com/w/page/36753496/How%20to%20Create%20a%20PhoneGap%20Plugin%20for%20iOS"> here</a> for iOS.  You can see that the JavaScript exec calls for iOS use .h/.m files for the actual native implementation, and .java for Android. </p>
<p>When you&#8217;re ready to use one of the APIs in your application, it&#8217;s very straightforward and easy to use. Here&#8217;s an example of adding a notification to your application:</p>
<p><strong>Code Example</strong></p>
<pre>
...
    function showAlert() {
        navigator.notification.alert(
            'You are the winner!',  // message
            alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }
...
</pre>
<p>Here&#8217;s the result:<br />
<a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-03-at-4.56.48-PM.png"><img src="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-03-at-4.56.48-PM.png" alt="" title="Screen shot 2012-05-03 at 4.56.48 PM" width="396" height="744" class="aligncenter size-full wp-image-3835"/></a></p>
<p>You will find that all of the APIs are accessed through a <em><strong>navigator</strong></em> variable (declared in the phonegap.js file). To see examples of how to use all of them, check out the nicely done <a rel="nofollow" target="_blank" href="http://docs.phonegap.com/en/1.7.0/index.html">API reference docs</a>. </p>
<p>If you&#8217;re curious of how this works underneath, here&#8217;s the notification code snippet straight out of the cordova.js file (<strong>NOTE:</strong> remember phonegap and cordova are currently the same library, so if you download it now you may find that your main API files are named cordova.js file instead of phonegap.js):</p>
<p><strong>phonegap.js Source for Notifications</strong></p>
<pre>
...
/**
 * Open a native alert dialog, with a customizable title and button text.
 *
 * @param {String} message              Message to print in the body of the alert
 * @param {Function} completeCallback   The callback that is called when user clicks on a button.
 * @param {String} title                Title of the alert dialog (default: Alert)
 * @param {String} buttonLabel          Label of the close button (default: OK)
 */
Notification.prototype.alert = function(message, completeCallback, title, buttonLabel) {
    var _title = title;
    if (title == null || typeof title === 'undefined') {
        _title = &quot;Alert&quot;;
    }
    var _buttonLabel = (buttonLabel || &quot;OK&quot;);
    &lt;strong&gt;Cordova.exec(completeCallback, null, &quot;org.apache.cordova.notification&quot;, &quot;alert&quot;, [message,{ &quot;title&quot;: _title, &quot;buttonLabel&quot;: _buttonLabel}]);&lt;/strong&gt;
};
</pre>
<p>The above code shows the notification alert function definition to use for performing a native alert notification on iOS. The important line there is the <strong>Cordova.exec(&#8230;)</strong> call, which will use the native plugin code for iOS or Java to perform the notification. If you&#8217;re extra curious and want to see what the native code looks like for this, you can open the Notification.java or CDVNotification.m files such as shown (note: you need to download the actual cordova/phonegap project source <a rel="nofollow" target="_blank" href="https://github.com/cordova">from github here</a> to view the source files for the core plugins. This is only necessary if you wish to view them or want to make your own custom changes to them, typically you would just <a rel="nofollow" target="_blank" href="http://phonegap.com/download">install from here</a>). I pasted a couple snippets from the native code files below to give an idea:</p>
<p><strong>Java Source for Notifications</strong></p>
<pre>
public PluginResult execute(String action, JSONArray args, String callbackId) {
    PluginResult.Status status = PluginResult.Status.OK;
    String result = &quot;&quot;;   

    try {
      ...
      else if (action.equals(&quot;alert&quot;)) {
        this.alert(args.getString(0),args.getString(1),args.getString(2), callbackId);
        PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
        r.setKeepCallback(true);
        return r;
      }
...
</pre>
<p><strong>Objective-C Source for Notifications</strong></p>
<pre>
...
- (void) alert:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
    int argc = [arguments count];

	NSString* callbackId = argc &gt; 0? [arguments objectAtIndex:0] : nil;
	NSString* message = argc &gt; 1? [arguments objectAtIndex:1] : nil;
	NSString* title   = argc &gt; 2? [arguments objectAtIndex:2] : nil;
	NSString* buttons = argc &gt; 3? [arguments objectAtIndex:3] : nil;

	if (!title) {
        title = NSLocalizedString(@&quot;Alert&quot;, @&quot;Alert&quot;);
    }
	if (!buttons) {
        buttons = NSLocalizedString(@&quot;OK&quot;, @&quot;OK&quot;);
    }

	CDVAlertView *alertView = [[CDVAlertView alloc]
							  initWithTitle:title
							  message:message
							  delegate:self
							  cancelButtonTitle:nil
							  otherButtonTitles:nil];

	alertView.callbackId = callbackId;

	NSArray* labels = [buttons componentsSeparatedByString:@&quot;,&quot;];
	int count = [labels count];

	for(int n = 0; n &lt; count; n++)
	{
		[alertView addButtonWithTitle:[labels objectAtIndex:n]];
	}

	[alertView show];
	[alertView release];
}
...
</pre>
<h3>Common Questions</h3>
<ul>
<li><strong>What kind of UI Components does PhoneGap offer?</strong> PhoneGap does not offer UI Components, they leave that implementation up to you with your choice of HTML/JS/CSS or some other UI frameworks available like Twitter Bootstrap, jQuery Mobile, Kendo UI etc&#8230;</li>
<li><strong>How can I consume data in a PhoneGap app? </strong> The same way you consume data from a web application &#8211; REST, JSON, SOAP etc.</li>
<li><strong>What&#8217;s the difference between PhoneGap and Cordova?</strong> Cordova is the Apache Open Source project behind PhoneGap. If this is confusing to you, please read <a rel="nofollow" target="_blank" href="http://phonegap.com/2012/03/19/phonegap-cordova-and-what%E2%80%99s-in-a-name/">this post</a>!</li>
<li><strong>What kind of development environment do I need?</strong> You can develop in your editor of choice on any platform. There are some workflow tips I can provide and will do so in the next post with my choices for editing, debugging etc. Once you have created your app in your platform of choice, you can just upload the source directly from your source control system or via zip file to <a rel="nofollow" target="_blank" href="http://build.phonegap.com">PhoneGap Build</a> as the screenshot below shows and it will create a ready to install package for all of the different platforms.</li>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-14-at-2.20.46-PM2.png"><img src="http://devgirl.org/wp-content/uploads/2012/05/Screen-shot-2012-05-14-at-2.20.46-PM2.png" alt="" title="Screen shot 2012-05-14 at 2.20.46 PM" width="468" height="535" class="aligncenter size-full wp-image-3864"/></a></p>
</ul>
<h3>More Resources</h3>
<a rel="nofollow" target="_blank" href="http://www.tricedesigns.com/2012/03/22/phonegap-explained-visually/">PhoneGap Explained Visually</a>
<a rel="nofollow" target="_blank" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/94e7fded-7162-445e-8ceb-97a2140866a9/entry/debugging_mobile_javascript_with_weinre?lang=en">Debugging PhoneGap Apps with Weinre</a> 
<a rel="nofollow" target="_blank" href="http://buddylindsey.com/things-to-look-at-when-you-are-using-a-phonegap-plugin/">PhoneGap Plugin FYI 
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F05%2F14%2Fphonegap-for-flexair-mobile-developers%2F&amp;title=PhoneGap%20for%20Flex%2FAIR%20Mobile%20Developers" id="wpa2a_4"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p></a>]]></content:encoded>
      </item>
      <item>
         <title>An interesting way to handle event giveaways – Phraffle.com</title>
         <link>http://gregsramblings.com/2012/05/13/an-interesting-way-to-handle-event-giveaways-phraffle-com/</link>
         <description>As developer evangelists, we often do giveaways of Creative Suite and other goodies at meetups, user group meetings, and other events.  Sometimes we use physical raffle tickets handed out at the door.  Other times there is a quiz to determine the winner, but recently while at a meeting of the Atlanta Web Design Group, I [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3401</guid>
         <pubDate>Sun, 13 May 2012 18:11:50 +0000</pubDate>
         <content:encoded><![CDATA[<p>As developer evangelists, we often do giveaways of Creative Suite and other goodies at meetups, user group meetings, and other events.  Sometimes we use physical raffle tickets handed out at the door.  Other times there is a quiz to determine the winner, but recently while at a meeting of the <a rel="nofollow" target="_blank" href="http://www.awdg.org/">Atlanta Web Design Group</a>, I saw their organizer, <a rel="nofollow" target="_blank" href="https://twitter.com/#!/jc/">J. Cornelius</a>, do something interesting.  He called out some random numbers and had people raise their hand if their phone number contained that number.  He then quickly narrowed it down to a winner.</p>
<p>Last week, I tried a variation of this at a <a rel="nofollow" target="_blank" href="http://www.meetup.com/BarCampTampaBay/events/60875062/?a=socialmedia">Tampa meetup</a> with an audience of about 100 people and it worked really well.  Late  Friday night, I created <a rel="nofollow" target="_blank" href="http://phraffle.com">Phraffle</a> (phone + raffle = Phraffle!) &#8212; <a rel="nofollow" target="_blank" href="http://phraffle.com">http://phraffle.com</a>.  It&#8217;s obviously a very simple and somewhat silly app, but it was fun to build.  It was also my first use of <a rel="nofollow" target="_blank" href="https://typekit.com/">TypeKit</a> (font used in the logo).  The spinning effect is based on a blog post I found by <a rel="nofollow" target="_blank" href="http://odhyan.com/blog/2011/05/slot-machine-in-javascript/">Saurabh Odhyan</a>.  He basically pans an image across a div using <a rel="nofollow" target="_blank" href="http://www.spritely.net/">JQuery.spritely</a>.  Once the speed increases, the image is switched to a blurred version.   I loved the effect so I took his example and made some modifications until I had the right look and feel.</p>
<p>Let me know if you have any ideas on how to improve this or if you have seen other interesting ways of handling raffles.  I might create a tiny app for phones/tablets for off-line use-cases.  It all depends on how bored I get next weekend. <img src='http://gregsramblings.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley'/> </p>
<p style="text-align:center;"><a rel="nofollow" target="_blank" href="http://phraffle.com"><img class="aligncenter size-medium wp-image-3402" title="phraffle-screenshot" src="http://gregsramblings.com/wp-content/uploads/2012/05/phraffle-screenshot-300x193.png" alt="" width="300" height="193"/></a></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F05%2F13%2Fan-interesting-way-to-handle-event-giveaways-phraffle-com%2F&amp;title=An%20interesting%20way%20to%20handle%20event%20giveaways%20%E2%80%93%20Phraffle.com" id="wpa2a_8"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>May Meetups! Building Real Mobile Apps with HTML/JS/PhoneGap</title>
         <link>http://devgirl.org/2012/05/03/may-meetups-building-real-mobile-apps-with-htmljsphonegap/</link>
         <description>We will be doing a couple of presentations here in Florida on building mobile applications with HTML/JS and PhoneGap that you will not want to miss if you&amp;#8217;re anywhere near the area. Christophe Coenraets, Greg Wilson and myself will be presenting two 3 hour workshops in Orlando and Tampa on May 8th and 9th respectively. [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3779</guid>
         <pubDate>Thu, 03 May 2012 15:09:26 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/05/mobile-devices2.png"><img src="http://devgirl.org/wp-content/uploads/2012/05/mobile-devices2.png" alt="" title="mobile-devices2" width="360" height="365" class="aligncenter size-full wp-image-3813"/></a><br />
We will be doing a couple of presentations here in Florida on building mobile applications with HTML/JS and <a rel="nofollow" target="_blank" href="http://phonegap.com/">PhoneGap</a> that you will not want to miss if you&#8217;re anywhere near the area. <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/">Christophe Coenraets</a>, <a rel="nofollow" target="_blank" href="http://gregsramblings.com/ ">Greg Wilson</a> and myself will be presenting two 3 hour workshops in Orlando and Tampa on May 8th and 9th respectively. Included in the presentation will be an introduction to <a rel="nofollow" target="_blank" href="http://phonegap.com/">PhoneGap</a>, a deep dive into building an HTML/JS mobile application (non-web) using popular JavaScript frameworks available, and some demos of applications built with this technology, including a real-world Salesforce.com backed iPad application showing off how powerful this technology can be. </p>
<p>Details on the events are below: </p>
<p><strong><a rel="nofollow" target="_blank" href="http://www.meetup.com/BarCampTampaBay/events/60875062">Tampa Meetup</a></strong><br />
<strong><a rel="nofollow" target="_blank" href="http://fullsail.groups.adobe.com/index.cfm?event=post.display&#038;postid=42197">Orlando Meetup</a></strong></p>
<p>There were only 10 spots left in the Tampa meetup when I last checked, so if you&#8217;re interested, be sure to sign up now <img src='http://devgirl.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> !!</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F05%2F03%2Fmay-meetups-building-real-mobile-apps-with-htmljsphonegap%2F&amp;title=May%20Meetups%21%20Building%20Real%20Mobile%20Apps%20with%20HTML%2FJS%2FPhoneGap" id="wpa2a_6"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Single-Page CRUD Application with Backbone.js and Twitter Bootstrap</title>
         <link>http://coenraets.org/blog/2012/05/single-page-crud-application-with-backbone-js-and-twitter-bootstrap/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=single-page-crud-application-with-backbone-js-and-twitter-bootstrap</link>
         <description>A few weeks weeks ago, I posted a first Backbone.js and Twitter Bootstrap sample application. While interesting, &amp;#8220;Employee Directory&amp;#8221; is a read-only application. As such, it doesn’t show off the full power of Backbone&amp;#8217;s models or the coolness of some of Bootstrap&amp;#8217;s data entry features such as forms, validation, etc. To demonstrate these features, I [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Single-Page CRUD Application with Backbone.js and Twitter Bootstrap http://coenraets.org/blog/?p=3575"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F05%2Fsingle-page-crud-application-with-backbone-js-and-twitter-bootstrap%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3575</guid>
         <pubDate>Thu, 03 May 2012 14:23:34 +0000</pubDate>
         <content:encoded><![CDATA[<p>A few weeks weeks ago, I <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/02/sample-app-with-backbone-js-and-twitter-bootstrap/">posted</a> a first <a rel="nofollow" target="_blank" href="http://documentcloud.github.com/backbone/">Backbone.js</a> and <a rel="nofollow" target="_blank" href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> sample application. While interesting, &#8220;Employee Directory&#8221; is a read-only application. As such, it doesn’t show off the full power of Backbone&#8217;s models or the coolness of some of Bootstrap&#8217;s data entry features such as forms, validation, etc.</p>
<p>To demonstrate these features, I decided to revisit my <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-1-getting-started/">wine cellar application</a>, which was in need of a serious UI makeover.</p>
<p>You can run the application <a rel="nofollow" target="_blank" href="http://coenraets.org/backbone-cellar/bootstrap">here</a>.</p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone-cellar/bootstrap"><img src="http://coenraets.org/blog/wp-content/uploads/2012/05/cellar012.jpg" alt="" width="640" height="553" class="aligncenter size-full wp-image-3600"/></a></p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone-cellar/bootstrap"><img src="http://coenraets.org/blog/wp-content/uploads/2012/05/cellar021.jpg" alt="" title="cellar02" width="640" height="584" class="aligncenter size-full wp-image-3603"/></a><br />
<span id="more-3575"></span><br />
This online version uses an in-memory datastore: all your changes will be lost the next time you start the application or hit your browser’s refresh button. The image upload feature is also disabled, but you can still drag an image from your file system and drop it  in the Wine Form, which is pretty cool (see the note about browser support below). The <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-cellar">source code</a> available on GitHub includes a persistent back-end (in addition to the in-memory datastore), and a fully functional implementation of the file upload feature.</p>
<h4>Code Highlights</h4>
<h6>Template Loader</h6>
<p>This application features a template loader that now uses jQuery “deferreds” to load the HTML templates more efficiently.</p>
<h6>Drag-and-Drop File Upload and HTML 5 File API</h6>
<p>To upload an image file for a Wine, drag a file from your file system and drop it in the image box inside the Wine Form: The image is automatically displayed inside the img tag. This is done using the HTML 5 File API and doesn’t require a server roundtrip. </p>
<p>NOTE: This feature only works in Chrome at this time. I will implement an alternative implementation in a future version of the application to provide a consistent behavior across browsers.</p>
<p>The image is uploaded to the server using Ajax (XHR) when you save the form: no page refresh or iframe hack.</p>
<h6>Paging</h6>
<p>Twitter Bootstrap provides easy markup and styles to create paginated lists. In this application, the Bootstrap markup and styles are “componentized” or “widgetized” into a Backbone View (Paginator), which adds the appropriate pagination behavior.</p>
<p>NOTE: In the current implementation of this application, the entire data set is always retrieved from the server and paging is provided for a cosmetic/layout reason. You could easily replace this implementation with a true paging strategy where pages are lazy-loaded from the server as needed.</p>
<h6>Forms</h6>
<p>Backbone Cellar also uses Twitter Bootstrap’s forms, which greatly help with form layouts (see WineView). </p>
<h6>Validation</h6>
<p>Twitter Bootstrap also provides simple markup and styles to highlight validation errors in forms. In Backbone Cellar, Bootstrap’s validation markup and styles are wired with validation rules defined in the Backbone model. Note that at this time, the application doesn’t use the Backbone model’s default validate() method, but custom validateItem() and validateAll() methods instead. </p>
<p>The application also uses other Twitter Bootstrap features including thumbnails, dropdowns, alerts, etc.</p>
<h4>Source Code</h4>
<p>The source code is available in the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-cellar/bootstrap">bootstrap</a> folder of the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-cellar">backbone-cellar</a> repository on GitHub.</p>
<h4>Disclaimer</h4>
<p>This is a sample application, not a production application. Some trade-offs were made to keep the code generic, simple and readable. In a real-life application, you should consider implementing a namespacing scheme to keep the global namespace clean, and other optimization techniques such as view and/or data caching.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Single-Page CRUD Application with Backbone.js and Twitter Bootstrap http://coenraets.org/blog/?p=3575">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F05%2Fsingle-page-crud-application-with-backbone-js-and-twitter-bootstrap%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>Central Florida Events: Building real apps with HTML/JavaScript and PhoneGap</title>
         <link>http://gregsramblings.com/2012/05/02/central-florida-events-building-real-apps-with-htmljavascript-and-phonegap/</link>
         <description>If you live anywhere near Tampa or Orlando and have an interest in building mobile apps using web standards, you need to come to one of the following two local events: Tampa &amp;#8212;  5/9/2012 6:00PM please RSVP on the site &amp;#8211; if it&amp;#8217;s full, try again later in the day Orlando &amp;#8212;  5/8/2012 6:00PM EDT [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3381</guid>
         <pubDate>Thu, 03 May 2012 02:08:22 +0000</pubDate>
         <content:encoded><![CDATA[<p>If you live anywhere near Tampa or Orlando and have an interest in building mobile apps using web standards, you need to come to one of the following two local events:</p>
<ul>
<li><a rel="nofollow" target="_blank" href="http://www.meetup.com/BarCampTampaBay/events/60875062/?a=socialmedia">Tampa</a> &#8212;  5/9/2012 6:00PM please RSVP on the site &#8211; if it&#8217;s full, try again later in the day</li>
<li><a rel="nofollow" target="_blank" href="http://fullsail.groups.adobe.com/index.cfm?event=post.display&amp;postid=42197">Orlando</a> &#8212;  5/8/2012 6:00PM EDT at Full Sail University &#8211; DONE &#8211; Had a packed room and over 35 online!</li>
</ul>
<p>Even if you have looked at PhoneGap already, we&#8217;re going much deeper than an introduction.  We&#8217;re going to show how to build production-quality, high-performing apps using HTML and JavaScript.  This goes well beyond the typical demos.  Micro-frameworks such as backbone.js, twitter boostrap and more will be used.</p>
<p>The folks at Full Sail University put together a poster for the Orlando event (see below).  Now I feel like we need some sort of cool music playing when we enter the room! <img src='http://gregsramblings.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley'/> </p>
<p style="text-align:center;"><a rel="nofollow" target="_blank" href="http://fullsail.groups.adobe.com/index.cfm?event=post.display&amp;postid=42197"><img class="aligncenter size-full wp-image-3383" style="border-width:3px;border-color:black;border-style:solid;" title="poster500" src="http://gregsramblings.com/wp-content/uploads/2012/05/poster500.jpg" alt="" width="500" height="773"/></a></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F05%2F02%2Fcentral-florida-events-building-real-apps-with-htmljavascript-and-phonegap%2F&amp;title=Central%20Florida%20Events%3A%20Building%20real%20apps%20with%20HTML%2FJavaScript%20and%20PhoneGap" id="wpa2a_10"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Amazon EC2 – a real-world case study of moving from a data center to the cloud</title>
         <link>http://gregsramblings.com/2012/05/02/amazon-ec2-a-real-world-case-study-of-moving-from-data-center-to-the-cloud-chessjam/</link>
         <description>Two years ago, I blogged about ChessJam, a chess application that I helped develop where people from all over the world play live chess with each other.  Since launching ChessJam, it&amp;#8217;s been up and running 24/7 with very little downtime and has experienced some good growth. To give you a sense of the activity levels, [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3354</guid>
         <pubDate>Wed, 02 May 2012 14:21:40 +0000</pubDate>
         <content:encoded><![CDATA[<p>Two years ago, I <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2009/11/09/the-making-of-chessjam-flexair-coldfusion-livecycle-ds-fun-project/">blogged</a> about <a rel="nofollow" target="_blank" href="http://chessjam.com">ChessJam</a>, a chess application that I helped develop where people from all over the world play live chess with each other.  Since launching ChessJam, it&#8217;s been up and running 24/7 with very little downtime and has experienced some good growth.</p>
<p style="text-align:center;"><a rel="nofollow" target="_blank" href="http://chessjam.com"><img class="aligncenter size-full wp-image-3351" title="chessjamcollage" src="http://gregsramblings.com/wp-content/uploads/2012/05/chessjamcollage.png" alt="" width="784" height="162"/></a></p>
<p>To give you a sense of the activity levels, here are a few ChessJam stats:</p>
<ul>
<li>At any time, day or night, there is an average of 100 users logged in playing chess.  We&#8217;ve seen it as high as 180 concurrent on weekends.</li>
<li>Our average load is about 2 or 3 chess moves per second.</li>
<li>During the month of March, 2012, more than 4,500 users played 128,920 games (5.8 million moves in one month)</li>
</ul>
<p>Not bad for no marketing budget I think.  It&#8217;s not a huge amount of activity compared to a lot of applications, but the performance demands are very high. Serious chess players don&#8217;t tolerate delays in response time, so we have to make sure we have plenty of CPU and bandwidth to spare.</p>
<h4>Hosting history:</h4>
<p><strong>Late 2009/Early 2010 &#8212; development and early production &#8211; hosting from my home office</strong></p>
<p>During development and the first few months of production, ChessJam was hosted from a computer in my home office.  The cost was around $70/month for FiOS fixed IP address plus whatever power my server was drawing. This was fine until the Florida summer storms took out my power twice in a single month. That&#8217;s when we realized the difference between a real data center and my personal data center! It was also a bit stressful when I traveled because it left my wife in charge of late-night server repairs.</p>
<p><strong>Late 2010 &#8212; moved to rack mounted servers in a real data center</strong></p>
<p><strong></strong>We acquired two used (circa 2008) rack-mounted IBM servers and rented some rack space at a local data center.  Reliable power and Internet were no longer a problem, but the hardware was ours to manage and eventually repair.  It was better, but it wasn&#8217;t a great situation. Once we settled in, our cost was around $190/month (rack space rental and bandwidth).</p>
<p>Why didn&#8217;t we move to Amazon EC2 instead of the data center?  We did consider moving from my home office to Amazon EC2 instead of the data center, but at the time, Amazon didn&#8217;t have an instance type that suited us.  The small instance type was affordable, but it only offers 1.7GB of memory, which just won&#8217;t cut it for our server app (we tried). The next step up was the large instance type with 7.5GB of memory, but it was too expensive and overkill.</p>
<p>Two months ago, Amazon filled the huge gap between the small and large instance type by <a rel="nofollow" target="_blank" href="http://aws.typepad.com/aws/2012/03/ec2-updates-new-instance-64-bit-bit-ubiquity-ssh-client.html">announcing the new &#8220;medium&#8221; instance type</a>. It provides 3.75GB of memory as well as a decent amount of CPU for a good price&#8230; so we decided it was time to make the move.</p>
<h4>Our EC2 configuration:</h4>
<ul>
<li>Medium EBS instance running <a rel="nofollow" target="_blank" href="http://alestic.com/">Ubuntu Linux</a>.  EBS is &#8220;Elastic Block Store&#8221;, which basically means that the storage is persistent.  If you haven&#8217;t looked at EC2 in the past two years, you might not know that persistent storage on server instances is an now an option.  With EBS storage, you can shut down your server and all of the data is saved (just like a physical server).</li>
<li>200GB EBS disk volume &#8211; for our MySQL database and fast growing log files.</li>
</ul>
<h4>AWS and bill anxiety</h4>
<p><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2012/05/anxiety.jpg"><img class="alignright size-medium wp-image-3363" title="anxiety" src="http://gregsramblings.com/wp-content/uploads/2012/05/anxiety-200x300.jpg" alt="" width="200" height="300"/></a>Most people exploring Amazon EC2 ask the same question I asked… &#8220;What is this really going to cost me?&#8221;. When you dig into how EC2 is priced, you&#8217;ll find that there are multiple variables, which creates a bit of uncertainty. Basically, it boils down to the server instance type, the disk space used, and the amount of data moved in and out of the instance. There are other small charges for number of I/Os and any unused IP addresses, but these are typically only a few cents and don&#8217;t have much impact on the final bill (based on my experience).</p>
<ul>
<li><strong>The server instance</strong> &#8212; this one is easy and predictable. Amazon charges by the hour. For example, our medium instance is $0.16 per hour. You could fire up a medium server instance and spend a full 8 hour work day playing with it and only pay about $1.30. Not bad! Our app runs 24/7 so 24 hours per day * 30 days = 720 hours per month. So, our monthly cost can be calculated with $0.16 * 720 = <strong>$115/month</strong>.  (later in this article, I explain how reserved instances work and how they can lower this price by nearly half)</li>
<li><strong>Disk volume</strong> &#8211; this one is also easy and predictable as well. It cost $0.10 per GB per month. We have a 200GB volume, so that&#8217;s 200*$0.10 = <strong>$20/month</strong>.</li>
<li><strong>Disk I/Os</strong> &#8212; The EC2 pricing page also shows a $0.10 charge per million I/Os. We do about 300,000 I/Os per day (based on my last bill) so that comes to about 9 million I/Os per month resulting in less than <strong>$1/month</strong>&#8230; so we&#8217;ll just call that a rounding error.</li>
<li><strong>Data transfer charges</strong> &#8212; this is the part that scared us. Amazon charges $0.12 per GB of data transferred out of our EC2 instance. They do not charge for inbound traffic. This method of charging for data is very different than how our data center charges us. The data center uses &#8220;95th percentile peak billing&#8221; which means we are charged based on the average rate that we move data, not the volume of data moved. I&#8217;ll spare you the details, but it doesn&#8217;t translate to Amazon&#8217;s model. However, our data center provider does have a report that shows the total amount of data transferred each month and we used that number to estimate. Now that we&#8217;ve been up and running a few days, I know that we transfer about 250MB of data every hour or 6GB of data per day. So, 6GB * 30 days * $0.12 = <strong>$21/month</strong>.</li>
</ul>
<p><strong>Summary:</strong> $115.20/month for our server instance, $20/month for our disk volume and $21/month for data transfer which comes to about <strong>$156.20/month</strong>. That&#8217;s already about $30 less than we were paying the data center.  That price is already lower than what we were paying&#8230; but with reserved instances, we can lower it considerably.</p>
<h4>Saving money with reserved instances</h4>
<p><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2012/05/savings1.jpg"><img class="alignright size-full wp-image-3367" title="savings" src="http://gregsramblings.com/wp-content/uploads/2012/05/savings1.jpg" alt="" width="120" height="78"/></a>A lot of companies use Amazon EC2 in a much more &#8220;elastic&#8221; fashion than ChessJam does.  They set up load balancers and auto-scaling to dynamically increase and decrease instances based on the load. However, our app is not nearly that sophisticated (although eventually our usage may justify re-architecting our back end!).  Our app uses a consistent amount of EC2 resources.  Thankfully, Amazon offers special pricing for this type of use-case called <em><strong>reserved instances</strong></em>. Reserved Instances give you the option to make a one-time payment for each instance you want to reserve and in turn, receive a significant discount on the hourly charge for that instance. Basically, Amazon is rewarding you for being predictable. There are three different options, light utilization, medium utilization, and heavy utilization. Our server is up and running 24/7, so our best deal is the heavy utilization model.</p>
<p>I reserved a medium instance for one year by paying an upfront fee of $390. Now, instead of paying $0.16 per hour, we pay $0.032 per hour (just over 3 cents!).  Some simple math shows the savings:</p>
<ul>
<li>With a normal &#8220;demand instance&#8221;, we paid $0.16 per hour * 24 hours per day * 365 days per year resulting in a <strong>yearly cost of $1,401.60</strong> (plus disk, I/O, transfer)</li>
<li>With the reserved instance, we paid $390 up front and then $0.032 per hour * 24 hours per day * 365 days per year resulting in a <strong>yearly cost of $670.32</strong> (plus disk, I/O, transfer)</li>
</ul>
<h4>Bottom line cost including disk, data, etc.</h4>
<ul>
<li>We paid around <strong>$2,280</strong> a year to the data center.</li>
<li>We now pay <strong>$1,160</strong> a year to Amazon EC2 &#8211; saving us over $1,000 per year (not counting any hardware costs we could have incurred).</li>
</ul>
<p>There are two smaller instance types &#8211; micro and small.  You might can get by far cheaper for your app/site.  With reserved instance pricing, you can get a micro instance for about $100 per year!  I currently host 6 low-use websites on a single micro instance (local bagel store, my aerial photo site, etc.).</p>
<p><strong>TIP:</strong> If you plan to use Amazon&#8217;s micro instances, you should be aware of how they throttle CPU.  It&#8217;s unique to the micro instance type.  <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2011/02/07/amazon-ec2-micro-instance-cpu-steal/">I blogged about this months ago</a>.</p>
<p><strong>TIP:</strong> Amazon&#8217;s billing data is updated several times per day, so you can quickly determine what your run-rate is for everything. I was able to project our monthly cost after 24 hours of activity.</p>
<h4>We didn&#8217;t move to EC2 just to save money</h4>
<p><img class="alignright size-full wp-image-3353" title="serverrepair200" src="http://gregsramblings.com/wp-content/uploads/2012/05/serverrepair200.jpg" alt="" width="200" height="300"/>Yes, we&#8217;re saving some money &#8211; that&#8217;s awesome, but to be honest, it&#8217;s not the reason we moved.   The real reason we wanted to move to a cloud solution like EC2 is for peace of mind and to prevent us from dealing with a hardware failures.  We had a backup server in the data center, but if there was a failure in the primary server, it would likely result in a 30 minute drive to the data center and a few hours in a cold room moving hard drives from server to server and hoping it all goes well.  It was a precarious situation!  Now, if there is a hardware failure (rare, but they happen on EC2), I simply launch a new instance with a few clicks of the mouse, mount our disk volume to it, tweak a few things, and get us back online.  All of this while watching Big Bang Theory in my PJs!</p>
<p>I know that a few of you IT-minded folks are seeing some holes in my final architecture, and yes, you&#8217;re correct. The above scheme doesn&#8217;t address a disk volume crash. Disk volume crashes are very rare on EC2, but I do plan to make a few more enhancements to the architecture. I could start up a new instance and use it as a slave server to replicate data from the primary server&#8217;s database (MySQL).  I could start this backup instance in a completely different zone, which basically means that it&#8217;s in a different physical facility.  This would allow us to quickly recover if Amazon has a massive failure like the one a year ago that brought down several popular sites for a few hours. However, I might go the cheap route and create a 2nd disk volume and use a file system that allows me to mirror the database between the two disk volumes. I think this will be adequate until someone buys us for a $1 billion. <img src='http://gregsramblings.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley'/> </p>
<p>Another option to mention is <a rel="nofollow" target="_blank" href="http://aws.amazon.com/rds/">Amazon RDS</a> (MySQL in the cloud). If we used RDS for our database, it would give us more redundancy and scalability, but for now, we&#8217;re going to avoid that cost and stay on the single instance until we grow more.</p>
<h4>It may not be for all applications</h4>
<p>Our experience with EC2 was very positive, especially with this application.  However, it&#8217;s not perfect for all applications.  The server is still &#8220;virtual&#8221; so the performance is not perfectly<br />
consistent.  Things like disk I/O speed, network bandwidth, etc., is what it is.  You can&#8217;t tell Amazon that you need a SSD for your swap drive and 10,000RPM drives for your databases. In other words, you don&#8217;t have as many ways to tweak performance as you do by managing your own real hardware.  However, if your app runs well on EC2, why bother with that stuff?!  I personally feel that I&#8217;ve served my time in computer rooms during my career. <img src='http://gregsramblings.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> </p>
<h4>The rest of the Amazon Web Services world</h4>
<p>Everything we&#8217;ve talked about in this article has been specific to the low-end instance types of Amazon EC2.  There are many other instance types and other related features including load balancers, auto-scaling, monitoring, automatic alerts, etc.  Also, EC2 is only one of many services offered by Amazon.  Check them all out at <a rel="nofollow" target="_blank" href="http://aws.amazon.com/">http://aws.amazon.com/</a>.</p>
<h4><a rel="nofollow" target="_blank" href="http://aws.amazon.com"><img class="aligncenter size-full wp-image-3369" title="awslogo" src="http://gregsramblings.com/wp-content/uploads/2012/05/awslogo1.png" alt="" width="162" height="64"/></a></h4>
<h4>Check it out for free</h4>
<p>Amazon recently started offering a &#8220;<a rel="nofollow" target="_blank" href="http://aws.amazon.com/free/">free tier</a>&#8221; for EC2 newbies. You basically get a year free of a micro instance along with some disk space and bandwidth. See <a rel="nofollow" target="_blank" href="http://aws.amazon.com/free/">http://aws.amazon.com/free</a> for more details. Remember &#8211; you can resize instances anytime. It&#8217;s very common to use a micro instance during development, and then upgrade as needed when you go live.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F05%2F02%2Famazon-ec2-a-real-world-case-study-of-moving-from-data-center-to-the-cloud-chessjam%2F&amp;title=Amazon%20EC2%20%E2%80%93%20a%20real-world%20case%20study%20of%20moving%20from%20a%20data%20center%20to%20the%20cloud" id="wpa2a_12"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>JavaScript Developer Magazine – Appliness May Issue now Available</title>
         <link>http://gregsramblings.com/2012/04/30/javascript-developer-magazine-may-2012-appliness/</link>
         <description>The May 2012 issue of Appliness is now available for your iPad and Android tablet.  This issue has over 100 pages of content including tons of code samples and interactive demos.  If you are a JavaScript developer, this is something you should subscribe to.  It&amp;#8217;s free. May 2012 table of contents: CSS Regions and CSS [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3336</guid>
         <pubDate>Mon, 30 Apr 2012 18:57:00 +0000</pubDate>
         <content:encoded><![CDATA[<p>The May 2012 issue of <a rel="nofollow" target="_blank" href="http://appliness.com">Appliness</a> is now available for your iPad and Android tablet.  This issue has over 100 pages of content including tons of code samples and interactive demos.  If you are a JavaScript developer, this is something you should subscribe to.  It&#8217;s free.</p>
<p><strong>May 2012 table of contents:</strong></p>
<ul>
<li>CSS Regions and CSS Exclusions, by Deepa Subramaniam</li>
<li>Drag and drop with jQuery UI on mobile devices, by Michaël Chaize</li>
<li>JavaScript Object Creation, by Keith Peters</li>
<li>Using Backbone with jQuery Mobile, by Christophe Coenraets</li>
<li>Crafting native looking iOS apps with HTML, by Christophe Coenraets</li>
<li>Demo of Handlebars, by Raymond Camden</li>
<li>Real-time data exchange in HTML5, by Ryan Stewart</li>
<li>Swipe to delete items, by Michaël Chaize</li>
<li>App-UI, a library by Andrew Trice</li>
<li>HTML5 Multimedia components, by Ian Devlin</li>
<li>Interview of Pamela Fox</li>
<li>Colour Match, Cutest Paw, Bit Timer: showcase</li>
<li>Which Element ? Pull quotes, comments</li>
<li>PhoneGap and the File API</li>
<li>WTFJS: False advertising</li>
<li>Generate color palettes from HTML5 video</li>
<li>CSS variables draft</li>
<li>News</li>
</ul>
<p>More information at <a rel="nofollow" target="_blank" href="http://appliness.com/download-the-second-issue/">http://appliness.com/download-the-second-issue/</a></p>
<p><img class="alignnone size-full wp-image-3345" title="JavaScript Developer Magazine Appliness" src="http://gregsramblings.com/wp-content/uploads/2012/04/collage700.png" alt="" width="700" height="643"/></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F04%2F30%2Fjavascript-developer-magazine-may-2012-appliness%2F&amp;title=JavaScript%20Developer%20Magazine%20%E2%80%93%20Appliness%20May%20Issue%20now%20Available" id="wpa2a_14"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>WANTED – Rock star C++ programmers to work on WebKit</title>
         <link>http://gregsramblings.com/2012/04/17/wanted-rock-star-c-programmers-to-work-on-webkit/</link>
         <description>Did you know that Adobe is ramping up engineering efforts to build new features for WebKit?  This is not a fork of WebKit for an upcoming product.  This is WebKit trunk code commits!  The WebKit Engineering team in San Francisco contributes features, bug fixes, and engineering system improvements to WebKit.  They work on the WebKit [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3327</guid>
         <pubDate>Wed, 18 Apr 2012 03:00:56 +0000</pubDate>
         <content:encoded><![CDATA[<p>Did you know that Adobe is ramping up engineering efforts to build new features for WebKit?  This is not a fork of WebKit for an upcoming product.  This is WebKit trunk code commits!  The WebKit Engineering team in San Francisco contributes features, bug fixes, and engineering system improvements to WebKit.  They work on the WebKit trunk, according to the processes of the WebKit development community.  You can get a taste of what the team has been working on by looking at <a rel="nofollow" target="_blank" href="http://blogs.adobe.com/webplatform/">http://blogs.adobe.com/webplatform/</a>.</p>
<p>If you are a C++ programmer with a desire to work on a highly visible team that is having a huge impact on the future of the web, it&#8217;s time to apply!  You can go to <a rel="nofollow" target="_blank" href="http://adobe.com/jobs">http://adobe.com/jobs</a> and search for the keyword &#8220;<strong>WebKit</strong>&#8221; to find the current open positions.  You can also email WebKitJobs at adobe dot com to apply.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F04%2F17%2Fwanted-rock-star-c-programmers-to-work-on-webkit%2F&amp;title=WANTED%20%E2%80%93%20Rock%20star%20C%2B%2B%20programmers%20to%20work%20on%20WebKit" id="wpa2a_16"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Building Mobile Apps with HTML and a Local Database</title>
         <link>http://coenraets.org/blog/2012/04/building-mobile-apps-with-html-and-a-local-database/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=building-mobile-apps-with-html-and-a-local-database</link>
         <description>After my recent post, Crafting Native Looking iOS Apps with HTML, a number of you asked for an offline version that would use a Local Database (instead of the simple in-memory store) and provide a mechanism to automatically keep the local database in sync with a server database. I&amp;#8217;ll save automatic data synchronization strategies for [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Building Mobile Apps with HTML and a Local Database http://coenraets.org/blog/?p=3474"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F04%2Fbuilding-mobile-apps-with-html-and-a-local-database%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3474</guid>
         <pubDate>Wed, 11 Apr 2012 16:03:22 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://coenraets.org/blog/wp-content/uploads/2012/04/empdirdb4.jpg"><img src="http://coenraets.org/blog/wp-content/uploads/2012/04/empdirdb4.jpg" alt="" title="empdirdb4" width="436" height="607" class="aligncenter size-full wp-image-3555"/></a></p>
<p>After my recent post, <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/03/crafting-native-looking-ios-apps-with-html-backbone-js-and-phonegap/">Crafting Native Looking iOS Apps with HTML</a>, a number of you asked for an offline version that would use a Local Database (instead of the simple in-memory store) and provide a mechanism to automatically keep the local database in sync with a server database.<br />
<span id="more-3474"></span><br />
I&#8217;ll save automatic data synchronization strategies for a future post, but here is the first step: an &#8220;offline&#8221; version of the application that uses the device&#8217;s or the browser&#8217;s local database as its data provider. This version still uses <a rel="nofollow" target="_blank" href="http://backbonejs.org/">Backbone.js</a> as its architectural framework. Backbone.js makes it easy to change its default data access mechanism (which assumes RESTful services). You just replace the default <strong>Backbone.sync</strong> implementation and provide your own data access logic: in this case, some local SQL logic.</p>
<h5>Web SQL vs IndexedDB</h5>
<p>As you probably know, there have been two competing database APIs for HTML. From the W3C web site:</p>
<ul>
<li>The <a rel="nofollow" target="_blank" href="http://dev.w3.org/html5/webdatabase/">Web SQL specification</a> defines an API for storing data in databases that can be queried using a variant of SQL. This specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further.</li>
<li>The <a rel="nofollow" target="_blank" href="http://www.w3.org/TR/IndexedDB/">Indexed Database specification</a> defines APIs for a database of records holding simple values and hierarchical objects. It is a working draft, and &#8220;work in progress&#8221;.</li>
</ul>
<p>Even though the W3C is no longer actively maintaining the spec, this application uses the Web SQL API because, as a mobile <em>app</em>, its two main target platforms are iOS and Android, which both currently support Web SQL but not IndexedDB. More detailed platform support information can be found on caniuse.com (<a rel="nofollow" target="_blank" href="http://caniuse.com/#feat=sql-storage">Web SQL</a> and <a rel="nofollow" target="_blank" href="http://caniuse.com/indexeddb">IndexedDB</a>).</p>
<p>Chrome, Safari, and Opera on the desktop also support Web SQL, which means that you can run the application in these browsers. Try it <a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/localdb">here</a>. For example, using the Chrome Developer Tools you could debug the application and inspect the database as shown in this screenshot:</p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/blog/wp-content/uploads/2012/04/debugdb2.gif"><img src="http://coenraets.org/blog/wp-content/uploads/2012/04/debugdb2.gif" alt="" title="debugdb2" width="640" height="469" class="alignnone size-full wp-image-3516"/></a></p>
<p>Firefox and IE don&#8217;t support Web SQL. You could easily create an alternative version of EmployeeDAO (described below) that uses IndexedDB instead. You could also create a version of the application that uses either Web SQL or IndexedDB depending on the platform it&#8217;s running on.</p>
<h5>Code Highlights</h5>
<p>The source code is available in the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory/tree/master/localdb">localdb</a> folder of the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory">backbone-directory</a> repository on GitHub. Here is a quick walkthrough&#8230;</p>
<p>The data access logic is encapsulated in EmployeeDAO, which also has a “populate” function to populate the employee table with sample data.</p>
<pre>
directory.dao.EmployeeDAO = function(db) {
    this.db = db;
};

_.extend(directory.dao.EmployeeDAO.prototype, {

    findByName: function(key, callback) {
        this.db.transaction(
            function(tx) {

                var sql = &quot;SELECT e.id, e.firstName, e.lastName, e.title, count(r.id) reportCount &quot; +
                    &quot;FROM employee e LEFT JOIN employee r ON r.managerId = e.id &quot; +
                    &quot;WHERE e.firstName || ' ' || e.lastName LIKE ? &quot; +
                    &quot;GROUP BY e.id ORDER BY e.lastName, e.firstName&quot;;

                tx.executeSql(sql, ['%' + key + '%'], function(tx, results) {
                    var len = results.rows.length,
                        employees = [],
                        i = 0;
                    for (; i &lt; len; i = i + 1) {
                        employees[i] = results.rows.item(i);
                    }
                    callback(employees);
                });
            },
            function(tx, error) {
                alert(&quot;Transaction Error: &quot; + error);
            }
        );
    },

    findById: function(id, callback) {
        // removed for brevity
    },

    findByManager: function(managerId, callback) {
        // removed for brevity
    },

    populate: function(callback) {
        // removed for brevity
    }
});
</pre>
<p>Models are annotated with a “dao” attribute to indicate which data object to use to access their underlying data.</p>
<pre>
directory.models.Employee = Backbone.Model.extend({

    dao: directory.dao.EmployeeDAO,

});

directory.models.EmployeeCollection = Backbone.Collection.extend({

    dao: directory.dao.EmployeeDAO,

    model: directory.models.Employee,

});
</pre>
<p>With that infrastructure in place, you can then override Backbone.sync to access data from the local database instead of RESTful services:</p>
<pre>
Backbone.sync = function(method, model, options) {

    var dao = new model.dao(directory.db);

    if (method === &quot;read&quot;) {
        if (model.id) {
            dao.findById(model.id, function(data) {
                options.success(data);
            });
        } else if (model.managerId) {
            dao.findByManager(model.managerId, function(data) {
                options.success(data);
            });
        }
        // removed for brevity
    }

};
</pre>
<h5>Source Code</h5>
<p>The source code is available in the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory/tree/master/localdb">localdb</a> folder of the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory">backbone-directory</a> repository on GitHub.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Building Mobile Apps with HTML and a Local Database http://coenraets.org/blog/?p=3474">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F04%2Fbuilding-mobile-apps-with-html-and-a-local-database%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>Upcoming Flex Events</title>
         <link>http://devgirl.org/2012/04/09/upcoming-flex-events/</link>
         <description>If you&amp;#8217;re looking for a great conference to attend, 360&amp;#124;Flex is right around the corner and you should definitely make a point of checking it out. Most developers consider this to be *the* conference to attend and glancing at the schedule, you can see why. My fellow teammate, Christophe Coenraets is going to be doing [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3767</guid>
         <pubDate>Mon, 09 Apr 2012 17:48:44 +0000</pubDate>
         <content:encoded><![CDATA[<p>If you&#8217;re looking for a great conference to attend, <a rel="nofollow" target="_blank" href="http://www.360flex.com/">360|Flex</a> is right around the corner and you should definitely make a point of checking it out. Most developers consider this to be *the* conference to attend and glancing at the <a rel="nofollow" target="_blank" href="http://www.360flex.com/schedule/">schedule</a>, you can see why. My fellow teammate, Christophe Coenraets is going to be doing the keynote and has some fun in store that you will not want to miss. There will also be an update from the <a rel="nofollow" target="_blank" href="http://www.spoon.as/">Spoon folks</a> so you can find out all the latest and greatest information around the <a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/">Apache Flex</a> open source project. This year&#8217;s conference is not just Flex either, you will have the opportunity to help yourself become a more well-rounded developer and explore other technologies from the best of the best developers first hand. <a rel="nofollow" target="_blank" href="http://www.360flex.com/blog/2012/03/360flex-2012-not-just-flex/">This post by John Wilker</a> (who runs the show) sums up the experience well. Also, Denver is a great location and has so much to offer. It&#8217;s personally one of my favorite cities to visit, so be sure to check this one out! </p>
<p>Secondly, if you&#8217;re in or around the Dallas area, be sure to visit <a rel="nofollow" target="_blank" href="http://gregsramblings.com/">Greg Wilson</a> and <a rel="nofollow" target="_blank" href="http://www.unitedmindset.com/jonbcampos/">Jon Campos</a> at the Flex User Group meeting on April 19, 2012. Details about the event can be found <a rel="nofollow" target="_blank" href="http://dflex.groups.adobe.com/index.cfm?event=post.display&#038;postid=41781">here</a>!  </p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F04%2F09%2Fupcoming-flex-events%2F&amp;title=Upcoming%20Flex%20Events" id="wpa2a_8"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Appliness, a New Digital Magazine for Web Developers</title>
         <link>http://coenraets.org/blog/2012/03/appliness-a-new-digital-magazine-for-web-developers/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=appliness-a-new-digital-magazine-for-web-developers</link>
         <description>My multi-talented colleague Michael Chaize has been working hard on Appliness, a new Digital Magazine for Web developers. Appliness features interactive tutorials, video tutorials, news, application showcases, interviews, etc. Check out the video: Appliness is available on the iPad and Android tablets. If you have an iPad, you can get it from the &amp;#8220;Newsstand&amp;#8221;: http://itunes.apple.com/au/app/appliness/id510636049 [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Appliness, a New Digital Magazine for Web Developers http://coenraets.org/blog/?p=3462"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Fappliness-a-new-digital-magazine-for-web-developers%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3462</guid>
         <pubDate>Thu, 29 Mar 2012 14:42:12 +0000</pubDate>
         <content:encoded><![CDATA[<p>My multi-talented colleague <a rel="nofollow" target="_blank" href="http://www.riagora.com/">Michael Chaize</a> has been working hard on <a rel="nofollow" target="_blank" href="http://www.appliness.com">Appliness</a>, a new Digital Magazine for Web developers. Appliness features interactive tutorials, video tutorials, news, application showcases, interviews, etc. </p>
<p>Check out the video:</p>
<p></p> 
<p>Appliness is available on the iPad and Android tablets.<br />
<span id="more-3462"></span><br />
If you have an iPad, you can get it from the &#8220;Newsstand&#8221;: <a rel="nofollow" target="_blank" href="http://itunes.apple.com/au/app/appliness/id510636049">http://itunes.apple.com/au/app/appliness/id510636049</a></p>
<p>If you have an Android tablet, Appliness is available as a standalone application on Google Play: <a rel="nofollow" target="_blank" href="https://play.google.com/store/apps/details?id=com.appliness.applinessAndroid">https://play.google.com/store/apps/details?id=com.appliness.applinessAndroid</a></p>
<p>Appliness was created using the <a rel="nofollow" target="_blank" href="http://www.adobe.com/products/digital-publishing-suite-family.html">Adobe Digital Publishing Suite</a> (DPS).</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Appliness, a New Digital Magazine for Web Developers http://coenraets.org/blog/?p=3462">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Fappliness-a-new-digital-magazine-for-web-developers%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
         <category>Uncategorized</category>
      </item>
      <item>
         <title>Crafting Native Looking iOS Apps with HTML, Backbone.js, and PhoneGap</title>
         <link>http://coenraets.org/blog/2012/03/crafting-native-looking-ios-apps-with-html-backbone-js-and-phonegap/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=crafting-native-looking-ios-apps-with-html-backbone-js-and-phonegap</link>
         <description>If you just want to try the application in your browser, click here. The data is based on Dwight&amp;#8217;s original org chart :) I&amp;#8217;ve been blogging a lot about Backbone.js recently. Backbone.js is a lightweight architectural framework that brings structure to your Web applications. Backbone is not, however, a user interface framework that helps you [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Crafting Native Looking iOS Apps with HTML, Backbone.js, and PhoneGap http://coenraets.org/blog/?p=3359"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Fcrafting-native-looking-ios-apps-with-html-backbone-js-and-phonegap%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3359</guid>
         <pubDate>Wed, 28 Mar 2012 18:00:04 +0000</pubDate>
         <content:encoded><![CDATA[<p>If you just want to try the application in your browser, click <a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/iphone">here</a>. The data is based on Dwight&#8217;s original <a rel="nofollow" target="_blank" href="http://www.nbc.com/The_Office/downloads/dunder_mifflin_org_chart.pdf">org chart</a> :)</p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/iphone"><img src="http://coenraets.org/blog/wp-content/uploads/2012/03/empdirios04.jpg" alt="" title="empdirios04" width="300" height="574" style="float:left;"/></a></p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/iphone"><img src="http://coenraets.org/blog/wp-content/uploads/2012/03/empdirios05.jpg" alt="" title="empdirios05" width="300" height="574" style=""/></a></p>
<p>I&#8217;ve been blogging a lot about Backbone.js recently. Backbone.js is a lightweight architectural framework that brings structure to your Web applications. Backbone is not, however, a user interface framework that helps you with the way your application looks.</p>
<p><em>So, where do you turn to for help when you need to make your application look good? </em><br />
<span id="more-3359"></span><br />
For traditional web apps (delivered through a browser), Twitter Bootstrap can help (read <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/02/sample-app-with-backbone-js-and-twitter-bootstrap/">here</a>). But what about Mobile apps? I explored Backbone.js + jQuery Mobile <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/03/employee-directory-sample-app-with-backbone-js-and-jquery-mobile/">here</a>. Depending on what you are looking for, it may or may not be the right solution: jQM provides mobile skins, but they don&#8217;t look native. It&#8217;s also more of a full stack framework than a lightweight UI toolkit that you can easily layer on top of your app.  </p>
<p>The alternative to using an existing UI toolkit is to roll your own styles to make your application look and behave like a native app. Sounds easy enough, but when you consider all the details and want to achieve &#8220;pixel perfection&#8221;, it becomes a daunting task. </p>
<p>As I was getting ready to tackle the challenge, and build a new native looking version of my Employee Directory app, I came across <a rel="nofollow" target="_blank" href="http://cheeaun.com/blog/2012/03/how-i-built-hacker-news-mobile-web-app">this great blog post</a> by Chee Aun where he documents the process he went through to build his own Hacker News mobile app. His post is a real gem, and I ended up reusing a lot of the Hacker News app styles.</p>
<p>Compared to the Hacker News app, the Employee Directory page flow is more random. Here are a few examples:</p>
<ol>
<li>SearchPage -&gt; EmployeePage -&gt; ReportsPage -&gt; EmployeePage -&gt; &#8230; </li>
<li>SearchPage -&gt; EmployeePage -&gt; EmployeePage (manager) -&gt; Reports -&gt; &#8230; </li>
<li>SearchPage -&gt; EmployeePage -&gt; EmployeePage (manager) -&gt; EmployeePage (manager&#8217;s manager) -&gt; &#8230; </li>
</ol>
<p>As you can see, the page flow includes &#8220;same page transitions&#8221;, when the user navigates from one employee to his/her manager. To accommodate the Employee Directory page flow requirements, my Backbone.js infrastructure creates and destroys pages as needed with the appropriate slide-in/slide-out transitions. The implementation of these transitions was inspired by Wesley Hales&#8217; <a rel="nofollow" target="_blank" href="http://www.html5rocks.com/en/mobile/optimization-and-performance/">article</a>.</p>
<h5>PhoneGap</h5>
<p>Even though you can run this application in a browser (<a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/iphone">here</a>), I built it with the intention of packaging it as a native app with <a rel="nofollow" target="_blank" href="http://phonegap.com/">PhoneGap</a> so  that you could start it like any other app from your iPhone home screen. If you are not familiar with PhoneGap, I&#8217;ll provide more details on packaging this app as a native app in my next post.</p>
<h5>Source Code</h5>
<p>I updated the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory">backbone-directory</a> GitHub repository to include this version: It is available in the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory/tree/master/iphone">iphone</a> directory.<br />
<br/><br/></p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Crafting Native Looking iOS Apps with HTML, Backbone.js, and PhoneGap http://coenraets.org/blog/?p=3359">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Fcrafting-native-looking-ios-apps-with-html-backbone-js-and-phonegap%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>Appliness – New digital magazine for JavaScript app developers!</title>
         <link>http://gregsramblings.com/2012/03/28/appliness-javascript-magazine/</link>
         <description>Today, the Adobe evangelists team has launched a new digital magazine called Appliness. If you have an iPad or Android tablet, you can grab a free copy now! The Kindle Fire version will be available any day (we&amp;#8217;re waiting on Amazon to approve &amp;#8211; their backlog is 2 weeks!). This will be a monthly magazine [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3309</guid>
         <pubDate>Wed, 28 Mar 2012 13:24:31 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2012/03/appliness1.png"><img class="alignleft size-full wp-image-3310" title="appliness1" src="http://gregsramblings.com/wp-content/uploads/2012/03/appliness1.png" alt="" width="184" height="239"/></a>Today, the Adobe evangelists team has launched a new digital magazine called Appliness.  If you have an iPad or Android tablet, you can grab a free copy now!  The Kindle Fire version will be available any day (we&#8217;re waiting on Amazon to approve &#8211; their backlog is 2 weeks!).</p>
<p>This will be a monthly magazine with articles about writing applications using web standards. Some of the articles have interactive content and video.</p>
<p>All of this was done using Adobe Digital Publishing Suite (the same technology used for popular magazines such as Wired, National Geographic, and many more).</p>
<p>Michael Chaize was the driving force behind this and has a <a rel="nofollow" target="_blank" href="http://www.riagora.com/2012/03/appliness-digital-magazine/">blog post</a> with more details.  <a rel="nofollow" target="_blank" href="https://twitter.com/#!/mailevalentine">Maile Valentine</a> also played a huge role in the creation of Appliness &#8211; THANK YOU BOTH!</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2012%2F03%2F28%2Fappliness-javascript-magazine%2F&amp;title=Appliness%20%E2%80%93%20New%20digital%20magazine%20for%20JavaScript%20app%20developers%21" id="wpa2a_18"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Appliness: digital magazine</title>
         <link>http://www.riagora.com/2012/03/appliness-digital-magazine/</link>
         <description>Hi guys! I&amp;#8217;ve been working on a new project for several weeks. As my team is now extending its audience and its skills, we were looking for innovative ways to reach web application developers. To address the Flex community, our blogs and our events remain the best ways to deliver our messaging and get your [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=926</guid>
         <pubDate>Wed, 28 Mar 2012 13:19:12 +0000</pubDate>
         <content:encoded><![CDATA[<p>Hi guys! I&#8217;ve been working on a new project for several weeks. As my team is now extending its audience and its skills, we were looking for innovative ways to reach web application developers. To address the Flex community, our blogs and our events remain the best ways to deliver our messaging and get your feedback. With HTML developers, it&#8217;s a different story. Adobe is not the only actor in the HTML world, that&#8217;s why we need to find innovative ways of communication. <strong><span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://www.appliness.com"><span style="color:#3366ff;">Appliness</span></a></span></strong> is one of them. It&#8217;s a digital magazine, actually the first one created for web application developers. Available on iPad and Android tablets, Appliness contains technical tutorials, news, applications showcased, video tutorials, exclusive interviews and more.</p>
<p></p> 
<h3>Website and links</h3>
<p>Appliness is now alive and has its own dedicated website: <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://www.appliness.com"><span style="color:#3366ff;">http://www.appliness.com</span></a></span></p>
<p>If you have an iPad, you can download the magazine on the app store. It will appear in the Newsstand application: <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://itunes.apple.com/au/app/appliness/id510636049"><span style="color:#3366ff;">http://itunes.apple.com/au/app/appliness/id510636049</span></a></span></p>
<p>If you have an Android tablet, Appliness is available as a standalone application on Google Play. <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="https://play.google.com/store/apps/details?id=com.appliness.applinessAndroid"><span style="color:#3366ff;">https://play.google.com/store/apps/details?id=com.appliness.applinessAndroid</span></a></span></p>
<p>I&#8217;m currently working with Amazon to put it on the Amazon Appstore.</p>
<h3>Digital Publishing Suite</h3>
<p>To create this magazine, I used<span style="color:#3366ff;"> <a rel="nofollow" target="_blank" href="http://www.adobe.com/products/digital-publishing-suite-family.html"><span style="color:#3366ff;">Adobe Digital Publishing Suite</span></a></span> (DPS). First, I had to install and learn how to use InDesign CS5.5. I was happily surprised by the number of video tutorials available on the web. DPS adds some components and features to InDesign to create digital magazines. The extensions are free and you can create and test a magazine for free on your tablet. Basically, you create static articles and then you add interactive parts. At any time you can save and upload your work on acrobat.com. The free application &#8220;Adobe Content Viewer&#8221; available on the app store and on the android market lets you test your work on your tablet.</p>
<h3>Add interactive content with DPS</h3>
<p>The first panel with DPS installed is called &#8220;Overlay creator&#8221;. It&#8217;s a list of interactive components: slideshow, image sequence, Video, Panorama, Pan &amp; Zoom and Web content. The last one was the most interesting for Appliness. It lets you load HTML content in a page. That&#8217;s why in some technical tutorials, you&#8217;ll find the source code of a sample and its execution right next to it. It&#8217;s an instant preview of HTML and JS code! You can even make it interactive so that the reader plays with your HTML samples. It&#8217;s a great way to share tutorials and learn new development tricks. DPS stores your HTML samples in a HTMLresources folder. You can update its content uploading a HTMLresources.zip file. The files will be embedded in your magazine and rendered even if the user if offline. Otherwise you can chose to execute remote HTML files hosted on your own server.</p>
<h3>Organize your folio</h3>
<p>The other panel that comes with DPS in InDesign is the &#8220;Folio Builder&#8221;. A folio is an issue of your magazine. It consists in a list of articles <em>(InDesign files)</em>. Every time you modify the ordering of your articles and their metadata, the changes are synced on acrobat.com. By the way, a hosted version of the folio builder exists and it&#8217;s a fantastic Flex app. Once you sign-in on <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://digitalpublishing.acrobat.com"><span style="color:#3366ff;">digitalpublishing.acrobat.com</span></a>,</span> you can access this app and order your articles, enter the descriptions, etc&#8230;</p>
<h3>Create a native viewer</h3>
<p>A viewer is a native application that you can customize <em>(splash screen, icons&#8230;)</em> and that will consume your folios published on acrobat.com. The Viewer Builder application is a desktop AIR app that lets you create a viewer for iPad or Android tablets. Basically, it&#8217;s a wizard to upload the icons of your application, the splash screen, the certificates&#8230; At the end of the process, this AIR application sends information to acrobat.com that will return an .ipa or an .apk file. You have the choice between several kinds of viewer applications: the single edition <em>(one viewer per folio)</em>, the multi-folio, the multi-folio with subscriptions&#8230; You have a lot of options too: enable push notifications, in-app purchase, presence in the Apple Newsstand application.</p>
<h3>Contribute</h3>
<p>I&#8217;ve also launched a dedicated website: <strong><span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://www.appliness.com"><span style="color:#3366ff;">http://www.appliness.com</span></a>.</span></strong> This magazine for developers and is edited by passionate developers and bloggers. That&#8217;s why it would be great to get your feedback. If you want to contribute, publish a tutorial or showcase your application, use the <span style="color:#3366ff;"><strong><a rel="nofollow" target="_blank" href="http://appliness.com/give-us-feedback/"><span style="color:#3366ff;">feedback form</span></a></strong></span> on appliness.com.</p>
<p>&nbsp;</p>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2012/03/appliness-digital-magazine/&text=Appliness%3A+digital+magazine&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Employee Directory Sample App with Backbone.js and jQuery Mobile</title>
         <link>http://coenraets.org/blog/2012/03/employee-directory-sample-app-with-backbone-js-and-jquery-mobile/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=employee-directory-sample-app-with-backbone-js-and-jquery-mobile</link>
         <description>Here is a mobile version of my Backbone.js Employee Directory application using jQuery Mobile as the UI toolkit. As described in my previous post, jQuery Mobile was (at least initially) intended as a full-stack framework as opposed to a pure UI toolkit like Twitter Bootstrap. As such, it overlaps with the Backbone.js infrastructure in some [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Employee Directory Sample App with Backbone.js and jQuery Mobile http://coenraets.org/blog/?p=3313"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Femployee-directory-sample-app-with-backbone-js-and-jquery-mobile%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3313</guid>
         <pubDate>Thu, 08 Mar 2012 15:50:04 +0000</pubDate>
         <content:encoded><![CDATA[<p>Here is a mobile version of my Backbone.js Employee Directory application using jQuery Mobile as the UI toolkit.</p>
<p>As described in my <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/">previous post</a>, jQuery Mobile was (at least initially) intended as a full-stack framework as opposed to a pure UI toolkit like Twitter Bootstrap. As such, it overlaps with the Backbone.js infrastructure in some areas. In particular, the URL routing feature provided by both frameworks may clash. The approach used here is to disable the routing and navigation capabilities of jQuery Mobile, and essentially use it as a pure UI framework on top of Backbone.js. This approach and its caveats are described in my <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/">previous post</a>.</p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/jquerymobile"><img src="http://coenraets.org/blog/wp-content/uploads/2012/03/photo003.jpg" alt="" title="photo003" width="300" height="450" class="alignleft size-full wp-image-3337"/></a></p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/jquerymobile"><img src="http://coenraets.org/blog/wp-content/uploads/2012/03/photo001.jpg" alt="" title="photo001" width="300" height="450" class="alignnone size-full wp-image-3320" style=""/></a><br />
<span id="more-3313"></span><br />
<a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/jquerymobile"><img src="http://coenraets.org/blog/wp-content/uploads/2012/03/photo002.jpg" alt="" title="photo002" width="300" height="450" class="alignleft size-full wp-image-3322"/></a></p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/jquerymobile"><img src="http://coenraets.org/blog/wp-content/uploads/2012/03/photo0041.jpg" alt="" title="photo004" width="300" height="450" class="alignnone size-full wp-image-3343" style=""/></a></p>
<p>Click <a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/directory/jquerymobile">here</a> to run the application.</p>
<p>A Backbone.js + Twitter Bootstrap version of this application is available <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/02/sample-app-with-backbone-js-and-twitter-bootstrap/">here</a>.</p>
<h5>Source Code</h5>
<p>I updated the <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory">backbone-directory</a> GitHub repository to include this version: It is available in the jquerymobile directory while the Twitter Bootstrap version is available in the web directory.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Employee Directory Sample App with Backbone.js and jQuery Mobile http://coenraets.org/blog/?p=3313">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Femployee-directory-sample-app-with-backbone-js-and-jquery-mobile%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
         <category>Uncategorized</category>
      </item>
      <item>
         <title>Using Backbone.js with jQuery Mobile</title>
         <link>http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=using-backbone-js-with-jquery-mobile</link>
         <description>Backbone.js is an architectural framework that helps you write well-structured Web applications. It is not, however, a user interface framework and it therefore doesn&amp;#8217;t help you with the way your application looks. Backbone’s confined scope is a good thing: it&amp;#8217;s lightweight, non-intrusive, not coupled to things you don&amp;#8217;t need, and it lets you use the [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Using Backbone.js with jQuery Mobile http://coenraets.org/blog/?p=3215"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Fusing-backbone-js-with-jquery-mobile%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3215</guid>
         <pubDate>Mon, 05 Mar 2012 15:58:11 +0000</pubDate>
         <content:encoded><![CDATA[<p>Backbone.js is an architectural framework that helps you write well-structured Web applications. It is not, however, a user interface framework and it therefore doesn&#8217;t help you with the way your application looks.</p>
<p>Backbone’s confined scope is a good thing: it&#8217;s lightweight, non-intrusive, not coupled to things you don&#8217;t need, and it lets you use the UI toolkit of your choice or simply roll your own styles and widgets. In my <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/02/sample-app-with-backbone-js-and-twitter-bootstrap/">previous post</a>, I demonstrated how to use Twitter Bootstrap on top of Backbone. </p>
<h5>Quest for a Mobile UI Toolkit</h5>
<p>After that post, I wanted to create a mobile version of the same application; a version that I could package with PhoneGap and that would look and behave like a native app. Twitter Bootstrap can probably be tweaked for that purpose as well, but I was looking for a UI toolkit dedicated to providing native looking controls and behaviors on mobile devices.<br />
<span id="more-3215"></span></p>
<h5>Another Way to Use jQuery Mobile</h5>
<p>jQuery Mobile (jQM) is one option that I’ve explored before (<a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2011/10/sample-application-with-jquery-mobile-and-phonegap/">here</a> and <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2011/11/jquery-mobile-getting-started-application/">here</a>), but it fits more in the category of full-stack frameworks that tie together architectural structure and UI controls and behaviors. <a rel="nofollow" target="_blank" href="http://johnbender.us/">John Bender</a>, my colleague at Adobe and member of the jQuery Mobile team, recently pointed out to me that you can disable the routing and navigation capabilities of jQM, and essentially use it as a pure UI framework on top of other architectural frameworks like Backbone.js.</p>
<h5>Sample Application</h5>
<p>I ended up spending a decent amount of time trying different things to get the two frameworks to play well together without stepping on each other. To save you some headaches if you are trying to do the same, I put together a simple application with the basic setup to combine Backbone (for the application structure and “routing”) and jQuery Mobile (for its styles and widgets).</p>
<p>NOTE: Another approach would be to use jQM’s “routing” instead of Backbone’s. Ben Nolan has an example of this approach <a rel="nofollow" target="_blank" href="http://bennolan.com/2010/11/24/backbone-jquery-demo.html">here</a>. I prefer to use Backbone’s routing because I find it more flexible and less “page-centric”.</p>
<p>Here is the app:</p>
<p></p> 
<p>Click <a rel="nofollow" target="_blank" href="http://coenraets.org/backbone/jquerymobile">here</a> to run the application in a separate window. The source code is available in <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-jquerymobile">this GitHub repository</a>.</p>
<h5>How it works</h5>
<p>The key to this approach is to disable jQuery Mobile&#8217;s &#8220;routing&#8221;: In other words, you need to tell jQuery Mobile not to handle links, hash tag changes, and so on. I isolated that code in jqm-config.js:</p>
<pre>
$(document).bind(&quot;mobileinit&quot;, function () {
    $.mobile.ajaxEnabled = false;
    $.mobile.linkBindingEnabled = false;
    $.mobile.hashListeningEnabled = false;
    $.mobile.pushStateEnabled = false;
});
</pre>
<p>If jQuery Mobile is not in charge of page navigation, you also have to manually remove the pages from the DOM when they are not used anymore. Here is one way to do it: </p>
<pre>
$('div[data-role=&quot;page&quot;]').live('pagehide', function (event, ui) {
    $(event.currentTarget).remove();
});
</pre>
<p>With this configuration in place, you use Backbone&#8217;s routing as usual:</p>
<pre>
var AppRouter = Backbone.Router.extend({

    routes:{
        &quot;&quot;:&quot;home&quot;,
        &quot;page1&quot;:&quot;page1&quot;,
        &quot;page2&quot;:&quot;page2&quot;
    },

    home:function () {
        this.changePage(new HomeView());
    },

    page1:function () {
        this.changePage(new Page1View());
    },

    page2:function () {
        this.changePage(new Page2View());
    },

    changePage:function (page) {
        $(page.el).attr('data-role', 'page');
        page.render();
        $('body').append($(page.el));
        $.mobile.changePage($(page.el), {changeHash:false});
    }

});
</pre>
<h5>Is this the right stack?</h5>
<p>I like the idea of a lightweight architectural framework combined with a UI toolkit. Backbone + Twitter Bootstrap felt right because the two frameworks have different areas of concern and complement each other very well. I was happy to see you could decouple jQM from its navigation infrastructure. However, that&#8217;s probably not the main &#8220;design center&#8221; at this point. I think it would be interesting for jQM to focus on that utilization scenario as well. At the end of the day, frameworks are often a matter of personal preferences, and not all applications are equal. So try it, see if it works for you, and share your experience. What UI toolkit are you using?</p>
<h5>Source Code</h5>
<p>The source code is available in <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-jquerymobile">this repository</a> on GitHub.</p>
<h5>A More Real-Life Application</h5>
<p>In my next post, I&#8217;ll share a Backbone.js + jQuery Mobile version of the Employee Directory application first explored with Backbone.js + Twitter Bootstrap.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Using Backbone.js with jQuery Mobile http://coenraets.org/blog/?p=3215">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F03%2Fusing-backbone-js-with-jquery-mobile%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>Adobe’s Commitments to Flex – Official Whitepaper</title>
         <link>http://devgirl.org/2012/02/15/adobe-commitments-to-flex-whitepaper/</link>
         <description>There have been a lot of questions about the viability and future of Flex recently, and Adobe has published an official whitepaper today detailing their support for Flex going forward. The paper also contains details regarding Flash runtime support, Flash Builder support and other Apache contributions including the Falcon compiler. I believe the paper is [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3745</guid>
         <pubDate>Wed, 15 Feb 2012 23:58:55 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/02/flex.png"><img src="http://devgirl.org/wp-content/uploads/2012/02/flex.png" alt="" title="flex" width="191" height="100" class="aligncenter size-full wp-image-3750"/></a><br />
There have been a lot of questions about the viability and future of Flex recently, and Adobe has published an official whitepaper today detailing their support for Flex going forward. The paper also contains details regarding Flash runtime support, Flash Builder support and other Apache contributions including the Falcon compiler. I believe the paper is a must read and can be found <strong><a rel="nofollow" target="_blank" href=" http://www.adobe.com/go/flex_whitepaper">HERE</a>.</strong></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F02%2F15%2Fadobe-commitments-to-flex-whitepaper%2F&amp;title=Adobe%E2%80%99s%20Commitments%20to%20Flex%20%E2%80%93%20Official%20Whitepaper" id="wpa2a_10"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Sample App with Backbone.js and Twitter Bootstrap</title>
         <link>http://coenraets.org/blog/2012/02/sample-app-with-backbone-js-and-twitter-bootstrap/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=sample-app-with-backbone-js-and-twitter-bootstrap</link>
         <description>Backbone.js is a lightweight JavaScript framework that provides the basic infrastructure (Model, Collection, View, and Router classes) to bring structure to your Web applications. Twitter Bootstrap is a UI toolkit that provides simple and flexible HTML, CSS, and Javascript to implement popular user interface components and interactions. In other words, Backbone.js and Twitter Bootstrap focus [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Sample App with Backbone.js and Twitter Bootstrap http://coenraets.org/blog/?p=3125"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F02%2Fsample-app-with-backbone-js-and-twitter-bootstrap%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3125</guid>
         <pubDate>Mon, 13 Feb 2012 18:51:18 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://documentcloud.github.com/backbone/">Backbone.js</a> is a lightweight JavaScript framework that provides the basic infrastructure (Model, Collection, View, and Router classes) to bring structure to your Web applications. </p>
<p><a rel="nofollow" target="_blank" href="http://twitter.github.com/bootstrap/index.html">Twitter Bootstrap</a> is a UI toolkit that provides simple and flexible HTML, CSS, and Javascript to implement popular user interface components and interactions.   </p>
<p>In other words, Backbone.js and Twitter Bootstrap focus on different areas of your application: core architecture and user interface respectively. Because of their well-defined and non-overlapping scope, Backbone.js and Twitter Bootstrap work well together. In general, I find a lightweight architectural framework and a UI toolkit to be a powerful combination, and an interesting alternative to full-stack frameworks: it gives you the flexibility to choose the library you like (if any) in the respective areas of your application.</p>
<h4>The Sample Application</h4>
<p>To give this combination a try, I put together a new sample application that uses Backbone.js to organize the code, and Twitter Bootstrap to organize the UI. The application is an Employee Directory that allows you to look for employees by name, view the details of an employee, and navigate up and down the Org Chart by clicking the employee&#8217;s manager or any of his/her direct reports.</p>
<p>You can run the application <a rel="nofollow" target="_blank" href="http://coenraets.org/directory">here</a>.</p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/blog/wp-content/uploads/2012/02/directory1.gif"><img src="http://coenraets.org/blog/wp-content/uploads/2012/02/directory1.gif" alt="" title="directory1" width="640" height="526" class="aligncenter size-full wp-image-3197"/></a></p>
<p><a rel="nofollow" target="_blank" href="http://coenraets.org/blog/wp-content/uploads/2012/02/directory2.gif"><img src="http://coenraets.org/blog/wp-content/uploads/2012/02/directory2.gif" alt="" title="directory2" width="640" height="526" class="aligncenter size-full wp-image-3200"/></a><br />
<span id="more-3125"></span><br />
Backbone Directory is a single page application: index.html is essentially empty. Views are injected into and removed from the DOM as needed. Even though it is a single page application, the Backbone.js Router makes it easy to keep the different states of the app &#8220;bookmarkable&#8221; and &#8220;deep-linkable&#8221;.</p>
<h4>Twitter Bootstrap highlights</h4>
<p>&#8220;Backbone Directory&#8221; uses a number of the Twitter Bootstrap styles, components, and interactions: the 12-column grid with nested columns, a &#8220;Navbar&#8221;, a &#8220;Search Form&#8221; with dropdown,  the dropdown plugin, the Glyphicons icons, Info and Warning alerts, a &#8220;Well&#8221;, etc.</p>
<h4>Backbone.js highlights</h4>
<p>If you are new to Backbone.js, you may want to start with the tutorial (<a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-1-getting-started/">part 1</a>, <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-2-crud/">part 2</a>, <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-3-deep-linking-and-application-states/">part 3</a>, and <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/01/backbone-js-lessons-learned-and-improved-sample-app/">postface</a>) I blogged recently. &#8220;Backbone Directory&#8221; includes some interesting elements not covered in the tutorial:</p>
<ul>
<li><strong>One-to-Many association.</strong> A one-to-many (Manager-to-Employees) association is defined in the Employee model (model/employeemodel.js) as a collection of employees (the direct reports). That collection is lazily fetched in the render() function of EmployeeFullView (view/employeedetails.js).</li>
<li><strong>Composite View.</strong> EmployeeFullView (views/employeedetails.js) is an example of a composite view. Its render() function instantiates two subviews: EmployeeView and EmployeeListView (to display the employee&#8217;s direct reports).
</ul>
<h4>Source Code</h4>
<p>The source code is available in <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-directory">this repository</a> on GitHub.</p>
<p>Your feedback and comments are appreciated.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Sample App with Backbone.js and Twitter Bootstrap http://coenraets.org/blog/?p=3125">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F02%2Fsample-app-with-backbone-js-and-twitter-bootstrap%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>Sample Mobile App with Backbone.js, PhoneGap, and a Local Database</title>
         <link>http://coenraets.org/blog/2012/02/sample-mobile-app-with-backbone-js-phonegap-and-a-local-database/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=sample-mobile-app-with-backbone-js-phonegap-and-a-local-database</link>
         <description>In my previous post, I shared a simple Wine Cellar application built with Backbone.js and packaged as a mobile app with PhoneGap. That version of the application gets its data from a set of RESTful services, which means that you can only use it while online. In this post, we explore an offline version of [...]
	

&lt;a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Sample Mobile App with Backbone.js, PhoneGap, and a Local Database http://coenraets.org/blog/?p=3044"&gt;Retweet this&lt;/a&gt;


	
	

&lt;a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F02%2Fsample-mobile-app-with-backbone-js-phonegap-and-a-local-database%2F"&gt;Share on Facebook&lt;/a&gt;




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</description>
         <guid isPermaLink="false">http://coenraets.org/blog/?p=3044</guid>
         <pubDate>Tue, 07 Feb 2012 16:29:39 +0000</pubDate>
         <content:encoded><![CDATA[<p>In my <a rel="nofollow" target="_blank" href="http://coenraets.org/blog/2012/02/sample-mobile-app-with-backbone-js-and-phonegap/">previous post</a>, I shared a simple Wine Cellar application built with <a rel="nofollow" target="_blank" href="http://documentcloud.github.com/backbone/">Backbone.js</a> and packaged as a mobile app with <a rel="nofollow" target="_blank" href="http://phonegap.com/">PhoneGap</a>. That version of the application gets its data from a set of RESTful services, which means that you can only use it while online.</p>
<p>In this post, we explore an offline version of the same application: this new version gets its data from your device&#8217;s local database using the PhoneGap SQL database API. </p>
<p>By default, Backbone.js Models access their data using RESTful services defined by the Models &#8220;url&#8221; and &#8220;urlRoot&#8221; attributes. But Backbone.js also makes it easy and elegant to change your Models data access mechanism: All you have to do is override the Backbone.sync method. From the Backbone.js <a rel="nofollow" target="_blank" href="http://documentcloud.github.com/backbone/#Sync">documentation</a>:</p>
<blockquote><p>Backbone.sync is the function that Backbone calls every time it attempts to read or save a model to the server. By default, it uses (jQuery/Zepto).ajax to make a RESTful JSON request. You can override it in order to use a different persistence strategy, such as WebSockets, XML transport, or Local Storage.</p></blockquote>
<p>The documentation includes a <a rel="nofollow" target="_blank" href="http://documentcloud.github.com/backbone/docs/backbone-localstorage.html">useful example</a> that shows how to replace the default Backbone.sync implementation with localStorage-based persistence where models are saved into JSON objects.  </p>
<p>In our application, we will replace the default Backbone.sync implementation with SQL-based persistence using the device&#8217;s local database.<br />
<span id="more-3044"></span><br />
First, we create a data access object that encapsulates the logic to read (find), create, update, and delete wines. This simple application is read-only and only needs to retrieve collections. So, I only implemented the findAll() method and stubbed the other methods (find, create, update, destroy). WineDAO also has a &#8220;populate&#8221; function to populate the wine table with sample data. </p>
<pre>
window.WineDAO = function (db) {
    this.db = db;
};

_.extend(window.WineDAO.prototype, {

    findAll:function (callback) {
        this.db.transaction(
            function (tx) {
                var sql = &quot;SELECT * FROM wine ORDER BY name&quot;;
                tx.executeSql(sql, [], function (tx, results) {
                    var len = results.rows.length;
                    var wines = [];
                    for (var i = 0; i &lt; len; i++) {
                        wines[i] = results.rows.item(i);
                    }
                    callback(wines);
                });
            },
            function (tx, error) {
                alert(&quot;Transaction Error: &quot; + error);
            }
        );
    },

    create:function (model, callback) {
//        TODO: Implement
    },

    update:function (model, callback) {
//        TODO: Implement
    },

    destroy:function (model, callback) {
//        TODO: Implement
    },

    find:function (model, callback) {
//        TODO: Implement
    },

//  Populate Wine table with sample data
    populate:function (callback) {
        this.db.transaction(
            function (tx) {
                console.log('Dropping WINE table');
                tx.executeSql('DROP TABLE IF EXISTS wine');
                var sql =
                    &quot;CREATE TABLE IF NOT EXISTS wine ( &quot; +
                        &quot;id INTEGER PRIMARY KEY AUTOINCREMENT, &quot; +
                        &quot;name VARCHAR(50), &quot; +
                        &quot;year VARCHAR(50), &quot; +
                        &quot;grapes VARCHAR(50), &quot; +
                        &quot;country VARCHAR(50), &quot; +
                        &quot;region VARCHAR(50), &quot; +
                        &quot;description TEXT, &quot; +
                        &quot;picture VARCHAR(200))&quot;;
                console.log('Creating WINE table');
                tx.executeSql(sql);
                console.log('Inserting wines');
                tx.executeSql(&quot;INSERT INTO wine VALUES (1,'CHATEAU DE SAINT COSME','2009','Grenache / Syrah','France','Southern Rhone / Gigondas','The aromas of fruit and spice give one a hint of the light drinkability of this lovely wine, which makes an excellent complement to fish dishes.','saint_cosme.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (2,'LAN RIOJA CRIANZA','2006','Tempranillo','Spain','Rioja','A resurgence of interest in boutique vineyards has opened the door for this excellent foray into the dessert wine market. Light and bouncy, with a hint of black truffle, this wine will not fail to tickle the taste buds.','lan_rioja.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (3,'MARGERUM SYBARITE','2010','Sauvignon Blanc','USA','California Central Cosat','The cache of a fine Cabernet in ones wine cellar can now be replaced with a childishly playful wine bubbling over with tempting tastes of black cherry and licorice. This is a taste sure to transport you back in time.','margerum.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (4,'OWEN ROE &#92;&quot;EX UMBRIS&#92;&quot;','2009','Syrah','USA','Washington','A one-two punch of black pepper and jalapeno will send your senses reeling, as the orange essence snaps you back to reality. Do not miss this award-winning taste sensation.','ex_umbris.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (5,'REX HILL','2009','Pinot Noir','USA','Oregon','One cannot doubt that this will be the wine served at the Hollywood award shows, because it has undeniable star power. Be the first to catch the debut that everyone will be talking about tomorrow.','rex_hill.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (6,'VITICCIO CLASSICO RISERVA','2007','Sangiovese Merlot','Italy','Tuscany','Though soft and rounded in texture, the body of this wine is full and rich and oh-so-appealing. This delivery is even more impressive when one takes note of the tender tannins that leave the taste buds wholly satisfied.','viticcio.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (7,'CHATEAU LE DOYENNE','2005','Merlot','France','Bordeaux','Though dense and chewy, this wine does not overpower with its finely balanced depth and structure. It is a truly luxurious experience for the senses.','le_doyenne.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (8,'DOMAINE DU BOUSCAT','2009','Merlot','France','Bordeaux','The light golden color of this wine belies the bright flavor it holds. A true summer wine, it begs for a picnic lunch in a sun-soaked vineyard.','bouscat.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (9,'BLOCK NINE','2009','Pinot Noir','USA','California','With hints of ginger and spice, this wine makes an excellent complement to light appetizer and dessert fare for a holiday gathering.','block_nine.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (10,'DOMAINE SERENE','2007','Pinot Noir','USA','Oregon','Though subtle in its complexities, this wine is sure to please a wide range of enthusiasts. Notes of pomegranate will delight as the nutty finish completes the picture of a fine sipping experience.','domaine_serene.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (11,'BODEGA LURTON','2011','Pinot Gris','Argentina','Mendoza','Solid notes of black currant blended with a light citrus make this wine an easy pour for varied palates.','bodega_lurton.jpg')&quot;);
                tx.executeSql(&quot;INSERT INTO wine VALUES (12,'LES MORIZOTTES','2009','Chardonnay','France','Burgundy','Breaking the mold of the classics, this offering will surprise and undoubtedly get tongues wagging with the hints of coffee and tobacco in perfect alignment with more traditional notes. Breaking the mold of the classics, this offering will surprise and undoubtedly get tongues wagging with the hints of coffee and tobacco in perfect alignment with more traditional notes. Sure to please the late-night crowd with the slight jolt of adrenaline it brings.','morizottes.jpg')&quot;);
            },
            function (tx, error) {
                alert('Transaction error ' + error);
            },
            function (tx) {
                callback();
            }
        );
    }
});
</pre>
<p>I then added a &#8220;dao&#8221; attribute to the Models to specify which data object should be used to access their underlying data.</p>
<pre>
window.Wine = Backbone.Model.extend({
	urlRoot: &quot;http://coenraets.org/backbone-cellar/part1/api/wines&quot;,
    dao: WineDAO
});

window.WineCollection = Backbone.Collection.extend({
	model: Wine,
	url: &quot;http://coenraets.org/backbone-cellar/part1/api/wines&quot;,
    dao: WineDAO
});
</pre>
<p>NOTE: The application doesn&#8217;t need the url and urlRoot attributes anymore, but you can imagine a more sophisticated version of the app that would work with the RESTful services while online and fall back to the local database while offline. </p>
<p>With that infrastructure in place, we can now override Backbone.sync as follows:</p>
<pre>
Backbone.sync = function (method, model, options) {

    var dao = new model.dao(window.db);

    switch (method) {
        case &quot;read&quot;:
            if (model.id)
                dao.find(model, function (data) {
                    options.success(data);
                });
            else
                dao.findAll(function (data) {
                    options.success(data);
                });
            break;
        case &quot;create&quot;:
            dao.create(model, function (data) {
                options.success(data);
            });
            break;
        case &quot;update&quot;:
            dao.update(model, function (data) {
                options.success(data);
            });
            break;
        case &quot;delete&quot;:
            dao.destroy(model, function (data) {
                options.success(data);
            });
            break;
    }

};
</pre>
<p>And finally, we need to open the database (and populate it with sample data) at startup:</p>
<pre>
window.startApp = function () {
    var self = this;
    window.db = window.openDatabase(&quot;WineCellar&quot;, &quot;1.0&quot;, &quot;WineCellar Demo DB&quot;, 200000);
    var wineDAO = new WineDAO(self.db);
    wineDAO.populate(function () {
        this.templateLoader.load(['wine-list', 'wine-details', 'wine-list-item'], function () {
            self.app = new AppRouter();
            Backbone.history.start();
        });
    })
}
</pre>
<h4>Download</h4>
<p>I added this version of the application to the backbone-cellar GitHub repository <a rel="nofollow" target="_blank" href="https://github.com/ccoenraets/backbone-cellar/tree/master/mobile/offline">here</a>. </p>
<p>NOTE: You will have to create a PhoneGap project (see <a rel="nofollow" target="_blank" href="http://phonegap.com/start">documentation</a> here) or use the <a rel="nofollow" target="_blank" href="https://build.phonegap.com/">hosted build service</a> to package the code as a native app for different mobile platforms.</p>

	

<a rel="nofollow" target="_blank" href="http://twitter.com/?status=RT @ Sample Mobile App with Backbone.js, PhoneGap, and a Local Database http://coenraets.org/blog/?p=3044">Retweet this</a>


	
	

<a rel="nofollow" target="_blank" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fcoenraets.org%2Fblog%2F2012%2F02%2Fsample-mobile-app-with-backbone-js-phonegap-and-a-local-database%2F">Share on Facebook</a>




Follow @ccoenraets
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");]]></content:encoded>
      </item>
      <item>
         <title>Apache Flex and the community</title>
         <link>http://www.riagora.com/2012/01/apache-flex-and-the-community/</link>
         <description>Flex is now an Apache project in incubation (as PhoneGap under the name &amp;#8216;Cordova&amp;#8217;). The community is hyper-active and it&amp;#8217;s not a surprise. If you look at what the community has achieved around Flex since its creation, you&amp;#8217;ll directly understand why Apache Flex will be successful. Macromedia, and then Adobe, defined Flex&amp;#8217;s vision, launching and [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=921</guid>
         <pubDate>Mon, 23 Jan 2012 15:18:45 +0000</pubDate>
         <content:encoded><![CDATA[<p>Flex is now an Apache project in incubation <em>(as PhoneGap under the name &#8216;Cordova&#8217;)</em>. The community is hyper-active and it&#8217;s not a surprise. If you look at what the community has achieved around Flex since its creation, you&#8217;ll directly understand why Apache Flex will be successful. Macromedia, and then Adobe, defined Flex&#8217;s vision, launching and promoting the concept of Rich Internet Applications. Basically, this trend promotes the development of &#8220;software-like&#8221; interfaces in web browsers. RIA can answer large organizations needs who want to migrate legacy client-server applications to a modern web architecture. That&#8217;s why the Flex community is so unique and developed very specific and valuable skills. In my opinion, the only serious competitor on that market is/was Microsoft with SilverLight: great technology combined with a huge community of software developers (VB, .Net, C++&#8230;). They even introduced the concept <em>(or the utopia)</em> or a seamless workflow between designers and developers with Blend. I guess that this healthy competition boosted the Spark architecture in Flex 4 <em>(and the birth of Flash Catalyst)</em>. JavaFX by Sun <em>(and then Oracle)</em> is also trying to embrace this market.</p>
<p>But today, the Flex community is by far the strongest one on the RIA market and it&#8217;s not only due to Adobe. Flex is still the first-choice to build RIA because it&#8217;s consistent and because&#8230; it works. You should all read <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="https://plus.google.com/109047477151984864676/posts/CVGJKLMMehs"><span style="color:#3366ff;">this fantastic article by Joao</span></a></span> <em>(RIA expert in Portugal)</em>. It&#8217;s also due to the fact that a lot of Flex developers were coming from various technical backgrounds: Java (mainly), PHP, AS3, .NET&#8230; And they tried to bring and translate their knowledge investing in areas not covered by Adobe&#8217;s engineers: data-visualization, backend integration, continuous integration, micro-architectures&#8230; As a tribute, I just wanted to summarize on one graph <em>(inspired by Michell Zappa)</em> some compelling projects developed by the community around Flex. All these projects are used by large organizations in strategic Enterprise applications. All these talents can now become official Flex contributors thanks to the Apache foundation. Flex is successful thanks to this constellation of talents, not thanks to Adobe.</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2012/01/flexCommunity.png"><img class="alignnone  wp-image-923" title="flexCommunity" src="http://www.riagora.com/wp-content/uploads/2012/01/flexCommunity.png" alt="" width="570"/></a></p>
<p>Some projects are of course missing, I&#8217;m sorry for that, it&#8217;s not an exhaustive list; but this graph expresses all the efforts made by the community to make Flex a successful framework in a professional Enterprise environment. Just a few projects, such as BlazeDS, were initiated by Adobe on this map. Flex has been successful in the past thanks to the involvement of its vibrant community of talented developers&#8230; why would it change?  If you want to follow the Apache Flex project and get involved, check this page: <a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/">http://incubator.apache.org/flex/</a></p>
<p><em>Thanks to all the folks who helped me build this list on Google Docs.</em></p>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2012/01/apache-flex-and-the-community/&text=Apache+Flex+and+the+community&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Flex Mobile Development – Dynamic Splash Screens</title>
         <link>http://devgirl.org/2012/01/20/flex-mobile-development-dynamic-splash-screens/</link>
         <description>Flash Builder 4.6 includes a new feature to allow you to add a dynamic splash screen component to your mobile application. This feature will allow you to load a different image based on a few different properties you can set to ensure you get the best image for the right device. The properties you can [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3635</guid>
         <pubDate>Fri, 20 Jan 2012 17:14:11 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder">Flash Builder 4.6</a> includes a new feature to allow you to add a dynamic splash screen component to your mobile application. This feature will allow you to load a different image based on a few different properties you can set to ensure you get the best image for the right device. The properties you can use to determine which image is displayed for the splash screen are:</p>
<p><em><strong>dpi<br />
minResolution<br />
aspectRatio</strong></em></p>
<p>You can combine these attributes as well to get the best possible image selected. It&#8217;s very easy to implement, you simple create an MXML component based on the <strong>SplashScreenImage</strong> property and include as many <strong>SplashScreenImageSource</strong> objects to cover the number of situations needed. For example, in the following code I&#8217;m setting different images depending on both<em> <strong>dpi</strong></em> and <em><strong>aspectRatio</strong></em> properties. Note that this example makes an assumption about tablets generally being 160 DPI (thus needing the bigger image), the 320 DPI being the iPhone 4 and above and most android phones at 240 and setting the image based on that. It also assumes that I want to use the landscape version of the image when the <em><strong>aspectRatio</strong></em> happens to be landscape on startup. You could also use the <em><strong>minResolution</strong></em> to further ensure that the 160 DPI is indeed a tablet etc and that will cause the the stage width and stage height to be compared on startup to find the largest number of the two. If it&#8217;s equal to or greater than your <em><strong>minResolution</strong></em> setting, it will select that image for the splash screen. </p>
<p><strong>DynamicSplashScreen.mxml</strong></p>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:SplashScreenImage xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot; xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;&gt;
	&lt;s:SplashScreenImageSource dpi=&quot;160&quot; aspectRatio=&quot;portrait&quot; source=&quot;@Embed('assets/texas-768x1024.jpg')&quot;/&gt;
	&lt;s:SplashScreenImageSource dpi=&quot;240&quot; aspectRatio=&quot;portrait&quot; source=&quot;@Embed('assets/texas-480x810.jpg')&quot;/&gt;
	&lt;s:SplashScreenImageSource dpi=&quot;320&quot; aspectRatio=&quot;portrait&quot; source=&quot;@Embed('assets/texas-640x960.jpg')&quot;/&gt;
        &lt;s:SplashScreenImageSource dpi=&quot;160&quot; aspectRatio=&quot;landscape&quot; source=&quot;@Embed('assets/texas-1024x768.jpg')&quot;/&gt;
	&lt;s:SplashScreenImageSource dpi=&quot;240&quot; aspectRatio=&quot;landscape&quot; source=&quot;@Embed('assets/texas-810x480.jpg')&quot;/&gt;
	&lt;s:SplashScreenImageSource dpi=&quot;320&quot; aspectRatio=&quot;landscape&quot; source=&quot;@Embed('assets/texas-960x640.jpg')&quot;/&gt;
&gt;/s:SplashScreenImage&gt;
</pre>
<p>Now in your main application root, you simply specify the name of your component defined above in the <em><strong>splashScreenImage</strong></em> property as follows:</p>
<pre>
&lt;s:ViewNavigatorApplication xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
							xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
							firstView=&quot;views.FrontView&quot;
							splashScreenImage=&quot;DynamicSplashScreen&quot;&gt;
...
&lt;/s:ViewNavigatorApplication&gt;
</pre>
<div align="center"><strong>Portrait Splash</strong></div>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/01/portraitSplash1.png"><img src="http://devgirl.org/wp-content/uploads/2012/01/portraitSplash1-225x300.png" alt="" title="portraitSplash" width="225" height="300" class="aligncenter size-medium wp-image-3741"/></a></p>
<div align="center"><strong>Landscape Splash</strong></div>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/01/landscapeSplash1.png"><img src="http://devgirl.org/wp-content/uploads/2012/01/landscapeSplash1-300x225.png" alt="" title="landscapeSplash" width="300" height="225" class="aligncenter size-medium wp-image-3742"/></a></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F01%2F20%2Fflex-mobile-development-dynamic-splash-screens%2F&amp;title=Flex%20Mobile%20Development%20%E2%80%93%20Dynamic%20Splash%20Screens" id="wpa2a_12"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Apache Flex Update!</title>
         <link>http://devgirl.org/2012/01/19/apache-flex-update/</link>
         <description>It&amp;#8217;s been quite the roller coaster in the Flex world these past few months to say the least! Now seemed like a good time for an update on the latest status of things. Adobe Flex to Apache Flex Adobe Flex is now Apache Flex (in case you&amp;#8217;ve been under a rock lately or perhaps just [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3645</guid>
         <pubDate>Thu, 19 Jan 2012 15:24:39 +0000</pubDate>
         <content:encoded><![CDATA[<p>It&#8217;s been quite the roller coaster in the Flex world these past few months to say the least! Now seemed like a good time for an update on the latest status of things. </p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2012/01/Flexicon1.png"><img src="http://devgirl.org/wp-content/uploads/2012/01/Flexicon1.png" alt="" title="Flexicon" width="256" height="256" class="aligncenter size-full wp-image-3711"/></a></p>
<p><a rel="nofollow" target="_blank" href="http://www.apache.org"><img src="http://devgirl.org/wp-content/uploads/2012/01/asf_logo_wide.gif" alt="" title="Apache Software Foundation" width="537" height="51" class="aligncenter size-full wp-image-3662"/></a></p>
<p><strong>Adobe Flex to Apache Flex</strong><br />
Adobe Flex is now <a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/">Apache Flex</a> (in case you&#8217;ve been under a rock lately or perhaps just discovered Flex <img src='http://devgirl.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley'/> ). It&#8217;s been contributed to the Apache community and is in <a rel="nofollow" target="_blank" href="http://incubator.apache.org/projects/">incubator status</a>. Incubator status is a holding place for a new Apache project and basically a gateway to it becoming a full-fledged project after a release or two. It was great news that it was accepted recently and I have no doubt it will quickly move out of this stage into a full-fledged project. The project has an amazing amount of traction so far, and it&#8217;s awesome to see all the activity! If you want to stay on top of the latest, <a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/mailing-lists.html">subscribe to the mailing list here</a>, (note that your inbox will be flooded so you might want to use a separate email to track it, it&#8217;s a high traffic mailing list <img src='http://devgirl.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> ). There are a bunch of extremely talented, well-known developers behind this project as well, which is huge and makes all the difference, in my opinion. <a rel="nofollow" target="_blank" href="http://www.spoon.as/">The Open Spoon Foundation</a> is also actively behind this project and if you aren&#8217;t aware of it, definitely make a point of checking it out. I attended the Flex Summit in December and learned a lot about the Apache process from <a rel="nofollow" target="_blank" href="http://roy.gbiv.com/">Roy Fielding</a> (Apache Co-Founder), with the biggest takeaway being that Apache projects are run as a <a rel="nofollow" target="_blank" href="http://www.merriam-webster.com/dictionary/meritocracy">meritocracy</a>, so there is equal opportunity amongst all and that contributions of any kind, including code, bug fixes and documentation are <a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/get-involved.html">welcome</a>.</p>
<p><strong>The State of Things&#8230;</strong><br />
So the big question everyone has been asking us, should we continue to build apps with Flex? I think the general consensus to be made is yes. There&#8217;s still a viable need for this technology and with the dedication and energy of the community so far I feel very positive about things. As I&#8217;ve stated before and will continue to state, as a developer you shouldn&#8217;t put all of your eggs in any one basket, and should be learning the latest technologies along with continuing your Flex development to ensure your relevance and development diversity, but Flex remains an excellent choice for the right type of application. </p>
<p>Here are some related links you should check out that I found very useful as a meter for what other great developers are thinking and doing:</p>
<p><a rel="nofollow" target="_blank" href="http://inflagrantedelicto.memoryspiral.com/2012/01/questioning-the-viability-of-flex/">Joseph Labrecque &#8211; Questioning the viability of Flex</a><br />
<a rel="nofollow" target="_blank" href="https://plus.google.com/109047477151984864676/posts/CVGJKLMMehs">Joao Saleiro &#8211; After 6 years doing Flex, am I moving to HTML5? </a><br />
<a rel="nofollow" target="_blank" href="http://www.theflexshow.com/blog/index.cfm/2012/1/11/Open-Discussion-w-Joseph-Labrecque-and-Mark-Ehlert-The-Flex-Show-Episode-159">The Flex Show &#8211; Discussing the Future of Flex with Joseph Labrecque and Mark Ehlert</a></p>
<p><strong>Hot Topics&#8230;</strong><br />
One big topic on the mailing list right now centers around a new logo for Apache Flex. The community held a contest (over 50 entries submitted!) and the submissions can be found <a rel="nofollow" target="_blank" href="http://dl.dropbox.com/u/715349/tmp/flex-logos.html">here</a>. The contest ended yesterday and now the voting process has begun. To vote you will need to start by subscribing to the mailing list. Once subscribed you can cast your votes with a point system defined in the mailing list. There are also some excellent summaries of what&#8217;s going on with the project being posted to this <a rel="nofollow" target="_blank" href="http://blog.teotigraphix.com/">blog by Michael Schmalle </a> (a current contributor). I would definitely make a point to skim those summaries to get a quick read on the status of things since it can be hard to keep up with the mailing list.  </p>
<p>The following links are also useful to check out for more info:<br />
<a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/">The Flex Incubator Project</a><br />
<a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/team.html">Contributors</a><br />
<a rel="nofollow" target="_blank" href="https://issues.apache.org/jira/browse/">JIRA Bug Tracking</a><br />
<a rel="nofollow" target="_blank" href="http://incubator.apache.org/projects/flex">Flex Incubator Status Page</a><br />
<a rel="nofollow" target="_blank" href="http://wiki.apache.org/incubator/FlexProposal">The initial proposal from Adobe</a><br />
<a rel="nofollow" target="_blank" href="http://incubator.apache.org/flex/get-involved.html">Getting Involved</a></p>
<p><strong>This Blog&#8230; </strong><br />
As far as me and my evangelism are concerned, I plan to continue to use Flex and blog about it as I have been. The <a rel="nofollow" target="_blank" href="http://blogs.adobe.com/flex/2012/01/announcing-flex-user-group-2012-tour-north-america-dates.html">2012 Flex User Group Tour</a> is about to start and my team will be visiting many locations over the next couple of months where we&#8217;ll discuss all the recent activity and announcements and talk about the latest 4.6 release. You can also plan on seeing some posts on other technologies as I&#8217;m exploring them myself. I will make a point of comparing them to Flex as I go along where possible. I&#8217;m also really looking forward to seeing what Adobe has in store this year to help utilize these other technologies like HTML5, JavaScript/jQuery etc and already excited by what I&#8217;ve heard! I will post information on these topics as I&#8217;m allowed <img src='http://devgirl.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley'/> . </p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2012%2F01%2F19%2Fapache-flex-update%2F&amp;title=Apache%20Flex%20Update%21" id="wpa2a_14"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Flex mobile and music apps</title>
         <link>http://www.riagora.com/2012/01/flex-mobile-and-music-apps/</link>
         <description>Flash (and then Flex) has always been the first choice technology for streaming audio content. I had the chance to work on a very cool mobile application for Radio X-Track. In this article, I&amp;#8217;ll showcase this mobile app and share with you some tips on developping this type of application. As I was developing the [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=906</guid>
         <pubDate>Thu, 19 Jan 2012 13:34:12 +0000</pubDate>
         <content:encoded><![CDATA[<p>Flash <em>(and then Flex)</em> has always been the first choice technology for streaming audio content. I had the chance to work on a very cool mobile application for Radio X-Track. In this article, I&#8217;ll showcase this mobile app and share with you some tips on developping this type of application. As I was developing the Radio X-Track mobile apps, <a rel="nofollow" target="_blank" href="http://www.ckti.com/">Christophe Keromen</a> presented to me another Flex mobile app developed for Mioozic, which I&#8217;ll also cover in this article. Lastly, I&#8217;ll end by presenting a very cool Flex mobile app named &#8220;What&#8217;s that track?&#8221;, a multiplayer music quiz game.</p>
<h2>Radio X-Track</h2>
<h3>UI considerations</h3>
<p>Radio X-Track is a great project led by true music lovers. DJs, painters, actresses and sound designers work together to publish creative playlists of music, covering various styles and  stimulating your eyes with massive paintings. The web radio is also a place for networking with music lovers. Once logged-in with your Facebook account, you can start chatting directly on the website. This arty space is directed by X-Track, a famous sound design studio in France. You can visit the web radio here: <a rel="nofollow" target="_blank" href="http://radio.x-track.net/EN/">http://radio.x-track.net/EN/</a></p>
<p>The development of the mobile application was challenging as the web radio is a Flash application connected to FMS. Thanks to the recent updates of Adobe AIR, I&#8217;ve been able to use Flex to stream the playlists on smartphones and tablets. First, I&#8217;ve decided to use <a rel="nofollow" target="_blank" href="http://www.riagora.com/2011/06/adaptive-ui-mobile-vs-tablet/">my adaptive layout technique</a> to code one UI and target both mobile and tablet screens. Here is a video that explains the trick. I&#8217;m playing with two view navigators that dynamically adapt their dimensions and their coordinates at runtime, depending on the screen resolution and the screen orientation.</p>
<p></p> 
<p>That&#8217;s why on Android, you have a very simple user experience. The first view is the list of DJs, the second view displays a scrollable picture, streams the playlist and displays the title of the song.</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2012/01/androidRadioXtrack.jpg"><img class="alignnone size-full wp-image-910" title="androidRadioXtrack" src="http://www.riagora.com/wp-content/uploads/2012/01/androidRadioXtrack.jpg" alt="" width="570" height="259"/></a></p>
<p><em><strong>Here is the link to the Android application:</strong></em></p>
<p><a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.com.riagora.Xtrack">https://market.android.com/details?id=air.com.riagora.Xtrack</a></p>
<p>With Flex, you code one project and then can publish it on both Android and iOS. So I submitted this application to Apple.</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2012/01/iphoneRadioXtrac.jpg"><img class="alignleft size-full wp-image-911" title="iphoneRadioXtrack" src="http://www.riagora.com/wp-content/uploads/2012/01/iphoneRadioXtrac.jpg" alt="" width="257" height="300"/></a>The App Store reviewers rejected the initial application for UI reasons. They told me that displaying a list and then a view could be done in the browser, and that it doesn&#8217;t justify the development of an application. They wanted me to develop the application using HTML5&#8230; well&#8230; live audio&#8230; html5&#8230; I had to consider a new strategy and worked on a totally different UI. I started studying the UI patterns of approved radio application and ended up with a new user experience. I&#8217;ve also added some features such as a twitter feed and the biographies of the artists. The application has been directly approved by Apple and is now available for iPhone and iPad users.</p>
<p><em><strong>Here is the link to the iOS application:</strong></em></p>
<p><a rel="nofollow" target="_blank" href="http://itunes.apple.com/fr/app/radio-x-track/id467964868?mt=8">http://itunes.apple.com/fr/app/radio-x-track/id467964868?mt=8</a></p>
<p>&nbsp;</p>
<h3>Some technical tips to manage audio content</h3>
<p>As the music is streamed by FMS, you can use the classic NetConnection and NetStream object of the Flash API. When the user wants to hear another playlist, I kill the current NetStream object and create a new one<em> (I keep in memory the NetConnection instance)</em>. FMS fires a RTMP message every time a new song is streamed. The client catches the message and displays the title of the song on the screen. The main challenge was to mimic the behavior of the iPod. If you shutdown the screen of your iPhone, or if you switch to another application, the radio is still supposed to stream audio. AIR 3 introduced a new feature to enable this behavior. At the end of the application descriptor of your Flex mobile application, you have a dedicated section for iPhone settings. You can set iOS keys such as <strong>UIApplicationExistsOnSuspend</strong>. All the iOS settings for Adobe AIR are <a rel="nofollow" target="_blank" href="http://help.adobe.com/en_US/air/build/WSfffb011ac560372f7e64a7f12cd2dd1867-8000.html">listed on this page</a>. In this case, I&#8217;m setting the UIBackgroundModes key to audio.</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_1" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_1" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display:block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;iPhone<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;InfoAdditions<span class="re2">&gt;</span></span></span><span class="sc2">&lt;![CDATA[</span>
<span class="sc2">			&lt;key&gt;UIDeviceFamily&lt;/key&gt;</span>
<span class="sc2">			&lt;array&gt;</span>
<span class="sc2">				&lt;string&gt;1&lt;/string&gt;</span>
&nbsp;
<span class="sc2">			&lt;/array&gt;</span>
<span class="sc2">			&lt;key&gt;UIBackgroundModes&lt;/key&gt;</span>
<span class="sc2">			&lt;array&gt;</span>
<span class="sc2">				&lt;string&gt;audio&lt;/string&gt;</span>
<span class="sc2">			&lt;/array&gt;</span>
<span class="sc2">		]]&gt;</span><span class="sc3"><span class="re1">&lt;/InfoAdditions<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;requestedDisplayResolution<span class="re2">&gt;</span></span></span>high<span class="sc3"><span class="re1">&lt;/requestedDisplayResolution<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/iPhone<span class="re2">&gt;</span></span></span></pre></div></div>
<p>Unfortunately, it won&#8217;t display the &#8220;play&#8221; icon in the status bar of iOS. I guess it would require the development of a native extension. Radio X-Track is a free application. Enjoy !</p>
<h2>Mioozic</h2>
<p>Mioozic is also a Flex mobile application available on both Android and iOS. You start by choosing a theme or a category, and it will start streaming music on your device. This Flex application has been developed by Christophe Keromen, the author of <a rel="nofollow" target="_blank" href="http://www.amazon.fr/Flex-4-5-pour-mobiles-multiplateformes/dp/2100567063/ref=ntt_at_ep_dpt_1">&#8220;Flex 4.5 for mobile devices&#8221;</a> (in French). It&#8217;s a great example of a high-performance Flex application running on smartphones.</p>
<p style="text-align:center;"><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2012/01/mioozic.jpg"><img class="size-full wp-image-913 aligncenter" title="mioozic" src="http://www.riagora.com/wp-content/uploads/2012/01/mioozic.jpg" alt="" width="530" height="300"/></a></p>
<p>Mioozic on Android : <a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.netrix.air.mioozic">https://market.android.com/details?id=air.netrix.air.mioozic</a></p>
<p>Mioozix on the app store: <a rel="nofollow" target="_blank" href="http://itunes.apple.com/fr/app/mioozic/id479503574?mt=8">http://itunes.apple.com/fr/app/mioozic/id479503574?mt=8</a></p>
<h2>What&#8217;s that track</h2>
<p>This game developed by Orange Labs and Deezer is also a very cool Flex mobile application. It&#8217;s a quiz game. You can play alone or with friends. The goal is very basic: hear a song, tap the screen if you think that you know the artist, and select the correct artist in a list of four. It&#8217;s a very cool game with a nice 70s UI. It&#8217;s already a popular app on Android (only). Have fun.</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2012/01/android-mioozic.jpg"><img class="alignnone size-full wp-image-915" title="android-mioozic" src="http://www.riagora.com/wp-content/uploads/2012/01/android-mioozic.jpg" alt="" width="530" height="300"/></a></p>
<p>What&#8217;s that track on Android: <a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.com.orange.labs.whatsthattrack&amp;hl=fr">https://market.android.com/details?id=air.com.orange.labs.whatsthattrack&amp;hl=fr</a></p>
<p>&nbsp;</p>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2012/01/flex-mobile-and-music-apps/&text=Flex+mobile+and+music+apps&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>GradleFx automated builds</title>
         <link>http://www.riagora.com/2011/12/gradlefx-automated-builds/</link>
         <description>I&amp;#8217;ve just attended the Flex summit, a great event with 40 members of the Flex community. It was the opportunity to brainstorm about future contributions and it went very well. Some members of the community already posted great articles about what have been said. You can read this remarkable article by Adam Flater, another one by [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=898</guid>
         <pubDate>Fri, 16 Dec 2011 01:02:43 +0000</pubDate>
         <content:encoded><![CDATA[<p>I&#8217;ve just attended the <span style="color:#0000ff;"><strong><a rel="nofollow" target="_blank" href="http://www.spoon.as/category/announcements/"><span style="color:#0000ff;">Flex summit</span></a></strong></span>, a great event with 40 members of the Flex community. It was the opportunity to brainstorm about future contributions and it went very well. Some members of the community already posted great articles about what have been said. You can read this <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://www.adamflater.net/2011/12/14/apache-flex-beginning/"><span style="color:#0000ff;">remarkable article</span></a></span> by Adam Flater, <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://www.peterelst.com/blog/2011/12/13/flex-summit-updates-on-the-open-source-strategy-and-runtimes/"><span style="color:#0000ff;">another one by Peter Elst</span></a></span>  and some <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://blog.nerdradio.com/tagged/Flex-Community-Summit"><span style="color:#0000ff;">great interviews on Nerd Radio</span></a></span>. I&#8217;m very confident in the future of Flex because of the level of maturity of our community, and also because it&#8217;s a passionate one. To showcase this excitement, I&#8217;m working on a graph that will express all the work already done by the community. I&#8217;m currently listing several major community projects in a Google Doc. If you want to review this document and add comments, <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="https://docs.google.com/document/d/1V8kP5eT22oK2Jwd2Zrn_vmcJ5MIoRB6vcxj-kfLSfnk/edit"><span style="color:#0000ff;">feel free to review this document</span></a></span>.</p>
<p><strong>We are looking for committers!!!</strong> If you want to participate in the success of Apache Flex, <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://blogs.adobe.com/flex/2011/12/call-for-committers.html"><span style="color:#0000ff;">check this blog post</span></a></span>. Yennick is one of these talented Flex developers who could become Apache Flex committers. He&#8217;s the project leader of GradleFx. I met him in Belgium during the Devoxx conference and he has been kind enough to accept an interview.</p>
<p><strong>&#8220;Hi Yennick, can you introduce yourself, your background and your relationship with Flex:&#8221;</strong></p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/12/2011new-058.jpeg"><img class="size-thumbnail wp-image-901 alignleft" style="border-color:initial;border-width:0px;margin:5px;" title="2011new-058" src="http://www.riagora.com/wp-content/uploads/2011/12/2011new-058-150x150.jpg" alt="" width="150" height="150"/></a>Hi, my name is Yennick Trevels and together with Steven Dick I started the GradleFx plugin. I work as a RIA Consultant at iDA MediaFoundry in Belgium where I do most of my projects in Java and Flex <em>(desktop, web, mobile, &#8230;)</em>.</p>
<p>I started out as a Java developer for 3 years, but soon found out that I wanted to focus on frontend development and that&#8217;s how I got started with Flex. Flex has been somewhat of a passion for me now because it allows me to create good looking applications with lots of custom components and there are still a lot of oppertunities to create libraries which make our lives easier.</p>
<p><strong>&#8220;GradleFx is a Gradle plugin. Can you explain us what Gradle is and who is using it today?&#8221;</strong></p>
<p>Gradle is a new build tool which combines the best features of Ant and Maven and leaves the bad things behind. It has dependency management, convention-over-configuration, multi-project support and lot&#8217;s of other cool features. Build scripts are written in Groovy where you have access to the Gradle API, which gives your build scripts a lot of flexibility.</p>
<p>Lots of plugins are already available for Gradle, like the Java plugin, Maven plugin, Eclipse &amp; Intellij plugins, Sonar plugin etc. These plugins make your build scripts a lot easier because most of the time the only thing you have to do is configure some variables. So build script in Gradle are shorter/easier and more flexible than Maven or Ant build scripts.</p>
<p>GradleFx uses these same principles because it&#8217;s a plugin for Gradle.</p>
<p><strong>&#8220;Then I guess that GradleFx is just an extension for building Flex applications. How does it work and what do I need to make it run?&#8221;</strong></p>
<p>GradleFx is indeed a plugin to build Flex applications.</p>
<p>First you&#8217;ll need to install the Gradle and Flex SDK, add the Gradle bin directory to your PATH environment variable and create a FLEX_HOME environment variable which points to your Flex SDK. Once you have these setup you can start to write your build script (in a build.gradle file). You don&#8217;t have to manually download GradleFx because it&#8217;s available on the Maven Central repository, so just specify it as a dependency for your build script and apply the plugin, that&#8217;s it.</p>
<p><strong>&#8220;What are the features that the GradleFx plugin adds to Gradle.&#8221;</strong></p>
<p>Right now the plugin has tasks to compile SWC, SWF and AIR projects, clean the build directory, copy your resources to the build directory, create an html wrapper and run FlexUnit tests.</p>
<p><strong>&#8220;Automated builds are more and more strategic in our industry and most of the Flex projects are industrialized. In your opinion, what are the key differentiators of GradleFx compared to Ant or Maven for instance?&#8221;</strong></p>
<p>Because GradleFx uses convention-over-configuration and builds scripts are written in Groovy your average build script will be a lot shorter and easier to read.</p>
<p>Another big advantage is the flexibility that Groovy offers, if you need to perform some custom functionality that isn&#8217;t available yet in any plugin then it&#8217;s much easier to write this yourself compared to Ant or Maven. Simple tasks like copying some files can be added in just a few lines of code.</p>
<p>GradleFx can use Ivy or Maven repositories to get its dependencies so you don&#8217;t need a separate repository for your existing Maven or Ant based build scripts.</p>
<p><strong>&#8220;Can you share with us a sample to manage several project and comment the code?&#8221;</strong></p>
<p>Ok, I&#8217;ll show you an example of a multi-project build which uses all the conventions provided by GradleFx.</p>
<p>This is the build script of the parent project and these settings are used by all sub-projects. This project doesn&#8217;t compile to a SWC or SWF.</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_2" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_2" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display:block;"><pre class="groovy" style="font-family:monospace;"><span class="co1">//specify the GradleFx plugin as a dependency for this build script. Maven Central will be used to get it.</span>
buildscript <span class="br0">&#123;</span>
	repositories <span class="br0">&#123;</span>
		mavenCentral<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#125;</span>
	dependencies <span class="br0">&#123;</span>
		classpath group: <span class="st0">'org.gradlefx'</span>, name: <span class="st0">'gradlefx'</span>, version: <span class="st0">'0.3.2'</span>
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co1">//specify settings common to all subprojects</span>
subprojects <span class="br0">&#123;</span>
&nbsp;
	<span class="co1">//apply the GradleFx plugin to this project</span>
	apply plugin: <span class="st0">'gradlefx'</span>
&nbsp;
	version <span class="sy0">=</span> <span class="st0">'1.0-SNAPSHOT'</span>
&nbsp;
	<span class="co1">//define the repositories from which the project dependencies</span>
	<span class="co1">//should be downloaded</span>
    	repositories <span class="br0">&#123;</span>
        		mavenCentral<span class="br0">&#40;</span><span class="br0">&#41;</span>
        		mavenRepo name: <span class="st0">'yoolab-releases'</span>,      url: <span class="st0">&quot;http://projects.yoolab.org/maven/content/repositories/releases&quot;</span>
        		mavenRepo name: <span class="st0">'yoolab-snapshots'</span>,     url: <span class="st0">&quot;http://projects.yoolab.org/maven/content/repositories/snapshots&quot;</span>
    	<span class="br0">&#125;</span>
&nbsp;
	<span class="co1">// specify the project dependencies. Notice the 'external' marker,</span>
	<span class="co1">// which means that the library will not be compiled in the</span>
	<span class="co1">// swc of the subprojects</span>
   	dependencies <span class="br0">&#123;</span>
        		external group: <span class="st0">'org.as3commons'</span>, name: <span class="st0">'as3commons-collections'</span>,
			version: <span class="st0">'1.1'</span>, ext: <span class="st0">'swc'</span>
        		external group: <span class="st0">'org.as3commons'</span>, name: <span class="st0">'as3commons-lang'</span>,
			version: <span class="st0">'0.3.2'</span>, ext: <span class="st0">'swc'</span>
    	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>Then we have the build script of a library subproject which will compile to a SWC.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_3" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_3" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display:block;"><pre class="groovy" style="font-family:monospace;"><span class="co1">//specify the type of flex project</span>
type <span class="sy0">=</span> <span class="st0">'swc'</span>
&nbsp;
dependencies <span class="br0">&#123;</span>
	<span class="co1">// specifies a dependency to another subproject. This will compile</span>
	<span class="co1">// the other project before compiling this one and use its</span>
	<span class="co1">// compiled SWC in this project.</span>
	external project<span class="br0">&#40;</span><span class="st0">':util'</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>And finally we have the build script of the application project which compiles to a SWF.</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_4" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_4" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display:block;"><pre class="groovy" style="font-family:monospace;"><span class="co1">//specify the type of flex project</span>
type <span class="sy0">=</span> <span class="st0">'swf'</span>
&nbsp;
dependencies <span class="br0">&#123;</span>
	<span class="co1">// specify two dependencies to library projects. These will be compiled</span>
	<span class="co1">// into the SWF file since they belong to the &quot;merged&quot; configuration.</span>
	merged project<span class="br0">&#40;</span><span class="st0">':util'</span><span class="br0">&#41;</span>
	merged project<span class="br0">&#40;</span><span class="st0">':domain'</span><span class="br0">&#41;</span>
&nbsp;
	<span class="co1">//override the dependencies specified in the parent project so they</span>
	<span class="co1">//use the &quot;merged&quot; configuration</span>
	merged group: <span class="st0">'org.as3commons'</span>, name: <span class="st0">'as3commons-collections'</span>,
		version: as3commons_collections_version, ext: <span class="st0">'swc'</span>
	merged group: <span class="st0">'org.as3commons'</span>, name: <span class="st0">'as3commons-lang'</span>,
		version: as3commons_lang_version, ext: <span class="st0">'swc'</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co1">// add another source directory for the locale files. The srcDirs property is a</span>
<span class="co1">// GradleFx property which by default has the value ['src/main/actionscript']. This</span>
<span class="co1">// is the directory where you need to put your actionscript and mxml files.</span>
srcDirs.<span class="me1">add</span><span class="br0">&#40;</span><span class="st0">'src/main/locales/{locale}'</span><span class="br0">&#41;</span>
&nbsp;
additionalCompilerOptions <span class="sy0">=</span> <span class="br0">&#91;</span>
		<span class="st0">'-locale=en_US'</span>
<span class="br0">&#93;</span></pre></div></div>
<p>That&#8217;s it for this example. You can find more examples in our GradleFx examples repository: <a rel="nofollow" target="_blank" href="https://github.com/GradleFx/GradleFx-Examples">https://github.com/GradleFx/GradleFx-Examples</a></p>
<p><strong>&#8220;What are you working on and what will be the next features of GradleFx?&#8221;</strong></p>
<p>I just released version 0.4 which contains support for AIR projects.</p>
<p>Upcoming features are mobile projects support, project file generation for Eclipse and Intellij IDEA, automatic downloading of the Flex SDK and AS3Doc generation.</p>
<p><strong>&#8220;GradleFx is open-source. How can we contribute?&#8221;</strong></p>
<p>You can contribute in a number of ways.</p>
<p>One is by trying out the project and giving feedback on our support forum and/or log issues in our issue tracker on Github.  Or if you feel some documentation is missing, feel free to add it to our wiki on Github (or just tell us so we can add it). It&#8217;s the feedback that we get that also makes this project better and we always try to do something with it.</p>
<p>Another way is by forking the project on GitHub, add a feature or improve the code and apply a &#8220;pull request&#8221;. Then we can integrate those changes and put them in an official release.</p>
<p><strong>&#8220;How do we know when a new version of GradleFx is released?&#8221;</strong></p>
<p>You can follow me or Steven on twitter, this is where we announce all things related to GradleFx.<br />
Yennick: @SlevinBE<br />
Steven: @stevendick</p>
<p>Some useful links to get started:</p>
<ul>
<li>Site: <a rel="nofollow" target="_blank" href="http://gradlefx.github.com/">http://gradlefx.github.com/</a></li>
<li>Documentation: <a rel="nofollow" target="_blank" href="https://github.com/GradleFx/GradleFx/wiki">https://github.com/GradleFx/GradleFx/wiki</a></li>
<li>Examples: <a rel="nofollow" target="_blank" href="https://github.com/GradleFx/GradleFx-Examples">https://github.com/GradleFx/GradleFx-Examples</a></li>
<li>Help &amp; Support: <a rel="nofollow" target="_blank" href="http://gradlefx.tenderapp.com/home">http://gradlefx.tenderapp.com/home</a></li>
<li>Bug Tracking: <a rel="nofollow" target="_blank" href="https://github.com/GradleFx/GradleFx/issues">https://github.com/GradleFx/GradleFx/issues</a></li>
<li>Changelog: <a rel="nofollow" target="_blank" href="https://github.com/GradleFx/GradleFx/blob/master/CHANGELOG.textile">https://github.com/GradleFx/GradleFx/blob/master/CHANGELOG.textile</a></li>
</ul>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/12/gradlefx-automated-builds/&text=GradleFx+automated+builds&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Game of Flex for Tablets Released!</title>
         <link>http://devgirl.org/2011/12/07/game-of-flex-for-tablets-released/</link>
         <description>My fellow teammate Michael Chaize recently had an idea for creating a &amp;#8216;game&amp;#8217; to showcase Flex and the latest 4.6 release features with Tour de Mobile Flex being the initial inspiration. I&amp;#8217;m happy to announce that the Game of Flex is now available on both the Apple iTunes and Android Market for your downloading pleasure [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3615</guid>
         <pubDate>Wed, 07 Dec 2011 19:32:46 +0000</pubDate>
         <content:encoded><![CDATA[<p>My fellow teammate <a rel="nofollow" target="_blank" href="http://www.riagora.com/">Michael Chaize</a> recently had an idea for creating a &#8216;game&#8217; to showcase Flex and <a rel="nofollow" target="_blank" href="http://www.adobe.com/content/dotcom/en/devnet/flex/articles/introducing-flex46sdk.html">the latest 4.6 release</a> features with <a rel="nofollow" target="_blank" href="http://flex.org/tour-de-mobile-flex/">Tour de Mobile Flex</a> being the initial inspiration. I&#8217;m happy to announce that the <a rel="nofollow" target="_blank" href="http://flex.org/flexgame/">Game of Flex</a> is now available on both the <a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/game-of-flex/id483389384">Apple iTunes</a> and <a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.com.riagora.flexgame&#038;feature=search_result#?t=W251bGwsMSwyLDEsImFpci5jb20ucmlhZ29yYS5mbGV4Z2FtZSJd">Android Market</a> for your downloading pleasure <img src='http://devgirl.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> !</p>
<p>The Game of Flex consists of 16 questions which if answered correctly, will qualify you to win a free copy of <a rel="nofollow" target="_blank" href="https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder">Flash Builder 4.6</a>! Ultimately though, it&#8217;s a learning tool, where we&#8217;ve included samples and source code for all of the new 4.6 features and other useful mobile features. Click the &#8216;Snippet&#8217; button to get the source code for the sample within the app, and the &#8216;Tutorial&#8217; button to link to tutorials with more details on how to use a certain feature.</p>
<p>Be sure to check out <a rel="nofollow" target="_blank" href="http://flex.org/flexgame/">Michael&#8217;s post</a> about the game, and visit the official website for it <a rel="nofollow" target="_blank" href="http://www.riagora.com/2011/12/game-of-flex-on-tablets/">here</a>!</p>
<div align="center"><strong>Sample Question</strong><br />
<a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/flexgame-sample1.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/flexgame-sample1.png" alt="" title="flexgame-sample" width="500" height="375" class="aligncenter size-full wp-image-3618"/></a>
<p><strong>Sample Code Snippet</strong><br />
<a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/flexgame-code.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/flexgame-code.png" alt="" title="flexgame-code" width="500" height="375" class="aligncenter size-full wp-image-3619"/></a>
</div>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2011%2F12%2F07%2Fgame-of-flex-for-tablets-released%2F&amp;title=Game%20of%20Flex%20for%20Tablets%20Released%21" id="wpa2a_16"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>“Game of Flex” on tablets</title>
         <link>http://www.riagora.com/2011/12/game-of-flex-on-tablets/</link>
         <description>I&amp;#8217;m very happy to announce that &amp;#8220;Game of Flex&amp;#8221; is available for iPad and Android tablets users (it will be soon available for BlackBerry PlayBook users). Last week, we released Flex 4.6 with great additions to build cross-platform tablet applications. &amp;#8220;Game of Flex&amp;#8221; is a game built with Flex 4.6 and inspired by Tour de [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=881</guid>
         <pubDate>Wed, 07 Dec 2011 12:23:15 +0000</pubDate>
         <content:encoded><![CDATA[<p>I&#8217;m very happy to announce that <strong>&#8220;Game of Flex&#8221;</strong> is available for iPad and Android tablets users <em>(it will be soon available for BlackBerry PlayBook users)</em>. Last week, we released Flex 4.6 with great additions to build cross-platform tablet applications. &#8220;Game of Flex&#8221; is a game built with Flex 4.6 and inspired by Tour de Mobile Flex. As you may know, Tour de Mobile Flex has never been available on the App Store. Let me tell you why: the application has been rejected by Apple because it&#8217;s a demo application which violates the developer guidelines. That&#8217;s why I had to find another way to showcase Flex on iOS devices using&#8230; a game! Gamification is so trendy that it worked! It has been directly approved by Apple. It&#8217;s actually a quiz with 16 questions, and it&#8217;s a real game, which means that if you correctly answer all the questions, you get a chance to win a copy of Flash Builder 4.6!!!</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/12/screenshotRiagora.png"><img class="aligncenter size-full wp-image-882" title="screenshotRiagora" src="http://www.riagora.com/wp-content/uploads/2011/12/screenshotRiagora.png" alt="" width="570" height="356"/></a></p>
<p>&#8220;Game of Flex&#8221; is not just a game, it&#8217;s also a great way for us to <strong>showcase the great performance of Flex</strong> on tablet devices, and for you to discover the new components and features of our latest release of Flex! Indeed, Game of Flex is also a learning tool. At anytime, you can click on the &#8220;Snippet&#8221; button and read the source code of the current sample. You can also click on &#8220;Tutorial&#8221; to read an online tutorial about the current sample.</p>
<h3>Download the game and the source code</h3>
<p><a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.com.riagora.flexgame"><img class="size-full wp-image-883 alignnone" style="border-color:initial;border-width:0px;margin:0px;" title="dlAndroid" src="http://www.riagora.com/wp-content/uploads/2011/12/dlAndroid.png" alt="" width="205" height="269"/></a><a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/game-of-flex/id483389384"><img class="alignnone size-full wp-image-884" style="border-color:initial;border-width:0px;margin:0px;" title="dlIpad" src="http://www.riagora.com/wp-content/uploads/2011/12/dlIpad.png" alt="" width="190" height="269"/></a><img class="alignnone size-full wp-image-885" style="border-color:initial;border-width:0px;margin:0px;" title="dlPlaybook" src="http://www.riagora.com/wp-content/uploads/2011/12/dlPlaybook.png" alt="" width="150"/></p>
<p>The direct links to the application are:</p>
<p><strong>Android tablets: </strong><a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.com.riagora.flexgame">https://market.android.com/details?id=air.com.riagora.flexgame<br />
</a><strong>iPad:</strong> <a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/game-of-flex/id483389384?ls=1&amp;mt=8">http://itunes.apple.com/us/app/game-of-flex/id483389384<br />
</a><strong>BlackBerry Playbook:</strong> soon</p>
<p>You can also download the source code of the application. Install Flash Builder 4.6 and import this Flash Builder Project (FXP file): <a rel="nofollow" target="_blank" href="http://riagora.com/pvt_content/flexgame/FlexGame-source.fxp">FLEXGAME.FXP</a></p>
<p>&nbsp;</p>
<h3>Some tips inside the code</h3>
<p>If you want to check the source code of the app, you&#8217;ll learn&#8230;:</p>
<ul>
<li>How to use the new SplitViewNavigator architecture (portrait and landscape layouts on tablet devices)</li>
<li>How to display HTML content inside a Flex app</li>
<li>How to access the camera to take pictures</li>
<li>How to use the BusyIndicator, ToggleSwitch and List components</li>
<li>How to enable multi-touch</li>
<li>How to manage your views</li>
<li>How to use the accelerometer</li>
<li>How to create custom AS3 item renderers for your lists</li>
<li>How to access the local SQLite database</li>
<li>How to use native extensions</li>
<li>How to set up the new DateSpinner component</li>
<li>How to display callout popups</li>
<li>How to set up the software keyboard to match your needs</li>
<li>How to declare spinner lists</li>
</ul>
<div>Have fun !!!</div>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/12/game-of-flex-on-tablets/&text=%E2%80%9CGame+of+Flex%E2%80%9D+on+tablets&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Flex Mobile Development – Adding Maps with the MapQuest AS3/Flash API!</title>
         <link>http://devgirl.org/2011/12/06/flex-mobile-development-adding-maps-with-mapquest-flash-api-w-sample-app/</link>
         <description>A topic that has come up often in my conversations with developers lately is how to easily add mapping components to their their Flex and Flash mobile apps. Now I&amp;#8217;m super excited to share this latest AS3/Flash API for mobile from MapQuest for everyone to check out! The new version contains touch-friendly maps and controls [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3562</guid>
         <pubDate>Tue, 06 Dec 2011 20:13:17 +0000</pubDate>
         <content:encoded><![CDATA[<p>A topic that has come up often in my conversations with developers lately is how to easily add mapping components to their their Flex and Flash mobile apps. Now I&#8217;m super excited to share this <a rel="nofollow" target="_blank" href="http://developer.mapquest.com/web/products/featured/as3-flex-flash-mobile">latest AS3/Flash API for mobile from MapQuest</a> for everyone to check out! The new version contains touch-friendly maps and controls and was streamlined for performance on mobile. </p>
<p>To get started, first check out <a rel="nofollow" target="_blank" href="http://devgirl.org/files/MapQuestSample/">this sample application</a> I&#8217;ve included the <a rel="nofollow" target="_blank" href="http://devgirl.org/files/MapQuestSample/MQMobileSample%283%29/">source</a> and <a rel="nofollow" target="_blank" href="http://devgirl.org/files/MapQuestSample/MQMobileSample.fxp">fxp</a> for that was written by my friend <a rel="nofollow" target="_blank" href="http://twitter.com/@MapQuestTech">Darin Weakley</a> over at <a rel="nofollow" target="_blank" href="http://www.mapquest.com/">MapQuest</a>. He&#8217;s done a great job of showcasing the fun cool features available in this app. I&#8217;ve included some screen shots below to give an idea of what it entails:</p>
<div align="center"><strong><br />
<h2>Map Component</h2>
<p></strong></div>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqmaps.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqmaps.png" alt="" title="mqmaps" width="500" height="710" class="aligncenter size-full wp-image-3564"/></a></p>
<div align="center"><strong><br />
<h2>Search Business</h2>
<p></strong></p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucks0.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucks0.png" alt="" title="Starbucks Search" width="500" height="771" class="aligncenter size-full wp-image-3572"/></a></p>
<p><strong><br />
<h2>Search Results</h2>
<p></strong></p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucks1.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucks1.png" alt="" title="Search Results" width="500" height="771" class="aligncenter size-full wp-image-3573"/></a></p>
<p><strong><br />
<h2>Results on Map</h2>
<p></strong></p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucksmap.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucksmap.png" alt="" title="Search Results on Map" width="500" height="771" class="aligncenter size-full wp-image-3574"/></a></p>
<p><strong><br />
<h2>Result Item Detail</h2>
<p></strong></p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucks2.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqstarbucks2.png" alt="" title="Search Detail" width="500" height="771" class="aligncenter size-full wp-image-3575"/></a></p>
<p><strong><br />
<h2>Directions</h2>
<p></strong></p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqdirectionstext.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqdirectionstext.png" alt="" title="Directions Text" width="500" height="771" class="aligncenter size-full wp-image-3596"/></a><br />
<strong><br />
<h2>Directions by Map</h2>
<p></strong></p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/mqdirectionsmap.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/mqdirectionsmap.png" alt="" title="Directions on Map" width="500" height="771" class="aligncenter size-full wp-image-3594"/></a>
</div>
<p>If you have an Android device, be sure to download the <a rel="nofollow" target="_blank" href="https://market.android.com/details?id=air.com.mapquestapi.www&#038;feature=search_result">showcase application</a> for free to your device!</p>
<p>To implement this in your own app you will need to <a rel="nofollow" target="_blank" href="http://developer.mapquest.com/">create yourself an app key and join the developer program</a> here before using the APIs. It&#8217;s fast and easy. Click &#8216;Join Now&#8217;. Also, don&#8217;t forget to include the <a rel="nofollow" target="_blank" href="http://developer.mapquest.com/content/as3/v7/7.0.7_MQ_MOBILE/downloads/MQFlashMapsAPI_7.0.7_MQ_MOBILE.swc">latest MapQuest Flash API 7.07 mobile swc file</a> in your project (see the sample for reference). <a rel="nofollow" target="_blank" href=" http://developer.mapquest.com/web/products/featured/as3-flex-flash-mobile">This link</a> also has documentation and other examples on the right side of the page to check out for more info!</p>
<p><strong><br />
<h3>MapQuest Flash Maps API Quick Links</h3>
<p><a rel="nofollow" target="_blank" href="http://developer.mapquest.com/web/products/featured/as3-flex-flash-mobile">Mobile Flash Maps API</a><br />
<a rel="nofollow" target="_blank" href="http://developer.mapquest.com/web/products/featured/as3-flex-flash">Web/Desktop Flash Maps API</a><br />
<a rel="nofollow" target="_blank" href="http://developer.mapquest.com/web/products/open/flash-mobile">OpenStreetMap Mobile Flash Maps API</a> &#8211; more information about <a rel="nofollow" target="_blank" href="http://www.openstreetmap.org/index.html">OpenStreetMap (OSM)</a><br />
<a rel="nofollow" target="_blank" href="http://developer.mapquest.com/web/products/open/flash">OpenStreetMap Web/Desktop Flash Maps API</a> </strong></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2011%2F12%2F06%2Fflex-mobile-development-adding-maps-with-mapquest-flash-api-w-sample-app%2F&amp;title=Flex%20Mobile%20Development%20%E2%80%93%20Adding%20Maps%20with%20the%20MapQuest%20AS3%2FFlash%20API%21" id="wpa2a_18"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Flex Mobile Development – SplitViewNavigator Tutorial (w/ source)</title>
         <link>http://devgirl.org/2011/12/01/flex-mobile-development-splitviewnavigator-tutorial/</link>
         <description>The SplitViewNavigator is another new Flex 4.6 component targeted for tablet development that can be used when you want to create a master view / detail view in your application, where the master view typically serves as a source of navigation and the detail view displays the results of the action taken on the master [...]</description>
         <guid isPermaLink="false">http://devgirl.org/?p=3223</guid>
         <pubDate>Thu, 01 Dec 2011 16:09:35 +0000</pubDate>
         <content:encoded><![CDATA[<p>The <strong>SplitViewNavigator</strong> is another new Flex 4.6 component targeted for tablet development that can be used when you want to create a master view / detail view in your application, where the master view typically serves as a source of navigation and the detail view displays the results of the action taken on the master view. The master view is typically the left or top of the screen, and the detail view is typically the right side or bottom part of the screen depending on layout. If you&#8217;re not familiar with this screen pattern, see <a rel="nofollow" target="_blank" href="http://designingwebinterfaces.com/designing-web-interfaces-12-screen-patterns">this link</a> for more detail. A great example of this is your typical mail application, for instance on one of my iPad email accounts:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svn01.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svn01.png" alt="" title="svn0" width="500" height="375" class="aligncenter size-full wp-image-3522"/></a></p>
<p>Now we can build applications with this type of layout simply using built-in Flex 4.6 features! The <strong>SplitViewNavigator</strong> extends<strong> ViewNavigatorBase</strong>, so it does not reside at the root level of the application but rather at the child level similar to <strong>ViewNavigator</strong>. Note that this component can only be used in a blank <strong>Application</strong> or within a <strong>TabbedViewNavigatorApplication</strong>. Here&#8217;s an example:</p>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; applicationDPI=&quot;160&quot;&gt;

	&lt;s:SplitViewNavigator id=&quot;svn&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
		&lt;s:ViewNavigator id=&quot;leftNav&quot; width=&quot;30%&quot; height=&quot;100%&quot; firstView=&quot;views.LeftView&quot;/&gt;
		&lt;s:ViewNavigator id=&quot;rightNav&quot; width=&quot;100%&quot; height=&quot;100%&quot; firstView=&quot;views.RightView&quot;/&gt;
	&lt;/s:SplitViewNavigator&gt;
&lt;/s:Application&gt;
</pre>
<p>In this case my left view and right view are simple <strong>View</strong> classes showing a list of cities to click on and some dummy data about that particular city in the detail. I&#8217;ve included the code below for reference:</p>
<p><strong>LeftView.mxml</strong></p>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:View xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
		xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; title=&quot;Left View&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			protected function list_clickHandler(event:MouseEvent):void
			{
				(this.parentDocument as Sample).rightNav.activeView.data=list.selectedItem;
			}
		]]&gt;
	&lt;/fx:Script&gt;

	&lt;s:List id=&quot;list&quot; width=&quot;100%&quot; height=&quot;100%&quot; click=&quot;list_clickHandler(event)&quot;&gt;
		&lt;s:dataProvider&gt;
			&lt;s:ArrayCollection&gt;
				&lt;fx:String&gt;Atlanta, GA&lt;/fx:String&gt;
				&lt;fx:String&gt;Baltimore, MD&lt;/fx:String&gt;
				&lt;fx:String&gt;Boston, MA&lt;/fx:String&gt;
				&lt;fx:String&gt;Chicago, IL&lt;/fx:String&gt;
				&lt;fx:String&gt;Dallas, TX&lt;/fx:String&gt;
				&lt;fx:String&gt;Detroit, MI&lt;/fx:String&gt;
				&lt;fx:String&gt;Honolulu, HI&lt;/fx:String&gt;
				&lt;fx:String&gt;Los Angeles, CA&lt;/fx:String&gt;
				&lt;fx:String&gt;Minneapolis, MA&lt;/fx:String&gt;
				&lt;fx:String&gt;New Orleans, LA&lt;/fx:String&gt;
				&lt;fx:String&gt;New York, NY&lt;/fx:String&gt;
				&lt;fx:String&gt;Richmond, VA&lt;/fx:String&gt;
				&lt;fx:String&gt;San Francisco, CA&lt;/fx:String&gt;
				&lt;fx:String&gt;San Jose, CA&lt;/fx:String&gt;
				&lt;fx:String&gt;St. Louis, MO&lt;/fx:String&gt;
				&lt;fx:String&gt;Washington, DC&lt;/fx:String&gt;
			&lt;/s:ArrayCollection&gt;
		&lt;/s:dataProvider&gt;
	&lt;/s:List&gt;
&lt;/s:View&gt;
</pre>
<p><strong>RightView.mxml</strong></p>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:View xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot; xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; title=&quot;Detail View&quot;&gt;
	&lt;s:layout&gt;
		&lt;s:VerticalLayout paddingTop=&quot;15&quot; paddingBottom=&quot;15&quot; paddingLeft=&quot;15&quot; paddingRight=&quot;15&quot; gap=&quot;5&quot;
						  horizontalAlign=&quot;center&quot; verticalAlign=&quot;top&quot;/&gt;
	&lt;/s:layout&gt;
	&lt;s:Label text=&quot;Click on a location on the left to explore!&quot; visible=&quot;{data==null?true:false}&quot;/&gt;
	&lt;s:Label text=&quot;Information about {this.data}&quot; visible=&quot;{data!=null?true:false}&quot;/&gt;

	&lt;s:TextArea text=&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur accumsan felis ac tortor aliquam iaculis. Phasellus hendrerit viverra enim, sit amet scelerisque lectus dictum at. Aenean sodales nisi sed leo congue et porttitor ligula vehicula.
Pellentesque turpis massa, suscipit vel fermentum quis, dignissim sed ipsum. Nulla aliquet libero adipiscing risus lobortis eleifend quis at velit. Duis at leo urna.
Praesent facilisis faucibus neque, ut ullamcorper lacus gravida a. Donec vel iaculis sapien.&quot;  width=&quot;90%&quot; editable=&quot;false&quot; visible=&quot;{data!=null?true:false}&quot;/&gt;
&lt;/s:View&gt;
</pre>
<p>The resulting application:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svnLand.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svnLand.png" alt="" title="svnLand" width="500" height="385" class="aligncenter size-full wp-image-3531"/></a></p>
<p>You could also set a layout on the <strong>SplitViewNavigator</strong> container so if you wanted it to split vertically for instance, you would simply set a <strong>VerticalLayout</strong>, and adjust the height percentages with the width set to 100%, such as:</p>
<pre>
&lt;s:SplitViewNavigator id=&quot;svn&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
	&lt;s:layout&gt;
	     &lt;s:VerticalLayout/&gt;
	&lt;/s:layout&gt;
	&lt;s:ViewNavigator id=&quot;leftNav&quot; width=&quot;100%&quot; height=&quot;30%&quot; firstView=&quot;views.LeftView&quot;/&gt;
	&lt;s:ViewNavigator id=&quot;rightNav&quot; width=&quot;100%&quot; height=&quot;70%&quot; firstView=&quot;views.RightView&quot;/&gt;
&lt;/s:SplitViewNavigator&gt;
</pre>
<p>Here&#8217;s the updated layout:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svnVert.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svnVert.png" alt="" title="svnVert" width="500" height="385" class="aligncenter size-full wp-image-3539"/></a></p>
<p>This split view approach works well for landscape mode, however, in portrait mode you may want to display it a little differently since the screen width is much less to work with. There are some built-in features to help you do this. There&#8217;s an <em>autoHideFirstViewNavigator</em> property on the <strong>SplitViewNavigator</strong> that will automatically hide the left side view when the application receives an orientation change event to portrait. </p>
<pre>
&lt;s:SplitViewNavigator id=&quot;svn&quot; width=&quot;100%&quot; height=&quot;100%&quot; autoHideFirstViewNavigator=&quot;true&quot;&gt;
	&lt;s:ViewNavigator id=&quot;leftNav&quot; width=&quot;30%&quot; height=&quot;100%&quot; firstView=&quot;views.LeftView&quot;/&gt;
	&lt;s:ViewNavigator id=&quot;rightNav&quot; width=&quot;100%&quot; height=&quot;100%&quot; firstView=&quot;views.RightView&quot;/&gt;
&lt;/s:SplitViewNavigator&gt;
</pre>
<p>Now when we run it, we will see the following:<br />
<a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svnAuto.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svnAuto.png" alt="" title="svnAuto" width="500" height="619" class="aligncenter size-full wp-image-3533"/></a></p>
<p>Not very useful yet though since there&#8217;s no way to navigate to a different item in our list! So we need to take this one step further and use the <strong>showViewNavigatorInPopUp</strong> function from the <strong>SplitViewNavigator</strong> to pop up our list in a <strong>Callout</strong> while in portrait mode. We can call this function from a button in the right ViewNavigator&#8217;s actionBar <em>navigationContent</em> for instance such as the following:</p>
<pre>
&lt;s:SplitViewNavigator id=&quot;svn&quot; width=&quot;100%&quot; height=&quot;100%&quot; autoHideFirstViewNavigator=&quot;true&quot;&gt;
		&lt;s:ViewNavigator id=&quot;leftNav&quot; width=&quot;30%&quot; height=&quot;100%&quot; firstView=&quot;views.LeftView&quot;/&gt;
		&lt;s:ViewNavigator id=&quot;rightNav&quot; width=&quot;100%&quot; height=&quot;100%&quot; firstView=&quot;views.RightView&quot; &gt;
			&lt;s:navigationContent&gt;
				&lt;s:Button id=&quot;listButton&quot; label=&quot;List&quot; click=&quot;svn.showFirstViewNavigatorInPopUp(listButton)&quot;/&gt;
			&lt;/s:navigationContent&gt;
		&lt;/s:ViewNavigator&gt;
&lt;/s:SplitViewNavigator&gt;
</pre>
<p>Note: Just to clarify, in the above we are using the actionBar already implicitly defined as part of the Spark ViewNavigator container and setting the parent for the popup to the listButton, so the Callout or popup arrow will stem from that button. Here&#8217;s what the above code will look like when run in portrait mode:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svnPortrait.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svnPortrait.png" alt="" title="svnPortrait" width="500" height="619" class="aligncenter size-full wp-image-3532"/></a></p>
<p>At this point, we probably don&#8217;t want this button to show though when going back into landscape mode, so we&#8217;ll need to add states management to set visible to false when in landscape. One way to determine when to update the state would be to add a resize event handler and check the width and height and update the state accordingly. Our code now looks like the following:</p>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot; applicationDPI=&quot;160&quot; resize=&quot;application1_resizeHandler(event)&quot;&gt;
	&lt;fx:Script&gt;
		&lt;![CDATA[
			import mx.events.ResizeEvent;

			protected function application1_resizeHandler(event:ResizeEvent):void
			{
				if (width&gt;height)
					this.currentState=&quot;landscape&quot;;
				else this.currentState=&quot;portrait&quot;;
			}
		]]&gt;
	&lt;/fx:Script&gt;

	&lt;s:states&gt;
		&lt;s:State name=&quot;portrait&quot;/&gt;
		&lt;s:State name=&quot;landscape&quot;/&gt;
	&lt;/s:states&gt;

	&lt;s:SplitViewNavigator id=&quot;svn&quot; width=&quot;100%&quot; height=&quot;100%&quot; autoHideFirstViewNavigator=&quot;true&quot;&gt;
		&lt;s:ViewNavigator id=&quot;leftNav&quot; width=&quot;30%&quot; height=&quot;100%&quot; firstView=&quot;views.LeftView&quot;/&gt;
		&lt;s:ViewNavigator id=&quot;rightNav&quot; width=&quot;100%&quot; height=&quot;100%&quot; firstView=&quot;views.RightView&quot; &gt;
			&lt;s:navigationContent&gt;
				&lt;s:Button id=&quot;listButton&quot; label=&quot;List&quot; click=&quot;svn.showFirstViewNavigatorInPopUp(listButton)&quot; visible.landscape=&quot;false&quot;/&gt;
			&lt;/s:navigationContent&gt;
		&lt;/s:ViewNavigator&gt;
	&lt;/s:SplitViewNavigator&gt;
&lt;/s:Application&gt;
</pre>
<p>Now when we run the application in landscape mode, we can see the List button is not showing in the actionBar:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svnLand.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svnLand.png" alt="" title="svnLand" width="500" height="385" class="aligncenter size-full wp-image-3531"/></a></p>
<p>You can download the source and project file for this sample application <strong><a rel="nofollow" target="_blank" href="http://devgirl.org/files/SplitViewNavigatorSample/">here</a></strong>!</p>
<p>Also, if you haven&#8217;t looked at this yet, <a rel="nofollow" target="_blank" href="http://coenraets.org">Christophe</a> and I created an extensive SplitViewNavigator-based expense tracking tablet application called <strong><em>XpenseIt</em></strong> that includes a bunch of other Flex 4.6 features as well and can be downloaded <a rel="nofollow" target="_blank" href="http://devgirl.org/files/RIAUnleashed/">here</a>. Here is a screenshot from that application:</p>
<p><a rel="nofollow" target="_blank" href="http://devgirl.org/wp-content/uploads/2011/12/svn2.png"><img src="http://devgirl.org/wp-content/uploads/2011/12/svn2.png" alt="" title="XpenseIt" width="500" height="385" class="aligncenter size-full wp-image-3503"/></a></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdevgirl.org%2F2011%2F12%2F01%2Fflex-mobile-development-splitviewnavigator-tutorial%2F&amp;title=Flex%20Mobile%20Development%20%E2%80%93%20SplitViewNavigator%20Tutorial%20%28w%2F%20source%29" id="wpa2a_20"><img src="http://devgirl.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Flex 4.6 is out!</title>
         <link>http://www.riagora.com/2011/11/flex-4-6-is-out/</link>
         <description>The Flex 4.6 SDK is available for download here. If you are using Flash Builder 4.5, download and upgrade your IDE for free. You can download Flash Builder 4.6 here. Since Flex 4.5, you can develop desktop AND mobile applications with a native experience on iOS, Android and BlackBerry devices. Flex mobile applications aim to perform [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=872</guid>
         <pubDate>Wed, 30 Nov 2011 15:08:12 +0000</pubDate>
         <content:encoded><![CDATA[<p>The Flex 4.6 SDK is available for <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://www.adobe.com/cfusion/entitlement/index.cfm?e=flexsdk"><span style="color:#0000ff;">download here</span></a></span>. If you are using Flash Builder 4.5, download and upgrade your IDE <strong>for free</strong>. You can <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder"><span style="color:#0000ff;">download Flash Builder 4.6 here</span></a></span>. Since Flex 4.5, you can develop desktop AND mobile applications with a native experience on iOS, Android and BlackBerry devices. Flex mobile applications aim to perform and look like native applications. The new features of Flex 4.6 will help you to achieve great performance and experience. If you take your existing Flex 4.5 mobile project and recompile it with Flex 4.6, you should feel great performance improvements, especially with scrolling lists and transitions between views. But the Flex SDK team also worked on new components. Here are the list of some new features available in Flex 4.6 and Flash Builder 4.6:</p>
<h2>New set of mobile components</h2>
<p>Tablet devices are incredibly successful. The Apple iPad introduced new ways to structure applications and new user interactions. The new set of components available in Flex 4.6 is inspired by classic tablet applications. As you&#8217;re targeting a larger screen than a smartphone, you need to review your UI navigation. I&#8217;ve already shared some thoughts on this in my <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://www.riagora.com/2011/06/adaptive-ui-mobile-vs-tablet/"><span style="color:#0000ff;">post named &#8220;Adaptive UI&#8221;</span></a></span>. Thanks to the new SplitViewNavigator, you can manage the layout of multiple views. The &#8216;Adaptive UI&#8217; is managed by the component and is based on the device orientation.</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/11/adaptiveSplit.png"><img class="aligncenter size-full wp-image-873" title="adaptiveSplit" src="http://www.riagora.com/wp-content/uploads/2011/11/adaptiveSplit.png" alt="" width="550" height="302"/></a></p>
<p>How to use SpitViewNavigator:</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_5" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_5" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display:block;"><pre class="mxml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;s:SplitViewNavigator</span> width=<span class="st0">&quot;100%&quot;</span> height=<span class="st0">&quot;100%&quot;</span> id=<span class="st0">&quot;splitViewNavigator&quot;</span> autoHideFirstViewNavigator=<span class="st0">&quot;true&quot;</span><span class="re2">&gt;</span></span>
		<span class="sc3"><span class="re1">&lt;s:ViewNavigator</span> id=<span class="st0">&quot;vnList&quot;</span> firstView=<span class="st0">&quot;views.ListQuestions&quot;</span> width=<span class="st0">&quot;300&quot;</span> height=<span class="st0">&quot;100%&quot;</span><span class="re2">/&gt;</span></span>
		<span class="sc3"><span class="re1">&lt;s:ViewNavigator</span> id=<span class="st0">&quot;vnFull&quot;</span> firstView=<span class="st0">&quot;views.FullView&quot;</span> width=<span class="st0">&quot;100%&quot;</span> height=<span class="st0">&quot;100%&quot;</span><span class="re2">&gt;</span></span>
&nbsp;
			<span class="sc3"><span class="re1">&lt;s:actionContent</span>.portrait<span class="re2">&gt;</span></span>
				<span class="sc3"><span class="re1">&lt;s:Button</span> id=<span class="st0">&quot;navigatorButton&quot;</span>   label=<span class="st0">&quot;Show questions&quot;</span> click=<span class="st0">&quot;splitViewNavigator.showFirstViewNavigatorInPopUp(navigatorButton)&quot;</span> <span class="re2">/&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;/s:actionContent</span>.portrait<span class="re2">&gt;</span></span>
		<span class="sc3"><span class="re1">&lt;/s:ViewNavigator</span><span class="re2">&gt;</span></span>
	<span class="sc3"><span class="re1">&lt;/s:SplitViewNavigator</span><span class="re2">&gt;</span></span></pre></div></div>
<p>More components are also available and directly inspired from iOS applications: the CallOutButton (popup related to a component), the SpinnerList, the ToggleSwitch and the famous DateSpinner.</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/11/compo.png"><img class="aligncenter size-full wp-image-874" title="compo" src="http://www.riagora.com/wp-content/uploads/2011/11/compo.png" alt="" width="550" height="175"/></a></p>
<h2>Soft keyboard parameters</h2>
<p>You can easily enhance the behavior of your soft keyboard. If you&#8217;re building a form, with a text input field that is waiting for a phone number, then you can modify the look of your mobile/tablet soft keyboard to display numbers only. You can also customize the label of the &#8220;return&#8221; key on the soft keyboard (and display &#8220;Join&#8221;, &#8220;Go&#8221; or &#8220;Search&#8221; for example). It&#8217;s a very nice feature <a rel="nofollow" target="_blank" href="http://devgirl.org/2011/11/29/flex-mobile-development-flex-4-6-cool-new-soft-keyboard-features-sample-w-source/">detailed by Holly in this post</a>.</p>
<p>You can set different values for the softKeyboardType property: number, email, punctuation, url, contact or default. For instance, to display numbers on the keyboard, just add a parameter to your TextInput component:</p>
<p><code> </code><code>&lt;</code><code>s:TextInput</code> <code>softKeyboardType</code><code>=</code><code>"number"</code> <code>width</code><code>=</code><code>"180"</code><code>/&gt;</code></p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/11/number-keyboard.png"><img class="aligncenter size-full wp-image-875" title="number-keyboard" src="http://www.riagora.com/wp-content/uploads/2011/11/number-keyboard.png" alt="" width="500" height="333"/></a></p>
<h2>AIR 3, native extensions and captive runtime</h2>
<p>Air 3.1 is attached to Flex 4.6 developments. It means that you can easily embed ActionScript Native Extensions within your Flex mobile project. ANE are a bridge between your Flex mobile app and a native library that can extend the capabilities of the Flex SDK. A <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://www.adobe.com/devnet/air/native-extensions-for-air.html"><span style="color:#0000ff;">list of native extensions are available on adobe.com </span></a></span>such as the Gyroscope API, Vibration, Notification, Kinnect&#8230; To import an ActionScript Native Extension within your project, just open the new tab in Flash Builder 4.6 dedicated to ANE.</p>
<p style="text-align:center;"><a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/11/Screen-shot-2011-11-30-at-3.46.22-PM1.png"><img class="aligncenter size-full wp-image-877" title="Screen shot 2011-11-30 at 3.46.22 PM" src="http://www.riagora.com/wp-content/uploads/2011/11/Screen-shot-2011-11-30-at-3.46.22-PM1.png" alt="" width="550"/></a></p>
<p>Remember that you can also use the new captive runtime option while packaging a mobile application OR a desktop application. It will create a standalone application that is embedding the AIR runtime. On the desktop, it means that you can actually copy your application on a USB stick and launch it without administration rights! It&#8217;s a fantastic new way for deploying AIR apps. On mobile devices, we were already using this technic on iOS. Now you can use the same technic on Android and generate an .apk file that will embed a specific version of the AIR runtime.</p>
<h2>Test Flex 4.6 apps on your device</h2>
<p>There are already some Flex 4.6 apps available on the Android Market and on the App Store. If you have an iPhone, you can download the free music application called <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://itunes.apple.com/tw/app/radio-x-track/id467964868?mt=8"><span style="color:#0000ff;">&#8220;Radio X-track&#8221;</span></a></span>. It&#8217;s a Flex 4.6 app I&#8217;ve been working on, I&#8217;ll share more information about this app soon on this blog. <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/narcissus/id472974421?mt=8"><span style="color:#0000ff;">Narcissus</span></a></span> is also compiled with Flex 4.6 by the way and offers great performance on iPad tablets. Christophe and Holly shared <span style="color:#0000ff;"><a rel="nofollow" target="_blank" href="http://devgirl.org/2011/10/31/flex-mobile-development-building-tablet-apps-full-example-with-source-code/"><span style="color:#0000ff;">an open-source tablet application</span></a></span> to manage your expenses.I&#8217;ve also been working on a Flex 4.6 application for tablet users and Flex developers&#8230; This application is already secretly available on the Android Market but the app is still &#8220;in review&#8221; on the app store. As soon as it&#8217;s available for both iPad and Android tablets, I&#8217;ll showcase this application. More to come&#8230;</p>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/11/flex-4-6-is-out/&text=Flex+4.6+is+out%21&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Flexcursion with Apache</title>
         <link>http://www.riagora.com/2011/11/flex-is-open/</link>
         <description>What a week! Adobe made a lot of announcements which raised a lot of questions on the web, and led to a lot of WTF (which meant&amp;#8221;What The Flex&amp;#8221; right?). I feel that since MAX, the Flex community was expecting some clarification about the future of Flex. The strategic shift made by Adobe precipitated our [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=857</guid>
         <pubDate>Thu, 17 Nov 2011 16:59:08 +0000</pubDate>
         <content:encoded><![CDATA[<p>What a week! Adobe made a lot of announcements which raised a lot of questions on the web, and led to a lot of WTF <em>(which meant&#8221;What The Flex&#8221; right?)</em>. I feel that since MAX, the Flex community was expecting some clarification about the future of Flex. The strategic shift made by Adobe precipitated our communication to unveil the overall plan. Unfortunately, it has been shared in the middle of a wave of changes <em>(the lay-off, the Flash mobile story, the HTML5 commitment&#8230;)</em>. There was a lot of misunderstanding, so let me give you <strong>my personal opinion</strong> on this as a Flex developer and as an Adobe Evangelist. First, here is the official article that provides details about the future of Flex: <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://www.adobe.com/devnet/flex/articles/flex-announcements.html"><span style="color:#3366ff;">http://www.adobe.com/devnet/flex/articles/flex-announcements.html</span></a> </span></p>
<h2>The evolution of Flex</h2>
<p>This is a fairly long post, if you don’t have time to read it all right now, you may want to skip directly to What’s next for Flex. I&#8217;m French, I talk too much, and I&#8217;m not Victor Hugo&#8230; Whatever <img src='http://www.riagora.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/>  So feel free to skip this paragraph to focus on our future. But the history of Flex might help you understanding the difference between our past strategy and the new one.</p>
<p>Flex 1 was released in 2004. To develop and deploy a Flex app, you had to use a 15000$ server. I remember that I started looking at Flex 1.5 in 2005 at my previous company. Because of this economic model, I didn&#8217;t even try to develop a prototype. Then, after the acquisition of Macromedia, Flex 2 was launched with a free business model and an IDE based on Eclipse. It was 2006, when I started coding Flex projects and when I joined Adobe to promote this technology. In 2007, Flex 3 was open-sourced under the MPL license. Flex 4 introduced the Spark architecture that lets you skin visual components very easily and with a lot of freedom. Thanks to Flex 4.5.1 (and soon Flex 4.6) you can build &#8220;native-like&#8221; mobile apps and deploy them on Android, iOS and QNX. So what&#8217;s next?</p>
<p>I&#8217;m very close to the Java and the PHP community <em>(I&#8217;m currently writing this post from the fantastic DEVOXX conference with 3200 Java developers around me)</em>. When we used to present Flex as an open-source technology, it was more a &#8220;you can view my source&#8221; one. That was a huge step, and it helped our community to understand how the framework works. After a few months, it also generated some frustration. Flex developers and strategic customers who are Flex masters wanted to contribute actively, optimize the code, etc&#8230; Some of them even started their own branches. The Spoon project is the expression of this will and the expression of our lack of efficiency in accepting contributions, which I think was because Flex was perceived and promoted as a product. What I want to express is that we were defining the new Flex features on our side, to (somewhat) surprise our community and generate excitement. It was of course based on customer and user feedback, but then the new features were only shared during main conferences <em>(360Flex or MAX for instance)</em>, and this was related sometimes to our product strategy. And this system works very well to spur adoption and generate a lot of excitement: Flex is very successful in the Enterprise today thanks to this strategy.</p>
<h2>What&#8217;s next for Flex ?</h2>
<p>At the same time, HTML5 is moving very very fast &#8212; faster than most anyone would have predicted two years ago. This is mainly due to the success of the iPad. That&#8217;s why Adobe believes that within 3 to 5 years, depending on the complexity of your RIA, HTML5 should be able to enable decent Enterprise Application user experiences for desktop users, associated with a professional coding experience. What I would add, as an Enterprise consultant, is that we can easily add 2 or 3 years to this period of time. A significant part of the Enterprise customers I&#8217;m interacting with are still running on Windows XP. This is a reflection of the tempo of the Enterprise world that cannot be synced with the outside world for security, maintenance, training, and auditing reasons. So even if HTML5 integrates some key RIA concepts within 5 years, it means that browsers still have to implement them and that companies need to update to a recent browser&#8230; well, you know the story.</p>
<p>Flex is and will remain the leading framework for first-class Enterprise applications for many years. And by the way, don&#8217;t be scared. We&#8217;re not blind and we must accept the fact that HTML5 is making fantastic progress. That&#8217;s GREAT! And our community has A LOT of time to anticipate this shift and make the most of this transition. Adobe won&#8217;t let you down. We&#8217;ll contribute to open standards, and at the same time, Adobe, starting with my team, will make sure that you&#8217;ll make it through &#8212; and even thrive during &#8212; any shift in our industry. Don&#8217;t worry, if HTML5 becomes the standard for RIA apps, then the best HTML5 RIA developers of tomorrow will be today&#8217;s Flex developers. Why? Because RIA development is not just a matter of language. RIA developers have a lot of specific skills<em> (design awareness, client-side architectures, service exposure architecture, user-experience, mobile applications conception and optimization to name a few)</em>. You have a unique knowledge of the market that goes beyond knowing a technology inside and out. Adobe is already a key player in the HTML industry, and we&#8217;ll deliver more and more advanced tools and technologies (you can already look at PhoneGap, Edge&#8230;).</p>
<p>That&#8217;s why we need to define the best strategy for the Flex framework and establish it as an Enterprise standard today! There are two options. The first option is to invest in more new features and hire more engineers on the Flex SDK team. For the long term, I don&#8217;t believe in this strategy. It&#8217;s the traditional way to proceed for software products but not for application development frameworks. The more committed and talented developers you have in the community, the more you need to let them interact with the source code of your technology. The more you have mission critical Flex apps deployed in large organizations, the more strategic customers need to trust the future of your technology. Open source can fulfill these needs. We all know that Flex is deeply linked to the Flash Player which boosted the innovation on the web, and then, consequently, in Rich Internet Applications. I believe that the Flex framework is very mature in terms of features and can answer pretty much all the current Enterprise needs. It can also answer  future needs as we can now rapidly build native apps for iOS, Android and QNX since Flex 4.5.</p>
<p>The second option is to consolidate the current SDK and transition to the next level of openness. That&#8217;s why we decided to propose incubating the Flex SDK to the Apache Software Foundation. I&#8217;m very happy and excited about this move for several reasons:</p>
<ul>
<li>Apache is a very respected foundation by developers and by large organizations. A lot of mission-critical Enterprise applications are already relying on Apache software: Axis, Ant, Maven, JackRabbit, Tomcat, Geronimo, ActiveMQ, Felix&#8230;</li>
<li>We are not only proposing the Flex SDK, we&#8217;re also pushing BlazeDS <em>(Java server libraries for data serialization and real-time messaging)</em>. In 2012, we&#8217;ll propose Falcon, a new generation compiler. We&#8217;ll also unveil and propose FalconJS, an experimental and advanced Flex to JavaScript compiler. More projects may also be proposed to Apache to build a first-class open Enterprise RIA stack.</li>
<li>For the first time, Adobe won&#8217;t be the sole influencer on the Flex roadmap. We&#8217;ll still have engineers working on it but the effort will also be advanced directly by work of top Flex developers in the community <em>(join the Spoon project if you&#8217;re one of them)</em>.</li>
</ul>
<div>
<h2>So Flex or HTML5 ?</h2>
<p>I&#8217;ve been working on Rich Enterprise applications for more than 6 years and I can tell you that it requires a lot of different skills and specialized knowledge. RIA developers, and especially Flex developers, know how complex it is to combine an efficient user experience with a maintainable client architecture. Flex is really the only cross-platform solutions on the desktop for rich applications. Today, 90% of Flex applications are internal apps <em>(statistics from what I see on the field)</em> available on the intranet and on the extranet to share the screens with external partners or customers. Flex apps won&#8217;t run in mobile browsers as Apple and MSFT don&#8217;t host plugins on their tablets<em> (we&#8217;re still waiting for the MSFT one by the way)</em> and as Adobe announced its intent to discontinue Flash in mobile browsers. Thanks to this decision, Adobe engineers are now focusing on Adobe AIR, the runtime that can execute and package your Flex applications as native iOS, Android and QNX (BlackBerry) apps. With the arrival of Flex 4.6 at the end of November, Flex apps will perform even better to deliver &#8220;native-like&#8221; experiences on smartphones and tablet devices. So what&#8217;s the market for Flex? Well it&#8217;s huge because we are focusing on Enterprise apps and not on Customer apps, we&#8217;re focusing on Enterprise data-driven apps, on rebranding and re-architecting existing Enterprise apps developed with Web 1.0 technologies or even client-server ones. That&#8217;s a growing market in all industries. Tablets will accelerate this need of user-oriented architectures, because if you deliver a bad user experience on tablets, you&#8217;ll immediately fail. The potential of RIA for desktop and tablet users is higher than ever because it unlocks ROI <em>(increase the productivity of your company, improve the decision making processes, reduce the learning curve and then the training costs for employees&#8230;)</em>. I know that today you&#8217;ll hear a lot of people talking about the growing role of tablet devices in our daily life, that tablets will replace PCs, etc&#8230; Who cannot agree? I&#8217;d like just to add that the Enterprise world is evolving at a different tempo. Believe me, you won&#8217;t see large organizations replacing all PCs by tablets next year. If it happens and if it makes sense, it will take years, maybe decades. Desktop users will still represent the main population of Enterprise apps end users for a very long time. With Flex, you can already target 100% of your desktop users without migrating to a new operating system or a new browser, and you can target 99% of tablet devices as you can now generate iOS and Android native apps.</p>
<p>This is regarding the market for Flex, but there&#8217;s also the &#8220;developer experience&#8221;. Flex has been designed for Enterprise developers who are used to working with object-oriented languages like Java, first-class debugging experiences (on the desktop and on mobile devices), continuous integration, agile development, modular applications managed by several development teams, productive tools based on Enterprise standard IDEs like Eclipse, etc&#8230; It&#8217;s by far the best and the most efficient coding experience on the market and that&#8217;s not trivial. Before developing a mission-critical application, you have to measure/estimate the development time. Flex is usually way faster than other solutions, for a better result at the end. That&#8217;s why it&#8217;s considered the leading RIA framework on the market. So, don&#8217;t be scared, Flex is not dead. I was not surprised to see some posts on the web promoting this idea. It&#8217;s a classic trend in our industry. Just to illustrate that point, I googled some queries. Here is my TOP 5 list of the dead technologies:</p>
<ol>
<li>&#8220;.NET is dead&#8221; is the big winner with 576000 search results on Google. Congratulations.</li>
<li>&#8220;JAVA is dead&#8221; is following with 138.000 results. I can hardly feel this trend from Devoxx and the 3200 Java developers around me <img src='http://www.riagora.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> </li>
<li>&#8220;PHP is dead&#8221; is a little child with only 35.600 results.</li>
<li>&#8220;Ruby is dead&#8221; is in the same range with 30.700 results.</li>
<li>&#8220;AJAX is dead&#8221; generates 6500 results.</li>
</ol>
<div>So we are newbies in this competition as &#8220;Flex is dead&#8221; only displays 5000 results <img src='http://www.riagora.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley'/>  I&#8217;m kidding of course, it&#8217;s a stupid analysis but it highlights that you shouldn&#8217;t always trust online articles about technologies lives. Try it with Flash, you&#8217;ll be amazed. Flash is a damned zombie <img src='http://www.riagora.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> . Ok&#8230; no more stupid games, let me go back to the future of Flex.</div>
<div>
<h2>How can I contribute ?</h2>
<p>After the announcement of our proposal to the Apache foundation, I received several emails from Flex developers and customers who want to contribute, to play a role in the roadmap, to fix bugs, etc&#8230; We&#8217;re still defining the process, so I cannot share any information on that today. But as soon as everything is defined, I&#8217;ll be the first writing tutorials to explain how to contribute. It&#8217;s such a big opportunity for the Flex community. It&#8217;s also a huge change of strategy and I&#8217;m aware of that, and some of you may be a little bit nervous. But Flex won&#8217;t be the only project in collaboration with Apache. We acquired Day software, and the engineers at Day are Apache masters, true open-source contributors. I like that. PhoneGap will also become an Apache project. Adobe is one of the top contributing companies to the Apache Foundation, and I fully embrace this strategy. I want Flex to become as popular as Tomcat in Enterprise architecture!</p>
<p>Let&#8217;s embrace this strategy together. Adobe is proud of Flex and super proud of what you achieve everyday with this framework. Based on the emotional reactions perceived on social networks this week, I can tell that we are all true and passionate Flex lovers. So let&#8217;s continue to build on that passion and work together on the future of Flex.</p>
</div>
</div>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/11/flex-is-open/&text=Flexcursion+with+Apache&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Flex</title>
         <link>http://gregsramblings.com/2011/11/11/flex/</link>
         <description>The Flex team just provided some insight into what&amp;#8217;s next for Flex - http://blogs.adobe.com/flex/2011/11/your-questions-about-flex.html</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3292</guid>
         <pubDate>Sat, 12 Nov 2011 01:42:01 +0000</pubDate>
         <content:encoded><![CDATA[<p><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2011/11/Flex-Logo.png"><img class="size-thumbnail wp-image-3294 alignleft" title="Flex-Logo" src="http://gregsramblings.com/wp-content/uploads/2011/11/Flex-Logo-150x150.png" alt="" width="150" height="150"/></a>The Flex team just provided some insight into what&#8217;s next for Flex - <a rel="nofollow" target="_blank" href="http://blogs.adobe.com/flex/2011/11/your-questions-about-flex.html">http://blogs.adobe.com/flex/2011/11/your-questions-about-flex.html</a></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F11%2F11%2Fflex%2F&amp;title=Flex" id="wpa2a_20"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>PhoneGap Day Videos now available</title>
         <link>http://gregsramblings.com/2011/11/03/relive-phonegap-day-with-videos/</link>
         <description>A great way to learn a lot about PhoneGap &amp;#8212; http://phonegap.com/2011/11/03/relive-phonegap-day-with-videos/</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3287</guid>
         <pubDate>Fri, 04 Nov 2011 03:10:13 +0000</pubDate>
         <content:encoded><![CDATA[<p>A great way to learn a lot about PhoneGap &#8212; <a rel="nofollow" target="_blank" href="http://phonegap.com/2011/11/03/relive-phonegap-day-with-videos/">http://phonegap.com/2011/11/03/relive-phonegap-day-with-videos/</a></p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F11%2F03%2Frelive-phonegap-day-with-videos%2F&amp;title=PhoneGap%20Day%20Videos%20now%20available" id="wpa2a_22"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Narcissus, segment your followers</title>
         <link>http://www.riagora.com/2011/10/narcissus-segment-your-followers/</link>
         <description>UPDATE: Twitter modified its API in the night. The desktop version has been updated (1.0.2). I&amp;#8217;m still waiting for Apple to review my update 1.0.2.  I&amp;#8217;ve been working on a Flex mobile application called Narcissus, and I finally found the time to finalize and publish it on the App Store. Narcissus is a free application, [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=835</guid>
         <pubDate>Mon, 31 Oct 2011 13:17:22 +0000</pubDate>
         <content:encoded><![CDATA[<p><em><span style="text-decoration:underline;">UPDATE</span>: Twitter modified its API in the night. The desktop version has been updated (1.0.2). I&#8217;m still waiting for Apple to review my update 1.0.2. </em></p>
<p>I&#8217;ve been working on a <strong>Flex mobile application</strong> called Narcissus, and I finally found the time to finalize and <a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/narcissus/id472974421?mt=8">publish it on the App Store</a>. Narcissus is a free application, available <a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/narcissus/id472974421?mt=8">on the App Store</a> for iPad users, and <a rel="nofollow" target="_blank" href="http://www.riagora.com/narcissus/Narcissus.air">on your desktop</a> thanks to the Adobe AIR runtime. Narcissus can analyze and segments the followers of a Twitter account. Inspired by Google + circles, Narcissus categorizes your followers in circles based on their activity on twitter (the number of tweets they sent) and their influence (the number of followers they get). It helps to understand who&#8217;s following you, how active your followers are on Twitter  and how influential they are. If you want your content to be re-tweeted and seen by a maximum of Twitter users, you&#8217;ll discover that you just need to focus on few people of your network. I&#8217;ve recorded a video that showcases the basic features of Narcissus.</p>
<p><embed width="580" height="423" type="application/x-shockwave-flash" src="http://www.youtube.com/v/2ZEfBlLGdXk?version=3&amp;hl=en_US"/></p> 
<p>This application has been developed with the Flex 4.5.1 framework and Flash Builder. It performs very well on all platforms (iPad, Android and the PlayBook), that&#8217;s why I want to share some tricks I&#8217;ve learnt building this app.</p>
<h3>Design Driven Development</h3>
<p>I&#8217;m clearly not a designer, but as I was the only person involved in this project, I forced myself to use the <strong>Design Driven Development</strong> methodology. It implies designing the full user-experience before writing one single line of code. As this project is a &#8220;data-visualization&#8221; application, the design process was obvious. The goal of a dashboard is to<strong> transform data into information</strong>. I know the data I can get from Twitter and I know what&#8217;s the user problem which is in this case: &#8220;how can I know better who&#8217;s following me on Twitter to be more efficient on my social network ?&#8221;. The UI of the application must bring solutions to that question. As it&#8217;s a dashboard application, I decided to use the &#8220;drill-down&#8221; strategy: start with a global view <em>(using circles)</em> and give the ability to drill-down <em>(analyze the list of followers per category and get the details about a follower)</em>. I think I spent at least <strong>4 hours in Photoshop</strong> to design the main screen, place the elements, design the circles, the callout popups, the icons&#8230; Then the second step is &#8220;what&#8217;s the best UI architecture to serve this design?&#8221;. I rapidly decided to use the new ViewNavigator class of Flex 4.5 and the IconItemRenderer to get the best performance on tablet devices. So I&#8217;m using a classic &lt;s:Application&gt; root tag that contains eight &lt;s:ViewNavigator&gt; components, one per circle. I spent two days on coding the application. Then I tested it on an iPAD, optimized the code <em>(mainly my database code)</em> and fixed some bugs.</p>
<h3>Optimizing SQLite calls</h3>
<p>When you test your application on your PC, SQLite always acts very well. When Narcissus retrieves the list of followers for one account, it needs to save all the ids in one table. So, if you analyze an account that has 2000 followers, it means that you need to fire 2000 INSERT SQL queries. On the desktop, it&#8217;s okay, it takes less than one second to Adobe AIR to save these 2000 lines. On the iPAD 1, it&#8217;s another story. It takes more or less 10 seconds, and it can freeze the UI. Very bad user-experience. That&#8217;s why I decided to use SQLite transactions. If you need to execute a batch of INSERT, DELETE or UPDATE queries, always use transactions. In other words, if you need to execute SQL queries that don&#8217;t return a result, you can use transactions. <strong>It reduced the SQLite processing time by 90% in my case.</strong> Here is a <span style="color:#3366ff;"><a rel="nofollow" target="_blank" href="http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7d47.html"><span style="color:#3366ff;">link to the doc</span></a></span> that explains how it works, and the code I&#8217;m using in the application.</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_6" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_6" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw2">var</span> sqlS<span class="sy0">:</span>SQLStatement = <span class="kw1">new</span> SQLStatement<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
			sqlS<span class="sy0">.</span>sqlConnection = sqlc<span class="sy0">;</span>
			sqlS<span class="sy0">.</span><span class="kw7">text</span> = <span class="st0">&quot;INSERT INTO &quot;</span><span class="sy0">+</span> tableName<span class="sy0">+</span><span class="st0">&quot;(idUser,screenName,name,url,description,circle,nbFollowers,statusCount,picture) VALUES (@IDUSER,@SCREENNAME,@NAME,@URL,@DESCRIPTION,@CIRCLE,@NBFOLLOWERS,@STATUSCOUNT,@PICTURE)&quot;</span><span class="sy0">;</span>
&nbsp;
			sqlc<span class="sy0">.</span>begin<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
			<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i<span class="sy0">:</span><a rel="nofollow" target="_blank" href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span class="kw5">int</span></a> = <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> arrayFollowers<span class="sy0">.</span><span class="kw7">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span>
			<span class="br0">&#123;</span>
				objUser = arrayFollowers<span class="sy0">.</span>getItemAt<span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@IDUSER'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span>idUser<span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@SCREENNAME'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span>screenName<span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@NAME'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span><span class="kw7">name</span><span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@URL'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span><span class="kw7">url</span><span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@DESCRIPTION'</span><span class="br0">&#93;</span> = myDescription<span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@CIRCLE'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span>circle<span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@NBFOLLOWERS'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span>nbFollowers<span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@STATUSCOUNT'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span>statusCount<span class="sy0">;</span>
				sqlS<span class="sy0">.</span><span class="kw7">parameters</span><span class="br0">&#91;</span><span class="st0">'@PICTURE'</span><span class="br0">&#93;</span> = objUser<span class="sy0">.</span>picture<span class="sy0">;</span>
				sqlS<span class="sy0">.</span>execute<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
			sqlc<span class="sy0">.</span>commit<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>I&#8217;m also using incremental savings (auto-save) for performance and user-experience reasons.</p>
<p>&nbsp;</p>
<h3>How to persist simple parameters</h3>
<p>I wanted to persist the settings <em>(activity and influence thresholds)</em> in a cleaner way than using a SQLite database. I started using the classic File API. The only directory that works on tablet devices is the Documents one. Here is some code that works both on desktop and tablet apps:</p>
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_7" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_7" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw2">var</span> file<span class="sy0">:</span>File = File<span class="sy0">.</span>documentsDirectory<span class="sy0">.</span>resolvePath<span class="br0">&#40;</span><span class="st0">'settingsNarcissus.inf'</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">if</span> <span class="br0">&#40;</span>file<span class="sy0">.</span>exists<span class="br0">&#41;</span> file<span class="sy0">.</span>deleteFile<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	<span class="kw2">var</span> fileStream<span class="sy0">:</span>FileStream = <span class="kw1">new</span> FileStream<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//create a file stream</span>
	fileStream<span class="sy0">.</span><span class="kw7">open</span><span class="br0">&#40;</span>file<span class="sy0">,</span> FileMode<span class="sy0">.</span>WRITE<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// and open the file for write</span>
	fileStream<span class="sy0">.</span><span class="kw7">writeObject</span><span class="br0">&#40;</span>object<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//write the object to the file</span>
	fileStream<span class="sy0">.</span><span class="kw7">close</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>But I&#8217;m not a big fan of the Files approach. That&#8217;s why I decided to use the Persitence Manager API. This class is so easy to use and so efficient!!! Here is how you can easily save and load settings from anywhere in your mobile project:</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_8" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_8" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="co1">//SAVE</span>
&nbsp;
<span class="kw2">var</span> object<span class="sy0">:</span>SettingsObj = <span class="kw1">new</span> SettingsObj<span class="br0">&#40;</span>thresholdTweets<span class="sy0">,</span>thresholdFollowers<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw2">var</span> persistenceMan<span class="sy0">:</span>PersistenceManager = <span class="kw1">new</span> PersistenceManager<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	persistenceMan<span class="sy0">.</span><span class="kw7">setProperty</span><span class="br0">&#40;</span><span class="st0">&quot;settings&quot;</span><span class="sy0">,</span>object<span class="br0">&#41;</span><span class="sy0">;</span>
	persistenceMan<span class="sy0">.</span><span class="kw7">save</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">//LOAD</span>
&nbsp;
<span class="kw2">var</span> persistenceMan<span class="sy0">:</span>PersistenceManager = <span class="kw1">new</span> PersistenceManager<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	<span class="kw1">try</span><span class="br0">&#123;</span>
		<span class="kw2">var</span> object<span class="sy0">:</span><a rel="nofollow" target="_blank" href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a> = persistenceMan<span class="sy0">.</span><span class="kw7">getProperty</span><span class="br0">&#40;</span><span class="st0">&quot;settings&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
		thresholdFollowers = object<span class="sy0">.</span>savedThresholdFollowers<span class="sy0">;</span>
		thresholdTweets = object<span class="sy0">.</span>savedThresholdTweets<span class="sy0">;</span>
	<span class="br0">&#125;</span><span class="kw1">catch</span><span class="br0">&#40;</span>e<span class="sy0">:</span><a rel="nofollow" target="_blank" href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span class="kw5">Error</span></a><span class="br0">&#41;</span><span class="br0">&#123;</span>
		<span class="co1">//error management if empty</span>
	<span class="br0">&#125;</span></pre></div></div>
<h3>Animations</h3>
<p>Some developers asked me how I managed the animations and the transitions with the circles. For the animations, I&#8217;m simply declaring basic MXML sequences. When I get the profile image picture of a Twitter account, I&#8217;m assigning it to a circle, and then I change the xTo and yTo coordinates of the &#8216;moveProfile&#8217; object. Here is how I declared the sequence.</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_9" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_9" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display:block;"><pre class="mxml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;s:Sequence</span> id=<span class="st0">&quot;seqAnimationProfile&quot;</span> target=<span class="st0">&quot;{profileImageComp}&quot;</span> effectEnd=<span class="st0">&quot;seqAnimationProfile_effectEndHandler(event)&quot;</span><span class="re2">&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;s:Fade</span>  alphaFrom=<span class="st0">&quot;0&quot;</span> alphaTo=<span class="st0">&quot;100&quot;</span> duration=<span class="st0">&quot;500&quot;</span><span class="re2">/&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;s:Move</span> id=<span class="st0">'moveProfile'</span>  xFrom=<span class="st0">&quot;480&quot;</span> yFrom=<span class="st0">&quot;380&quot;</span> duration=<span class="st0">&quot;800&quot;</span><span class="re2">&gt;</span></span>
				<span class="sc3"><span class="re1">&lt;s:easer</span><span class="re2">&gt;</span></span>
&nbsp;
					<span class="sc3"><span class="re1">&lt;s:Sine</span><span class="re2">/&gt;</span></span>
&nbsp;
				<span class="sc3"><span class="re1">&lt;/s:easer</span><span class="re2">&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;/s:Move</span><span class="re2">&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;s:Fade</span> alphaFrom=<span class="st0">&quot;100&quot;</span> alphaTo=<span class="st0">&quot;0&quot;</span> duration=<span class="st0">&quot;500&quot;</span><span class="re2">/&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;s:Move</span>  xTo=<span class="st0">&quot;480&quot;</span> yTo=<span class="st0">&quot;380&quot;</span> duration=<span class="st0">&quot;50&quot;</span><span class="re2">/&gt;</span></span>
		<span class="sc3"><span class="re1">&lt;/s:Sequence</span><span class="re2">&gt;</span></span></pre></div></div>
<p>Regarding the circles, I&#8217;m using the default transitions of the ViewNavigator object. To enjoy the background image, I&#8217;m placing eight ViewNavigator with a transparent background which load views with transparent background. Just set the backgroundAlpha property to 0 in the ViewNavigator tags AND in the View tags. The circles are also animated. To do so, I&#8217;m playing with MXML graphic properties. The static parts are PNG files (the background and the reflection effet at the top of the circle), the animated part is a Spark Graphic component. Here is the MXML code for a circle:</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_10" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_10" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display:block;"><pre class="mxml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;s:Image</span> horizontalCenter=<span class="st0">&quot;0&quot;</span> source=<span class="st0">&quot;assets/images/circleBack.png&quot;</span>   verticalCenter=<span class="st0">&quot;-20&quot;</span><span class="re2">/&gt;</span></span>
	<span class="sc3"><span class="re1">&lt;s:Graphic</span> id=<span class="st0">&quot;theCircle&quot;</span>  version=<span class="st0">&quot;2&quot;</span> horizontalCenter=<span class="st0">&quot;0&quot;</span> verticalCenter=<span class="st0">&quot;-20&quot;</span><span class="re2">&gt;</span></span>
		<span class="sc3"><span class="re1">&lt;s:Ellipse</span> height=<span class="st0">&quot;{radiusCircle}&quot;</span> width=<span class="st0">&quot;{radiusCircle}&quot;</span><span class="re2">&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;s:fill</span><span class="re2">&gt;</span></span>
				<span class="sc3"><span class="re1">&lt;s:SolidColor</span> color=<span class="st0">&quot;{data.colorCircle}&quot;</span><span class="re2">/&gt;</span></span>
			<span class="sc3"><span class="re1">&lt;/s:fill</span><span class="re2">&gt;</span></span>
		<span class="sc3"><span class="re1">&lt;/s:Ellipse</span><span class="re2">&gt;</span></span>
	<span class="sc3"><span class="re1">&lt;/s:Graphic</span><span class="re2">&gt;</span></span>
	<span class="sc3"><span class="re1">&lt;s:Image</span> horizontalCenter=<span class="st0">&quot;0&quot;</span> source=<span class="st0">&quot;assets/images/circleReflect.png&quot;</span> verticalCenter=<span class="st0">&quot;-87&quot;</span><span class="re2">/&gt;</span></span></pre></div></div>
<p>To animate the circles with some easing, I declared a Resize effect.</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_11" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_11" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="sy0">&lt;</span>fx<span class="sy0">:</span>Declarations<span class="sy0">&gt;</span>
		<span class="sy0">&lt;!--</span> Place non<span class="sy0">-</span>visual <span class="kw7">elements</span> <span class="br0">&#40;</span>e<span class="sy0">.</span>g<span class="sy0">.,</span> services<span class="sy0">,</span> <span class="kw7">value</span> objects<span class="br0">&#41;</span> here <span class="sy0">--&gt;</span>
		<span class="sy0">&lt;</span>s<span class="sy0">:</span>Resize id=<span class="st0">&quot;fxResize&quot;</span>  duration=<span class="st0">&quot;500&quot;</span>  <span class="kw7">target</span>=<span class="st0">&quot;{theCircle}&quot;</span><span class="sy0">&gt;</span>
			<span class="sy0">&lt;</span>s<span class="sy0">:</span>easer<span class="sy0">&gt;</span>
&nbsp;
				<span class="sy0">&lt;</span>s<span class="sy0">:</span>Sine<span class="sy0">/&gt;</span>
&nbsp;
			<span class="sy0">&lt;/</span>s<span class="sy0">:</span>easer<span class="sy0">&gt;</span>
		<span class="sy0">&lt;/</span>s<span class="sy0">:</span>Resize<span class="sy0">&gt;</span>
&nbsp;
	<span class="sy0">&lt;/</span>fx<span class="sy0">:</span>Declarations<span class="sy0">&gt;</span></pre></div></div>
<p>Leveraging the MXML tags of the Flex framework, you can very quickly build a professional iPAD application. Narcissus has been immediately approved by Apple on the App Store.</p>
<h3>Links</h3>
<p>If you want to use Narcissus on your desktop (MAC &amp; Windows), install this AIR application:</p>
<p><a rel="nofollow" target="_blank" href="http://www.riagora.com/narcissus/Narcissus.air">http://www.riagora.com/narcissus/Narcissus.air</a></p>
<p>If you have an iPAD, then you can find it on the App Store:</p>
<p><a rel="nofollow" target="_blank" href="http://itunes.apple.com/us/app/narcissus/id472974421?mt=8">http://itunes.apple.com/us/app/narcissus/id472974421?mt=8</a></p>
<p><strong>Feel free to add a nice review on the App Store.</strong> If you don&#8217;t like the app, don&#8217;t say anything <img src='http://www.riagora.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> </p>
<p>Narcissus is just a small app that showcases how creative you can be with basic Flex components on tablet devices. I&#8217;m working on the Android version <em>(I just need to fix some relative coordinates stuff to accept all screen resolutions)</em>.</p>
<p>I hope you&#8217;ll like it. Enjoy  !</p>
<p>&nbsp;</p>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/10/narcissus-segment-your-followers/&text=Narcissus%2C+segment+your+followers&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>JavaScript, CSS, HTML Frameworks and Tools – my list</title>
         <link>http://gregsramblings.com/2011/10/21/javascript-css-html-frameworks-tools-my-list/</link>
         <description>One of the challenges in the world of HTML/JavaScript/CSS app development is cobbling together your kitchen sink of frameworks, tools and other technologies. When you start looking around, it feels like there is an endless list of options, which is good and bad!  Recently, I&amp;#8217;ve been gathering a list of what&amp;#8217;s popular these days and [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3255</guid>
         <pubDate>Fri, 21 Oct 2011 20:57:50 +0000</pubDate>
         <content:encoded><![CDATA[<p style="text-align:center;"><img class="size-full wp-image-3260 aligncenter" style="border-width:1px;border-color:black;border-style:solid;" title="javascript-frameworks-500" src="http://gregsramblings.com/wp-content/uploads/2011/10/javascript-frameworks-500.jpg" alt="" width="500" height="360"/></p>
<p>One of the challenges in the world of HTML/JavaScript/CSS app development is cobbling together your kitchen sink of frameworks, tools and other technologies. When you start looking around, it feels like there is an endless list of options, which is good and bad!  Recently, I&#8217;ve been gathering a list of what&#8217;s popular these days and thought it might be useful for others to share. If you see anything obvious missing, please let me know.  Thanks to the following for helping me put together this list: <a rel="nofollow" target="_blank" href="http://www.coldfusionjedi.com/">Ray Camden</a>, <a rel="nofollow" target="_blank" href="http://www.tricedesigns.com/">Andy Trice</a>, <a rel="nofollow" target="_blank" href="http://wilsonhut.wordpress.com/">Philip Wilson</a>, <a rel="nofollow" target="_blank" href="http://coenraets.org/">Christophe Coenraets</a>, <a rel="nofollow" target="_blank" href="http://www.riaspace.net/">Piotr Walczyszyn</a>, and <a rel="nofollow" target="_blank" href="https://twitter.com/#!/ibjhb">James Brown</a>.</p>
<h4>In no particular order:</h4>
<ul>
<li><strong>Adobe Edge</strong> &#8211; HTML5/JS/CSS animation/interaction tool - <a rel="nofollow" target="_blank" href="http://labs.adobe.com/technologies/edge/">http://labs.adobe.com/technologies/edge/</a></li>
<li><strong>Less Framework</strong> &#8211; CSS grid system/layout - <a rel="nofollow" target="_blank" href="http://lessframework.com/">http://lessframework.com/</a></li>
<li><strong>Less</strong> &#8211; alternative CSS syntax &#8211; supports OO-like syntax &#8211; referenced by Google at Google IO &#8211; used in many projects - <a rel="nofollow" target="_blank" href="http://lesscss.org/">http://lesscss.org/</a></li>
<li><strong>Saas</strong> &#8211; another alternative CSS syntax &#8211; similar to Less - <a rel="nofollow" target="_blank" href="http://sass-lang.com/">http://sass-lang.com/</a></li>
<li><strong>Kendo UI Framework</strong> (mobile coming soon) - <a rel="nofollow" target="_blank" href="http://www.kendoui.com/">http://www.kendoui.com/</a></li>
<li><strong>Sencha</strong> - <a rel="nofollow" target="_blank" href="http://www.sencha.com/">http://www.sencha.com/</a> - multiple products &#8211; including Sencha Touch, Charts, etc.</li>
<li><strong>JQuery UI</strong> - <a rel="nofollow" target="_blank" href="http://jqueryui.com/">http://jqueryui.com/</a></li>
<li><strong>JQuery (core)</strong> - <a rel="nofollow" target="_blank" href="http://jquery.com/">http://jquery.com/</a></li>
<li><strong>JQuery Mobile</strong> - <a rel="nofollow" target="_blank" href="http://jquerymobile.com/">http://jquerymobile.com/</a></li>
<li><strong>xui</strong> -minimalist JQuery-like framework - <a rel="nofollow" target="_blank" href="http://xuijs.com/">http://xuijs.com/</a></li>
<li><strong>zepto.js</strong> &#8211; minimalist JQuery-like framework - <a rel="nofollow" target="_blank" href="http://zeptojs.com/">http://zeptojs.com/</a></li>
<li><strong>Backbone.js</strong> MVC framework for JavaScript - <a rel="nofollow" target="_blank" href="http://documentcloud.github.com/backbone/">http://documentcloud.github.com/backbone/</a></li>
<li><strong>Underscore.js</strong> &#8211; Kitchen-sink utilities for JavaScript - <a rel="nofollow" target="_blank" href="http://documentcloud.github.com/underscore/">http://documentcloud.github.com/underscore/</a></li>
<li><strong>Modernizr</strong> &#8211; JavaScript library to detect device features &#8211; very popular - <a rel="nofollow" target="_blank" href="http://modernizr.com/">http://modernizr.com/</a></li>
<li><strong>cubiq.org</strong> &#8211; home of iScroll, a very popular scroll/list lib - <a rel="nofollow" target="_blank" href="http://cubiq.org/">http://cubiq.org/</a></li>
<li><strong>appMobi</strong> &#8211; web-based dev with emulation, etc.  Also has an HTML5-framework - <a rel="nofollow" target="_blank" href="http://www.appmobi.com/">http://www.appmobi.com/</a></li>
<li><strong>LeviRoutes</strong> - lightweight routes framework for hooking in to HTML5 history - <a rel="nofollow" target="_blank" href="https://github.com/PaulKinlan/leviroutes">https://github.com/PaulKinlan/leviroutes</a></li>
<li><strong>Mustache</strong> &#8211; &#8220;logic-less templates&#8221; &#8211; mentioned by Google presenters at Google IO - <a rel="nofollow" target="_blank" href="http://mustache.github.com/">http://mustache.github.com/</a></li>
<li><strong>Midori</strong> &#8211; JavaScript framework &#8211; JQuery-like with some unique features - <a rel="nofollow" target="_blank" href="http://www.midorijs.com/">http://www.midorijs.com/</a></li>
<li><strong>Knockout.js</strong> &#8211; JavaScript UI framework &#8211; implements MVVM pattern &#8211; recommended by Greg&#8217;s brother &#8211; popular - <a rel="nofollow" target="_blank" href="http://knockoutjs.com/">http://knockoutjs.com/</a></li>
<li><strong>AngularJS</strong> &#8211; MVC framework, two-way data binding, JQuery-compatible - <a rel="nofollow" target="_blank" href="http://angularjs.org/">http://angularjs.org/</a></li>
<li><strong>JSFiddle</strong> &#8211; online tool for doing lint/tidy/debugging - <a rel="nofollow" target="_blank" href="http://jsfiddle.net/">http://jsfiddle.net/</a></li>
<li><strong>HighCharts</strong> &#8211; fantastic looking charts - <a rel="nofollow" target="_blank" href="http://www.highcharts.com/">http://www.highcharts.com/</a></li>
<li><strong>ZingCharts</strong> &#8211; HTML5/SVG/VML and Flash charts - <a rel="nofollow" target="_blank" href="http://www.zingchart.com/#welcome">http://www.zingchart.com/#welcome</a></li>
<li><strong>AMCharts</strong> &#8211; JavaScript/HTML5-based charts.  They also offer Flash-based charts. - <a rel="nofollow" target="_blank" href="http://www.amcharts.com/javascript/">http://www.amcharts.com/javascript/</a></li>
<li><strong>HTML5 Boiler Plate</strong> &#8211; assist with cross-browser issues and other utils - <a rel="nofollow" target="_blank" href="http://html5boilerplate.com/">http://html5boilerplate.com/</a></li>
<li><strong>Bootstrap, from Twitter</strong> - Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. <a rel="nofollow" target="_blank" href="http://twitter.github.com/bootstrap/">http://twitter.github.com/bootstrap/</a></li>
<li><strong>Popcorn.js</strong> &#8211; HTML5/JS Media Framework - <a rel="nofollow" target="_blank" href="http://popcornjs.org/">http://popcornjs.org/</a></li>
<li><strong>Three.js</strong> &#8211; JavaScript 3D engine - <a rel="nofollow" target="_blank" href="https://github.com/mrdoob/three.js">https://github.com/mrdoob/three.js</a> and <a rel="nofollow" target="_blank" href="http://www.aerotwist.com/lab/getting-started-with-three-js/">http://www.aerotwist.com/lab/getting-started-with-three-js/</a></li>
<li><strong>PhoneGap</strong> &#8211; <a rel="nofollow" target="_blank" href="http://phonegap.com">http://phonegap.com</a></li>
<li><strong>PhoneGap Plugins</strong> - <a rel="nofollow" target="_blank" href="https://github.com/phonegap/phonegap-plugins">https://github.com/phonegap/phonegap-plugins</a></li>
<li><strong>Require.js</strong> &#8211; <a rel="nofollow" target="_blank" href="http://requirejs.org">http://requirejs.org</a> - RequireJS is a JavaScript file and module loader</li>
<li><strong>Brunch</strong> - <a rel="nofollow" target="_blank" href="http://brunch.io/">http://brunch.io/</a> - A lightweight approach to building HTML5 applications with emphasis on elegance and simplicity.</li>
</ul>
<div>I&#8217;m also collecting a list of great learning resources, especially videos from Google IO and other conferences.  I&#8217;ll blog this list soon.</div>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F10%2F21%2Fjavascript-css-html-frameworks-tools-my-list%2F&amp;title=JavaScript%2C%20CSS%2C%20HTML%20Frameworks%20and%20Tools%20%E2%80%93%20my%20list" id="wpa2a_24"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Analytics in your Flex mobile apps</title>
         <link>http://www.riagora.com/2011/10/analytics-in-your-flex-mobile-apps/</link>
         <description>Analytics is a natural asset of an efficient website. If you don&amp;#8217;t collect, measure and analyze your internet data, you cannot maintain and optimize your web applications. Surprisingly, analytics are rarely used for Enterprise applications, and that&amp;#8217;s shocking. IT services deliver complex applications, with a lot of screens, tabs and advanced navigation components and they [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=826</guid>
         <pubDate>Thu, 20 Oct 2011 08:54:31 +0000</pubDate>
         <content:encoded><![CDATA[<p>Analytics is a natural asset of an efficient website. If you don&#8217;t collect, measure and analyze your internet data, you cannot maintain and optimize your web applications. Surprisingly, analytics are rarely used for Enterprise applications, and that&#8217;s shocking. IT services deliver complex applications, with a lot of screens, tabs and advanced navigation components and they just never analyze how their RIAs are used. Internal apps would benefit so much from analytics solutions. I feel that we are reproducing the same mistake with mobile applications. As we are living the early-ages of mobile apps, it&#8217;s time so standardize analytics in Flex mobile apps. Adobe Omniture is the most professional analytics solution of the market. As you can guess, it&#8217;s very easy to add analytics tags in a Flex application. We even developed an Omniture extension for Flash Builder. Check this article is you are Omniture customers: <a rel="nofollow" target="_blank" href="http://www.adobe.com/devnet/flex/articles/sitecatalyst_extension_flashbuilder.html">http://www.adobe.com/devnet/flex/articles/sitecatalyst_extension_flashbuilder.html</a> I know that you are not all Omniture customers, and for simple needs you may choose a free solution such as Google Analytics that would answer your basic needs.</p>
<p>Google Analytics is also trying to ease the addition of tracking events inside Flex applications. Unfortunately, the current version of the<a rel="nofollow" target="_blank" href="http://code.google.com/apis/analytics/docs/tracking/flashTrackingIntro.html"> Google Analytics Tracker library</a> doesn&#8217;t support Flex mobile projects. As I really needed this feature for a mobile app (that I will unveil next week), I modified the source code of the GATracker library and now it works like a charm. You can track everything, I mean everything:</p>
<p>- If you have HTTPService requests, you can track how many successful results your users get and  compared this number with the number HTTP fault events.</p>
<p>- If you have 5 tabs in your mobile apps, measure what is the most used tab, check if they are all used. You can also imagine to track the most common path for your app and track scenarios such as &#8220;the user hits tab 1, then tab 3 and then tab 2, is the main use case&#8221;.</p>
<p>Your mission is to defined what makes sense in your application, and which information will help optimizing it. Here are the steps I used to add Google Analytics tracking information in my mobile application:</p>
<p>1. Download the source (not the SWC) of the Google Analytics for Flash library:  <a rel="nofollow" target="_blank" href="http://code.google.com/p/gaforflash/">http://code.google.com/p/gaforflash/</a></p>
<p>2. Open your Flex mobile project and add the code inside your project. It will create a com.google.analytics package with a lot of AS3 classes.</p>
<p>In your Google Analytics console, you need to measure an existing website (in my case riagora.com) and add the classic Google Analytics JavaScript library. Then your website will be validated and you&#8217;ll be given an ID for your website by Google. We&#8217;ll surcharge the tracking information of your website with mobile tracking information. The ID of your website should look like this chain of characters: UA-2999999-2.</p>
<p>3. On the application level (your root MXML file), create an AnalyticsTracker variable and instantiate a GATracker. The tracking variable is public. Add this code for instance:</p>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_12" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_12" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw1">public</span> <span class="kw2">var</span> tracker<span class="sy0">:</span>AnalyticsTracker<span class="sy0">;</span>
<span class="kw1">protected</span> <span class="kw3">function</span> viewnavigatorapplication1_creationCompleteHandler<span class="br0">&#40;</span>event<span class="sy0">:</span>FlexEvent<span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span>
<span class="br0">&#123;</span>
	<span class="co1">// TODO Auto-generated method stub</span>
	tracker = <span class="kw1">new</span> GATracker<span class="br0">&#40;</span><span class="kw1">this</span><span class="sy0">,</span><span class="st0">&quot;YOUR_GOOGLE_ANALYTICS_WEBSITE_ID&quot;</span><span class="sy0">,</span><span class="st0">&quot;AS3&quot;</span><span class="sy0">,</span><span class="kw1">false</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>4. If you want to track something, just call the trackPageview method. It&#8217;s waiting for the name of the HTML page as a parameter. Create custom names such as &#8220;/mobileApp-Success&#8221;, or &#8220;/mobileApp-tab1&#8243;.</p>
<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_13" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_13" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw1">protected</span> <span class="kw3">function</span> button1_clickHandler<span class="br0">&#40;</span>event<span class="sy0">:</span><a rel="nofollow" target="_blank" href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span>
<span class="br0">&#123;</span>
	<span class="co1">// TODO Auto-generated method stub</span>
					FlexGlobals<span class="sy0">.</span>topLevelApplication<span class="sy0">.</span>tracker<span class="sy0">.</span>trackPageview<span class="br0">&#40;</span><span class="st0">'/mobileApp-tab1'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>5. Now if you compile your project, you&#8217;ll get error messages such as the famous TypeError #1009, also known as &#8220;the error that doesn&#8217;t help&#8221;. Let&#8217;s start modifying the Google Analytics code.</p>
<p>6. Open the class components/FlexTracker.as</p>
<p>7. Search and replace this code:</p>
<div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_14" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_14" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw2">var</span> appclass<span class="sy0">:</span><a rel="nofollow" target="_blank" href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span class="kw5">Object</span></a> = <span class="kw7">getDefinitionByName</span><span class="br0">&#40;</span> <span class="st0">&quot;mx.core::Application&quot;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
 _app = appclass<span class="sy0">.</span>application<span class="sy0">;</span></pre></div></div>
<p>by code that doesn&#8217;t refer to MX Application. In Flex 4.5, we don&#8217;t use MX applications anymore, but we can use the FlexGlobals class <img src='http://www.riagora.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley'/> </p>
<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_15" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_15" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;">appclass = <span class="kw7">getDefinitionByName</span><span class="br0">&#40;</span> <span class="st0">&quot;mx.core::FlexGlobals&quot;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
_app = appclass<span class="sy0">.</span>topLevelApplication<span class="sy0">;</span></pre></div></div>
<p>8. Then we need to add the root URL of our virtual website (in my case riagora.com). By default, the library tries to get the URL from browser information&#8230; well this cannot work with a mobile app running in AIR, so we&#8217;ll hard-code the URL Open the GATracker.as class. Comment the _env.url line and add your own root URL.</p>
<div id="wpshdo_16" class="wp-synhighlighter-outer"><div id="wpshdt_16" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_16" class="wp-synhighlighter-title" href="#codesyntax_16" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_16" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_16" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_16" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;"><span class="co1">//_env.url = _display.stage.loaderInfo.url;</span>
_env<span class="sy0">.</span><span class="kw7">url</span> = <span class="st0">&quot;http://www.riagora.com/&quot;</span><span class="sy0">;</span></pre></div></div>
<p>9. We still have to deal with small &#8216;stage&#8217; issues. Open the core/IdleTimer.as class and comment two lines of code that deal with the Stage:</p>
<div id="wpshdo_17" class="wp-synhighlighter-outer"><div id="wpshdt_17" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a rel="nofollow"></a><a rel="nofollow" id="wpshat_17" class="wp-synhighlighter-title" href="#codesyntax_17" title="Click to show/hide code block">Code block</a></td><td align="right"><a rel="nofollow" href="#codesyntax_17" title="Show code only"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png"/></a>&nbsp;<a rel="nofollow" href="#codesyntax_17" title="Print code"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png"/></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/plugins/wp-synhighlight/About.html" title="Show plugin information"><img border="0" style="border:0 none;" src="http://www.riagora.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif"/></a>&nbsp;</td></tr></table></div><div id="wpshdi_17" class="wp-synhighlighter-inner" style="display:block;"><pre class="actionscript3" style="font-family:monospace;">_debug      = debug<span class="sy0">;</span>
         <span class="co1">//   _stage      = display.stage;</span>
            _buffer     = buffer<span class="sy0">;</span>
            _lastMove   = <span class="kw7">getTimer</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
            _inactivity = inactivity <span class="sy0">*</span> <span class="nu0">1000</span><span class="sy0">;</span> <span class="co1">//milliseconds</span>
&nbsp;
            _loop<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span> <a rel="nofollow" target="_blank" href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="sy0">.</span><span class="kw8">TIMER</span><span class="sy0">,</span> checkForIdle <span class="br0">&#41;</span><span class="sy0">;</span>
            _session<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span> <a rel="nofollow" target="_blank" href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="sy0">.</span><span class="kw8">TIMER_COMPLETE</span><span class="sy0">,</span> endSession <span class="br0">&#41;</span><span class="sy0">;</span>
          <span class="co1">//  _stage.addEventListener( MouseEvent.MOUSE_MOVE, onMouseMove );</span></pre></div></div>
<p>10. And that&#8217;s it!!! Within the Google Analytics console, you can now create custom dashboards, filtering the visited pages that starts with &#8220;/mobileApp&#8221;.<a rel="nofollow" target="_blank" href="http://www.riagora.com/wp-content/uploads/2011/10/analyticsTracking.jpg"><br />
</a></p>
<p>11. You can download this sample Flex 4.5.1 project that contains my updated Google Analytics library. Here is the link to this Flash Builder project: <a rel="nofollow" target="_blank" href="http://riagora.com/pvt_content/android/GoogleAnalytics.fxp">http://riagora.com/pvt_content/android/GoogleAnalytics.fxp</a></p>
<p><strong>WARNING:</strong> Google Analytics doesn&#8217;t display the results in real-time ! You have to wait for 24 hours before seeing some tracking results.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/10/analytics-in-your-flex-mobile-apps/&text=Analytics+in+your+Flex+mobile+apps&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Tablet devices and Enterprise apps</title>
         <link>http://www.riagora.com/2011/10/tablet-devices-and-enterprise-apps/</link>
         <description>My talk at Adobe MAX was about the future role of tablet devices in large organizations, and the impact of this new generation of devices on IT services. Tablets will rapidly become a tremendous business opportunity for Flex developers. I was happily surprised by the number of sessions about tablets at MAX. A lot of [...]</description>
         <guid isPermaLink="false">http://www.riagora.com/?p=816</guid>
         <pubDate>Fri, 14 Oct 2011 10:10:12 +0000</pubDate>
         <content:encoded><![CDATA[<p>My talk at Adobe MAX was about the future role of tablet devices in large organizations, and the impact of this new generation of devices on IT services. Tablets will rapidly become a tremendous business opportunity for Flex developers. I was happily surprised by the number of sessions about tablets at MAX. A lot of Flex developers such as Christophe gave some nice technical tips on how to develop engaging mobile apps. For my session, I wanted to give some tips but also to explain why tablet devices will play a key role.</p>
<p>When you look at how humans have interacted with enterprise knowledge over the years and even today, paper is still very present. You often interact directly with the knowledge on a horizontal plan using a pen, but this can hardly be centralized. Collaboration on a whiteboard is also an interesting case. You share and review the knowledge on a vertical plane. Often this knowledge is lost as collaboration is thought of as a temporary step in an enterprise workflow or a decision making process. These two interactions (paper and whiteboard) are still very common in large organizations, and that&#8217;s how we learn things at school. Personal computers introduced a different approach due to the rise of mice and keyboards. You move your mouse on an horizontal plane, it acts on a vertical plane that hosts the knowledge. For the first time the knowledge could be easily centralized and shared beyond the firewall (the extended company) with partners and external customers. Inspired by typewriters, PCs are not mobile at all, even less mobile than paper. The laptop was the first attempt of mobility. It automatically extended our work area and let us interact with the enterprise knowledge from home and on the road. But it also introduced some of the worst interactions ever (trackpad, balls, etc&#8230;). Smartphones are the real truly mobile device, the first that can answer the &#8220;anywhere and at any time&#8221; requirement. But the typing experience is bad and the small screens don&#8217;t let you review documents for instance. For all these reasons, you can see why tablets are a natural evolution. Although there&#8217;s still progress to be made, tablets are fully mobile, the typing experience is good, the large screen lets you review documents, and for the first time, and you can combine pleasure and work on the same device.</p>
<p>The rise of tablet devices in large organizations introduces new challenges for IT services. They have to define new processes to secure the configuration and deployment of apps, they have to ensure that mobile apps are auditable and compliant, and, most of all, they have to run existing applications. On the other side, end users are already tablet ninjas. That&#8217;s why there will be a gap between what IT services can deliver and users&#8217; expectations. I also believe that native applications deliver the experience that people expect. If you deliver a classic web app on a tablet, employees won&#8217;t feel the benefits and they will wait until they are in front of a PC to interact with your app. By the way, I don&#8217;t think that tablet devices will replace laptops or PC. Sometimes, it will be complementary, and sometimes yes, there will be some cannibalization. If you look at the enterprise apps developed on tablets in 2011, they were mainly targeting three populations: the top managers, the sales force and the inspectors. Top managers need a real-time access to strategic information. They want dashboards to accelerate and improve their decision making time. The sales force uses tablets for two reasons. It&#8217;s a fantastic device to showcase the products  you&#8217;re selling, and it&#8217;s also a nice way to interact with the CRM. Inspectors, or employees that need to audit external environments, are naturally using tablets to access technical information, capture data in the field and collaborate. Tomorrow, anyone is a potential tablet candidate. Even I as a developer, I can imagine having a tablet with a companion app, helping me browsing the AS3 doc for instance (I think that someone had this idea before me&#8230; more to come&#8230;).</p>
<p>Flex developers can answer these new needs very easily. We are in pole position. If we embrace a Design-Driven Development methodology, we&#8217;ll be very successful. DDD consists of defining the technical infrastructure of your solution based on the user experience. The UI is here to solve end users&#8217; problems, and the system serves the UI. If you build a system-centric application on a tablet, with a UI that reflects the system, then you&#8217;ll fail. I hope that tablets will boost the Design-Driven methodology in large organizations. It would also increase the number of Rich Internet Applications. Today, RIA frameworks (and especially Flex) are much more mature than enterprise IT services.  Even with the best technology, if IT services stick to their traditional way of developing products, they will fail again and again. Flex developers need to become DDD sponsors.</p>
<p>Here is the recording of my presentation. You&#8217;ll also find my slides (hosted by SlideShare) at the end of this article.</p>
<p>&nbsp;</p>
<p></p> 
<div id="__ss_9558667" style="width:425px;"><strong style="display:block;margin:12px 0 4px;"><a rel="nofollow" title="Enterprise Flex applications on tablet devices" target="_blank" href="http://www.slideshare.net/mchaize/enterprise-flex-applications-on-tablet-devices">Enterprise Flex applications on tablet devices</a></strong> <embed id="__sse9558667" width="425" height="355" type="application/x-shockwave-flash" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=adobemaxtablets-111005095326-phpapp02&amp;stripped_title=enterprise-flex-applications-on-tablet-devices&amp;userName=mchaize"/> 
<div style="padding:5px 0 12px;">View more <a rel="nofollow" target="_blank" href="http://www.slideshare.net/">presentations</a> from <a rel="nofollow" target="_blank" href="http://www.slideshare.net/mchaize">Michael Chaize</a></div>
</div>
<div class="tweetthis" style="text-align:left;"><p> <a rel="nofollow" class="tt" target="_blank" href="http://twitter.com/share?url=http://www.riagora.com/2011/10/tablet-devices-and-enterprise-apps/&text=Tablet+devices+and+Enterprise+apps&via=mchaize&related=richardxthripp%2Ctweetthisplugin" title="Post to Twitter"><img class="nothumb" src="http://www.riagora.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter"/></a></p></div><div id="google_plus_one"></div>]]></content:encoded>
      </item>
      <item>
         <title>Upgrading my MacBook Pro to a SSD (solid state drive)</title>
         <link>http://gregsramblings.com/2011/10/12/upgrading-my-macbook-pro-to-a-ssd-solid-state-drive/</link>
         <description>Solid-state drives (SSDs) have been available for a few years now, but I&amp;#8217;ve been reluctant to move to one due to some early problems that friends of mine had.  When a SSD fails, there is no warning&amp;#8230; no clicking drive sound, and no opportunity to save a few files.  When it crashes, it&amp;#8217;s instant death. [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3240</guid>
         <pubDate>Wed, 12 Oct 2011 21:31:29 +0000</pubDate>
         <content:encoded><![CDATA[<p>Solid-state drives (SSDs) have been available for a few years now, but I&#8217;ve been reluctant to move to one due to some early problems that friends of mine had.  When a SSD fails, there is no warning&#8230; no clicking drive sound, and no opportunity to save a few files.  When it crashes, it&#8217;s instant death.  I&#8217;m usually a bleeding edge guy when it comes to technology, but converting my primary drive on my primary development machine was a bit scary, so I&#8217;ve waited.  Current SSDs are much more reliable and I don&#8217;t hear of any crash stories any more, so I felt it was time.  Yesterday I upgraded my MacBook Pro 15&#8243; (early 2011 model) from a 500GB 7200RPM drive to a 300GB SSD. After tweeting about it, I had a few people ask me what steps I took, so I have documented it:</p>
<p><strong>Stuff needed:</strong></p>
<ul>
<li>Small Phillips-head screwdriver</li>
<li>T6 Torx screwdriver (I found one at the local CompUSA as part of a small computer toolkit that cost less than $15)</li>
<li>New hard drive &#8211; in my case, it&#8217;s the <a rel="nofollow" target="_blank" href="http://www.amazon.com/gp/product/B004T0DNI8">Intel 320 Series 300GB SATA 3.0 GB-s 2.5&#8243; Solid State drive</a></li>
<li>SATA USB Docking station &#8211; allows you to access the new hard drive as a USB drive.  There are many alternatives.  I&#8217;ve had the <a rel="nofollow" target="_blank" href="http://www.amazon.com/gp/product/B001A4HAFS/">Thermaltake BlacX</a> for a couple of years.</li>
<li>Software to clone hard drives.  There are a few options, but I use <a rel="nofollow" target="_blank" href="http://www.bombich.com/">Carbon Copy Cloner</a>.  This software is also good for creating bootable USB drive images of your main drive.  In a pinch, you could boot off your USB drive and keep going if your main drive crashes.</li>
<li>Good directions on replacing the hard drive.  The iFixit site always has good directions.  For my early-2011 MacBook pro 15&#8243;, I used <a rel="nofollow" target="_blank" href="http://www.ifixit.com/Guide/Installing-MacBook-Pro-15-Inch-Unibody-Early-2011-Hard-Drive-Replacement/5895/1">this page</a>.</li>
</ul>
<p><center><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2011/10/intel320a.png"><img class="size-thumbnail wp-image-3242 alignnone" title="intel320a" src="http://gregsramblings.com/wp-content/uploads/2011/10/intel320a-150x150.png" alt="" width="150" height="150"/> </a>    <a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2011/10/blacxa.png"><img class="size-thumbnail wp-image-3243 alignnone" title="blacxa" src="http://gregsramblings.com/wp-content/uploads/2011/10/blacxa-150x150.png" alt="" width="150" height="150"/></a></center><strong>Steps I took:</strong></p>
<ol>
<li>I cleaned up my existing hard drive.  Since I was downsizing (for the first time in my life!), I had to do some serious space making (long overdue).</li>
<li>I plugged my new SSD into the SATA USB Dock and connected it to my computer.</li>
<li>I formatted the drive using Disk Utility.  I used the same format as my main drive (Mac OS Extended (Journaled)).</li>
<li>I ran Carbon Copy Cloner and set it to copy everything.  This took about 4 hours on my machine.  During that 4 hours, I continued to work knowing that I would be slightly out of sync when the cloning process was complete.</li>
<li>After the clone was finished, I shut down Mail, Calendar, Eclipse, Evernote, etc., and ran the clone process again as an incremental update.  This took less than 30 minutes.</li>
<li>I then shut down the MacBook Pro, unplugged it and flipped it upside down to start the surgery.</li>
<li>I followed the instructions at <a rel="nofollow" target="_blank" href="http://www.ifixit.com/Guide/Installing-MacBook-Pro-15-Inch-Unibody-Early-2011-Hard-Drive-Replacement/5895/1">http://www.ifixit.com/Guide/Installing-MacBook-Pro-15-Inch-Unibody-Early-2011-Hard-Drive-Replacement/5895/1</a> to swap the drives.  Depending on which model of MacBook you have, you may need to find alternative instructions.  For the early 2011 MacBook Pro 15&#8243;, it&#8217;s a piece of cake.  The only nervous moment was getting the bottom panel to snap off.  It takes some gentle prying.  Everything else was easy.  Since I was only replacing the hard drive, I skipped the step about disconnecting the battery.  (Do this at your own risk)</li>
<li>I put everything back together and booted it up.</li>
<li>After it was up and going, I turned off the hard drive sleep feature in SETTINGS, ENERGY SAVER (uncheck the &#8220;Put the hard disks(s) to sleep when possible&#8221; on both BATTERY and POWER ADAPTER).</li>
<li>All modern MacBooks have sudden motion sensors that halt the hard drive when motion is detected to save the drive heads.  Since this is a solid state drive with no moving parts, I turned off this feature using the following command in terminal: <strong>sudo pmset -a sms 0</strong></li>
<li>I then went to disk utility and verified the disk, and ran the repair permissions function.  This is always a good idea after doing any drive swap.</li>
</ol>
<div><strong>Results:</strong></div>
<div>I expected things to be faster, but WOW!  Boot time is crazy fast.  There is no pause between logging in and being able to launch an app.  Everything on the system is faster!  Build time for Flex apps is cut in half!  The drive will pay for itself in a few weeks in saved time.  The silence is a little eerie at first, but I&#8217;ve quickly adjusted.  :)</div>
<p>&nbsp;</p>
<div><strong>UPDATE</strong>: I put a 500GB regular hard drive in the optical bay using the <a rel="nofollow" target="_blank" href="http://eshop.macsales.com/item/Other+World+Computing/DDAMBS0GB/">OWC Data Doubler</a>.  The kit is fantastic and worth every penny.  It contains all of the tools that you need and their website has videos clearly documenting the hardware replacement.  I use the 2nd drive for backups, VMWare images and other media.  After I put this drive in, I decided to undo the command above that turns off hard drive sleep mode.  So far, everything has been working great.  To conserve battery life, I manually eject the drive.  Here are two command-line tricks for managing the 2nd hard drive:</div>
<p>&nbsp;</p>
<div>
<ul>
<li><strong>diskutil eject /dev/disk1</strong>  &#8211; ejects my 2nd hard drive which forces it to power down.  The drive is then unavailable until you remount it using the following command.</li>
<li><strong>diskutil mountDisk /dev/disk1</strong>  &#8212; mounts the drive again.</li>
</ul>
<p><strong>The OWC Data Doubler:</strong></p>
<div><a rel="nofollow" target="_blank" href="http://eshop.macsales.com/item/Other+World+Computing/DDAMBS0GB/"><img class="size-medium wp-image-3283" title="OWC Data Doubler" src="http://gregsramblings.com/wp-content/uploads/2011/10/datadoubler_hero10-300x186.jpg" alt="" width="300" height="186"/></a></div>
</div>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F10%2F12%2Fupgrading-my-macbook-pro-to-a-ssd-solid-state-drive%2F&amp;title=Upgrading%20my%20MacBook%20Pro%20to%20a%20SSD%20%28solid%20state%20drive%29" id="wpa2a_26"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Stupid PhoneGap Tricks – loading external content</title>
         <link>http://gregsramblings.com/2011/10/12/stupid-phonegap-tricks-loading-external-content/</link>
         <description>Most PhoneGap apps are built so that the HTML/JS/CSS content is bundled into the app (see my previous blog post).  I wondered if it was possible to load external content into the PhoneGap container, and after a few minutes of looking at the APIs, I discovered that it is doable, at least on Android (I&amp;#8217;ll [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3229</guid>
         <pubDate>Wed, 12 Oct 2011 06:18:15 +0000</pubDate>
         <content:encoded><![CDATA[<p>Most PhoneGap apps are built so that the HTML/JS/CSS content is bundled into the app (see my <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2011/10/06/what-is-phonegap/">previous blog post</a>).  I wondered if it was possible to load external content into the PhoneGap container, and after a few minutes of looking at the APIs, I discovered that it is doable, at least on Android (I&#8217;ll try iOS later, but if you are reading this and already know how to do it on iOS, please comment).</p>
<p>Simply modify the main Java Class of your PhoneGap Android project and set the <strong>loadInWebView</strong> property to <strong>true</strong> &#8211; then simply load your content using http:// instead of file://.  If you try using http:// without setting the loadInWebView property, it will open the page in the device&#8217;s browser and your code won&#8217;t have access to the device APIs.</p>
<p>For example:</p>
<pre>
package com.gregwilson.gregpg1;

import com.phonegap.*;

public class GregPG1Activity extends DroidGap {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setBooleanProperty(&quot;loadInWebView&quot;, true);
        super.loadUrl(&quot;http://somewebsite/index.html&quot;);
        //ORIGINAL--&gt; super.loadUrl(&quot;file:///android_asset/www/index.html&quot;);
    }
}
</pre>
<p>Since the web content is loaded and executed in the PhoneGap container, you can use any PhoneGap JavaScript APIs you desire just as if the code was loaded from the device. A few thoughts:</p>
<ul>
<li>This could actually speed up parts of the development workflow because now I can simply modify the HTML/CSS/JS and reload the page (once I add a reload button!).  It avoids having to deploy the app over and over.</li>
<li>This opens up a huge security hole.  Imagine if someone could hack your web server and inject some new JavaScript.  Since the JavaScript executes on the device, in the PhoneGap container, it could easily extract or delete your contacts, determine your location and many other devious things.  Therefore, I would NOT recommend doing this for anything other than testing.
<li>There might be some interesting hybrid apps where some of the content is sourced from the server while other content is on the device, but I&#8217;m fairly sure this would not be a &#8220;best practice&#8221; without further code changes to avoid the security issues.</li>
<li>Assuming this is possible on iOS, I&#8217;m fairly certain that your app could be rejected since you are loading external code (a no-no in iOS-land).</li>
</ul>
<p>I&#8217;m not a PhoneGap expert (yet!), so feel free to correct me.  I&#8217;m basically blogging as I learn!</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F10%2F12%2Fstupid-phonegap-tricks-loading-external-content%2F&amp;title=Stupid%20PhoneGap%20Tricks%20%E2%80%93%20loading%20external%20content" id="wpa2a_28"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>How PhoneGap impacts how we evangelize Flex</title>
         <link>http://gregsramblings.com/2011/10/06/how-phonegap-impacts-how-we-evangelize-flex/</link>
         <description>DISCLAIMER:  The following is my personal opinion and not necessarily that of my employer (Adobe Systems, Inc.). The PhoneGap announcement at MAX 2011 really got a lot of people excited (including me!), and it raised a few questions about how it changes our jobs as evangelists.  PhoneGap gives us the means to build cross-platform apps with [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3197</guid>
         <pubDate>Fri, 07 Oct 2011 03:40:09 +0000</pubDate>
         <content:encoded><![CDATA[<p><img class="size-full wp-image-3215 alignright" style="margin-left:8px;margin-right:8px;" title="mobiledevelopmentadobe" src="http://gregsramblings.com/wp-content/uploads/2011/10/mobiledevelopmentadobe.jpg" alt="" width="278" height="200"/><strong>DISCLAIMER:</strong>  The following is my personal opinion and not necessarily that of my employer (Adobe Systems, Inc.).</p>
<p>The <a rel="nofollow">PhoneGap announcement at MAX 2011</a> really got a lot of people excited (including me!), and it raised a few questions about how it changes our jobs as evangelists.  PhoneGap gives us the means to build cross-platform apps with HTML5 with hooks into the device&#8217;s native APIs (see my <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2011/10/06/what-is-phonegap/">previous post</a>).  Having new things to show off to developers and customers is always a good thing, especially when this new thing lets us stretch our new HTML5 muscles on mobile devices.  I&#8217;m already playing around with using <a rel="nofollow" target="_blank" href="http://labs.adobe.com/technologies/edge/">Adobe Edge</a> to animate some interactions in a mobile app (stay tuned!).</p>
<p>As a technical evangelist talking to developers, having PhoneGap in my arsenal removes the  &#8221;HTML vs Flash/Flex&#8221; religion  from the discussion and allows us to have a real conversation about which technology is the best solution for the requirements at hand.</p>
<p>Here&#8217;s an analogy:  If I worked for a company that sells tile flooring, it would be tough for me to convince someone that tile is the best choice for a particular room because they will expect me to say that tile is best for everything.  Conversely, if I worked for a company that sells wood flooring, they expect me to say wood is best.  However, if I work for a company that sells both types of flooring, I can have a real discussion about which is best on a room by room basis because I will have credibility in both types of flooring.</p>
<p>Now the conversation starts at a higher level and allows me to be more effective at demonstrating the value that Adobe offers to anyone building mobile apps.</p>
<p>There are clearly use-cases where PhoneGap will indeed be the better choice because of the lightweight nature, broader device support and the availability of the required skillset to build these types of apps.  However, there will continue to be use-cases that go beyond the capabilities of HTML5 and will demand the more capable Flash/Flex platform.  Features such as collaboration, complex UIs, handling of large data sets, real-time data processing, and rich data visualization are just a few examples where HTML5 simply won&#8217;t cut it today.  However, as the capabilities of the platforms evolve, Adobe is in a good position to provide solutions across the spectrum.</p>
<p>Our team is in rapid learning mode now, but that&#8217;s why we do this job.  New products, new technologies and new ways of approaching problems is what fuels us.  We&#8217;re basically professional learners.  During the next few months, you&#8217;ll see more content related to PhoneGap as well as the new features coming in Flex 4.6, and much more.  Fun, fun!</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F10%2F06%2Fhow-phonegap-impacts-how-we-evangelize-flex%2F&amp;title=How%20PhoneGap%20impacts%20how%20we%20evangelize%20Flex" id="wpa2a_30"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>What is PhoneGap?</title>
         <link>http://gregsramblings.com/2011/10/06/what-is-phonegap/</link>
         <description>Earlier this week at Adobe MAX, it was announced that Adobe had started the process (signed a definitive agreement) of acquiring Nitobi, the makers of PhoneGap. After this announcement, I had multiple conversations with conference attendees and found that several of them really had no idea what PhoneGap is. Some thought it was a JavaScript [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3183</guid>
         <pubDate>Fri, 07 Oct 2011 02:45:59 +0000</pubDate>
         <content:encoded><![CDATA[<p>Earlier this week at Adobe MAX, it was <a rel="nofollow" target="_blank" href="http://www.phonegap.com/2011/10/03/nitobi-enters-into-acquisition-agreement-with-adobe-2/">announced</a> that Adobe had started the process (signed a definitive agreement) of acquiring Nitobi, the makers of PhoneGap. After this announcement, I had multiple conversations with conference attendees and found that several of them really had no idea what PhoneGap is. Some thought it was a JavaScript framework that competes with JQuery or Sencha; others thought it was something that converted JavaScript to native Objective C or Java.  Both of these are incorrect &#8211; not even close&#8230; so I decided to write a quick blog post to explain.</p>
<p>Since I&#8217;m more familiar with Android than iOS, I&#8217;ll explain how it works for Android.</p>
<p>First, you create a new Android project in Eclipse (requires the Android SDK), add the phonegap.jar file to the lib folder, and make a few tweaks to the manifest and other files (details <a rel="nofollow" target="_blank" href="http://www.phonegap.com/start#android">here</a>). The main java file is modified as follows:</p>
<pre>
package com.gregwilson.gregpg1;

import com.phonegap.*;
import android.os.Bundle;

public class GregPG1Activity extends DroidGap {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl(&quot;file:///android_asset/www/index.html&quot;);
    }
}
</pre>
<p>Notice the highlighted line (line 11) &#8212;  We&#8217;ve created a native Android app, and this native app loads <strong>android_assets/www/index.html</strong> in WebView when launched.  WebView is a class in the Android SDK that allows you to display web pages as a part of your layout.  It&#8217;s like having a web browser inside of your app and uses the device&#8217;s existing implementation of WebKit.  In iOS, it&#8217;s UIWebView.  Other mobile OSes use similar techniques.</p>
<p>Below is my project in both Eclipse (Android) and Xcode (iOS).  The web application is in the www folder indicated by the red arrows.</p>
<p><img class="aligncenter size-full wp-image-3184" title="adobephonegap" src="http://gregsramblings.com/wp-content/uploads/2011/10/adobephonegap.png" alt="" width="900" height="361"/></p>
<p>Now you simply compile, build, deploy like any other Android project.</p>
<p>Basically, PhoneGap apps are HTML/JS/CSS apps that run within the WebView (or equiv) component. If you are like me, at this point you are thinking, &#8220;Uh &#8211; that&#8217;s lame &#8211; is that it? I can do that today without any additional software&#8221;.</p>
<p>But there&#8217;s more&#8230; PhoneGap extends the WebView class to give it hooks back to the device itself and exposed them as JavaScript.  Remember the jar file that is in the project?  The project also includes a <strong>phonegap.js</strong> file, which exposes many new functions that make this much more than simply displaying a web page in a WebView component.</p>
<p>Check out the code below for accessing the device GPS (copied from one of the many great examples from <a rel="nofollow" target="_blank" href="http://docs.phonegap.com">http://docs.phonegap.com</a>).  If you create an PhoneGap project and copy the code below to your index.html file, you can see it run.</p>
<pre>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Device Properties Example&lt;/title&gt;

    &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;phonegap.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;

    // Wait for PhoneGap to load
    //
    document.addEventListener(&quot;deviceready&quot;, onDeviceReady, false);

    // PhoneGap is ready
    //
    function onDeviceReady() {
        navigator.geolocation.getCurrentPosition(onSuccess, onError);
    }

    // onSuccess Geolocation
    //
    function onSuccess(position) {
        var element = document.getElementById('geolocation');
        element.innerHTML = 'Latitude: '           + position.coords.latitude              + '&lt;br /&gt;' +
                            'Longitude: '          + position.coords.longitude             + '&lt;br /&gt;' +
                            'Altitude: '           + position.coords.altitude              + '&lt;br /&gt;' +
                            'Accuracy: '           + position.coords.accuracy              + '&lt;br /&gt;' +
                            'Altitude Accuracy: '  + position.coords.altitudeAccuracy      + '&lt;br /&gt;' +
                            'Heading: '            + position.coords.heading               + '&lt;br /&gt;' +
                            'Speed: '              + position.coords.speed                 + '&lt;br /&gt;' +
                            'Timestamp: '          + new Date(position.timestamp)          + '&lt;br /&gt;';
    }

    // onError Callback receives a PositionError object
    //
    function onError(error) {
        alert('code: '    + error.code    + '&#92;n' +
              'message: ' + error.message + '&#92;n');
    }

    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;p id=&quot;geolocation&quot;&gt;Finding geolocation...&lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Now your &#8220;web app&#8221; has access to Accelerometer, Camera, Compass, Contacts, and many other device capabilities.</p>
<h3>Some observations:</h3>
<ul>
<li>Since the app itself is super small, it loads crazy fast &#8211; less than one second on my HTC Inspire and iPad 2.  You probably won&#8217;t even need a splash screen.</li>
<li>The framework is simple and lightweight, so the resulting app has a very small memory footprint. This allows apps to work on older and slower hardware like the original iPhone and older BlackBerry phones.</li>
<li>The PhoneGap docs and examples are fantastic &#8211; clear and concise.  I was able to copy/paste every sample and see the results. (one note &#8212; the phonegap-1.1.0.js for Android is different than the phonegap-1.1.0.js for iOS &#8211; I initially made the mistake of assuming they were identical and killed a few hours trying to figure out why certain samples wouldn&#8217;t run)</li>
<li>The platform support is broad. As of this article, PhoneGap supports iOS (iPhone, iPhone 3G/3Gs/4/4S, iPad 1/2, Android (all versions), BlackBerry OS 4.6 and newer, WebOS, Symbian, Bada and they have recently started to support Windows Mobile. See <a rel="nofollow" target="_blank" href="http://www.phonegap.com/about/features">http://www.phonegap.com/about/features</a> for a list of what&#8217;s supported on each.</li>
<li>Your HTML/JS/CSS run in the native WebView so you are free to use any frameworks you desire such as JQuery Mobile, Sencha, whatever. PhoneGap gives you a WebView/UIWebView with hooks to the device. The rest is up to you.</li>
<li>PhoneGap is free, open-source and will become an Apache project very soon (translation &#8211; it will remain free).</li>
<li>PhoneGap is extendable via a plugin model giving you a bridge between native code capabilities and JavaScript.</li>
<li>There is already a great collection of community-created plugins at <a rel="nofollow" target="_blank" href="https://github.com/phonegap/phonegap-plugins">https://github.com/phonegap/phonegap-plugins</a>.</li>
<li>I haven&#8217;t figured out a good way to debug these types of apps yet.  I suspect that this will be a bit of a challenge.  There is a console.log() function that will send messages back to your Eclipse console.  When the camera sample wasn&#8217;t working, I really had no clues as to why.  It&#8217;s likely that I&#8217;m missing something, so it&#8217;s too early to judge.</li>
</ul>
<h3>PhoneGap Build</h3>
<p>As you start building mobile apps in any technology, you soon discover that each platform has it&#8217;s own deployment steps and tooling requirments (some of which are amazingly tedious and error-prone).  For example, to build a native iOS app, you use Xcode, which only runs on Mac OS X.  To build for BlackBerry phones, you have to use their tooling that only runs on Windows.  To build for both platforms, you&#8217;ll need two machines (or use virtualization).  This is why <a rel="nofollow" target="_blank" href="http://build.phonegap.com">http://build.phonegap.com</a> was created.  The service allows you to upload your www project folder (or give it a GitHub URL) and it will package your app for the supported platforms.  The specific steps are documented at <a rel="nofollow" target="_blank" href="https://build.phonegap.com/docs/start">https://build.phonegap.com/docs/start</a>.  NOTE: Adobe has stated that this service will continue as part of the recently announced &#8220;<a rel="nofollow" target="_blank" href="http://www.adobe.com/products/creativecloud.html">Adobe Creative Cloud</a>&#8221; but no details have been provided nor has any pricing been announced.</p>
<h3>What&#8217;s next</h3>
<p>If you&#8217;re intrigued, I encourage you to go to <a rel="nofollow" target="_blank" href="http://phonegap.com">http://phonegap.com</a>, where you&#8217;ll find everything you need to build an app. I was able to get a Hello World app running on both Android and iOS in under 30 minutes (not counting the downloading of Xcode).  The &#8220;Getting Started&#8221; section is excellent.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F10%2F06%2Fwhat-is-phonegap%2F&amp;title=What%20is%20PhoneGap%3F" id="wpa2a_32"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>A super simple approach to Splash Screens for Flex Mobile Apps</title>
         <link>http://gregsramblings.com/2011/09/25/flex-splash-screen-sizes-easy-approach/</link>
         <description>If you are fairly new to mobile app development with Flash or Flex, I bet you have run into the following issue when creating your splash screens &amp;#8212; You create a splash image that looks great when the device is held in portrait orientation: &amp;#8230;but then when you turn it landscape, you get the white [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3144</guid>
         <pubDate>Mon, 26 Sep 2011 03:35:31 +0000</pubDate>
         <content:encoded><![CDATA[<p>If you are fairly new to mobile app development with Flash or Flex, I bet you have run into the following issue when creating your splash screens &#8212; You create a splash image that looks great when the device is held in portrait orientation:</p>
<p><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2011/09/app-portrait-good-orig.jpg"><img class="aligncenter size-full wp-image-3160" title="app-portrait-good-orig" src="http://gregsramblings.com/wp-content/uploads/2011/09/app-portrait-good-orig.jpg" alt="" width="215" height="388"/></a></p>
<p>&#8230;but then when you turn it landscape, you get the white borders (or whatever your app background color is):</p>
<p><img class="aligncenter size-full wp-image-3157" title="app-landscape-letterbox-bad" src="http://gregsramblings.com/wp-content/uploads/2011/09/app-landscape-letterbox-bad.jpg" alt="" width="391" height="207"/></p>
<p>&#8230;so you change the splashScreenScaleMode property to &#8220;<em>stretch</em>&#8221; and you get this (destroys the image):</p>
<p><img class="aligncenter size-full wp-image-3161" title="app-landscape-stretched-bad" src="http://gregsramblings.com/wp-content/uploads/2011/09/app-landscape-stretched-bad.jpg" alt="" width="391" height="207"/></p>
<p>&#8230;so then you start looking into how to include multiple splash screens, which requires a custom preloader and additional image work.</p>
<div class="woo-sc-box note  square " style="padding-left:15px;background-image:none;"><strong>Here&#8217;s a quick and simple solution</strong>: Put your splashScreenScaleMode back to &#8220;none&#8221;. Create your splash screen image as a square, and make the side dimensions equal to the length of the device. For example, if the screen is 480&#215;320, make it 480&#215;480, but make sure your artwork fits within the center 320&#215;320. When the app starts, the splash screen is auto centered.</div>
<p>Below is the same splash screen, but as you can see, I used a single square image that works with both orientations.</p>
<p><img class="aligncenter size-full wp-image-3163" title="app-autoorient-good" src="http://gregsramblings.com/wp-content/uploads/2011/09/app-autoorient-good.jpg" alt="" width="665" height="392"/></p>
<p>What about handling multiple device sizes? The same technique works, as long as you keep the content within the center square that has a width/height equal to the short side of the smallest device you intend to install on.</p>
<p>Below are two images; one for tablets, and one for phones. I&#8217;ve drawn the portrait and landscape edges of several popular devices.</p>
<p><strong>Tablets:</strong><br />
The largest tablet I&#8217;ve seen is the Motorola Zoom and Samsung Galaxy Tab 10.1, both of which are 1280&#215;800, so my diagram below assumes that it is the largest possible resolution by making the splash screen image 1280&#215;1280:</p>
<div id="attachment_3151" class="wp-caption aligncenter" style="width:810px;"><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2011/09/easy-splash-tablet.jpg"><img class="size-full wp-image-3151 " title="easy-splash-tablet-800" src="http://gregsramblings.com/wp-content/uploads/2011/09/easy-splash-tablet-800.jpg" alt="" width="800" height="800"/></a><p class="wp-caption-text">Click for full-size</p></div>
<p><strong>Phones:</strong><br />
Phones come in many resolutions. The image below assumes that the largest resolution is 960&#215;640 (iPhone 4), so the image is 960&#215;960:</p>
<div id="attachment_3152" class="wp-caption aligncenter" style="width:620px;"><a rel="nofollow" target="_blank" href="http://gregsramblings.com/wp-content/uploads/2011/09/easy-splash-phones.jpg"><img class="size-full wp-image-3152 " title="easy-splash-phones-600" src="http://gregsramblings.com/wp-content/uploads/2011/09/easy-splash-phones-600.jpg" alt="" width="610" height="610"/></a><p class="wp-caption-text">Click for full-size</p></div>
<p>Depending on your splash screen design, you could get away with only two images, one for tablets and one for phones. I typically do three images, one for the low-resolution iPhone 3Gs, one for other phones, and one for tablets.</p>
<p>If you are building an app that targets multiple device resolutions, I suggest you use the code below as your preloader. It assumes three images &#8211; tablet, high-res phones, low-res phones. It selects the image based on the length of the longest edge of the screen.</p>
<pre>
// Based on original DPI-based code by Jason San Jose at http://www.adobe.com/devnet/flex/articles/mobile-skinning-part2.html#articlecontentAdobe_numberedheader_5
// Improved by Christophe Coenraets to select image based on length of longest edge of device - http://coenraets.org
// Simplied by Greg Wilson to use only 3 images for all devices
package
{
	import flash.desktop.NativeApplication;
	import flash.display.NativeWindow;
	import flash.display.Stage;
	import flash.display.StageAspectRatio;
	import flash.display.StageOrientation;
	import flash.system.Capabilities;

	import mx.core.DPIClassification;
	import mx.core.mx_internal;

	import spark.preloaders.SplashScreen;

	use namespace mx_internal;

	public class MultiDPISplashScreen extends SplashScreen
	{
		[Embed(source=&quot;assets/splash-tablet.png&quot;)]
		private var SplashImageTablet:Class;

		[Embed(source=&quot;assets/splash-high-phone.png&quot;)]
		private var SplashImageHighPhone:Class;

		[Embed(source=&quot;assets/splash-low-phone.png&quot;)]
		private var SplashImageLowPhone:Class;

		public function MultiDPISplashScreen()
		{
			super();
		}

		override mx_internal function getImageClass(dpi:Number, aspectRatio:String):Class
		{
			var min:int = Math.min(Capabilities.screenResolutionX, Capabilities.screenResolutionY);

			if (min &gt; 960)
				return SplashImageTablet;
			else if (min &gt; 320)
				return SplashImageHighPhone;
			else
				return SplashImageLowPhone;
		}
	}
}
</pre>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F09%2F25%2Fflex-splash-screen-sizes-easy-approach%2F&amp;title=A%20super%20simple%20approach%20to%20Splash%20Screens%20for%20Flex%20Mobile%20Apps" id="wpa2a_34"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>VShieldUpdate process spiking CPU after Mac OS X Lion upgrade – FIX</title>
         <link>http://gregsramblings.com/2011/09/20/vshieldupdate-cpu-lion-macosx/</link>
         <description>I&amp;#8217;m writing this article because it took me longer than expected to find an answer to this fairly simple problem.  Hopefully this post will save you some time. Problem: After updating to OS X Lion, I noticed that the fans were spinning constantly and my battery was being quickly drained.  A quick look at the [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3137</guid>
         <pubDate>Tue, 20 Sep 2011 21:39:39 +0000</pubDate>
         <content:encoded><![CDATA[<p>I&#8217;m writing this article because it took me longer than expected to find an answer to this fairly simple problem.  Hopefully this post will save you some time.</p>
<p><strong>Problem</strong>: After updating to OS X Lion, I noticed that the fans were spinning constantly and my battery was being quickly drained.  A quick look at the activity monitor showed a process called VShieldUpdate.</p>
<p>VShieldUpdate is a virus scanning app that is part of VMWare Fusion.  For some reason, the updater for this app gets hung after updating to Lion.</p>
<p><strong>Solution</strong>:  Uninstall it with the following commands (from Terminal):</p>
<div class="woo-sc-box note   " style="padding-left:15px;background-image:none;">
cd /usr/local/vscanx<br />
./VirusScan&#92; Uninstall.command<br />
</div>
<p>After a couple of seconds, life returns to normal.  My VMWare images might be missing some virus protection, but for me, that&#8217;s not a problem.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F09%2F20%2Fvshieldupdate-cpu-lion-macosx%2F&amp;title=VShieldUpdate%20process%20spiking%20CPU%20after%20Mac%20OS%20X%20Lion%20upgrade%20%E2%80%93%20FIX" id="wpa2a_36"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>My Adobe MAX session – Migration to the Cloud – How Do I Get There?</title>
         <link>http://gregsramblings.com/2011/09/20/my-adobe-max-session-migration-to-the-cloud-how-do-i-get-there/</link>
         <description>During the past year, I&amp;#8217;ve learned a lot about various cloud computing offerings including Amazon EC2 / S3 / CloudFront / Beanstalk / RDS / etc., Rackspace Cloud, Salesforce.com, Cloud Foundry, Heroku, and of course, the growing number of Adobe cloud-related offerings.  I&amp;#8217;ve also learned that &amp;#8220;cloud&amp;#8221; is probably the most overused word I&amp;#8217;ve come [...]</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3123</guid>
         <pubDate>Tue, 20 Sep 2011 19:14:40 +0000</pubDate>
         <content:encoded><![CDATA[<div class="wp-caption alignright" style="width:410px;"><img class=" " src="http://gallery.tigeraerial.com/Photography/Looking-out-the-airplane/DSCF0664/147004441_QDFbC-S.jpg" alt="" width="400" height="300"/><p class="wp-caption-text">I had WiFi on this flight... Cloud Computing? <img src='http://gregsramblings.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley'/> </p></div>
<p>During the past year, I&#8217;ve learned a lot about various cloud computing offerings including Amazon EC2 / S3 / CloudFront / Beanstalk / RDS / etc., Rackspace Cloud, Salesforce.com, Cloud Foundry, Heroku, and of course, the growing number of Adobe cloud-related offerings.  I&#8217;ve also learned that &#8220;cloud&#8221; is probably the most overused word I&#8217;ve come across in 20+ years in technology!  I&#8217;ve put together a crash course MAX session to introduce people to what cloud computing is really all about.  My goal is to use only a few slides and spend most of the session doing some real demos that really show off what&#8217;s cool in cloud computing.   It&#8217;ll be action packed, so come check it out!  The information is below:</p>
<p><strong>When: Wednesday, October 5, 11:00 a.m. &#8211; 12:00 p.m, I&#8217;m doing the following session at Adobe MAX 2011</strong></p>
<p><a rel="nofollow" target="_blank" href="https://max.adobe.com/schedule/by-session/session/S4660"><strong>Migration to the Cloud: How Do I Get There?</strong></a></p>
<p>Cut through the hype and see what cloud computing is really all about. Take a tour of cloud infrastructure-as-a-service (IaaS) and platform-as-a-service (PaaS) solutions. Watch a live deployment of a server infrastructure that supports a new mobile app built with Adobe Flex. Learn how to create a new virtual server, configure it, and bring it online—all in a few minutes. Then see how the infrastructure is horizontally scaled to support 1,000,000+ users. During the demonstration, you&#8217;ll learn about reliability, redundancy, disaster recovery, geographic distribution, and other important considerations for migrating to the cloud.</p>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F09%2F20%2Fmy-adobe-max-session-migration-to-the-cloud-how-do-i-get-there%2F&amp;title=My%20Adobe%20MAX%20session%20%E2%80%93%20Migration%20to%20the%20Cloud%20%E2%80%93%20How%20Do%20I%20Get%20There%3F" id="wpa2a_38"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
      <item>
         <title>Finding the current location in your mobile app using Geolocation</title>
         <link>http://gregsramblings.com/2011/09/08/finding-the-current-location-in-your-mobile-app-using-geolocation/</link>
         <description>Yesterday, I blogged about Geolocation. I thought it would be helpful to show some code that determines the current location in your app. CODE:</description>
         <guid isPermaLink="false">http://gregsramblings.com/?p=3094</guid>
         <pubDate>Thu, 08 Sep 2011 18:25:14 +0000</pubDate>
         <content:encoded><![CDATA[<p>Yesterday, I <a rel="nofollow" target="_blank" href="http://gregsramblings.com/2011/09/08/geolocation-tips-quirks-bugs-flash-actionscript/">blogged</a> about Geolocation. I thought it would be helpful to show some code that determines the current location in your app.</p>
<div class="woo-sc-box info   " style="padding-left:15px;background-image:none;">
<p>Notes:</p>
<ul>
<li>The first location event is thrown away because as noted in <a rel="nofollow" title="Geolocation tips, quirks, and possible bugs (flash.sensors.Geolocation)" target="_blank" href="http://gregsramblings.com/2011/09/08/geolocation-tips-quirks-bugs-flash-actionscript/">yesterday&#8217;s blog post</a>, it&#8217;s not the current location. It&#8217;s the last known location (cached location).</li>
<li>The code below will keep trying to improve the location until it gets an accuracy of 150 meters or better, or, until it times out (30-second timeout).</li>
<li>Once the 30-second timeout occurs, it will report the last location event (if available).</li>
</ul>
</div>
<p><strong>CODE:</strong></p>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   applicationComplete=&quot;init()&quot;&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			import flash.sensors.Geolocation;

			protected var geo:Geolocation;
			protected var geoLastEvent:GeolocationEvent;
			protected var geoCheckCount:int;
			protected var geoTimer:Timer;

			protected function init():void
			{
				log.text = &quot;App Starting&#92;n&quot;;
				if(Geolocation.isSupported)
				{
					geoCheckCount = 0;
					geo = new Geolocation();
					geo.setRequestedUpdateInterval(500); 		// suggest a very frequent update of 500ms
					geo.addEventListener(GeolocationEvent.UPDATE, onUpdate);

					// Create a timer
					geoTimer = new Timer(30000,1);
					geoTimer.addEventListener(TimerEvent.TIMER_COMPLETE,onTimeout);
					geoTimer.start();
				} else {
					log.appendText(&quot;GPS not supported on this device&#92;n&quot;);
				}
			}

			protected function onUpdate(event:GeolocationEvent):void
			{
				++geoCheckCount;
				if(geoCheckCount &lt;= 1) return; // Throw away the first location event because it's almost always the last known location, not current location
				geoLastEvent = event;

				if(event.horizontalAccuracy &lt;= 150)
				{
					geoTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,onTimeout);
					geoTimer.stop();
					log.appendText(&quot;LOCATION: &quot; + event.latitude + &quot; / &quot; + event.longitude + &quot; - &quot; + event.horizontalAccuracy + &quot;&#92;n&quot;);
					geo.removeEventListener(GeolocationEvent.UPDATE, onUpdate);
					geo = null;
				}
			}

			protected function onTimeout(event:TimerEvent):void
			{
				geoTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,onTimeout);
				geoTimer.stop();
				geoTimer = null;
				if(geoLastEvent != null)
				{
					log.appendText(&quot;Timed out - best location is: &quot; + geoLastEvent.latitude + &quot; / &quot; + geoLastEvent.longitude + &quot; - &quot; + geoLastEvent.horizontalAccuracy + &quot;&#92;n&quot;);
				} else {
					log.appendText(&quot;Unable to determine location before timeout&#92;n&quot;);
				}
				geo.removeEventListener(GeolocationEvent.UPDATE, onUpdate);
				geo = null;
			}

		]]&gt;

	&lt;/fx:Script&gt;
	&lt;s:TextArea id=&quot;log&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
&lt;/s:Application&gt;
</pre>
<p><a rel="nofollow" class="a2a_dd a2a_target addtoany_share_save" target="_blank" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgregsramblings.com%2F2011%2F09%2F08%2Ffinding-the-current-location-in-your-mobile-app-using-geolocation%2F&amp;title=Finding%20the%20current%20location%20in%20your%20mobile%20app%20using%20Geolocation" id="wpa2a_40"><img src="http://gregsramblings.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
      </item>
   </channel>
</rss><!-- fe4.yql.bf1.yahoo.com compressed/chunked Sat May 26 15:59:26 UTC 2012 -->

