Creative Industries Network Alert Widget

CIF Network Alert WidgetFinally finished the Creative Industries Network Alerts Widgets (CIAlerts.widget Yahoo! flat-file, ~250k). Its purpose is to allow system administrators at QUT, where I work, to send out network alerts to staff and students when things go wrong on any of the servers.

You are free to download it, but be warned that you probably wont see very much (if anything) because it requires that someone send out an alert; and only Admins at QUT, where I work/study, can do that. The widget’s dynamically loaded source code is also available.

The widget is accompanied by a website from which the alerts are sent. Network admin can send three kinds of alerts: “Please Note”, “Attention”, and “Very Important”; each kind of alert comes with its own color (as seen above and below).

CIF Network Alert Widget in Please Note state CIF Network Alert Widget in Very Important state

Using XMLHttpRequest, The widget works by periodically polling the server for new alerts. The alerts are sent as a JSON header string and processed in the widget. The widget features:

Dynamic BootStrapper (bootstrap.js):
…details coming soon.
Custom Animation Engine:
…details coming soon.
Custom event subscription model:
…details coming soon.
Alerts database:
…details coming soon.
Simple Dock manager:
…details coming soon.

Dynamically loading Google Analytics

I finally finished the Creative Industries Newswire website. The Creative Industries Newswire is a centralized place where authorized QUT staff members can author and publish news items. It is a place where users can access those news items, leave comments, and subscribe to individual news wires via RSS. It basically runs off WordPress.

Creative Industries newswire homepage.

A few interesting issues that emerged with relation to using Google analytics. The issue with this website is that it is used by both public users and users on an intranet. Intranet users at QUT may be authenticated to access resources on the intranet (such as the newswire website), but not resources on the internet. When an unauthenticated users tries to load a page with the following Google-provided code the browser attempts to load the script but eventually times out. This can take around to 60 odd seconds in Firefox (or something close to that, not sure exactly how long). The implication is that, to the user, the browser looks as if it is still loading content. And in the browser, it does not execute the
<script> tags. Below is the problematic code that Google provides:

<script src=""  type="text/javascript">
<script type="text/javascript">
   _uacct = "UA-XXXXXX-1"; urchinTracker();

Looking at the code above, what essentially happens is:

  1. urchin.js needs to load synchronously and block the second script tag from running
  2. once loaded, the code inside the second script element must be run
  3. if the code is run without the script first loading, then the urchinTracker() method will be undefined.

So, like I already stated, in the intranet scenario, the urchinTracker() method is never called because urchin.js is never loaded. To make the whole process a bit more “behind-the-scenes” I decided to recode the Google code so that it is run only once the document has executed it “onload” function. The following simply dynamically appends the DOM with a script element AFTER the document has loaded. If the script element can reach its src, then analytics info is sent to Google, otherwise, nothing happens:

window.onload = function(){
   var scriptLoadFunction = function(){
   _uacct = "UA-XXXXX-X";
var e = loadScript("", scriptLoadFunction);

function loadScript(url,aFunction){
var e = document.createElement("script");
}else{ //try to force IE to work, but alas, it does not.
e.src = url;
return e;

The code works great in Firefox 2.0 but does not work in IE6 or IE7 (as IE does not support the addEventListener() function). If anyone has a work around to this problem, I’ll like to hear about it.

My empire for a NullPointerException – reasons ActionScript sucks

I’ve just finished coding two kids games in Flash called “BarryBell” and “DrumBell” (I will make them available here soon). ActionScript is a cool language: it has all the things you would expect from a real programming language, it is compiled, supports strong typing, classes and inheritance, interfaces, static variables, and constants. However, there are some things that suck.

The following is a list of things I think suck about Flash Professional (in order of most suckful!):

  • no null pointer exceptions – I can reference properties and variables that don’t exists and Flash does not care! this is highly irritating when you make a spelling mistake as Flash will not inform you of the error. The only way around it seems to be to use a decent IDE that actually does strict checking of existing classes, their public properties (if any), and member functions.
  • Event Dispatcher class – the included event dispatcher class lacks the option to provide a member function to call back when an event is fired.
  • No generic Event class – of course you can write your own, but a standardised one would save you having to look through Macromedia’s EventDispatcher class to work how the event broadcaster actually works!
  • Delegate class – really, why does this even exists! Plus the lack of support to bundle an argument is highly irritating.
  • no ability to send arguments when instantiating a movie clip – that is pretty severe.
  • Phoney-baloney iterators – calling the for (i in someHashMapObject) returns i as an integer instead of the object. What is that all about?!

If I get a chance, I will write another entry describing these problems in more details. All I can say is, if you are going to copy Java’s Event broadcasting model, do it completely as it is not that hard. There is hope yet, as all the core classes are open, you can simply re-code them to do what you need.

Mozilla, heed to the flaws of Adobe Flash and lets us avoid this in JavaScript 2.0!