Thursday, May 03, 2007

Data Loading Benchmark

RIA Data Loading Benchmarks

James Ward has created a Flex application for benchmarking data loading for RIA's. Thinking about the results from this tool there was something I thought worth mentioning. Firstly, what is clear from the results is how much faster Flex is for parsing and rendering data sets. It's ability to parse XML using E4X is extraordinary compared to AJAX. Therefore Flex is ideally suited to anything that requires repeated and regular data requests. But one thing that isn't immediately evident from the benchmark is that the applications file size also needs to be taken into consideration. Flex applications can quickly become quite large. While most AJAX frameworks are comparatively small. Consequently an application with fewer data requests might be better suited to AJAX. You also need to consider how often users will use the application because caching will reduce the impact of file size if the application is accessed frequently. So the more often an application is used the more appropriate Flex will be.

I will be very interested to see Silverlight included in these tests so that we can start to filter out the FUD from the facts.

Wednesday, May 02, 2007

Video : MVC For Non-Believers

A video of Robin Hilliard's session on using MVC (Model View Controller design pattern) with Flex from webDu has been added to video.onflex.org. I attended this session and found it a great introduction to using MVC with Flex. Robin is a very knowledgeable presenter with a genuine enthusiasm for MVC.

This presentation made me realise that MVC is an ideal design pattern for most (all ?) Flex projects (regardless of scale). If you are involved in Flex development then you should have a good understanding of MVC; if only so you have the choice of ignoring it. This video is a great entry point for understanding MVC.

Tuesday, May 01, 2007

Farewell FetchMeMovies, Hello QuickFlix

For the last couple of years we have been subscribed to an online DVD service called FetchMeMovies. This is a Telstra BigPond service and was one of the first in the Australian market. We subscribed because living outside the cities our choice of DVD's from the local stores was a bit limited. The FetchMeMovies service gave us access to a much larger range of DVD's.

But for the last year we've been getting frustrated with aspects of the service. One aspect is that the condition of the DVD's is often poor and we've had to return quite a few as unplayable. But the main reason for our frustration is how very slow the website is. Your main way of interacting with the service is through the website hence it is obviously important that this works well. Interestingly the site is easy to use. You can do most of the things you need to do without too much thought. But you can often make yourself a cuppa while waiting for the next page request to appear.

QuickFlix is either a new service or an old service that's suddenly found it's marketing department. Either way our frustration with FetchMeMovies motivated us to use their free trial. In our tests we looked at the range of DVD's available (everything we could get from FetchMe was available through QuickFlix), speed of turnaround, condition of the disks and most importantly the speed and usability of the website. In most areas both services where on a par but when it came to site speed the difference was 10 to 1 (i.e I could load 10 QuickFlix pages to one FetchMe page). I won't pretend to guess why FetchMe's site is so slow (thats their problem) but this has made me realise just how important speed is. I guess if the usability had been poor I might have left earlier. But in the end I still left.

Wednesday, April 25, 2007

Using BlueDot's SOAP API with PHP

In the last few weeks I've been working on a Flex based browser for BlueDot. It's been a good project for bringing together a few of my current interests (Flex, MVC, SOAP, PHP, BlueDot). The project is developing nicely but it's not ready for show and tell. But one thing I didn't find when I started the project was information about accessing the API with php. Don't take that the wrong way the BlueDot SOAP API is well documented. But I just couldn't find any information that directly related to using the API with PHP. Hence I thought it might save fellow travellers some leg work if I posted an example.

To get this working I'm using PHP4 and NuSOAP and naturally you'll need a BlueDot account with some Dots and Tags . You'll need to download NuSOAP into folder that will be accessible from your script. If you will be doing a lot of work with SOAP you'll want to place it somewhere that can be easily accessed by all of your projects. I thought we could start by getting the datetime of your last dot. This is the simplest method in BlueDot's API and consequently there are less points to go wrong. So let's look at some code:

<?php
require_once("nusoap/lib/nusoap.php");

//set path to server and create new client
$serverpath = "https://secure.bluedot.us/BlueDotApi.asmx?WSDL";
$client = new soapclient($serverpath);
?>

Just the basics to get started. The first line adds the nusoap libraries which obviously need to be available before they can be called. Next we create a variable with the path to the BlueDot API. Then we create the soap client. The soap client will format the SOAP request based on the details we provide and manage the request.

$client->setCredentials('your_username','your_password','basic');
$err = $client->getError();

if ($err)
{
print_r($err);
}

BlueDot uses basic authentication to check that you have a right to the data we are requesting. Consequently you'll need to use setCredentials with your BlueDot username and password. The third parameter just tells the soap client that we'll be using basic authentication. Finally we use getError to check that the login was passed. In our example we are checking for an error and printing it out so we can debug the login. If there isn't an error then we can proceed to calling the method.

$client->setCredentials('your_username','your_password','basic');
$err = $client->getError();

if ($err)
{
print_r($err);
}
else
{
$namespace ='http://bluedot.us/api';
$soapAction = "http://bluedot.us/api/GetLastUpdatedDateTime";

$result = $client->call('GetLastUpdatedDateTime',"",$namespace,$soapAction);
}

To get the datetime of the last update we call 'GetLastUpdatedDateTime'. This method requires no parameters and returns a datetime (i.e 2007-04-24T23:23:54). The namespace will be the same for all the calls you'll use. But the soap action will change depending on the method name. Next you'll want to check that the call was processed without any problems.

if ($client->fault)
{
print_r($client->response);
}
else
{
$err = $client->getError();

if($err)
{
print_r($err);
}
else
{
echo "<pre>";
print_r($result);
echo "</pre>";
}
}

We can use fault to check for faults and then use response to print out the fault details. If there is no fault we can test for an error and print the error if one exists. If there are no problems then lets just print out the result. Depending on where and how you are going to use the result you'll need to do something more useful here. So lets see it altogether:

<?php

require_once("../../serverScripts/nusoap/lib/nusoap.php");
//set path to server and create new client
$serverpath = "https://secure.bluedot.us/BlueDotApi.asmx?WSDL";
$client = new soapclient($serverpath);
$client->setCredentials('your_username','your_password','basic');
$err = $client->getError();

if ($err)
{
print_r($err);
}
else
{
$namespace ='http://bluedot.us/api';
$soapAction = "http://bluedot.us/api/GetLastUpdatedDateTime";
$result = $client->call('GetLastUpdatedDateTime',"",$namespace,$soapAction);

if ($client->fault)
{
print_r($client->response);
}
else
{
$err = $client->getError();

if ($err)
{
print_r($err);
}
else
{
echo "<pre>";
print_r($result);
echo "</pre>";
}
}
}
?>

Hopefully that's enough to get you started. Most of the available methods are as simple to call. The exceptions are RenameTag (requires two strings) and Search (which requires a Search object; you may want to leave this till you've had a bit of practice). The main differnce between GetLastUpdatedDateTime and most methods is that it returns a very simple object. For example, getTags returns an array of Tags that contain the tags name and a count of the number of dots it's used for. But the differnce is how you process the result not how you make the SOAP call.

Saturday, April 21, 2007

MUV : my first meeting

Finally, attended my first meeting of Macromedia Users Victoria (MUV). I've been planning to go for the last few years. But for a while I was always working on the meeting night. Then they went quiet for a while as they sorted out the change from Macromedia to Adobe (still using Macromedia in the groups branding; not sure what they have planned there). They had their first meeting back last month but I once again had a clash. Anyway I finally got there.

The first half of the evening was spent looking at and discussing the CS3 release. It is a huge release program with many new options for users whatever their level. Therefore any opportunity to discuss the options and their relative merits is much appreciated.

In the second half of the evening Chris Burgess presented the what, why and how of Apollo. I've been keen to get any and all available info on Apollo. Hence a lot of what Chris presented was news. But it was still invaluable to get his views on where Apollo is right now and where it will be heading.

The only disappointing part of the evening was the numbers. It is only their second night back so they are still finding their feet. I guess I'm the last person to comment having taken so long to get to a meeting. But there are a lot more Adobe users than we saw on Thursday night. It would be great to see more developers at future meetings. To state the obvious the more who come the more worthwhile it is for everyone who attends. To get more information you need to register so if you are in Victoria get to it.