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

<channel>
	<title>Christophe Coenraets &#187; MAX</title>
	<atom:link href="http://coenraets.org/blog/category/max/feed/" rel="self" type="application/rss+xml" />
	<link>http://coenraets.org/blog</link>
	<description>Rich Internet Applications, Flex, AIR, Java, Android</description>
	<lastBuildDate>Fri, 23 Jul 2010 14:45:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Using the SQLite Database Access API in AIR… Part 2: Using the DAO Pattern</title>
		<link>http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%e2%80%a6-part-2-using-the-dao-pattern/</link>
		<comments>http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%e2%80%a6-part-2-using-the-dao-pattern/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 21:04:43 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MAX]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/?p=91</guid>
		<description><![CDATA[The first version of our contact management application introduced us to the database access API in AIR. However, the lack of &#8220;application partitioning&#8221; or &#8220;separation of concerns&#8221; in that first implementation represented a poor architecture with no potential for reusability. In this second version, we use the Data Access Object pattern to improve the overall [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%E2%80%A6-part-1/">first version of our contact management application</a> introduced us to the database access API in AIR. However, the lack of &#8220;application partitioning&#8221; or &#8220;separation of concerns&#8221; in that first implementation represented a poor architecture with no potential for reusability.</p>
<p>In this second version, we use the Data Access Object pattern to improve the overall architecture of our application. A Data Access Object typically encapsulates the data access logic for one entity (in this case: Contact). </p>
<p>An interface (named IContactDAO) defines the “contract”:</p>
<pre class="brush: jscript;">
package
{
	import flash.utils.ByteArray;
	import mx.collections.ArrayCollection;

	public interface IContactDAO
	{
		function findAll():ArrayCollection;

		function insert(contact:Object):void;

		function update(contact:Object):void;

		function updatePicture(contactId:int, jpeg:ByteArray):void;

		function deleteItem(contact:Object):void;
	}
}
</pre>
<p>The ContactDAO class implements that interface and provides one specific implementation of the contract (persisting data to the embedded SQLite database).</p>
<h3>Benefits:</h3>
<ul>
<li>The View doesn’t know anything about your data access logic: You can reuse the same view (ContactForm) with a different way to access your data. You would just create another class implementing IContactDAO and pass an instance of that class to ContactForm. Notice that the dao property of ContactForm is of the IContactDAO data type (the interface). This allows us to pass an instance of any class implementing the IContactDAO interface to ContactForm.</li>
<li>The DAO doesn’t know anything about the view: You can reuse the same data access logic from within different views.</li>
</ul>
<p>Install inSync Local DAO Edition:<br />
<div id="flashcontent1288" style="width:215px; height:180px;"><strong>Please upgrade your Flash Player</strong> This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.</div><script type="text/javascript">
<!-- // <![CDATA[
var so = new SWFObject("http://coenraets.org/blog/wp-content/plugins/air-badge/AIRInstallBadge.swf", "Badge", "215", "180", "9.0.115", "#FFFFFF");
so.useExpressInstall("http://coenraets.org/blog/wp-content/plugins/air-badge/expressinstall.swf");
so.addVariable("airversion", "1.0");
so.addVariable("appname", "inSyncLocalDAO");
so.addVariable("appurl", "http://coenraets.org/apps/insync/inSyncLocalDAO.air");
so.addVariable("appid", "inSyncLocalDAO");
so.addVariable("pubid", "");
so.addVariable("appversion", "v1");
so.addVariable("imageurl", "http://coenraets.org/apps/insync/insync1.png");
so.addVariable("appinstallarg", "installed from web");
so.addVariable("applauncharg", "launched from web");
so.addVariable("helpurl", "help.html");
so.addVariable("hidehelp", "true");
so.addVariable("skiptransition", "false");
so.addVariable("titlecolor", "#00AAFF");
so.addVariable("buttonlabelcolor", "#00AAFF");
so.addVariable("appnamecolor", "#00AAFF");
so.addVariable("str_err_airswf", "<u>Running locally?</u><br/><br/>The AIR proxy swf won't load properly when this is run from the local file system.");
so.write("flashcontent1288");
// ]]&gt; -->
</script>

</p>
<p><br/></p>
<p>Click <a href="http://coenraets.org/apps/insync/insync-local-dao.zip">here</a> to download the source code. You can also right-click the app and select View Source to view the source code and download the application.</p>
<h3>Limitation:</h3>
<p>There is still a lot of SQL code to write. There are a few options to overcome that limitation:</p>
<ul>
<li>You could create a mini DAO framework where a base DAO class would take care of all the boilerplate code to set up and execute SQL statements.  (See the BaseDAO class in <a href="http://coenraets.org/blog/2008/11/salesbuilder-15-with-new-air-15-database-encryption/">Salesbuilder</a> for an example).</li>
<li>You could use an ORM framework where SQL statements are automatically generated.</li>
</ul>
<p>In part 3, we’ll look at a version of inSync built with an annotation-based ORM framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%e2%80%a6-part-2-using-the-dao-pattern/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using the SQLite Database Access API in AIR… Part 1</title>
		<link>http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%e2%80%a6-part-1/</link>
		<comments>http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%e2%80%a6-part-1/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 17:02:24 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MAX]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/?p=90</guid>
		<description><![CDATA[In my MAX session called &#8220;Liberate your Data with AIR&#8221;, I presented different approaches to access local data using the SQLite database access API in AIR. The list of approaches included: &#8220;SQL in View&#8221; Data Access Object (DAO) pattern Using an Object Relational Mapping (ORM) framework I demonstrated a version of inSync (a simple contact [...]]]></description>
			<content:encoded><![CDATA[<p>In my MAX session called &#8220;Liberate your Data with AIR&#8221;, I presented different approaches to access local data using the SQLite database access API in AIR.</p>
<p>The list of approaches included:</p>
<ol>
<li>&#8220;SQL in View&#8221;</li>
<li>Data Access Object (DAO) pattern</li>
<li>Using an Object Relational Mapping (ORM) framework</li>
</ol>
<p>I demonstrated a version of inSync (a simple contact management application) built with each of these approaches. I’m dedicating one blog post to each approach. This first post is focused on the &#8220;SQL in View&#8221; approach. To spice things up just a little bit, inSync also demosntrates how to take a picture of a contact using your webcam and store it in the SQLite database as a blob.</p>
<p><img src="http://coenraets.org/apps/insync/insyncwebcam.png"/></p>
<p>Install inSync Local SQL Edition:<br />
<div id="flashcontent1981" style="width:215px; height:180px;"><strong>Please upgrade your Flash Player</strong> This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.</div><script type="text/javascript">
<!-- // <![CDATA[
var so = new SWFObject("http://coenraets.org/blog/wp-content/plugins/air-badge/AIRInstallBadge.swf", "Badge", "215", "180", "9.0.115", "#FFFFFF");
so.useExpressInstall("http://coenraets.org/blog/wp-content/plugins/air-badge/expressinstall.swf");
so.addVariable("airversion", "1.0");
so.addVariable("appname", "inSyncLocalSQL");
so.addVariable("appurl", "http://coenraets.org/apps/insync/inSyncLocalSQL.air");
so.addVariable("appid", "inSyncLocalSQL");
so.addVariable("pubid", "");
so.addVariable("appversion", "v1");
so.addVariable("imageurl", "http://coenraets.org/apps/insync/insync1.png");
so.addVariable("appinstallarg", "installed from web");
so.addVariable("applauncharg", "launched from web");
so.addVariable("helpurl", "help.html");
so.addVariable("hidehelp", "true");
so.addVariable("skiptransition", "false");
so.addVariable("titlecolor", "#00AAFF");
so.addVariable("buttonlabelcolor", "#00AAFF");
so.addVariable("appnamecolor", "#00AAFF");
so.addVariable("str_err_airswf", "<u>Running locally?</u><br/><br/>The AIR proxy swf won't load properly when this is run from the local file system.");
so.write("flashcontent1981");
// ]]&gt; -->
</script>

</p>
<p><br/></p>
<p>NOTE: this application uses the same skin and overall context as a sample I posted previously to illustrate offline data synchronization using LCDS, but the implementation is entirely different: No LCDS here&#8230; just local data access.</p>
<p>Click <a href="http://coenraets.org/apps/insync/insync-local-sql.zip">here</a> to download the source code. You can also right-click the app and select View Source to view the source code and download the application.</p>
<p>Using the &#8220;SQL in View&#8221; approach, you embed SQL statements as needed in View components. In this example the ContactForm component has create, update, and delete methods with the appropriate embedded SQL statements to insert, update, and delete a contact in the database.  This approach works for quick prototyping, but is generally a bad practice. When you mix view logic and data access logic in the same component, neither the view logic, nor the data access logic is reusable: you can’t reuse the view with a different way to access your data, and you can’t reuse your data access logic with a different view.</p>
<p>I provide this approach here as a quick way to get acquainted with the database access API in AIR. For real life implementations, a more partitioned approach such as the DAO pattern or an ORM framework is of course highly recommended. Stay tuned for an example of approaches 2 and 3.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2008/11/using-the-sqlite-database-access-api-in-air%e2%80%a6-part-1/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>My MAX LCDS/BlazeDS Sessions Materials Available</title>
		<link>http://coenraets.org/blog/2008/11/my-max-lcdsblazeds-sessions-materials-available/</link>
		<comments>http://coenraets.org/blog/2008/11/my-max-lcdsblazeds-sessions-materials-available/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 20:28:11 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[LCDS]]></category>
		<category><![CDATA[MAX]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/?p=89</guid>
		<description><![CDATA[Many of you have asked me for the materials I used in my LCDS/BlazeDS hands-on sessions at MAX. Here are the links: Lab instructions PDF (Powering Flex Applications with BlazeDS and Data Services) Lab files (including final solutions) If you didn&#8217;t have a chance to attend, you should be able to use this as a [...]]]></description>
			<content:encoded><![CDATA[<p>Many of you have asked me for the materials I used in my LCDS/BlazeDS  hands-on sessions at MAX. </p>
<p>Here are the links:</p>
<ul>
<li><a href="http://coenraets.org/downloads/max2008/flex-dataservices-tutorial.pdf">Lab instructions PDF</a> (Powering Flex Applications with BlazeDS and Data Services)</li>
<li><a href="http://coenraets.org/downloads/max2008/flex-dataservices-tutorial.zip">Lab files (including final solutions)</a></li>
</ul>
<p>If you didn&#8217;t have a chance to attend, you should be able to use this as a BlazeDS/LCDS tutorial as well.</p>
<p>It was great to see all of you at MAX. I hope to see you next year in Los Angeles.</p>
<p>Christophe</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2008/11/my-max-lcdsblazeds-sessions-materials-available/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Salesbuilder 1.5 with new AIR 1.5 Database Encryption</title>
		<link>http://coenraets.org/blog/2008/11/salesbuilder-15-with-new-air-15-database-encryption/</link>
		<comments>http://coenraets.org/blog/2008/11/salesbuilder-15-with-new-air-15-database-encryption/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 14:22:25 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Collaboration]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[LiveCycle Data Services]]></category>
		<category><![CDATA[MAX]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/?p=88</guid>
		<description><![CDATA[As you probably already know, AIR 1.5 is now available. New features include database encryption, Flash Player 10 support, and an updated version of WebKit. I updated my Salesbuilder sample application to leverage the AIR 1.5 capabilities. Salesbuilder 1.5 leverages the new database encryption feature to allow you to secure your local database. The first [...]]]></description>
			<content:encoded><![CDATA[<p>As you probably already know, <a href="http://www.adobe.com/devnet/logged_in/rchristensen_lpolanco_air_1.5.html">AIR 1.5</a> is now available. New features include database encryption, Flash Player 10 support, and an updated version of WebKit.</p>
<p><img src='http://coenraets.org/salesbuilder/salesbuilder15.jpg' alt='' class='alignnone' /></p>
<p>I updated my Salesbuilder sample application to leverage the AIR 1.5 capabilities. Salesbuilder 1.5 leverages the new database encryption feature to allow you to secure your local database.</p>
<p>The first time you start Salesbuilder, the application will generate the encrypted database on your local file system. Salesbuilder implements the key generation approach described in the section <a href="http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS8AFC5E35-DC79-4082-9AD4-DE1A2B41DAAF.html">Using encryption with SQL databases in the manual Developing Adobe AIR Applications</a>. The encryption key is based on a password provided by you and a SALT generated by the system. </p>
<p>You can install the new version and download the source code <a href="http://www.adobe.com/devnet/air/flex/samples.html#salesbuilder">here</a>.</p>
<p>A basic script explaining how to use the application is available <a href="http://www.adobe.com/devnet/air/flex/articles/salesbuilder_demo.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2008/11/salesbuilder-15-with-new-air-15-database-encryption/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Sneak Peek of LiveCycle Data Services &#8220;Next&#8221; Tomorrow at MAX</title>
		<link>http://coenraets.org/blog/2008/11/sneak-peak-of-livecycle-data-services-next-tomorrow-at-max/</link>
		<comments>http://coenraets.org/blog/2008/11/sneak-peak-of-livecycle-data-services-next-tomorrow-at-max/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 07:24:41 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[LCDS]]></category>
		<category><![CDATA[LiveCycle Data Services]]></category>
		<category><![CDATA[MAX]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/?p=87</guid>
		<description><![CDATA[I will demonstrate some new and really exciting features of LiveCycle Data Services &#8220;Next&#8221; tomorrow (Monday), as part of my session called &#8220;Introduction to BlazeDS and LiveCycle Data Services ES&#8221;. I hope to see you there if you are interested in Data Services for Flex. Introduction to BlazeDS and LiveCycle Data Services ES Moscone West [...]]]></description>
			<content:encoded><![CDATA[<p>I will demonstrate some new and really exciting features of LiveCycle Data Services &#8220;Next&#8221; tomorrow (Monday), as part of my session called &#8220;Introduction to BlazeDS and LiveCycle Data Services ES&#8221;. I hope to see you there if you are interested in Data Services for Flex.</p>
<p>Introduction to BlazeDS and LiveCycle Data Services ES<br />
Moscone West 2007<br />
5:00pm to 6:00pm</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2008/11/sneak-peak-of-livecycle-data-services-next-tomorrow-at-max/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
