Thursday, July 27, 2006

XML-RPC and others

Looking at concepts related to mash-ups, inspired in part by Flickr and in part by Amazon’s Simple Queue Services. Have some notes here, and it’s a work in progress. Basically I am trying to understand how each protocol works, starting with REST as it is found in Zuardi’s Actionscript (REST-based) API for Flickr. Also looking at SOAP and XML-RPC, and SQS Query (used by Amazon) which indeed seems more alike to Flick’r REST than Amazon’s REST is.

Also looking at implementing each protocol in .NET and Java.

To summarize, for REST you use HTTP GET, for the others, POST. Effectively this means that in Actionscript you use XML.send in the first case and XML.sendAndLoad in the second. In .NET, request = (HttpWebRequest)WebRequest.Create(restEndpoint) with the default parameters in the first case, and WebRequest.Create with some parameters set differently in the second case.

There is an open source library that somewhat simplifies XML-RPC in Actionscript. The documentation is not there so I had to spend a couple of hours to get it to work!

For the methods that need authentication in Flickr, the process is just as involved as it is with SQS, but no X.509?

People really seem to like REST with Flickr as I have not found any XML-RPC implementations (I did not search too hard though).


In Java you have to use the URL and HttpURLConnection classes. And there are plenty of XML-RPC implementations in Java.

Tuesday, July 25, 2006

Amazon Simple Queuing Service

I was quite excited to read about Amazon’s Simple Queuing Services. It’s obviously a development based on their Storage Services, and it shows that:

- the commoditization of hitherto proprietary 'backend' services (perhaps under the influence of open source, and enabled by the likes of SOAP and REST). Queuing solutions such as RendezVous and MQSeries used to be complex beasts; no more. SQS has a few simple interfacing protocols, and while it may be lacking the more advanced features offered by the others, it does offer a solid (and cheap!) queuing/messaging platform;

- the internet is becoming a true execution ‘platform’, offering advanced runtime services. SQS is caller agnostic so any clients can use it – including those written in languages far removed from the ‘native’ OS, such as Actionscript or Python. It is entirely possible that a transaction broker or even DBMS web service be in the offering not too far in the future. I am curious to see how ‘mainstream’ web applications will take advantage of this. Large applications (including games or business systems) are now possible that can communicate asynchronously… the infrastructure is migrating from the OS to the web.

The security needs are quite involved and demand a HMAC-SHA1 hash function to work with the user's private key. Fortunately, Google has as API for both Win32 and Java that implements the HMAC-SHA1 funcaionality demanded by SQS.

Sunday, July 16, 2006

Image test



Other than a useless showoff of my Tibetan flag, the purpose of this photo was to test how images are rendered in Blogspot. I am tinkering with the Flickr API these days and was curious to see if I can do some distributed work between the Google domain (is it namespace?) and the Flickr one. Which reminds me of a few ideas that I read about the Internet as a programming platform. I really need to digest this a bit. The whole mashup concept, when the hype dies down, may have some actual value to it. Although the issue of trust seems paramount if it is to succeed; I do like the idea of throwing a request into a black hole and getting a response back, if I trust the black hole. Just getting started on a web services project and I do like the idea more and more. The difference being that in my case, we control the black hole – we being a B2B chain. I won’t talk much about it since it is a very new concept somewhat patented by my employer, but expect sometime in the near future to be able to shop for medical services the same way you currently shop for travel and books online.

Back to Internet apps, Web 2.0, et. al.: the Blogspot word processor is s-l-o-w on my laptop. And now we have online spreadsheets. That's cool, but do we really need it? And, has anyone thought of an online compiler - type your code in a www window and have it compiled behind the scenes? Let's web 2.0-enable web 2.0 development.

Not really related… I have been thinking about the concept of informatics quite a bit lately. I already mentioned that design (information design, motion design… basically, any kind of computerized visual design, for lack of a better term) is a major interest of mine (as a consumer/hobby-ist); and professionally too, since it is, after all, the visible end of the software development stack and the one that is the most removed from the ld hl, 0x0000 level. When I was growing up, informatics meant a heavily math-based science of algorithms and it was truly intimidating. Today it seems to take almost New Age-y overtones. Great. We have artists, we have ‘communists’ (open source movement), who says the world of software is boring?

More on the Flash IDE

It just seems that I am spending a lot of time in Actionscript these days. I’m working on my Googlepages home page and integrating it with Flash has been a headache.

I just read in Flashmagazine a feature about the Flash platform and its possible future evolution. One additional gripe to those I already listed that they mention is the long compile times. Having spent a Saturday largely waiting for a smallish Actionscript app to compile (okay I did compile repeatedly!), I do agree – this is annoying.

They do talk about XAML and its possible effect on the Flash market share. Quite correctly they point out that XAML is restricted to the Microsoft world at the moment.

The Eclipse environment seems to be the savior for Flash, other than initiatives such as FlashDev. I am not so sure – I am just not crazy about Eclipse or other Java-based IDE’s. They are just slow when compared to a native IDE, just like the .NET-based SQL Server 2005 Enterprise Manager is slow when compared to the previous EM’s.

Adobe has a hard fight ahead. It must not antagonize its core design audience while attempting to make Flash a real development environment. As an animation tool Flash is great, but animations will still be a niche. I really should be going back to Flex for my future Actionscript programming needs… now that it has finally been released.

Monday, July 10, 2006

Where is it all going

All this recent work in ActionScript has got me thinking: where does Flash fit anymore?

The evolution of Flash has clearly been in the direction of a fully fledged programming language. I.e., increased complexity. It is not your ‘average’ designer’s tool anymore – without any disrespect to the design community, for which, as an avid consumer of design, I have a lot of respect. Flash still has a way to go to be a complete programming language (support for multithreading, direct O/S access for example), but at that point will it have lost its unique design orientation, and will it become just another dev kit? Can it compete to the .NET/Java/perhaps Ruby on Rails worlds on its own merits as a software development tool if it sheds its design (web, motion) orientation?

But even if it stays primarily a design tool: can it compete with the likes of MS Expression? Platform loyalties aside, Expression and XAML provide an extension into the interactive arena of a formidable development stack.

That Flash poses some problems to developers (which can be quite annoying in large projects especially, but large projects are what make a development environment a ‘serious’ tool) has been evident by the emergence of Laszlo and even Flex; Flash still remains powerful as a runtime rendering engine with unmatched ubiquity. However, I see the former as yet untested, and the latter as liable to come under attack from XAML. It will be interesting to see which direction Adobe wants to take it in, and I am waiting for more details about their Apollo initiative.

The ‘distributed software’ ecosystem would be something like this:

Systems: C/C++ code, platform specific. Software engineers’ domain. Includes apps such as databases.

‘Piping’: most everything else. Business rules-systems. .NET, Java, PHP, Ruby, Python. Software architects’ domain. Some unmanaged/systems-level coding.

Front end: Flash, XAML, Looking Glass (?). Designers’ domain. Behavior coding, interfacing, front end logic, mash-ups, consuming web services.

Saturday, July 08, 2006

ActionScript annoyances

Contrary to what many hardcore developers may think, I do find ActionScript (and its brethren - JavaScript & family) a powerful language. Especially when embedded in Flash, it can do a lot of neat stuff. However, it has some problems for more complex development tasks: visibility (the layers are a pain, and especially in anonymous functions visibility can get tricky), typing, and multithreading (important because some operations are asynchronous which in fact creates a second thread). Finally, the interspersing of code in the FLA file is a readability/maintainability disaster, and thankfully Macromedia addressed this by enabling external class definitions that extend MovieClip or UIObject. The debugger and IntelliSense are both a bit of a joke too...

All of the above are neatly summarized in this: I have an object that has a XML object member. XML.load( file.xml ) is an asynchronous operation and the only way I could find to notify the parent that XML has finished loading the file is by creating an object derived from XML that has a property pointing back to the parent so that it can callback the parent when it has finished. Here it is:

The 'parent' object:

class ActionMenu extends MovieClip {

private var oFile:XMLD;

/*
* constructor
*/
public function ActionMenu( xmlFile:String ){
oFile = new XMLD(this);
}//endCtor


/*
* CallbackLoad
* called by the XML object when it finished loading
* the document
*/
public function CallbackLoad(success:Boolean):Void{
if(success){
//...do whatever needs to be done
// XMLD implements XML's interface so use it as you
// would use a XML object
}else{
trace( "File not loaded!");
}//endIfElse

}//endCallbackLoad

}//endClass




The XML-derived object:

/*
* XMLD
* Used to notify Parent (ActionMenu) when the XML document is loaded
*/
class XMLD extends XML{
private var ptrAM:ActionMenu;

public function XMLD( p:ActionMenu ){
ptrAM = p;
this.onLoad = function(success:Boolean){
ptrAM.CallbackLoad(success);
}
}
}