Tuesday, December 04, 2007

The class 'com.your.class' cannot be imported because its leaf name is already being resolved to imported class 'com.your.class'.

While I was refactoring some ActionScript2 code, I ended up with the above error message.
I searched the web and what I came up with was mostly the information that such a message actually exists.
so after figuring out why I got that error I decided to write about it here for your benefit. (Leave me a comment if it helped you).

well it turns out that this was cause by the following proccess:
I have an adbode flash source .FLA file which had inside its _root code two #include statements:

lets say
#include "fileA.as"
and
#include "fileB.as"

now each of those file in its turn had an import statement
import MyClass
where MyClass.as was a file that was on the same directory as the .FLA, fileA.as & fileB.as.

It worked fine.
But when I started refactoring and moved MyClass to become com.whatever.MyClass
(with all the required changes to MyClass, fileA and fileB) I suddenly got
"The class 'com.whatever.MyClass' cannot be imported because its leaf name is already being resolved to imported class 'com.whatever.MyClass'".

The solution was to remove the import statements from fileA.as and FileB.as
and just place one import directly in the .FLA.

(the #include files are on thair way out as well...)

My recomendation: Try to avoid #include, most likely you can get better results by using a static class.

Sunday, November 25, 2007

Will (or did) Live Documents copy Microsoft's UI ?

Live Documents , the new office suite rival say in the usability section:

"Live Documents gives you a familiar user interface - that of Microsoft Office - so that there is nothing new to learn. "

Can they realy do that ??

I am no xpert on any copyright laws and I am all for having the copy and paste buttons look the same on all apps.
but can you realy go and say "I have an office suite that is exactly like that of microsoft" and still walk free ??

What do You think ??

Saturday, November 10, 2007

Wildfire testimonial

On Gigya where I work as a System Architect with my hands deep into our Wildfire product we are running a forum for technical Q's.
One of the forum members (Joel Mirkin) just posted a Q and his oppinion on Wildfire along with it:
<snip-snip>
Also just to put my 2 cents in... I totally agree with what reverbnation said. I've looked at other similar services and none of them come even close to how easy it is to integrate and customize Wildfire (not to mention supporting AS3).
</snip-snip>

Just made me a few centimeters higher :)

Thank Joel.

Even when you know you have an excelent product its always nice to hear it again from someone objective.

Saturday, September 29, 2007

using arguments vs. an array parameter

This goes for both actionscript and javascript and I guess any language that lets you create functions without an arbitrary number of parameters (a syntax known as elipsis in some other languages).

It is very temping to use this syntax to write general functions such as Max or Min with an arbitrary number of parameters.

you would get something like (and this just an outline not code designed to work).

function maxOfN() {
var m=arguments[0];
for (var i=1;i if (arguments[i]>m) m=arguments[i];
}
return m;
}

you can then use this in a clean way:
var m1=maxOfN(4,8,3,9);

So what is the alternative?
Work on an explicit array of values

function maxOfN(arrValues) {
var m=arrValues[0];
for (var i=1;i if (arrValues[i]>m) m=arrValues[i];
}
return m;
}

and you get the less clean syntax:
var m1=maxOfN([4,8,3,9]);

so it looks as if its more "cool" to use the first option
but as I found out after writing some "cool" code there is a minor problem with this approach:

suppose you already have an array with the values you want to work on (as I did),
you will then have to use:

//
// values is set to an array of values by previous code
//
mar m1=maxOfN.apply(null,values);

Which:
0) Assumes you even have an apply in your language
1) Looks much worse then
var m1=maxOfN(values);
2) Actually means that you build an arry in your code, then call apply which takes the array appart, pushes it onto the stack just so that you can as for the arguments array and have all the parameters pushed back into the array you could have passed directly to begin with.

So my recomandation would be to pass the array explicitly and pay for the creation of the array parameter

var m1=maxOfN([4,8,3,9]);

This also has the advantage of being able to pass along more then a single array to a function and not being limited to having it as the last parameter of the function.

consider somthing like:
var sums=inPairs([1,3,5],add,[4,6,8]);
var products=inPairs([1,3,5],mult,[4,6,8]);

Anyone wants to guess what I would expect sums and products to be ?
Did i hear any one say "Excel" or "Array functions" ...

Thursday, September 06, 2007

Luciano Pavarotti died, God rest his soul.

71 yeas old Luciano Pavarotti,
one of the world famous 3 Tenors
died today.

Luciano Pavarotti on IMDB

 
Clicky Web Analytics