Posts

Showing posts from October, 2008

Unit Testing with Fluint

If you like FlexUnit , then you really wanna check out Fluint . It does the basic unit test assert stuff, but my favorite is the sequence testing. This is where it blows FlexUnit out of the water. Great job Mike, Jeff and Mike, you have a new convert !

Module Not Loading...WT(bleep)

Flex modules are very cool. In the AWS/X days, wrote a whole OSGi -like framework based on modules. So for this new project that I'm working on, I decided to reuse them again. Wrote a simple test case to remind myself how to use them with new Flex Builder, which BTW makes building modular application really easy. No more link reports CLI (well...it does it for you internally :-). So in my smart way (NOT) wrote the following: public function loadModule() : void { const info : IModuleInfo = ModuleManager.getModule( "TestModule.swf"); info.addEventListener( ModuleEvent.READY, readyHandler ); info.load(ApplicationDomain.currentDomain); } private function readyHandler( event : ModuleEvent ) : void { trace( event.type ); } Whenever I invoked the loadModule() function at the application creation complete, no trace would appear in my console. WT(bleep). Kept looking at the code, and re-launching the application, assuming that this time it will do it (come on, you...

[ANN] Flex Mapping API

I'm pleased to announce that we just released the Flex API for ArcGIS Server. Check it out here , and make sure to tell us what you think. Good or bad. I'm already on the road preaching the cool stuff you can do with it :-). BTW, it works on Flash Player 10 (though this is not "officially" supported), taking advantage of the speedier JIT and AVM. Check out the samples and the associated source codes to see how it works in MXML and AS3. Happy Mapping All :-)

Faster JSON Decoder - NOT :-(

I'm looking for a fast JSON decoder in AS3, and I'm really hoping that the next Flash player will have native JSON functions like IE8 . The as3 core library has a decoder. Tested it on a one megabyte JSON String and it took almost 4 seconds to decode on my MacBook Pro. Wow ! There has to be a better way. Couple of former life ago, was really into lex/yacc and flex/bison. BTW - I laughed so hard when I read the name of the first link when I googled 'lex yacc' - The generated "C" code was very fast. So one of the "modern" way to write a lexical analyzer/parser is to use ANTLR . ANTLR has an option to target ActionScript . I Found a JSON grammar reference and made simple adjustments for AS3. Ran the ANTLR Tool on the 'g' files and compiled the generated AS files into a test harness. BTW - Had to adjust by hand the generated AS3 code, as it did not compile out-of-the-box :-( I passed a set of test cases for the exception of escaped string co...

REST + JSON + AMF

So...I was asked to investigate what will it take to output data in AMF to an existing REST endpoint. The idea is that, with just a path info switch, the endpoint can output XML, JSON or AMF i.e. http://server/rest/service/json, http://server/rest/service/amf. And no , a direct BlazeDS integration is not an option :-( So after looking at the BlazeDS source code (you gotta love open source :-) I homed in on the Java15Amf3Output class. It take an output stream as a property and has a writeObject method. Cool ! So given an Address instance: package com.esri.webamf; import java.io.Serializable; public class Address implements Serializable { private String m_addr; private String m_city; public Address() { } public String getAddr() { return m_addr; } public void setAddr(final String addr) { m_addr = addr; } public String getCity() { return m_city; } public void setCity(final String city) { ...

Graphic Custom Symbols

We refactored the Symbol class for the next release of the Flex api for ArcGIS Server so it can be easily customized. Here is a simple custom symbol: package com.esri.symbol { import com.esri.ags.Map; import com.esri.ags.geometry.Geometry; import com.esri.ags.geometry.MapPoint; import com.esri.ags.symbol.Symbol; import flash.display.Sprite; /** * Simple custom class with variable color property. */ public class CustomSymbol extends Symbol { private var m_color : Number; /** * Constructor * @param color optional color. Default 0xFF0000 */ public function CustomSymbol( color : Number = 0xFF0000 ) { m_color= color; } [Bindable] /** * Bindable color property. dispatch Event.CHANGE on change. * Graphic objects are CHANGE event listeners, and will invalidate their display list * upon the receipt of the event. */ public function get color() : Number { return m_color; } ...