Logging everything in BlazeDS

When you create a Flex/Java project in Flex Builder the logging tag in the services-config.xml file looks like that:

    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <properties>
                <prefix>[BlazeDS] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
            </filters>
        </target>
    </logging>

Unfortunately you can lose some important error messages with this <filters> configuration. That’s why its better to edit the file after creating the project and change the filters section to *

    <filters>
        <pattern>*</pattern>
    </filters>

Logging in BlazeDS and LCDS with Java Util

I created a small class to allow integration between the logging mechanism from BlazeDS and java.util.logging. As an example it’s useful if you plan to use BlazeDS or Livecycle Data Services inside Google App Engine – the former one uses java.util.logging.

In order to use it you should modify services-config.xml to use the newly created class (I created my class in the package flex.messaging.log):
<target class=”flex.messaging.log.JavaUtilLogTarget” level=”Debug”>

The source code is below:

import java.util.logging.Level;

public class JavaUtilLogTarget extends AbstractTarget{
public void logEvent(LogEvent event) {

  java.util.logging.Logger log =
    java.util.logging.Logger.getLogger(event.logger.getCategory());
  Level level;

  if (event.level >= LogEvent.ERROR)
    level = Level.SEVERE;
  else if (event.level >= LogEvent.WARN)
    level = Level.WARNING;
  else if (event.level >= LogEvent.INFO)
    level = Level.INFO;
  else if (event.level >= LogEvent.DEBUG)
    level = Level.FINE;
  else
    level = Level.FINEST;

  log.log(level,event.message,event.throwable);

  }
}

FlexPMD

Yesterday Adobe Technical Services launched FlexPMD – a tool to audit  ActionScript source code and detect common problems (anti patterns, unused code, badly written Flex components ). The tool started as an internal project in Adobe and now it has been made open source.

I can say that using this tool is a must for any complex Flex projects, because it enables you to detect common problems at an early phase. For the moment it can be invoked from Maven/Ant and Mac OS X automator, in the future it will probaby also be available as a Flash Builder plugin.

BlazeDS and LiveCycle Data Services in the Cloud – MAX Laboratory

My colleagues, Mihai Pricope and Mihai Corlan, and I we’ll have a laboratory at Adobe MAX about deploying BlazeDS and LiveCycle Data Services in the Cloud. We plan to show how to create your first project and deploy it on the cloud. We’ll also discuss the challenges that are involved and best practices. We will cover Google App Engine and Amazon ES2.

We cannot cover anything in 90 minutes, but we hope to clarify the basic aspects – and of course to answer all of your questions.

If you are interested in Flex and Java I encourage you to attend – and also to check the other labs and sessions at MAX. And remember, when you attend MAX not only do you learn new things, you also meet new people and find new opportunities.

Managing humans – Michael Lopp book

I discovered this book several nights ago and I was amazed. Funny and in the same time valuable it is also a “no-crap” book about working in the software world, dealing with difficult people, the value of information, building the version number 1.0 and many more things. The author offers practical solutions for a lot of scenarios, in a very humorous way.

Its not a book for just managers or for wanna be managers, any individual can benefit from it. However I think that for some individuals it can be harder to accept several of the author’s conclusion (I told you, it’s a “no crap” book). Especially for younger people.

The book can be bought here; also the author has a blog.

Flex, Java and Fiber next week in Germany

Next week I’ll visit several Java User Groups in Germany speaking about Flex and Java

27 August Dusseldorf

1 September Stuttgart

2 September Karslruhe

In Stuttgart I will also present Fiber – building RIAs using an Model Driven Architecture

Looking forward to meeting you. If you know for a company from any of these towns interested in learning more about RIA let me know.

MAX 2009 Widget

Serge Jespers created a cool widget about MAX 2009 containing facts, testimonials and the possibility to tweet directly from it. Also, you can create your own video (if you have a video camera).

Performance analysis for websites – Page Speed from Google

Yesterday I discovered a very nice tool for optimizing websites – Page Speed from Google. It installs as a menu entry in the Firebug plugin. Running this tool on several websites (including the Romania’s largest newspaper) shows very interesting results -a lot of things to improve. I’m sure that some of them are very hard to find without an automated tool.

Some suggestions for www.evz.ro (the Romanian newspaper). They could save 200kbytes just by using proper sized images.

Enable gzip compression
Leverage browser caching
Combine external JavaScript
Minify JavaScript
Optimize images
Optimize the order of styles and scripts
Parallelize downloads across hostnames
Minimize DNS lookups
Specify image dimensions
Remove unused CSS
Serve static content from a cookieless domain
Minimize cookie size
Use efficient CSS selectors

HTTP Streaming and Gzip compression

Good observation by Michael Slinn - do not use HTTP compression when using HTTP Streaming channels – you will not be able to receive any messages from the server. If you want to understand better how HTTP Streaming works read this article.

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.