Archive for July, 2009

Some internals related to Flex and remoting

When I started working with Livecycle Data Services and Java remoting I was afraid of doing too many remote calls at one time because of the network latency – if the network latency is 100ms and you do ten remote calls in order to fill a panel with data you will lose (10/maximum no of parallel connection supported by the browse*0.1) seconds for requests  . At least this is what I thought, taking into account my experience with Ajax.

However I found that this is not the case when doing remoting using the AmfChannel (which is backed by flash.net.NetConnection). In this case all your remote calls are put in a queue, and then all this request are grouped in a single HTML post. So no ten calls, only one – you can check that using a proxy like Charles.

It is important to note that this happens only when you use channels backed by flash.net.NetConnection – if you use HttpChannel which is backed by flash.net.URLLoader you will have 10 different calls.

So I can conclude that you should not be worried that you have too many HTTP requests (listed as the first optimization by Yahoo -check this link) when using remoting.

Livecycle Designer 8.2 and SQLServer 2008

If you install SQLServer 2008 after Adobe Livecycle Designer 8.2 you will discover that Designer no longer works. In order to resolve this conflict you need LiveCycle ES Update 1 Designer Service Pack 2 patch.

Adobe Wave launched on Adobe Labs

Adobe Wave Beta was launched on Adobe Labs – it can be accessed here. The idea behind it is quite simple and in the same time quite interesting. Suppose that you are interested in being notified when a retailer is offering a great discount and when a new movie is offered by a content provider – a solution is to install two desktop applications from the publishers and to be receive background notifications when an event happened. The problem is that if you are interested about a lot of things you will have to install a lot of applications.

Adobe Wave solves this problem – you will get all of your notifications through it. It’s an Air application which can be installed and configured on your computer. You can choose which sites can contact you and subscribe/unsubscribe very easy.

If you are a publisher it’s also very easy to use the Adobe Wave to push your notifications, and also very important it’s free. More details can be found here.

Two new open source frameworks from Adobe

Adobe announced two new open source frameworks: Open Source Media Framework (previously called Strobe) and the Text Layout Framework.  What can you do with these frameworks?

OSMF is a set of components that you can use in order to build your own video player. Until OSMF you either had to use a pre-built player and try to customize its behavior or you had to create your own player. Most of the time the second option was embraced, especially by media publishers. Now, with OSMF it should be much easier to do that.

TLF is a framework for text layout – more powerful than HTML/CSS. It has support for bidirectional text, multiple columns and other typographical features. It does not depend on the Flex Framework so it can be used even from a simple Flash application. A good example of usage is the New York Times TimesReader 2.0.

Java serialization versus AMF/Hessian serialization

Update: I added also compression. The result is the same, Hessian is the clear winner. Not quite sure why deflate takes so much time when applied to AMF output, but I was able to reproduce this result with different inputs.

Two months ago I was asked by several guys from JUG Gothenburg to do a comparison between AMF and classic Java serialization. I was not able to answer at the moment, because I had never thought about it nor had I performed any tests. Now I extended my mini-benchmark from my previous post and I also serialized the objects using Java serialization. The results are below, and you can see from the results that the size of compressed data is much larger for Java serialization (I used Java 1.6). Without looking at the code from ObjectOutputStream I assume that there are no techniques like detecting duplicate values and writing references or writing small number on fewer bytes.

My suggestion is to use AMF/Hessian rather than Java serialization whenever you can – you will be able to save a lot of bandwidth.

The result table is below, and you can download the source code from here.

Avg Time (microseconds) Data size (kbytes)
AMF3 9945 28
Hessian 4675 29
Java serialization 6400 60
AMF3+Deflate 34479 14.5
Hessian+Deflate 6076 14
Java serialization+Deflate 19193 22
XML 22064 158
XML+Deflate 27336 18

Free Enterprise RIA seminar

Finextra and Adobe are hosting an e-seminar related to RIA concepts (real time data, video, rich interactive components) and how to integrate them in trading applications. The session is free, it lasts 75 minutes and is interactive (you can ask questions). It will feature experts from Morgan Stanley, Adobe, Lab 49 and Societe Generale. If you are working for the enterprise and you are interested in RIA applications it’s a good opportunity.

In order to attend go to the Finextra website, where you can read more details and register.

FlexMonkey 1.0

The first  production release of FlexMonkey is available now on the Gorilla Logic website. FlexMonkey is an AIR application used to do automated testing for Air applications. Also it’s free and open source. Related to that, one of my colleagues compiled a list of tools used for testing Flex applications – the list is located here.

Passing URL parameters to a Flash application

I have identified three cases in which you may want to extract parameters passed via the URL to your Flash application:

a)The URL is something like this: http://www.test.com/page.html?parameter=test. The SWF file is included in the HTML page.

Solution: Use the ExternalInterface to extract the data from URL. It’s not a nice solution but I do not know another option. The code is below:

private function readParameters():Object{
 var params:String =
  ExternalInterface.call("window.location.search.substring");
 return (params?(new URLVariables(params.substring(1))):null);
}

b)The URL is something like this: http://www.test.com/page.jsp?parameter=test. The SWF is included in the JSP page. The JSP will be rendered to produce HTML output.

The same solution from a) works. However, it is also possible to read the parameters from the Java code with request.getParameter() and add them to AC_FL_RunContent.. invocation.

    AC_FL_RunContent(
            "src", "test_test",
            "width", "100%",
            "height", "100%",
            "align", "middle",
            "id", "test_test",
            "quality", "high",
            "bgcolor", "#869ca7",
            "name", "test_test",
            "flashvars", "paramOne=test1&param2=test2",
            "allowScriptAccess","sameDomain",
            "type", "application/x-shockwave-flash",
            "pluginspage", "http://www.adobe.com/go/getflashplayer"
    );

Now you can read the parameters with the following code:

var params:Object = Application.application.parameters

c)The SWF is called directly. for example http://www.test.com/myswf.swf?parameter=test

In this case you can read the parameters again using the code from b)

var params:Object = Application.application.parameters