Monday, March 16, 2009

Flex HTTP Service result formatting

when playing around with the flex HTTPService class, i got the following error:

faultCode:Client.CouldNotDecode faultString:'Error #1090: XML parser failure: element is malformed.' faultDetail:'null'

this is because i was using the default parser (i.e. “object”) for the result digestion, while the returned value from my HTTP hit was HTML.

all this is clearly explained in the adobe documentation for the HTTPService, but not that clear from the error.

when connecting to a site or external data source with an unknown structure, its easier to analyze the incoming stream when the result format is set to “text”. this returns the stream in its raw form.

the property is set as follows:

myHTTPService.resultFormat="text";

Flex Right to Left – for the Hebrew man

here is some cowboy programming for handling the text direction in flex. i found that the simplest way is to extend the text UI component (i.e. mx:TextArea or mx:TextInput) with my own class with some instrumentation.

amazingly enough, selecting the right font family is all it takes to have the UI component type the correct order in words. the font i used was Ariel.



this.setStyle("textAlign","right");
this.setStyle("fontFamily","Arial");

it gets a little bit trickier when setting or retrieving the text from the component, so I've added a set and get methods, that crudely check for the first character. if its Hebrew, i flip the order of words.

the setter and getter look like this:



public function getText():String{
return LanguageUtil.getLocalazedText(this.text);
}

public function setText(s:String):void{
this.text = LanguageUtil.getLocalazedText(s);
}

the language utility I'm using is actually the following method:



public static function getLocalazedText(message:String) :String {
var c:int = message.charCodeAt(0);
if(c>1487 && c<1515){
var resArray:Array = message.split(" ");
var resLine:String = "";
for(var i:int = resArray.length; i>0; i--){
if(i != resArray.length){
resLine += " ";
}
resLine += resArray[i-1].toString();
}
return resLine
}else{
return message;
}
}

i haven't tested this on Mac yet. but for windows it seems to be ok.

hee haw

Wednesday, March 11, 2009

Data buckets

06042008239 For me, software development is just a nice way of saying ‘bit moving’. A good friend of mine used to describe himself as a bit reorganizer. We rearrange invisible magnets, he would say, setting their tiny arrows of residual currents to point this way or that. We are a bunch of “bitniks” and we are all about data.

Application design and development has been my main source of income for the last decade or so, it struck me as odd that there were so few terms that describe so many kinds of data.

It occurred to me, that the Eskimos had their fourteen words for snow, and they say that the Bedouins have nine words to describe sand. I felt so alone. I felt a need for discovering my own flavors of data. It took me a while, but then in a single perfect moment of clarity, I had realized what lay before me.

The orchestration of the moment was this; in the middle of a design meeting, yelling and shouting all around, we were discussing optimization and performance and spirits were high. My thoughts went back to when I have learnt about application design. The fact was that when developing any business application, the first step to take is to determine the set of business flows that describe the scope and functionality of that application within the organizations it’s meant to serve.

Listing these business-flows by rank and cardinality is no bother at all. The simplest evaluation I could think of is according to frequency of use and the sheer number of users that would eventually use the flow.

I thought that the categorization of the data body by the same yardstick could provide me with the flavors of data I was looking for.

... Read more: the complete post at JavaWorld

download this post from scribd

Wednesday, March 4, 2009

My new spot at JavaWorld

I’ve been upgraded. i have a new spot at JavaWorld in the daily brew community and I've just posted my first article there.

This is the link to my article “Data Buckets”.

What next?

I have two things I'm working on at the moment. I'm finalizing version 0.3 of the white rabbit project and I've stated writing the next post. I hope I'll finish them before my vacation later this month.

Australia here i come!