<?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; Air</title>
	<atom:link href="http://coenraets.org/blog/tag/air/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>InSync: Automatic Offline Data Synchronization in AIR using LCDS 2.6</title>
		<link>http://coenraets.org/blog/2008/05/insync-automatic-offline-data-synchronization-in-air-using-lcds-26/</link>
		<comments>http://coenraets.org/blog/2008/05/insync-automatic-offline-data-synchronization-in-air-using-lcds-26/#comments</comments>
		<pubDate>Tue, 20 May 2008 03:31:15 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[LCDS]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Offline]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/?p=80</guid>
		<description><![CDATA[LCDS 2.6 allows you to build AIR applications with automatic offline data synchronization. This feature leverages the SQLite relational database system embedded in the AIR runtime, but the advantage is that the data synchronization process is entirely automatic: you don’t have to write SQL statements or synchronization logic to keep your local database in sync [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://coenraets.org/apps/insync/insync1.png" alt="" /></p>
<p><img src="http://coenraets.org/apps/insync/insync2.png" alt="" /></p>
<p>LCDS 2.6 allows you to build AIR applications with automatic offline data synchronization. This feature leverages the SQLite relational database system embedded in the AIR runtime, but the advantage is that the data synchronization process is entirely automatic: you don’t have to write SQL statements or synchronization logic to keep your local database in sync with your central database.</p>
<p>I have been getting a number of questions related to this feature, so I decided to build a sample application that demonstrates how it works.<br />
<span id="more-80"></span><br />
In this application the synchronization process is implicit. When you are online, the cache (a SQLite database) is automatically updated along with the server database to make sure the user can go offline with the latest data without explicitly triggering a synchronization process. When you are offline, the changes are saved in the local cache. If the network becomes available while working in the application, the application will detect the network status change and automatically synchronize data (send your offline changes to the server, and get changes made by other users while you were offline).</p>
<h3>Installation Instructions</h3>
<ol>
<li>If you haven&#8217;t already done so, <a href="http://labs.adobe.com/technologies/livecycle_dataservices2_6/">install LCDS 2.6</a>.</li>
<li>Unzip <a href="http://coenraets.org/apps/insync/insync.zip">insync.zip</a></li>
<li>Copy the content of the sampledb folder in the sampledb folder of your existing LCDS directory</li>
<li>Copy the content of the tomcat folder in the tomcat folder of your existing LCDS directory</li>
<li>Add the following destination to data-management-config.xml
<p><pre class="brush: xml;">
&lt;destination id=&quot;insync&quot;&gt;
    &lt;adapter ref=&quot;java-dao&quot; /&gt;
    &lt;properties&gt;
        &lt;source&gt;lcds.samples.contact.ContactAssembler&lt;/source&gt;
        &lt;scope&gt;application&lt;/scope&gt;
        &lt;metadata&gt;
            &lt;identity property=&quot;contactId&quot; undefined-value=&quot;0&quot;/&gt;
        &lt;/metadata&gt;
    &lt;/properties&gt;
&lt;/destination&gt;
</pre>
</p>
</li>
<li>Restart the sample database: run sampledb.bat (Windows) or sampledb.sh (Unix) in the sampledb directory</li>
<li>Restart your application server</li>
</ol>
<h3>Quick Tour</h3>
<ol>
<li>Install and run the AIR application. Notice the green light in the status bar indicating that the application is in online mode.
<p><div id="flashcontent5048" 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", "sqliteadmin");
so.addVariable("appurl", "http://coenraets.org/apps/insync/insync.air");
so.addVariable("appid", "sqliteadmin");
so.addVariable("pubid", "");
so.addVariable("appversion", "v1.0");
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("flashcontent5048");
// ]]&gt; -->
</script>

</p>
</li>
<li>Double click a contact to view the contact details.</li>
<li>Modify the data in a few fields and click Save. Your server console indicates that the contact has been updated.</li>
<li>Click the + button in the application title bar. Enter a first name, last name, etc and click Save. Your server console indicates that the contact has been updated.</li>
<li>Shut down the server</li>
<li>Notice that the green light turns grey to indicate that the application is now working in offline mode.</li>
<li>Repeat steps 2 to 4 above: changes are saved locally. Notice that the offline status (not modified, created, or updated is displayed in the contact form (bottom left corner)</li>
<li>Restart the server.</li>
<li>The green light appears in that status bar as soon as the server is up and running. Notice that LCDS automatically detects the offline changes and sends them to the server.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2008/05/insync-automatic-offline-data-synchronization-in-air-using-lcds-26/feed/</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
		<item>
		<title>Offline Synchronization using AIR and LiveCycle Data Services</title>
		<link>http://coenraets.org/blog/2007/10/offline-synchronization-using-air-and-livecycle-data-services/</link>
		<comments>http://coenraets.org/blog/2007/10/offline-synchronization-using-air-and-livecycle-data-services/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 20:05:12 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Data Services]]></category>
		<category><![CDATA[Offline]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/2007/10/offline-synchronization-using-air-and-livecycle-data-services/</guid>
		<description><![CDATA[As part of my MAX talks in Chicago and Barcelona, I used a simple Contact Manager application to demonstrate offline synchonization using AIR and LiveCycle Data Services (LCDS). Many people have asked me to share the code, so here it is&#8230; This is actually an update of an application I posted a few months ago [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image30" alt=contacts3.gif src="http://coenraets.org/blog/wp-content/uploads/2007/03/contacts3.gif" /></p>
<p>As part of my MAX talks in Chicago and Barcelona, I used a simple Contact Manager application to demonstrate offline synchonization using AIR and LiveCycle Data Services (LCDS). Many people have asked me to share the code, so here it is&#8230; This is actually an update of <a href="http://coenraets.org/blog/2007/03/synchronizing-data-in-apollo-using-flex-data-services/">an application I posted a few months ago</a> (but that didn&#8217;t include the offline synchronization part at the time).</p>
<p><span id="more-54"></span></p>
<p>Using the Data Services to work with data in AIR offers several benefits:</p>
<p>First, just like for traditional browser-based Flex apps, the Data Management Service automates the synchronization of data between the client and the middle-tier. In other words, you don’t have to flag/keep track of the changes made at the client-side, and then make corresponding RPC calls to send changes to the server: this is all managed automatically.</p>
<p>Second, you can access and enter data while offline: the Data Management Service takes care of storing your data locally and synchronizing the changes with the server when you go back online. To enable offline synchronization, the Data Management Service API provides methods (such as saveCache() / clearCache()) to save data locally and manipulate the local data store. When you go back online, the commitRequired attribute of your dataService indicates if changes have been made offline. Invoking commit() on the dataService automatically synchronizes the offline changes with the server. See main.mxml for an example.</p>
<p>In the current AIR betas, the Flex Data Management Service uses Local Shared Objects as the local data store. For the AIR 1.0 release, we will use the SQLite database embedded in the AIR runtime instead.</p>
<p>In this application, I use the SQL assembler to provide the server-side persistence logic. Using the SQL assembler, you don’t have to write server-side components if you don’t want/need to: you just provide a series of SQL statements indicating how data should be retrieved, and how changes should be persisted in the database. The SQL assembler makes it extremely fast and easy to create applications that don’t require sophisticated persistence logic.</p>
<p><strong>Installation instructions:</strong></p>
<ol>
<li>Install LiveCycle Data Services 2.5 <a href="https://www.adobe.com/cfusion/tdrc/index.cfm?product=livecycle%5Fdataservices">here</a></li>
<li>In the samples web application, modify the flexdemodb database file to add the contact table: replace WEB-INF\db\flexdemodb\flexdemodb.script with <a href="/downloads/contacts/flexdemodb.zip">this version</a>.</li>
<li>Open WEB-INF\flex\data-management-config.xml and add the following destination.
<pre class="brush: xml;">
&lt;destination id=&quot;sql-contact&quot;&gt;

	&lt;adapter ref=&quot;java-dao&quot; /&gt;

	&lt;properties&gt;

		&lt;use-transactions&gt;true&lt;/use-transactions&gt;
		&lt;source&gt;flex.data.assemblers.SQLAssembler&lt;/source&gt;
		&lt;scope&gt;application&lt;/scope&gt;
		&lt;metadata&gt;
			&lt;identity property=&quot;CONTACT_ID&quot;/&gt;
		&lt;/metadata&gt;

		&lt;network&gt;
			&lt;session-timeout&gt;20&lt;/session-timeout&gt;
			&lt;paging enabled=&quot;false&quot; pageSize=&quot;10&quot; /&gt;
			&lt;throttle-inbound policy=&quot;ERROR&quot; max-frequency=&quot;500&quot;/&gt;
			&lt;throttle-outbound policy=&quot;REPLACE&quot; max-frequency=&quot;500&quot;/&gt;
		&lt;/network&gt;

		&lt;server&gt;

			&lt;database&gt;
			    &lt;driver-class&gt;org.hsqldb.jdbcDriver&lt;/driver-class&gt;
			    &lt;!-- Modify the URL below with the actual location of the flexdemodb database on your system --&gt;
			    &lt;url&gt;jdbc:hsqldb:file:C:/lcds/jrun4/servers/default/samples/WEB-INF/db/flexdemodb/flexdemodb&lt;/url&gt;
			    &lt;username&gt;sa&lt;/username&gt;
			    &lt;password&gt;&lt;/password&gt;
				&lt;login-timeout&gt;15&lt;/login-timeout&gt;
			&lt;/database&gt;

			&lt;actionscript-class&gt;Contact&lt;/actionscript-class&gt;

 			&lt;fill&gt;
   				&lt;name&gt;all&lt;/name&gt;
   				&lt;sql&gt;SELECT * FROM CONTACT&lt;/sql&gt;
 			&lt;/fill&gt;

			&lt;get-item&gt;
				&lt;sql&gt;SELECT * FROM CONTACT WHERE CONTACT_ID = #CONTACT_ID#&lt;/sql&gt;
			&lt;/get-item&gt;

 			&lt;create-item&gt;
			  &lt;sql&gt;INSERT INTO CONTACT
			  		(FIRST_NAME,LAST_NAME,EMAIL,PHONE,ADDRESS,CITY,STATE,ZIP,COUNTRY,NOTES)
			  		VALUES (#FIRST_NAME#, #LAST_NAME#, #EMAIL#, #PHONE#, #ADDRESS#, #CITY#, #STATE#, #ZIP#, #COUNTRY#, #NOTES#)&lt;/sql&gt;
			  &lt;id-query&gt;CALL IDENTITY()&lt;/id-query&gt; &lt;!-- HSQLDB syntax to retrieve value of autoincremented column --&gt;
			&lt;/create-item&gt;

 			&lt;update-item&gt;
			  &lt;sql&gt;UPDATE CONTACT SET FIRST_NAME=#FIRST_NAME#,LAST_NAME=#LAST_NAME#,EMAIL=#EMAIL#,PHONE=#PHONE#,ADDRESS=#ADDRESS#,CITY=#CITY#,STATE=#STATE#,ZIP=#ZIP#,COUNTRY=#COUNTRY#,NOTES=#NOTES#
			  		WHERE CONTACT_ID=#_PREV.CONTACT_ID#&lt;/sql&gt;
			&lt;/update-item&gt;

 			&lt;delete-item&gt;
			  &lt;sql&gt;DELETE FROM CONTACT WHERE CONTACT_ID=#CONTACT_ID#&lt;/sql&gt;
			&lt;/delete-item&gt;

			&lt;count&gt;
				&lt;name&gt;all&lt;/name&gt;
				&lt;sql&gt;SELECT count(*) FROM CONTACT&lt;/sql&gt;
			&lt;/count&gt;

		&lt;/server&gt;

	&lt;/properties&gt;

&lt;/destination&gt;
</pre>
</li>
<li>Start the server</li>
<li>Install <a href="/downloads/contacts/contacts.air">contacts.air</a> and run the application</li>
</ol>
<p>NOTE: The application has been compiled assuming that an RTMP endpoint named my-rtmp is configured at rtmp://localhost:2037. If your server isn&#8217;t configured that way, you will have to recompile the application. You can also provide the endpoints at runtime. See my <a href="http://coenraets.org/blog/2007/03/real-time-market-data-using-apollo-and-flex-data-services/">previous post</a> for more information on defining a ChannelSet.</p>
<p>You can download the source code <a href="/downloads/contacts/contacts-src.zip">here</a>.</p>
<p><strong>Application Walkthrough</strong></p>
<ol>
<li>Start the application. Notice the green light in the upper right corner indicating that the dataService is connected to the server.</li>
<li>Double-click a contact in the list to open the details form. Modify some data and click &#8220;Save&#8221;.</li>
<li>Shut down your server. Notice that the connectivity status light is now red. Close the application to make it clear that your are not working with data cached in memory.</li>
<li>Restart the application. It will take a second before you see the data: the dataService first tries to connect to the server before loading the data from the local cache. Open a contact, make some changes to the data and click &#8220;Save&#8221;. Your change is saved to the local cache.</li>
<li>Close the application.</li>
<li>Restart your server.</li>
<li>Restart the application. Notice that the application automatically detects that changes have been made offline, and synchronizes the offline changes.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2007/10/offline-synchronization-using-air-and-livecycle-data-services/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>New AIR SQLite Administration App (with Source Code)</title>
		<link>http://coenraets.org/blog/2007/10/new-air-sqlite-administration-app-with-source-code/</link>
		<comments>http://coenraets.org/blog/2007/10/new-air-sqlite-administration-app-with-source-code/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 21:12:27 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/2007/10/new-air-sqlite-administration-app-with-source-code/</guid>
		<description><![CDATA[UPDATE: This version is now obsolete. A new version is available here. Here is an updated/rewritten version of my AIR SQLite Admin application. You can use this application to examine the structure of a database, create a new database or open an existing one, execute any type of SQL statement, etc. An interesting aspect of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: This version is now obsolete. A new version is available <a href="http://coenraets.org/blog/2008/02/air-based-sqlite-admin-updated-for-beta-3/">here</a>.</strong></p>
<p><img src="http://coenraets.org/blog/wp-content/uploads/2007/10/sqladmin.png" style="border: 0pt none " /></p>
<p>Here is an updated/rewritten version of my AIR SQLite Admin application. You can use this application to examine the structure of a database, create a new database or open an existing one, execute any type of SQL statement, etc.</p>
<p>An interesting aspect of this new version is that the application itself uses a database (sqladmincache.db) to keep track of the databases you opened and the statements you executed. This is useful if you want to quickly re-open a recently accessed database, or re-execute a recently executed statement.</p>
<p>This new version uses synchronous database operations (AIR beta 1 only supported asynchronous database access), and uses the schema API (also new in beta 2) to show you the list of tables and columns available in your database.</p>
<p>The UI is still simple, but uses some new AIR and Flex 3 features such as the AdvancedDataGrid and Native Windows.</p>
<p>Click <a href="http://coenraets.org/downloads/sqladmin.air">here</a> to install the application.</p>
<p>Click <a href="http://coenraets.org/downloads/sqladmin.zip">here</a> to download the source code.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2007/10/new-air-sqlite-administration-app-with-source-code/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>Salesbuilder for Flex 3 / AIR Beta 2 (AIR file + source code)</title>
		<link>http://coenraets.org/blog/2007/10/salesbuilder-for-flex-3-air-beta-2-air-file-source-code/</link>
		<comments>http://coenraets.org/blog/2007/10/salesbuilder-for-flex-3-air-beta-2-air-file-source-code/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 21:46:56 +0000</pubDate>
		<dc:creator>Christophe Coenraets</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[Offline]]></category>
		<category><![CDATA[Salesbuilder]]></category>

		<guid isPermaLink="false">http://coenraets.org/blog/2007/10/salesbuilder-for-flex-3-air-beta-2-air-file-source-code/</guid>
		<description><![CDATA[I migrated the Salesbuilder application for Flex 3 / AIR beta 2. Click here to install the application. Click here to download the source code. Follow this script for a guide tour of the application.]]></description>
			<content:encoded><![CDATA[<p>I migrated the Salesbuilder application for Flex 3 / AIR beta 2.</p>
<p>Click <a href="http://coenraets.org/air/salesbuilder/beta2/salesbuilder.air">here</a> to install the application.</p>
<p>Click <a href="http://coenraets.org/downloads/salesbuilder_src_beta2.zip">here</a> to download the source code.</p>
<p>Follow <a href="http://coenraets.org/air/salesbuilder/salesbuilder_script.pdf">this script</a> for a guide tour of the application.</p>
]]></content:encoded>
			<wfw:commentRss>http://coenraets.org/blog/2007/10/salesbuilder-for-flex-3-air-beta-2-air-file-source-code/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>
