Friday, November 24, 2006

Odd Dreams

Here's an odd dream that I had last night;

A locksmith unlocks the doors at the wee hours of the morning and steps in. I see his shadow, there waiting, wondering why he doesn't close the door -- the animals might get out. Then someone turns on the lights, and he hands me a bill for "insecure locks" -- something that all locks must be lock-smith proof -- cannot be picked, or are subject to fines. First round is about $1.00 per lock, second is about $9000.00 per lock (the dream was clear enough to see the numbers; but I don't recall them clearly). Next day, fearing fines, I wonder if it's best practice to buy a new lock.

----

In actual news, the city of Montreal is fining people for leaving their car doors unlocked. Let's hope that they don't start fining people for weak security on houses, etc.

Thursday, November 23, 2006

Flash Coding

For my last pattern recognition assignment (dealing mostly with formants and fundamental frequency of voice), I decided to use Flash/actionscript; and to compare that to my experience of using C# for my previous assignments (which tended to deal with bitmap data). Also -- I've done other (bigger) projects in both; to the scale of over 10 classes (I like to keep my code organized).

C# was fun to program in. There is a panoply of existing objects to quickly get started to do practically anything. Debugging was easy and painless, and the squiqling up of the code like any word document was a nice addition (in comparison to XCode). The language has practically the same semantics as Java (both are managed/in a vm with reference counting galore -- well, a sophisticated version of reference counting). The documentation was easy to read; and I needed no help what-so-ever from Google's web search to complete the assignment (except for the odd bit of code that quickly loaded up the bitmaps).

Flash was fun to program. Admittedly, it is based around a different philosophy of programming. The built-in finite-state machine (aka timeline) made it possible to have very differing screens when buttons on the menu are pressed -- the easiest way to do that in C# would be through big if/else statements, or dynamically loading/unloading components. Debugging is really primitive in Flash -- I have not managed to set up a breakpoint that actually breaks... I'll investigate this later; for now trace is my trusty friend. Since the program is interpreted, some errors it only reports at run time -- and by specifying types, Flash will attempt to say if there will have any errors at run time. This prediction of errors can be wrong -- in the sense that it doesn't find errors, or that it finds non-existant errors. All-in-all, it's quite usable. The documentation, opposed to the one from Sun/XCode feels as though it's as good as the MSDN -- however I did have a bit of trouble the first time I used the BitmapData object -- and still do when it comes to loading images with transparency. Also, errors in the documentation sort of made it difficult... UI is what Flash does much better than C# -- where I'd import a bitmap for a coordinate system, I just draw them in Flash. Lastly, flash is resolution independant (if you don't use bitmaps), and is cross platform -- some nice incentives especially when you're doing all your homework on a Mac, and it will be graded on a PC or Linux box.

All in all, this just shows that Flash is as viable a language as C#/C++ for programming assignments. Actionscript hasn't let me down as a watered down language for designers, but as a nice semi-complete (public, private which acts like protected, no protected) OO implementation.