<?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>Luminis Software Development &#187; web</title>
	<atom:link href="http://lsd.luminis.nl/tag/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://lsd.luminis.nl</link>
	<description></description>
	<lastBuildDate>Mon, 19 Jul 2010 06:45:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>nl</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Search Engine Optimization (SEO) Toolkit</title>
		<link>http://lsd.luminis.nl/search-engine-optimization-seo-toolkit/</link>
		<comments>http://lsd.luminis.nl/search-engine-optimization-seo-toolkit/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 14:36:19 +0000</pubDate>
		<dc:creator>Erik Sanders</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=416</guid>
		<description><![CDATA[De search engine optimization toolkit die microsoft (zie ook de SEOToolkit site) biedt vele mogelijkheden om je IIS websites te optimaliseren. Je kunt je vindbaarheid verhogen door:

Sitemaps en site indexes te maken
Robot verkeer te regelen
Analyseren van de site

Het analyseren beperkt zich niet tot een IIS site maar kan op een willekeurige site worden losgelaten. Ik heb [...]]]></description>
			<content:encoded><![CDATA[<p>De search engine optimization toolkit die microsoft (zie ook de <a title="SEO Toolkit" href="http://www.iis.net/extensions/SEOToolkit" target="_blank">SEOToolkit</a> site) biedt vele mogelijkheden om je IIS websites te optimaliseren. Je kunt je vindbaarheid verhogen door:</p>
<ul>
<li>Sitemaps en site indexes te maken</li>
<li>Robot verkeer te regelen</li>
<li>Analyseren van de site</li>
</ul>
<p>Het analyseren beperkt zich niet tot een IIS site maar kan op een willekeurige site worden losgelaten. Ik heb dit direct losgelaten op onze nieuwe &#8216;out of the box&#8217; WordPress installatie en was vervolgens erg snel klaar met de analyse. De robot.txt blokkeerde alles. Dit was natuurlijk snel opgelost maar dit geeft maar aan dat controle van je site niet overbodig is.</p>
<p>De toolkit is zeer eenvoudig te installeren via de Microsoft Web platform installer (<a title="Web Platform" href="http://www.microsoft.com/web/Downloads/platform.aspx" target="_blank">dowload</a>) applicatie. Met deze applicatie is het beheren van je webserver zeer eenvoudig.</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/search-engine-optimization-seo-toolkit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using GWT to create an OSGi-aware web application</title>
		<link>http://lsd.luminis.nl/using-gwt-to-create-an-osgi-aware-web-application/</link>
		<comments>http://lsd.luminis.nl/using-gwt-to-create-an-osgi-aware-web-application/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 20:14:29 +0000</pubDate>
		<dc:creator>Angelo van der Sijpt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache ACE]]></category>
		<category><![CDATA[Apache Felix]]></category>
		<category><![CDATA[extender]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[pax]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[smartservices]]></category>
		<category><![CDATA[toolkit]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lsd.luminis.net/?p=217</guid>
		<description><![CDATA[<p><a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> is cool, and so is OSGi. However, creating a web application that can use OSGi services is not that easy. By the end of this tutorial, you will have created a GWT project that delivers a usable jar. If you're impatient, skip to the end for the downloadable Eclipse project.</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2010-02-20</strong> <em>Both Pax Runner 1.3.0 and GWT 2.0 have caused quite some changes to this post. I have tried to stay up to date as well as I could (the zipped project now uses GWT 2.0), but you might find some inconsistencies when following the tutorial.</em></p>
<p><a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> is cool, and so is OSGi. However, when building a web UI for <a href="http://cwiki.apache.org/confluence/display/ACE/Index">Apache ACE</a>, I found out that creating a web application that can use OSGi services is not that easy. By the end of this tutorial, you will have created a GWT project that delivers a usable jar. If you&#8217;re impatient, skip to the end for the downloadable Eclipse project.</p>
<h3>Step 1: Create a GWT project</h3>
<p>Create a regular GWT project using the regular webAppCreator; this will give you a project that includes an <a href="http://ant.apache.org">Ant</a> buildfile, we will need that later on.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">angelos:workspace angelos$ ./gwt-mac-1.6.4/webAppCreator -out GwtDemo net.luminis.gwt.gwtdemo
Created directory GwtDemo/src
Created directory GwtDemo/war
Created directory GwtDemo/war/WEB-INF
Created directory GwtDemo/war/WEB-INF/lib
Created directory GwtDemo/src/net/luminis/gwt
Created directory GwtDemo/src/net/luminis/gwt/client
Created directory GwtDemo/src/net/luminis/gwt/server
Created file GwtDemo/src/net/luminis/gwt/gwtdemo.gwt.xml
Created file GwtDemo/war/gwtdemo.html
Created file GwtDemo/war/gwtdemo.css
Created file GwtDemo/war/WEB-INF/web.xml
Created file GwtDemo/src/net/luminis/gwt/client/gwtdemo.java
Created file GwtDemo/src/net/luminis/gwt/client/GreetingService.java
Created file GwtDemo/src/net/luminis/gwt/client/GreetingServiceAsync.java
Created file GwtDemo/src/net/luminis/gwt/server/GreetingServiceImpl.java
Created file GwtDemo/build.xml
Created file GwtDemo/README.txt
Created file GwtDemo/.project
Created file GwtDemo/.classpath
Created file GwtDemo/gwtdemo.launch
Created file GwtDemo/war/WEB-INF/lib/gwt-servlet.jar</pre></div></div>

<p>If you want to, you can import this project directly into your Eclipse. If you check the mark &#8220;use Google Web Toolkit&#8221; in the project properties, you can use all the same goodies that creating the project in Eclipse would have given you. Remember to replace the buildpath entries for gwt-user.jar and gwt-dev-*.jar by a Library import for GWT.</p>
<h3>Step 2: Include the necessary OSGi references</h3>
<p>Create an &#8216;ext&#8217; directory, and add org.osgi.core.jar to that. In Eclipse, add this jar to your build path.</p>
<h3>Step 3: Use OSGi services from your web applicaiton</h3>
<p>We will first add a simple Activator on the server side.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">net.luminis.gwt.server</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.framework.BundleActivator</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.framework.BundleContext</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> <span style="color: #003399;">Activator</span> <span style="color: #000000; font-weight: bold;">implements</span> BundleActivator <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> BundleContext m_context<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> BundleContext getContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> m_context<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> start<span style="color: #009900;">&#40;</span>BundleContext context<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
        m_context <span style="color: #339933;">=</span> context<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> stop<span style="color: #009900;">&#40;</span>BundleContext context<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then, we up the GreetingServiceImpl to actually use this <a href="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/BundleContext.html">BundleContext</a> (note that we use it directly here, but you could use it to get other services, create a <a href="http://www.osgi.org/javadoc/r4v41/org/osgi/util/tracker/ServiceTracker.html">ServiceTracker</a>, etc.)</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> greetServer<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> input<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">String</span> serverInfo <span style="color: #339933;">=</span> getServletContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getServerInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> userAgent <span style="color: #339933;">=</span> getThreadLocalRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;User-Agent&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;Hello, &quot;</span> <span style="color: #339933;">+</span> input <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;!
&nbsp;
I am running &quot;</span> <span style="color: #339933;">+</span> serverInfo
    <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;.
&nbsp;
It looks like you are using:&quot;</span> <span style="color: #339933;">+</span> userAgent <span style="color: #339933;">+</span>
    <span style="color: #0000ff;">&quot;The framework we run from has &quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">Activator</span>.<span style="color: #006633;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBundles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; bundles in it.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Step 4: Add OSGi dependencies for the compiler</h3>
<p>Add our OSGi dependencies to the classpath, so the compiler can find all of it.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #808080; font-style: italic;">&lt;!-- Add any additional non-server libs (such as JUnit) --&gt;</span></pre></div></div>

<p>Right, let&#8217;s give it a try!</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">angelos:GwtDemo angelos$ ant war
Buildfile: build.xml
&nbsp;
...some output removed...
&nbsp;
war:
[zip] Building zip: /Users/angelos/workspace/workspace/GwtDemo/gwtdemo.war
&nbsp;
BUILD SUCCESSFUL
Total time: 36 seconds</pre></div></div>

<p>You will find a war in your project directory now. There still is one ingredient we need. We need to make this into a proper bundle. We can use <a href="http://www.aqute.biz/Code/Bnd">bnd</a> to help us with that.</p>
<h3>Step 5: use bnd to create a proper war</h3>
<p>Download bnd, and put into a lib directory, and add it to your buildfile.</p>
<p>We create a new target that transforms our war into a jar.</p>

<div class="wp_syntax"><div class="code"><pre class="ant" style="font-family:monospace;">&lt;target name=&quot;jar&quot;&gt;
    &lt;copy file=&quot;gwtdemo.war&quot; tofile=&quot;gwtdemo.jar&quot;/&gt;
    &lt;echo file=&quot;gwtdemo.bnd&quot;&gt;Import-Package: junit.framework;resolution:=optional, com.google.gwt.*;resolution:=optional, org.w3c.*;resolution:=optional, sun.misc;resolution:=optional, javax.imageio;resolution:=optional, javax.servlet.*;resolution:=optional, *
Bundle-Name: GWT Demo
Bundle-ClassPath: WEB-INF/classes, WEB-INF/lib/gwt-servlet.jar
Bundle-SymbolicName: net.luminis.gwt.gwtdemo
Webapp-Context: gwtdemo
Bundle-Activator: net.luminis.gwt.server.Activator
    &lt;/echo&gt;
    &lt;bndwrap jars=&quot;gwtdemo.jar&quot; output=&quot;gwtdemo.jar&quot;/&gt;
    &lt;jar file=&quot;gwtdemo.jar&quot; update=&quot;true&quot;&gt;
    &lt;manifest&gt;
        &lt;attribute name=&quot;Bundle-ClassPath&quot; value=&quot;WEB-INF/classes, WEB-INF/lib/gwt-servlet.jar, .&quot;/&gt;
     &lt;/manifest&gt;
    &lt;/jar&gt;
    &lt;delete file=&quot;gwtdemo.bnd&quot;/&gt;
&lt;/target&gt;</pre></div></div>

<p>What&#8217;s happening here?</p>
<ul>
<li>we copy our war to the same file, but with a jar extension,</li>
<li>we create a file for bnd to use, stating that we
<ul>
<li>want optional imports for junit and the gwt benchmarks, and non-optional imports for everything else (that what the * is for),</li>
<li>have some classes that we want bnd to scan for finding dependencies,</li>
<li>want to use a given Webapp-Context (this is a <a href="http://paxrunner.ops4j.org/display/paxweb/WAR+Extender">Pax war extender</a> specific entry),</li>
</ul>
</li>
<li>let bnd do its magic,</li>
<li>update our manifest: we put the . back on the classpath. This is important for the web application to find all resources, but if we would tell bnd to do it like this, it would treat . as the root of the classpath.</li>
<li>Finally, we delete that temporary bnd file.</li>
</ul>
<p>What does that give us?</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">angelos:GwtDemo angelos$ ant jar
Buildfile: build.xml
&nbsp;
...some output removed...
&nbsp;
jar:
[copy] Copying 1 file to /Users/angelos/workspace/workspace/GwtDemo
[bndwrap] gwtdemo 41 910305
[bndwrap] Warnings
[bndwrap] Superfluous export-package instructions: [WEB-INF.classes.net, gwtdemo.gwt.standard.images, WEB-INF, gwtdemo, WEB-INF.classes.net.luminis.gwt, gwtdemo.gwt.standard, WEB-INF.classes.net.luminis, WEB-INF.lib, WEB-INF.classes, gwtdemo.gwt.standard.images.ie6, WEB-INF.classes.net.luminis.gwt.client, WEB-INF.classes.net.luminis.gwt.server, gwtdemo.gwt]
[jar] Updating jar: /Users/angelos/workspace/workspace/GwtDemo/gwtdemo.jar
[delete] Deleting: /Users/angelos/workspace/workspace/GwtDemo/gwtdemo.bnd
&nbsp;
BUILD SUCCESSFUL
Total time: 23 seconds</pre></div></div>

<p>That&#8217;s it! You can now deploy this jar into a framework that uses the pax web tools. Right, let&#8217;s give that a try.</p>
<p>Download <a href="http://paxrunner.ops4j.org/space/Pax+Runner">pax-runner</a>, and unzip that somewhere. Copy in your new jar, an try the following command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">angelos:pax-runner angelos$ <span style="color: #c20cb9; font-weight: bold;">sh</span> bin<span style="color: #000000; font-weight: bold;">/</span>pax-run.sh <span style="color: #660033;">--profiles</span>=war,compendium gwtdemo.jar</pre></div></div>

<p>Now visit <a href="http://localhost:8080/gwtdemo">http://localhost:8080/gwtdemo</a>:</p>
<p><img class="alignnone size-full wp-image-450" title="gwtdemo" src="http://lsd.luminis.nl/wp-content/uploads/2009/07/gwtdemo.png" alt="gwtdemo" width="500" height="432" /></p>
<h3>Summary</h3>
<p>So, what did we need?</p>
<ul>
<li>A fairly regular GWT project, create with an Ant file,</li>
<li>some code that tries to use OSGi services,</li>
<li>some bnd magic to make the war into a jar,</li>
<li>Pax tools to get it all running quickly.</li>
</ul>
<p>If you don&#8217;t want to use pax runner, you can need to deploy <a href="http://paxrunner.ops4j.org/display/paxweb/WAR+Extender">pax-web-extender-war</a>(<a href="http://repository.ops4j.org/mvn-snapshots/org/ops4j/pax/web/pax-web-extender-war/0.7.0-SNAPSHOT/pax-web-extender-war-0.7.0-20090623.160836-13.jar">jar</a>, snapshot 23 June) and an http server, preferably <a href="http://paxrunner.ops4j.org/display/paxweb/Pax+Web">pax-web-service</a>(<a href="http://repository.ops4j.org/maven2/org/ops4j/pax/web/pax-web-service/0.6.0/pax-web-service-0.6.0.jar">jar</a>), into your framework.</p>
<p>You can download the <a href='http://lsd.luminis.nl/wp-content/uploads/2009/07/gwtdemo.zip'>gwtdemo</a> Eclipse project to play around with it. I have not provided the GWT runtime in this download; you should edit line 4 of the build.xml to point to your installation of GWT.</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/using-gwt-to-create-an-osgi-aware-web-application/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Developing a Flex AIR application</title>
		<link>http://lsd.luminis.nl/developing-a-flex-air-application/</link>
		<comments>http://lsd.luminis.nl/developing-a-flex-air-application/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 22:15:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lsd.luminis.net/?p=177</guid>
		<description><![CDATA[<p>Luminis had already developed a Web application for Nedap Healthcare, and we would like to know if a desktop variant with an offline scenario could be possible. The web application displayed your worksheet, planning, news, weather, birthdays of colleagues.</p>]]></description>
			<content:encoded><![CDATA[<h1>Project description</h1>
<p>During the last few weeks, we&#8217;ve been working on setting up a sample application using Adobe Flex / ActionScript (working with Adobe Flex Builder 3).</p>
<p>Luminis had already developed a Web application for Nedap Healthcare, and we would like to know whether a desktop variant with an offline scenario would be possible. The web application displays items such as a worksheet, planning, news, weather and birthdays of colleagues.</p>
<p>The desktop application does not include all functionality of the Web application, but focuses on the worksheet. The existing functionality will be rebuilt in Flex and Air. The focus of our assignment was on modifying times in the worksheet and implementing an online / offline scenario.</p>
<h1>User Interface</h1>
<p>Web applications have set a new trend in interface design. The rules of interface design are no longer bound by the rules of the Operating System, and also no longer bound by the rules of the developer. The design for Web applications is usually defined by a designer, and implemented by the developer.  For example the Gmail look and feel differs from a standard desktop application, but works in a familiar way. Buttons remain buttons, and input fields look like input fields, but there is the freedom to create a completely new interaction model and design.</p>
<p>The web application we were to base our desktop application on was designed by one of our team members which also did the interaction model. A specific design for a software application can help the customer to recognize the product and get a better feeling about the application. Don&#8217;t think of it as your corporate style embedded in the software, but also as user-friendly since it is targeted toward the end user.</p>
<p>The desktop application is a simple, familiar, user-friendly version of the Web application to be used by the target audience: women aged 40-50 years with little to no computer experience.</p>
<p><img src="http://blog.luminis.nl/roller/luminis/resource/pklein/webtodesktop.png" /></p>
<p>The interface is a direct derivative of the Web application and has the same look and feel.<br />
The desktop application provides the same functionality as the web application, adding the possibility of changing times and the control of the application when it is offline.</p>
<h1>Flex</h1>
<p>Flex makes it easy and fast to build applications. This is especially due to the many standard components. Much can be modified in Flex, such as colors and properties such as shadows and corners. Also refer to the<br />
<a href="http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html">Flex 3 Style Explorer</a></p>
<p>The same functionality of our Flex application could be built quickly if we would use standard Flex. The challenge was to make no concessions to our design. In this process in  which we were responsible for design and implementation, it was occasionally hard to make a balance between adjusting the design or features in Flex to match original design.</p>
<h1>The implementation</h1>
<p>The most common approach building software appliances, is to build it with the standard components and skin it later on. This not only affects the design, but also does not involve the end user in the process.</p>
<p>The implementation chosen here is the same as implementing a design in HTML. From the existing design, slice the PSD and create a grid in Flex. Put the images into the grid and translate component design to Flex where necessary.</p>
<p>In Flex, the possibilities are extensive and there are minimal restrictions. Also covered are a lot of design possibilities like rounded corners, drop shadows and glows. This makes building your application very flexible. But also means you rebuild your original (Photoshop) design in Flex. So adjusting your original design could mean rebuilding your Flex implementation.</p>
<p>For example, when using the application, we noticed that there were indicators missing in the design. These were:</p>
<ul>
<li>Feedback to notify the user what the application was doing.</li>
<li>An indication of whether the application was online or offline.</li>
</ul>
<p>Not wanting to create a new, more complex design (adding items such as a status bar or an online/offline indicator [on/off light bulb]), we chose to show the online and offline situation turning the colors of the application to black and white, and displayed the status at the place where it is triggered on the button. The button is not useful when the application is busy.</p>
<p><img src="http://blog.luminis.nl/roller/luminis/resource/pklein/werkstaatofflinestatus.png" /></p>
<h1>Technologies</h1>
<p>
This should give an overview of the issues we ran into and how we solved them in the context of using the mentioned technologies to setup an AIR application. To get a bit of an overview of the possibilities of Flex / get familiar with the subject, a good first step would be to check out <a href="http://flex.org/tour">Tour de Flex</a>. Since that application includes all (re)sources, it&#8217;s also very convenient as a reference / to get basic samples up-and-running quickly.
</p>
<p>
Now, moving on to the issues encountered and how we tackled them. Please note that the sample code below includes only non-standard import statements and is taken from an Adobe AIR application that uses AIR-only functionality!
</p>
<h1>XML</h1>
<p>It took a while to get a bit of a feeling for creating and handling XML type objects. To illustrate, a number of relevant subtleties are incorporated in the following bit of code:</p>
<pre>
    var i:int = 2;
    var s:String = 'green';

    // Convert a String value to an XML object to create the first element:
    var e1:XML = XML("&lt;element attr1='1'&gt;&lt;label&gt;first label&lt;/label&gt;" +
                     "&lt;color&gt;blue&lt;/color&gt;&lt;/element&gt;");

    // Create the second XML element using the values of variables 'i' and 's':
    var e2:XML =
        &lt;element attr1={i}&gt;
            &lt;label&gt;second label&lt;/label&gt;
            &lt;color&gt;{s}&lt;/color&gt;
        &lt;/element&gt;;

    // Now create the final XML object using the 2 elements that were created:
    var x1:XML = &lt;main&gt;{e1}{e2}&lt;/main&gt;;

    // And query it for a specific attribute value ('attr1', be sure not to forget the '@'!)
    // and element value (color) to determine the label value of a specific element:
    var result:String = x1.element.(@attr1 == 2).(color == 'green').label;
    // The value of the 'result' variable now is "second label". It would've been an empty
    // string ("") in case no matching element was found.
</pre>
<h1>HTTP POST</h1>
<p>The application started out using only the HTTP GET method, which was easily achieved by using the <a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/http/HTTPService.html">HTTPService</a>. However it was soon necessary to post data as well and getting the HTTPService to do this properly / finding some good examples (or even debuggin the (https) requests that were created properly) turned out to be a bit of a hassle. When we stumbled upon the <a href="http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html">URLRequest</a> we got things up-and-running fairly easily:</p>
<pre>
    import flash.net.*;

    private function onPostComplete(event:Event):void {
    }

    private function doPost():void {
        var dataToPost:XML = x1; // Posting the XML object from the previous example.
        var urlLoader:URLLoader = new URLLoader();

        // Define a handler in which actions can be defined for when the post is complete.
        urlLoader.addEventListener(Event.COMPLETE, onPostComplete);

        var urlToPostTo:String = "https://fillinyourhosthere.net/post.xml"
        var urlRequest:URLRequest = new URLRequest(urlToPostTo);
        urlRequest.data = dataToPost.toXMLString();
        urlRequest.method = URLRequestMethod.POST;
        urlLoader.load(urlRequest);
    }
</pre>
<h1>Online / Offline</h1>
<p>Another requirement of the application was that it should be usable even if the target server went down or the client using the application is offline. As it turns out, this functionality is readily provided through using the <a href="http://livedocs.adobe.com/flex/3/langref/air/net/URLMonitor.html">URLMonitor</a>:</p>
<pre>
    // This code assumes a 'mx:WindowedApplication' with 'initialize="onWindowInitialized(event)"'.

    import air.net.URLMonitor;

    private var m_monitor:URLMonitor;

    private function onWindowInitialized(e:Event):void {
        var serviceURL:String = "https://fillinyourhosthere.net";
        var serviceToMonitor:URLRequest = new URLRequest(serviceURL);
        m_monitor = new URLMonitor(serviceToMonitor);
        m_monitor.addEventListener(StatusEvent.STATUS, announceStatus);
        m_monitor.start();
    }

    private function announceStatus(e:StatusEvent):void {
        if (m_monitor.available) {
            // Possibly update work that was done if previously offline.
        } else {
            // The application is (now) offline.
        }
    }
</pre>
<h1>Updating DataProvider data</h1>
<p>When using e.g. an array of data objects as a dataprovider for a TileList (or a DataGrid/AdvancedDataGrid) and changing (the value of) an item in the array, the view isn&#8217;t (always) updated immediately. If you want to see the changes immediately, you should use the <i>invalidateList()</i> method:</p>
<pre>
    &lt;mx:TileList
        id="tl"
        dataProvider="myDataProvider"
    &lt;!-- ...rest of the declaration... --&gt;

    // Do something that updates myDataProvider data.
    tl.invalidateList();
</pre>
<h1>Conclusion</h1>
<p>There are still some things that could be improved on.</p>
<p>It would be preferable that the hours could be entered only through the use of keyboard, or mouse. Now you have to use both, and that makes it less intuitive. And corrupted/invalid data could be entered as the input fields are not masked.</p>
<p>Using Flex as a RIA developer kit can be fun, especially for designer who already know a bit of HTML/CSS and Javascript. Creating a skinned application in Flex is easy to do but still takes more time time than using the original components.</p>
<p>Patrick de Klein &#038; Jaap Vriend</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/developing-a-flex-air-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
