Archive for August, 2007

Commandline scripting in PHP 5

Wednesday, August 29th, 2007

At TriMM I am working on an eLearning environment consisting of a core engine and some 500 swfs (and growing). Some of these locations are very simple, like an image with hotspots and some are more complex such as an emailclient. The engine is refactored now and then, and extended, in addition the requests for some of the locations themselves might change.
All the work is done by different people in different roles, and some location versions might or might not be compatible with certain version of the core engine.

Why am I telling you this? Because I switched from Flash to PHP because of this? :) No way.

But I do have to write a script to automate the release process, which will collect the latest versions of all location swf’s that go with a certain core engine version. I thought about using Ruby or Python for that, but since TriMM does a lot of Java, PHP and Flash, I decided it had to be one of those 3.

My first choice was PHP since (more…)

Wrapping function calls in AS2

Friday, August 24th, 2007

Also known as:

  • debugging function calls
  • displaying the name of a called function
  • tracing function calls director like

Today I finally got to try something I had been wanting to try for a long time: wrapping function calls in a nice way.

I had been playing around with function pointers etc, which was ok in itself, but I was forced to create the messy pointer bit each time over again. So today I implemented a FunctionWrapper class.

Say we have a class Test, with a method testMethod.

Now we want to execute some code before calling testMethod and after calling testMethod. “Well write another function to do so”, you might say. Of course that is one option, but assume we are looking for another way to do so (I’ll discuss some scenario’s in a minute).

Using function pointers you can let the Test.testMethod reference point to your own method and from your own method execute the original method, pre and postpending it with some functionality. I think this is a bit like the AOP mechanism, but I’m not too sure since I am a composition filter freak by nature :) .

The FunctionWrapper class takes care of all this reference shuffling for you:

FunctionWrapper.wrap (
TestClass,
"testMethod",
_preFunction,
null, //no additional args to pre
_postFunction,
null //no additional args to post
);

Now I won’t explain a lot more about that on this page, since I’ve got an example for download here, which contains all required classes and documentation. Note that the example requires some support classes (more…)

Local Flash Content And SSL

Tuesday, August 14th, 2007

We are in the process of migrating one of our largest eLearning systems to SSL and Active Directory. Some of the Learning Objects within this system are pretty complex and I’ve implemented a mechanism which allows you to test them standalone.

However during the migration to SSL these objects stopped working when run locally, from the IDE or from FlashDevelop.

I tried to wrap my head around why this was happening, since I’ve been doing less and less with serverside content and certificates these past few years.

Luckily I found this URL which described the problem quite accurate.

Http:// content cannot always access https:// content it seems, but the invalid security certificate was the biggest issue for us.

Our system admin Roy Olthof quickly jumped in, installed a valid certificate and tadaaaaa. Local content could access https content again. Note that we were accessing https content on our own test server, which didnt have a certificate installed.

In addition the Flash content kept giving me the mixed content (secure and unsecure) warning. After changing all the http://’s in the macromedia/adobe codebases (contained within the object and embed tags) this disappeared as well.

Ice Warrior

Friday, August 10th, 2007

Sooo, for now this painting is considered done. Begun as a sketch, to a normal tiger, through to a blue tiger, and now …. a true Ice Warrior :).

Ice Warrior

I might add tusks someday, but on the other hand, sometimes you just have to call it finished…

Tiger sketch to painting

Sunday, August 5th, 2007

A few posts ago (Tattoo commision) I showed you some tryouts for a tiger sketch and colouring, and this weekend I had some more time to work on it, here are the results:

Tiger Normal

Sabertooth

Still not finished yet, but I’m slowly getting there :)

Update: The piece is finished and can be found here.