Aurora and Sol

Those are the names people: mark em down. Flexamp is on its way out :). I kinda want the player name to be independent of the technology behind it (I am following an industry norm here. There arent and C++MediaPlayers or JavaAmp πŸ˜› ). While these names may or may not stick, these are the package names of the Flex Project and the J2EE Project on my Eclipse application so they will always be reflected in the source files.
I am fairly far ahead on the clientside implementation of the player but am just about starting the J2EE part. I havent mucked around with J2EE as much although I do come from a Java background as such. Desktop Java has much fewer rules to adehere to. The first step in J2EE is the biggest one and understanding the structure of a J2EE app does take some serious reading.
Of course there is a leap from the book to the server ;).
So here is the story of day 1 of Sol development.

Step 0 – Choose Eclipse:
I do all my programming on Eclipse and love it. Ever since the ASDT plugin came out, Eclipse has been my standard development environment. Its well integraded with CVS and SVN and allows quick text searches which makes life a lot easier. And developing Flash and Java on the same IDE is veeeery convinient. The web tools project is something I am just getting used to and while I have heard seasoned Java developers complain about certain features, my own experience has been fairly good. So armed with Google, I created the Sol project.

Step 1 – Get your J2EE app container + MySQL database:
My www host runs Tomcat 5.0.27 so thats what I run as well. I also downloaded the appropriate MySQL version

Step-2 – Create the Dynamic Web Application Project:
This is a project template that I think came with the web tools plugin on Eclipse. Once you create a new Dynamic Web Project, Eclipse will create the WEB-INF, META-INF, classes and lib directories as per the J2EE spec(A typical j2ee webapp should look like this) in a folder called WebContent. That folder can go as is as a webapp in a container (although typically you would deploy it as a web archive (war) file).

Step 3 – Include the jstl taglibs in your container:
Since I will be using the Java Standard Taglibs, I downloaded the jars from the Apache site. Include these taglibs in either your application’s lib folder or, preferably, in your container’s common lib directory (TOMCAT_HOME/ROOT/common/lib/) which would make them visible to all the webapps.

Step 4 – Create your basic JSP
Since the goal of this pass is to verify that my installation is correct, I wrote the simplest JSP file. You can download it from here.

Step 5 – Run the JSP from within Eclipse:
Make sure that the Tomcat Engine isnt running and then right click on the project and choose Run As … > Run on the server. Update the files if prompted and point to the installation directory of the Tomcat server when prompted to choose the local server. As the server starts up, the server logs appear in the Console window. Eclipse will then launch the built in browser and point it to the application root. Click on the JSP page and ensure that it works.

Possible issue: I have no idea why this was happening but even though my JAVA_HOME environment variable was pointed correctly to the JDK, Tomcat could still not find the javac tool to compile my JSP. On a thread I found the solution to put the tools.jar into the TOMCAT_HOME/common/lib directory. That worked.


and finally….

The try-catch block is possibly one of the least used elements of AS2. Adobe’s page on the try catch block on livedocs is bare bones and pretty much mentions what it does and little else. For the most part, most flash developers are unfamiliar with the concept of error bubbling and you can pretty much get by without it. For example, if you are reading an xml file, and know that it may not exist, you can construct the code like:

var x:XML = new XML();
x.onLoad = function(success:Boolean){
// success

Here, the manager.xmlError() function deals with the error situation. However in the try catch block way your code would look like:

var x:XML = new XML();
x.onLoad = function(success:Boolean){
// success
throw new Error("xml load failed")

By using the throw keyword, you are declaring that that particular class is aware of a failure situation but its upto some other class which is below the class object on the invocation stack to deal with it (Java also has a 'throws' keyword that is used againt the method name to reinforce the fact that the function will throw an error).

So in AS2 land, while errors were 'nice-to-haves', they were by no means mandatory. This situation has since changed in AS3 and flash developers must now be really aware of this programming paradigm. In AS3, the player itself generates errors in certain situations and it is upto your code to deal with these runtime errors.

If try-catch blocks have been the neglected children of AS2, the finally keyword has been the forgotten one. Most of the code that deals with catching errors pretty uses try and catch but hardly ever finally. Code in 'finally' blocks is guaranteed to execute regardless of what happens in the try-catch block. While explaining the concept of finally, one of my collegues asked me the purpose of finally. For example if you have


/// statements here

how is that different from


/// statements here

I did not have any immediate answer for that question besides the better-readability of the code. Reading up on the Java implementation and talking to Java developers (most of whom end up not using it too πŸ˜‰ ), brought out the most important aspect of the finally statement. The part that I hadnt realized was that the finally block is executed even if your try block succeeds and does a return.

In the meanwhile make sure you are upto speed on compiler errors, warnings and runtime errors in Flash.

Https on Apache Tomcat 5.5

I tried to play around with Flex Data Services today. So I downloaded the package and went through the install. Now since I already have an instance of Apache Tomcat 5.5 running on my laptop I was less than inclined to install JRun. So I installed the non-JRun package and deployed the FDS WARs. I ran the the collaborative dashboard example and things looked good. The other application I had been eyeing for a while was the NoteTag example application written by Adobe. For the uninitiated, NoteTag is a collaborative note taking application. The coolest part of NoteTag is that it doesnt have a backend database but rather uses Blogger, TypePad and to store the data. However since these services require authentication over SSL, I had to install a security certificate on my Tomcat instance.

So here is how I went about it. First of all, the SSL key generator is part of the core JDK as of Java 1.4. The keytool is available at %JAVA_HOME%binkeytool.exe. Run it as specified at the Apache Tomcat tutorial site:

keytool -genkey -alias tomcat -keyalg RSA

The tool asks a series of questions like name, address etc to write the keystore. Once the key is written, move it to where tomcat can access it in the Catalina directory. Lastly uncomment the HTTPS connector and add the following attributes:



I still havent managed to run NoteTag (I am getting connection errors) but thats a battle for tomorrow. Right now I need to go to sleep.

HOLY SH** !!!! WE WON !!!!!


We WON!!!


The Fan won the People’s choice award from among 60 other applications. I gave a stuttering speech when I accepted the orange arrow.
Of course most of the kudos go to the design and the interaction gurus but I’d like to think development has had something to do with it as well :D.

Weirdly, this completes my Flash Forward experience. I first went to FF 3 years back as a volunteer, then as a regular attendee once I had a full time job….then as a speaker on architecting Flash applications for enterprise applications and finally this year as a nominee and winner !!!!

Onward to MAX ;).

More notes, Day 2, FF Austin

XD Talk:
Better looking evolution of Mike Chamber’s ApolloTunes, now renamed to Acsension. Neat design for the xd group: XD bold and joined to look like a bomb.

Browser Power for Flash
1) Loading a valid xhtml file as an xml file. (I think its a better idea than ripple but I need to look more at Ted Patrick’s FXT to compare with that)
2) To ‘hide’ the javascript parts of the HTML document surround the js in comment tags within the script block.

3) idMap[id] in the XML Object in Flash 8 returns the node with the id referenced.

From the Yahoo AS2 – AS3 migration talk:

1) Do not put code in constructors of classes since they arent JIT-ed.
2) NetConnection you can change objectEncoding to AMF0 or AMF3 to send data in AMF format.
3) The ‘delete’ keyword deletes only dynamic properties and methods.

From the FlexBuilder talk:
Eclipse editor shortcuts : Ctrl+Shift+L

From Grant Skinners talk on Resource Management in AS3.

AS3 doesnt garbage collect until it starts running out of memory.
Use weak references when adding listeners.
Have explicit dispose functions in your classes.

Blogging from Flash Forward, Austin

Am at the Flash Forward Conference at Austin. Has been fun so far even though I am really tired. I attended a few useful sessions so far one of which I am not allowed to speak about ;). I think the most educational session has been the one on the Flex component life-cycle by Chafic Kazoun. I have been reading about it but its different when someone walks you through the code of a custom component. Quick notes from the talk:

1) Lifecycle: constructor -> createChildren -> commitProperties ->measure -> updateDisplaylist.
2) The constructor and the createChildren is called only once.
3) Invalidation: invalidateProperties, invalidateSize, invalidateDisplaylist each calls a corresponding commit event to be fired from Flex.
4) Embedding swfs and ripping symbols from the library: [Embed(source=”/assets/source.swf” symbol=”[symbol_linkage]”]
5) I have never used the BitmapAsset class. Need to look at what that is.
6) In the updateDisplayList call [instance].move(x,y) rather than [instance].x = [value] since move fires additional functions that let flex layout stuff correctly.
7) Measure doesnt get called if width,height are declared explicitly.
8) You can access unscaledwidth, unscaledHeight in the updateDisplaylist functions to layout your stuff. Call the children’s setActualSize function accordingly.

Another tip from a different talk:
[Flash8] CacheAsBitmap your masker and maskee to get smooth 8bit alphas.

Thats it so far. More stuff as it happens.

Next Gen Apps: Really Good or RRRReally Bad !

I installed MAX today, a new app running on the WPF RC1 runtime, mostly cos of the hype I read on a few blogs. Is it great? Well I dont know. Its…different. A lot of things glow. A lot of things have drop shadows. There are some tweens. But is that what I am looking for in an app that manages my photos and my blogs? Its kind of hard for me to say this but I dread the new world of ‘cinematic apps’. Why? Cos its so easy to get them wrong. The biggest complaint against Flash used to be that every Flash site had to be learnt. The newer sites seem to be doing a better job of information architecture but thats come after years of learning from bad apps. And now the desktop is open to similar abuse with application developers flexing their new-found freedom from traditional controls.

WPF’s prize demo is the Northface application that shows users videos overlayed on 3d planes and videos overlayed on video. I am completely blah’ed by it and couldnt care less. Nor do I care about the photos rotating 360 degrees before coming into view. Actually for a desktop app, I cant think of any place I would use 3d anyway. I still want Flash to come up with native 3d but thats cos I would like to make a game or some interesting new UI for a site but I dont think for an app like an rss browser.

Maybe I lack imagination and maybe I am just getting old (26 years !!…shudder). Maybe I will revisit my fears when some new apps come out. I still think MAX is interesting, but I doubt it’ll replace my RSSOwl