Saturday, April 26, 2008

Hardy Heron

Left office with update manager on to upgrade my work machine "Nemesis" to Hardy Heron. Gotta check it tomorrow. :-)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04
Release: 8.04
Codename: hardy

However, I have no luck on my home machine "Kate". I have filed a bug report at Launchpad and hopefully I can get some help from the community.

- yc

Saturday, April 19, 2008

A Review on Adobe Flex Builder Linux Alpha 3

Initially when I started to write this review, I downloaded and set up Adobe Flex Builder Linux Alpha 2 on my Ubuntu machine, faced some troubles which some will be addressed at the Troubleshooting section. It was left with just three days for evaluation and I got stuck with work. By the time I had the time to start a proper review on it (by following the materials provided by Adobe), it was already expired. I had to download the Alpha 3 instead, which was released on 31st of March.

Just in case that you had the wrong idea, Adobe Flex Builder (I will call it the "general release" to avoid confusion), which can be obtained from this address, is not the same project with the Linux release. They are both on two different projects, where the former follows the Flex product schedule; the latter at this stage is not a full release and not all features of the general release are implemented in it. Please read the release notes of it for a list of supported and unsupported features.

To give a short introduction about myself, I have no Flex technical experience prior to doing the review, knowing just general idea of it. However, I'm a supporter of the MyFUG (Malaysian Flex User Group) and I attended most of their meetings.


Flex Builder is an add-on to Eclipse IDE, a well-known IDE especially for Java-based development. The general release is a commercial add-on but is completely free for educational purpose, it is also available free for 60 days evaluation. The Linux release however is release for evaluation purposes only and it has a fixed expiry date for each release. If you want to find out more about the price and licensing details of Flex Builder, please read this link.

Eclipse is a mature, feature-rich and extensible IDE. Having Flex Builder to be an extension of it gives developers a very-well integrated environment for different kinds of development that could fall under the same project, e.g. developers can easily switch from Flex Development perspective to the Java Development perspective, etc.


As you would have already read from the release notes, the Linux release doesn't support design view at this stage. It provides you with Flex SDK version 2 and 3, Flash Player, JSEclipse, Adobe AIR support and more others that you can read from the What's New.

Without a Design View could actually be a big issue to some people, but given that Unix-based users generally love text more than GUI, it could just not be the case. Plus, writing Flex application using vi editor can longer be that quick in comparison as the Flex Builder provides you with features such as content assistant, quick navigation to API source, etc.

Followed the review guidelines, I developed a simple application with an advanced data grid (read also this) which its data is populated from a local XML file through the HTTP service. The advanced data grid is part of the Data Visualization which is shipped as a trial with the Linux release since Alpha 2, it therefore places a "Flex Data Visualization Trial" watermark in the UI as you can see from the screen-shot below. Another feature that comes as a trial is the Automated Testing.

The solution to remove the watermark seems explained in this blog entry.


So you may question, how bad it is without the Design View. I wrote nearly 50 lines of code with not more than half of them are realizable in the general release via Design View, i.e. <mx:Application/>, <mx:Panel/> and <mx:AdvancedDataGrid/>. The rest of the code is <mx:HTTPService/> and action scripts. Therefore the answer is very subjective to the nature of the application which you are building. If it consists of a lot of UI components, the development can definitely be sped up with drag-and-drop and other features provided by the Design View.

I am not too sure if the general release has the same behaviour (which I doubt no), content assistant does not work for advanced data grid. It turned out to be quite annoying, but knowing that Data Visualization is still at trial, we can safely say that it is not a bug.

I am also very much concerned with having a Maven 2 plug-in for Flex development. There is a popular issue tracking this at SDK-12730.


I had some issues initially when I tried to install the Flex Builder on my system, which is an Ubuntu 7.10 Gutsy Gibbon running on a 64-bit machine. There were a few requirements mentioned in the release notes that I missed out the first two:
You will have to run update-alternatives to replace the default java executable, e.g.
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.5.0-32bit/jre/bin/java 50
I also hit into the following error when I was trying to start the installer with JRE6:
Runtime link error - it appears that libXt got loaded before libXm,
which is not allowed.
Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

Stack Trace:
at sun.java2d.SunGraphicsEnvironment.addDirFonts(
at sun.java2d.SunGraphicsEnvironment.registerFontsInDir(

The quick workaround to this is to set the AWT_TOOLKIT environment variable with the value XToolkit.

Further Reading and Other Resources

Friday, April 11, 2008

I'm a Java guy

Learned from KageSenshi that, there is a meme happening at the Fedora Planet, that is to execute this command:

history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head

Here's my result:

yclian@nemesis:~$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
110 ls
109 cd
41 sudo
39 svn
37 mvn
21 cat
12 java
10 $JAVA_HOME/bin/java
9 find
8 sh

svn, mvn, java. What a Java guy.

It's your turn now. :-)

- yc

BridgeComponent.. OMG

In Mule, BridgeComponent is the root of a lot of evil if you do not pay enough of attention, for instance, you might be wondering why interceptor was not working then realized that BridgeComponent was the culprit!

What is a BridgeComponent? According to the API documentation:

The BridgeComponent is a standard Mule component that enables a bridge between an inbound and outbound endpoints. Transformers can be used on the endpoints to convert the data being received in order to 'bridge' from one endpoint transport to another.

When the BridgeComponent is used, it configures itself so that it will not actually be invoked, instead it tells Mule to bypass invocation of the component, which has a slight performance improvement. Note that because the component is never actually invoked any interceptors configured on the component will not be invoked either.

It is an implementation of the Messaging Bridge pattern in integration. A messaging bridge is responsible to connect two different channels, it is smart because it has a big list of channel adapters.

Fair enough, the API documentation has warned you about interceptor. It's all your fault if you did not read it.

I had been working on a response router problem since morning, scratching my head since then, and in the end realized that the culprit of my unexpectation was the BridgeComponent. What is a response router? Basically, in Mule, a response router is used for request-reply scenario, where a request will be blocked until a response is formed (usually using an aggregator) from results of asynchronous calls. But what is the problem? When my client sent a request to Mule, it received a null response straight after the invocation, before the asynchronous calls were ever made.

I had done a lot of debugging, drilling into the code to find out which part that I could have missed out, perhaps it would just be a missing property? Yes, there was a lot of WTFs. Until I did a full code search on "*ResponseRouter" and noticed that DefaultMuleProxy was in the results..

What had happened? The DefaultMuleProxy is a proxy to a UMO component and it handles its lifecycle (start/stop), interceptors and message routing (which includes response router). When you use a BridgeComponent, request will be forwarded from the inbound to the outbound directly without invoking the UMO component, and thus the response router part will not be not taken care. As Mule dispatches messages asynchronously if ReplyTo is detected at the outbound, a null response will be returned. This explains why I was getting a null response.

So, please take note when you are using BridgeComponent!

- yc