Going to Flash On The Beach 2009
Now i finally got my ticket for this years’s Flash On The Beach in Brighton…
And if it wasn’t enough to get to hear all the übercool speakers at this year’s FOTB, but I also managed to enroll into this year’s workshop entitled “Down And Dirty With The Low Level Bytes” featuring none other than infamous and enormously capable Lee Brimelow…
In case you haven’t signed up yet yourself, check it out and hurry if you are interested in one of the very compelling workshops this year…
http://www.flashonthebeach.com/
Mapping Design and Develop Disciplines… My Competencies
In continuation of reading Doug Winnie’s pretty clever article about how to map design and development disciplines and into a simple competence matrix, I decided to do my own…
The basic idea is for the individual to be honest in order to identify areas of where to improve as well as identify areas which may be more likely of creating positive outcomes when focused upon.
The extension of this is to use it for team constellation planning and for matchmaking in competence development programs, this will allow project managers to validate team competencies against project characteristics in order to ensure that all bases are covered for any given project. The approach is simple and in comparison to more elaborate approaches, maybe to crude for some who are already doing competencies matrices, but for those of us who are not yet having a program of such kind in place, this is an easy beginning.
Getting started with mapping competencies are really simple.
You start with downloading the template in an editable PNG file format.
And then you can modify it to match your own competencies and then e.g. compare with the profile you wish to match.
When I did that for myself, it came to look like this.
Comparing with where I wish to be, I can see that I perhaps need to play around with Photoshop for a weekend or two…
Anyways… check out the original article by Doug Winnie for download of resources and to read more about the approach…
http://www.adobe.dougwinnie.com/?p=111
Invoking the Flex Compiler from Adobe AIR… with Merapi and the Flex Compiler API
As the first step in a larger effort trying to automate my Flex Application development, I have been creating a simple Adobe AIR application that through the AIR bridge from the Merapi Project invoke the Flex compiler.
The implementation is only intended as the first experiment, so currently the use case for the App is a bit farfetched… however, the offspring of this experiment and the potential implications are very strong in terms of workflow optimizations.
Anyways, lets get on with it…
I have to warn you in advance, this is not the simplest possible implementation, but originally it was not my intention to post about it. A better sample would have excluded all the didn’t relate to the central elements which in this case is the Flex Compiler API and getting in touch with it through Merapi. Anyways… after this disclaimer… let’s get on with it…
There are a number of prerequisites in order to get started.
First you need to download and familiarize yourself with the Merapi Project.
Then you need to get the Flex Compiler. The easiest way is to grab it from the Flex SDK which was installed alongside Flex Builder / Flash Builder.
You can find the JAR file in following location:
{Flash Builder Installation Directory}/sdks/{SDK Version}/lib/flex-compiler-oem.jar
On my machine the location looks like this:
Applications/Flash Builder Plugin 4 Beta 1/sdks/4.0.0/lib/flex-compiler-oem.jar
Setting up the appropriate Java project is an exercise I will leave for you to accomplish on your own as out of scope of this post to go through that.
After setting up the project, the first we need to create the Java application which will be running in the background and listening for messages from Adobe AIR.
This application will instantiate the Merapi AIR bridge and through this listen for commands in the form of Compile message types.
It could look something like this…
import java.io.File;
import merapi.Bridge;
import flex2.tools.oem.Application;
public class FxsdkJavAirApplication
{
public static void main(String[] args)
{
Bridge.open();
new CompileHandler();
}
protected static void compile(CompileMessage message)
{
try
{
String inputFile = message.inputFile;
String outputFile = message.outputFile;
Application application = new Application(new File(inputFile));
application.setOutput(new File(outputFile));
application.setProgressMeter(new FxsdkJavAirProgressMeter(message));
long result = application.build(true);
if (result > 0)
{
System.out.println("COMPILE OK");
}
else
{
System.out.println("COMPILE FAILED");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
The message which will be using to pass through the bridge is called CompileMessage and inherits from Merapi’s message class and we are using the Application class from the Compiler API to actually do the building of the SWF from the MXML file.
import merapi.messages.Message;
public class CompileMessage extends Message
{
public static final String COMPILE = "compile";
public String inputFile = null;
public String outputFile = null;
public int progress;
public CompileMessage()
{
super();
}
}
Seeing that I copied most of the Java code from the HelloWorld sample of the Merapi project, the calling back to the Adobe AIR application is implemented in the ProgressMeter seeing that this was a very easy and convenient way of getting the callback to function. It should not be regarded as a recommended way of doing it, this is merely an experiment and should not be taken on account for recommended ways of implementing callbacks.
import merapi.messages.IMessage;
import flex2.tools.oem.ProgressMeter;
public class FxsdkJavAirProgressMeter implements ProgressMeter
{
private CompileMessage message;
private long before, after;
FxsdkJavAirProgressMeter(IMessage message)
{
super();
this.message = (CompileMessage)message;
}
public void start()
{
before = System.currentTimeMillis();
System.out.print("begin...");
}
public void end()
{
after = System.currentTimeMillis();
System.out.println("done");
System.out.println("Elapsed Time: " + (after - before) + "ms");
this.message.send();
}
public void percentDone(int n)
{
System.out.print(n + "...");
this.message.progress = n;
this.message.send();
}
}
One of the key elements in the establishing the bridge between Adobe AIR and Java is the message handler invoked by the Java application.
This eventually registers a message type and will assume the role of the observer in the messaging flow.
import merapi.handlers.MessageHandler;
import merapi.messages.IMessage;
public class CompileHandler extends MessageHandler
{
public CompileHandler()
{
super( CompileMessage.COMPILE );
}
public void handleMessage( IMessage message )
{
if( message instanceof CompileMessage )
{
CompileMessage compileMessage = (CompileMessage)message;
FxsdkJavAirApplication.compile(compileMessage);
}
}
}
These 4 classes are all the constitute the Java application based on the existing Flex Compiler API and the classes from the Merapi Project.
Now in the same order, I will go through the Flex part of the application.
First we have the application itself, in this case it is the container of the form and the Mate EventMap and to spice thinks up, a PreferenceMap which wraps the logic relating to managing user preferences.
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:simplecompile="org.hello.fxsdkjavair.simplecompile.*"> <simplecompile:SimpleCompileForm /> <fx:Declarations> <simplecompile:MainEventMap /> <simplecompile:PreferenceMap /> </fx:Declarations> </s:WindowedApplication>
The message which corresponds to the message in the Java application looks something like this.
package org.hello.fxsdkjavair.simplecompile
{
import merapi.messages.Message;
[Bindable]
[RemoteClass(alias="CompileMessage")]
public class CompileMessage extends Message
{
public static const COMPILE:String = "compile";
public var inputFile:String = null;
public var outputFile:String = null;
public var progress:int;
public function CompileMessage()
{
super( COMPILE );
}
}
}
Then we have the form which contains the code allowing us to manage the inputfile and the outputfile paths.
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:merapi="http://merapiproject.net/2009"
xmlns:simplecompile="org.hello.fxsdkjavair.simplecompile.*"
width="100%" height="100%">
<fx:Script>
<![CDATA[
import com.adobe.air.preferences.Preference;
import com.asfusion.mate.core.Cache;
import mx.rpc.events.ResultEvent;
protected function compileHandler_resultHandler(event:ResultEvent):void
{
this.currentState = READY;
}
protected function compileButton_clickHandler(event:MouseEvent):void
{
this.currentState = PROCESS;
this.compileMessage.inputFile = inputFileInput.text;
this.compileMessage.outputFile = outputFileInput.text;
this.compileMessage.send();
this.preference.setValue( "inputFile", inputFileInput.text );
this.preference.setValue( "outputFile", outputFileInput.text );
}
[Bindable]
public var preference:Preference
public static const READY:String = "ready";
public static const PROCESS:String = "process";
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Declarations>
<simplecompile:CompileMessage id="compileMessage" />
<merapi:MessageHandler id="compileHandler" type="{ CompileMessage.COMPILE }" result="compileHandler_resultHandler(event)" />
</fx:Declarations>
<s:Group width="100%" height="30">
<s:layout>
<s:HorizontalLayout>
</s:HorizontalLayout>
</s:layout>
<s:TextInput id="inputFileInput" width="100%" text="{ this.preference.getValue('inputFile') }" />
<s:TextInput id="outputFileInput" width="100%" text="{ this.preference.getValue('outputFile') }" />
<s:Button id="compileButton" label="Compile" click="compileButton_clickHandler(event)" enabled.process="false"/>
<mx:Label text="{ this.compileMessage.progress }%" />
</s:Group>
<mx:DataGrid id="resultGrid" width="100%" height="100%" />
<s:states>
<mx:State name="ready" />
<mx:State name="process" />
</s:states>
</s:Group>
For your reference, I will just be adding the EventMap and the PreferenceMap as well…
First we have the EventMap which is a core element of Mate based applications, again… this as well is outside the scope of this post to discuss further.
<?xml version="1.0" encoding="utf-8"?>
<mate:EventMap xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:mate="http://mate.asfusion.com/">
<fx:Script>
<![CDATA[
import com.adobe.air.preferences.Preference;
import mx.events.FlexEvent;
]]>
</fx:Script>
<fx:Declarations>
<mate:EventHandlers type="{ FlexEvent.INITIALIZE }">
<mate:ObjectBuilder generator="{ Preference }" />
</mate:EventHandlers>
<mate:EventHandlers type="{ FlexEvent.LOADING }">
<mate:MethodInvoker generator="{ Preference }" method="load" />
</mate:EventHandlers>
<mate:EventHandlers type="{ Event.CLOSING }">
<mate:MethodInvoker generator="{ Preference }" method="save" />
</mate:EventHandlers>
</fx:Declarations>
</mate:EventMap>
This is the preferencemap, again it might be total overkill to put in a sample such as this… but seeing that it is a basic part of any application I do these days, I saw no reason to exempt it. Remembering the user’s preferences is paramount when creating user experiences which seeks to satisfy the increasingly high expectations of users today.
<?xml version="1.0" encoding="utf-8"?>
<mate:EventMap xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:mate="http://mate.asfusion.com/">
<fx:Script>
<![CDATA[
import com.adobe.air.preferences.Preference;
]]>
</fx:Script>
<fx:Declarations>
<mate:Injectors target="{ SimpleCompileForm }">
<mate:PropertyInjector source="{ Preference }" targetKey="preference" />
</mate:Injectors>
</fx:Declarations>
</mate:EventMap>
This is far from a complete or perhaps even suitable sample to illustrate the interoperation with both Merapi and the Flex Compiler API, but I decided to put it out here as part of a collaborative effort of getting my hands dirty with extending Flash Builder and Flash Catalyst.
If you have any questions regarding this sample, please don’t hesitate to contact me or comment on the post.
I will soon make the source code available under the “unsponsored” framework.
FlashCamp Sofia 2009… the website
Only today I found out that the FlashCamp Sofia 2009 I spoke at last week had a website… Anyways, its probably one of the most well-build and extravagant one of its kind, so I thought it deserved a mention.
However, beware… its in Bulgarian…
Check it out…
http://gugga.com/flexcamp/
I guess this is just a humble example on the professionalism and thoroughness with which Gugga seems to always approach tasks…
Quirk with the Merapi Hello World project…
When running the Merapi project for the first time within Flash Builder, the obvious choice is to look for the Hello World project. However, when you first try to run this project the compiler will complaint with the following error:
Actual Results:
Process terminated without establishing connection to debugger.Command:
“/Applications/Adobe Gumbo MAX Preview/sdks/4.0.0/bin/adl” -runtime “/Applications/Adobe Gumbo MAX Preview/sdks/4.0.0/runtimes/air/mac” “/Users/mac/Documents/Flex Builder 3/myair/bin-debug/myair-app.xml” “/Users/mac/Documents/Flex Builder 3/myair/bin-debug”Output from command:
error while loading initial content
The solution is to update the application configuration file to use the 1.5 namespace instead of the preconfigured one which is set to 1.1.
You can read more about the solution in the Adobe JIRA here: http://bugs.adobe.com/jira/browse/FB-15687
First meeting in DFUG-CPH was a success…
65 signups and the room was full… very few seats were left unoccupied when James Ward began his presentation of Flash Catalyst and Flash Builder 4.
Here is a picture of James as he enjoys a one of the clever questions from the audience…

FlashCamp Sofia 2009… Presentation
I have just finished my presentation at FlashCamp in Sofia 2009. Being presenting immediately after Mihail Pricobe presented me quite a challenge since most of the material I had was covered by his contents (he covered the entire Workflow from Creative Suite and onto coupling the Flex Application to the backend services).
So I ended up creating my presentation until the minute before I was on… quite an interesting exercise since I remembered my slides better than I probably normally would have with a first-time presentation…
Anyways, you can check out the slides here, the video will be posted later as it gets released by the event facilitators…
Introducing Google’s PowerMeter…
How much does it cost to leave your TV on all day? What about turning your air conditioning 1 degree cooler? Which uses more power every month — your dishwasher or your washing machine? Is your household more or less energy efficient than similar homes in your neighborhood ?
Its nearly impossible to make informed choices about electricity. This is a problem but also a huge opportunity for us all to save money and help the environment by reducing our power usage. Studies show that access to your household’s personal energy information is likely to save you 5–15% on your monthly bill. Even greater savings are possible if you use this information to see the value of retiring your old refrigerator, installing a new air conditioner or insulating your home. The potential impact of large numbers of people achieving similar efficiencies is even more exciting. For every six households that save 10% on electricity, for instance, we reduce carbon emissions as much as taking one conventional car off the road.
In Denmark we have Elsparefonden’s MyHome project and some clever legislation forcing Utility Companies to share consumption data with the clients. However, its far from the situation in most other places in the world which is why its so interesting what Google is doing with their PowerMeter application. At Google they’re doing their helping enable a future where access to personal electricity information helps everyone make smarter energy choices. Google PowerMeter shows consumers their electricity consumption in a secure Google gadget. Currently they are testing the product with utility partners in the US, India and Canada and they plan to expand the rollout of Google PowerMeter later this year.

Check it out…
http://www.google.org/powermeter/
Introducing Adobe “Blueprint”
Blueprint is a plugin for Adobe Flash Builder that allows users to query for Adobe Flex and Adobe Flash code examples found on the Web directly inside of the development environment. The purpose of this preview is to assess the level of community interest in this type of customized search interface for code examples.

I have installed it and have already found it to be an interesting addition to the existing documentation… check it out…
http://labs.adobe.com/technologies/blueprint/
My Microsoft Entourage is suffering from “Database Daemon Fatal Error”…
Now its been two times in three days I have had to run the Database Utility which is shipped and installed together with Microsoft Office for MAC 2008.
Each time I have been forced to do so has been due to a Fatal Error (see screenshot below) in the Microsoft Database Daemon which seems to fail in keeping consistency and integrity in the database underlying Microsoft Entourage.

The solution to solve it is pretty easy… inside the Microsoft Office directory of the local applications folder, you will find a sub-directory entitled “Office” which contains the application called “Microsoft Database Utility”. When executed the application offers you the option of rebuilding the database. Choosing this option will fix the issues while off course creating a backup in case something even more serious should fault during rebuilding. I can’t imagine what use a backup a broken database can have, but I guess its a nice gesture by the utility developers.
Anyways, should you encounter the error below, don’t dispair… make a quick search on your preferred search engine and find this blog-entry, then your problem is likely to be solved in less than half an hour.










