Blog to discuss Midnight Coders products features, ideas and trends in development of Rich Internet Applications

Friday, August 26, 2005

ActionScript Development Kit 1.0 is released

I am very pleased to announce immediate availability of the ActionScript Development Kit 1.0. We started working on the product a while back and it got started as a fun experiment. Over the time we enhanced the APIs and created the best data collection library ever implemented in ActionScript. On top of this there is an awesome XML parser available in the ASDK. The goal for the XML parser was ease-of-use as we got really tired of creating bad looking code with the Macromedia's XML object. The era of firstChild.firstChild.firstChild.firstChild.nodeValue is over! You can download the 1.0 release right from our website. The distribution includes full source code as well as a set of some AsUnit scripts we used to the ASDK with.

I'm sure you are wondering about product licensing, and it is one of the best parts! The product is free to use by anyone, unless your company develops commercial, reusable Flash components.
So why wait? Download ASDK 1.0 from http://www.themidnightcoders.com/download and enjoy your ActionScript coding! We will be posting articles to this blog and the website about the best practices with ASDK, so stayed tuned, there is more to come.

Thursday, August 25, 2005

WebORB 2.0 Beta 2 is available

The new beta release addresses the bugs found in Beta1. Thanks to everyone who helped us out with finding the bugs! Below is a summary of all the stuff we fixed and added in Beta2:

  • Safari 2.0 support. The Rich Client System has been fixed to work on Safari. All AJAX examples now work on all major browsers.
  • Added QuickStart guide for ColdFusion Components (CFCs) to the user guide.
  • Date and array serialization for the AJAX clients has been fixed.
  • .NET object property serialization. Beta 2 introduces new way of complex type serialization. The product will serialize only public fields and properties. There is a configuration parameter to turn on serialization of private fields.
  • Serialization of circular object references in returned complex types has been fixed.
  • Serialization of returned singleton objects has been fixed.
  • Fixed an internationalization problem manifested with AJAX clients. WebORB for .NET with a non-US locale failed to parse AJAX requests.
  • Server-side exceptions can now contain a fault code delivered to Flash Remoting clients. Use Weborb.Exceptions.ServiceException to propagate exception information to the client side.

One thing notably missing from the list above is the documentation for the Message Server. We planned to include it into the Beta2 release, but ran out of time. The theme for Beta3 is 'Interactive messaging for Flash and AJAX clients'. We have some great ideas for that area of the product and you should be pleasantly surprised when it becomes available.

Tuesday, August 23, 2005

Ajax products comparison chart

We have been getting a lot of requests to provide a comparison between WebORB and a few other competing products. We did a thorough research and created a comparison chart. The chart is now available on our website. I suspect some people will claim that we have a bias when doing the competitive analysis. If you truly believe that some of the information in the chart is not valid or does not represent the reality, please challenge us! We would like to be proven wrong here! Also, if you would like to see other comparable products to be added to the chart, please let us know too.

You can see the comparison chart at: http://www.themidnightcoders.com/weborb/comparison.htm

Friday, August 19, 2005

Online vs onsite training

We are working on putting together a few online training courses. The classes will include AJAX and Flash Remoting training as well as beginning to advanced WebORB development. There will be a ton of hands-on exercises and examples to learn by.
We've been discussing whether we should add classroom training as well. I wonder how much interest there would be if we were to set up onsite training seminars in major metropolitan areas like New York, Chicago, SanFran, LA, etc. The seminars would cover the subjects of AJAX and Flash Remoting development, designing RIAs, development strategies, using WebORB and the Rich Client System, etc. So assuming both online and onsite training were available for a reasonable price, what would you choose and why?

WebORB Beta2 update

Lots of progress with Beta2. We fixed the Rich Client System to work with Safari 2.0. There are bug fixes in the library to support proper serialization of the JavaScript Date object and arrays.

There is an important change in the .NET edition of WebORB coming in Beta2. We changed how .NET complex types get serialized. Previously WebORB serialized both private and public fields of a .NET object. The approach was acceptable, but caused inconvenience if a class also declares properties to get/set field values. Indeed, the approach resulted in two different representations of the same class on both client and server sides. The Beta2 release corrects that problem. The new approach will serialize only public fields and properties. To support existing applications running with FlashORB, we added a configuration parameter that will turn on serialization of private fields.

Here's an example of a C# class declaring a property:

namespace Weborb.Example
{
public class Person
{
private string _name;

public string Name
{
set
{
name = value;
}

get
{
return _name;
}
}
}

public class PersonFactory
{
public Person getPerson( string someName )
{
Person p = new Person();
p.Name = someName;
return p;
}
}
}
Below is an example of how the property from the Person class shown above can be used in a JavaScript or a Flash Remoting application:

JavaScript/AJAX:
var className = "Weborb.Example.PersonFactory";
var proxy = webORB.bind( className, "weborb.aspx" );
var personObj = proxy.getPerson( "James Bond" );
alert( persobObj.Name );
Flash Remoting:
var webORBURL = http://host/weborb.aspx;
var proxy = new Service( webORBURL, null,
"Weborb.Example.PersonFactory",
null, null);
var callObj:PendingCall = proxy.getPerson( "James Bond" );
callObj.responder = new RelayResponder( this,
"gotPerson", "gotFailure" );

function gotPerson( resultEventObj:ResultEvent )
{
var personObj = resultEventObj.result;
trace( personObj.Name );
}

Wednesday, August 17, 2005

Flash to .NET invocation guide is available

We blogged about it just last night. The guide is available now and can be accessed at: http://www.themidnightcoders.com/examples/flashdotnetguide.htm

We used the same invocation scenarios from the AJAX/.NET guide. It is not obvious from the examples, but both Flash Remoting and AJAX guides hit exactly the same instance of WebORB and invoke on exactly the same .NET objects.

Both guides will be updated over time to include additional invocation scenarios. Let us know if you'd like to see a particular example included in the guide.

Flash to .NET invocation guide is coming up soon

We're working on porting our AJAX to .NET invocation guide to Flash. It has been rather enjoyable experience. We already converted 5 out of the 9 available invocation scenarios and will finish everything up tomorrow.
Every time we do something in both Flash and AJAX, it is always quite interesting to observe which approach lets us be the most productive. So far we noticed that AJAX apps take about 20% more time. This is mostly due to the fact that we have more experience writing Flash applications. I bet over time, the effort for doing similar types of apps in AJAX and Flash will pretty much even out.

Friday, August 12, 2005

Building the 'Ajaxian Google' example

We worked on an example demonstrating XML Web Services integration for AJAX clients. The complete example can be found at:

http://dev.flashorb.com/weborb/examples/googleonsteroids.htm

UPDATE: although this blog entry covers some of the details of the implementation, there is a thorough review of the example available here:

The client side of the example is as basic as the Google's main interface, i.e. all it has is a search query text field. The text field is sensitive to the user's input. As soon as the user stops typing, the client sends the query to Google and displays the result. WebORB sits between the client application and Google web service and brokers the request. There are several reasons why WebORB would have to be in the picture:

  1. Some browsers do now allow direct connections to 3rd party hosts. Requests can be sent only to the server where the page is loaded from
  2. The example uses the license key we got from Google and also lets the user enter his key. Since we cannot expose our license key, we have to hide it in our server side class

The server side implementation is very simple. We used VS.NET to create a web reference for the Google service. The code instantiates web service proxy and invokes the search query method:

using System;
using googlesearch.com.google.api;

namespace googlesearch
{
public class GoogleSearch
{

public GoogleSearchResult runGoogleSearch( string query,
string googleKey )
{
if( googleKey == null )
googleKey = "********* our google key goes here **********";

// instantiate google web service proxy
GoogleSearchService service = new GoogleSearchService();

// invoke web service method
GoogleSearchResult searchResult = service.doGoogleSearch(
googleKey, query,
0, 10, false, "", false, "", "", "" );
// return result 'as is' to the client.
// let WebORB serialize it so the data structure
//l
ooks the same in JS
return searchResult;
}
}
}

The client side script is just as simple. When the page loads, the script binds to the server side object:

<body onload=bind()>


function bind()
{

// hide the animation - need to show it only when a query
//
is in progress
document.getElementById("animation").style.visibility = "hidden";

// build a proxy to the backend object
if( googleProxy == null )
googleProxy = webORB.bind( "googlesearch.GoogleSearch",
"weborb.aspx" );

requestStack = new Array();
}
When the conditions for issuing a query are met (user pauses or enters space or hits Enter), the script executes the following function:


function search()
{
// get what the user typed in
var search = document.getElementById( "searchtext" ).value;

// if the user provided his own key, use in the invocation
var googleKey = document.getElementById( "gkey" ).value;

// mark the request in the stack - to avoid overlap
//of multiple responses

requestStack.push( search );

// turn on animation notifying the user of the query in progress
document.getElementById( "animation" ).style.visibility = "visible";

// run the query on the backend object (see the code above)
var async = new Async( processSearchResults, processError )


googleProxy.runGoogleSearch( search,
googleKey.length != 0 ? googleKey : null,
async );
}
The client code invokes the remote method asynchronously - see the Async argument. The argument contains two callbacks - one for successful result and the other is for any errors returned from the invocation. See the source for the implementation of processSearchResults and processError.

Something to note about the processSearchResults is the response value maintains full fidelity with the original endpoint. As a result, the data can be accessed as:


function processSearchResults ( result )
{

[skip]

for( var i = 0; i < result.resultElements.length; i++ )
{
searchContent += result.resultElements[ i ].title;

if( result.resultElements[ i ].snippet )
searchContent += result.resultElements[ i ].snippet;

searchContent += result.resultElements[ i ].URL;
}

[skip]

searchResults.innerHTML = searchContent;
}


Wednesday, August 10, 2005

Canceling pending Flash Remoting calls

We're looking for a way to cancel pending flash remoting invocations. If anyone knows the answer, please let us know. Here's some surrounding context:

Using Flash Remoting components for Flash MX2004 AS2.0 one can invoke a server-side method and get an instance of mx.remoting.PendingCall. The object represents the invocation and provides a level of indirection for response or error handling. There is a similar object in the ActionScript web services API. The PendingCall class from the web services API has the cancel() method, but no such method seems to be available with the FR components.

Tuesday, August 09, 2005

AJAX to .NET invocation guide is available

We posted the first iteration of the AJAX/.NET invocation guide to our website today. You can access the guide at: http://www.themidnightcoders.com/examples/ajaxdotnetguide.htm. It has been a lot of fun working on the guide. We had to introduce a way to register a listener with Rich Client System. A listener can receive callbacks as various steps during method invocation process get complete. There were 2 bug fixes which we will introduce in Beta2. First is with array serialization and the second is with date serialization and parsing.
We will be adding additional invocation scenarios to the guide in the near future, but next we need to prepare a similar guide for Flash Remoting clients.

New home for the blog

We finally decided to go with Blogger to host the WebORB blog. The service has been quite flexible and easy to use. It is neat how they handle hosting at a different server. I hope the new blog will become a useful source of information about the product, its features and many other topics from the RIA arena.