Need a QuickFix? Try Google App Engine, Adobe AIR, and Flex

Last week I spent a few hours with Dick Wall of the Java Posse working on an application which combines Google App Engine, Adobe AIR, and Flex. This was a fun experiment that turned into a pretty cool application. The application, named QuickFix, sends an image to Google App Engine which does an “I’m Feeling Lucky” transformation on the image and sends it back. Here’s a screenshot of it fixing one of the photos I took at the Java Posse Roundup this past winter:

You can get the application by going to:
http://airquickfix.appspot.com/

All of the source code can be found in the air-quick-fix project on Google Code.

The division of work between Dick and I worked really well. Dick worked on the back-end code in Python while I worked in Flex on the front-end. We used PyAMF to connect the back-end to the front-end. PyAMF made the whole process very easy. The only challenge was in figuring out how to transform the data types correctly. The first version of the application came together in a couple of hours.

The back-end Python code is really simple. Here is the method that is called from the client (trimmed down a bit):

def fiximage(data):
 
  image_in = Image(str(data))
  image_in.im_feeling_lucky()
 
  image_out = ByteArray()
  image_out.write(image_in.execute_transforms())
 
  return image_out

In this code, the data which is passed to the method is just a ByteArray containing the image. The data is turned into an Image, the im_feeling_lucky transform is specified, then run - taking the bytes and sending them back to the client.

The front-end Flex code that sends the image to the back-end is also really simple:

The RemoteObject (AMF networking API in Flex) is defined as:

<mx:RemoteObject id="ro" destination="image" endpoint="http://airquickfix.appspot.com/image/">

The function which actually makes the request to the back-end is:

var stream:FileStream = new FileStream();
stream.open(startFile, FileMode.READ);
var imageData:ByteArray = new ByteArray();
stream.readBytes(imageData);
ro.fiximage(imageData);

In this Flex code the image file is opened, read into a ByteArray, then sent to the fiximage method on the back-end.

There is a bunch of other Flex code that creates the UI, handles selecting, saving, and dragging and dropping images but is all pretty straightforward.

Dick and I really enjoyed creating this application together. It shows off some of the strengths of each technology well and shows how easy it is to use the technologies together. Let us know what you think about the application.

Two Great Flex / Adobe AIR Articles

Just a quick note about two great articles which were recently published:

ActionScript Collections and Functional Programming by Bruce Eckel
In this article Bruce provides examples and insights into the functional pieces of ActionScript. He also covers some of the lesser known things about Collections. I learned quite a bit from this one!

InfoQ Case Study: NASDAQ Market Replay
Jon Rose worked with NASDAQ to create a great case study about using Adobe AIR, Flex, and Amazon S3.

MAX 2008 - Full of Flex Goodness

Adobe MAX is a special time of year. Kind-of like getting together the family for Christmas… Lots of drinking, carousing, and the gift of inspiring Flex talks by people like Ely Greenfield and Christophe Coenraets.

This year festivities take place November 16 - 19 at Moscone in San Francisco. Moscone has become like my second home so I’m glad to yet again visit that little village by the sea. Best thing about Moscone is the number of Starbucks within a block of the place.

Last year sold out fast, so go register today!

Filty Rich [Flex] Clients on June 3rd

Chet Haase and I will be doing a presentation at the SDForum Java SIG in Palo Alto on June 3. Hope to see you there!

Flex and Adobe AIR Interview from QCon SF 2007

InfoQ.com has posted an old interview I did with Jon Rose at their QCon SF 2007 conference. In this slightly dated interview I talk about the usual Flex, Adobe AIR, and RIA topics. Makes me wish I still had my beard. Gosh I was sexy. ;)

Adobe Open Source Presentation in New York Tomorrow

Tomorrow night I’ll be presenting at the New York GNU/Linux Meetup Group about Adobe Open Source - including the Adobe Flex SDK, Mozilla Tamarin, Adobe AIR (pieces like SQLite and WebKit), and BlazeDS. More details here. Hope to see you there!

Rich-Client Misconceptions & Adobe’s Open Screen Project

Artima recently posted two interviews with me which relate to Flex. First is an interview about Adobe’s Open Screen Project. The second is called Rich-Client Misconceptions. Also Bruce Eckel recently posted a very interesting article on Artima called “Concurrency with Python, Twisted, and Flex“. Let me know what you think about those.

Whoops. Cool Flex Typo at JavaOne 2008

At JavaOne 2008 the daily edition of “JavaOne Today” features an interview with Sun’s Tor Norbye saying “Java and the Flex SDK are both open sourced. I hope they both benefit from community involvement at whatever level people choose to get involved.”

Funny thing is that this is actually a quote from Chet Haase of Adobe which was featured in yesterday’s JavaOne Today. Whoops.

See a picture from Tor’s interview below.

Count on Flex - 9,547

9,547 = Number of members of the FlexCoders Yahoo! Group.

That’s 9,547 more reasons you can Count on Flex!

“Count on Flex” is a series of blogs about the current state of the Flex ecosystem… by the numbers.