Off to University

I'm leaving in a few minutes for Toronto. I will stay in Toronto overnight then on Sunday I'm going to the University of Western Ontario to move in and start frosh week. Woo!

jQuery Inspired Actionscript Library, part 2

Hah, didn't expect a part II now did you? Well, I was contemplating it too. So, here's why: last night I was thinking about how I would make the categories (groups of tags with a single name) section in OneLobby interesting, and somewhat different than the single tag view, so I decided I will show a category relationships section. The way this will work is that I will find similar categories (based on categories that use some of the tags of the current category) and then find similar categories of those categories. Only two levels deep. Then hopefully I will sort out all the unique ones, and find a nice way of finding links between them (efficiently). Finally, I'll output all this info to XML and flash with read it.

» read the rest of this entry.

New Google Search Result Layout?

Edit: It's actually the SEO Books extension that causes this. I had it installed but didn't know what it was. My bad. Otherwise, I think it's still pretty cool!

For the first time I'm the one who gets to see the cool new UI tests google does. Well, I took a screenshot of it...

» read the rest of this entry.

Globals, Singletons and (Public) Static Members

I've decided that a solid explanation of where global variables, singletons and public static members of a class should be used is in order. Even though none of these three things are the same, they all share a single commonality: they can be accessed anywhere and in any scope. Lets get to it then...

» read the rest of this entry.

jQuery Inspired Actionscript Library

So the other week while I was fooling around with flash, I decided to make something. It was nothing really, just a good way for me to learn how to use the Actionscript language. I got generally far when I realized: "some of the things in this language annoy me. I wish there could be a jQuery for actionscript." And so on that wish, I made a jQuery for actionscript.

» read the rest of this entry.

Observers and Dispatchers

NOTE: an ArrayIterator is used in the code below. Make sure to familiarize yourself with iterators before continuing.

Maybe you've used a framework that uses Observers and Dispatchers, or you've heard of them but don't know how they work. Well, I'm going to explain them and tell you why they're so useful.

First, what are the observer and dispatcher patterns? Well, just as their names imply, they are a set of classes that observe events and another set of classes that dispatch events. This might seem like a mouthful, so instead of giving you more explanations, I will show you how they work:

» read the rest of this entry.

PHP4 Iterators Explained

NOTE to PHP5 Users: iterators are built in!

The common PHP application will generally have this layout:

  1. Query the database
  2. Loop over the database result set, and on each loop, add the result to a large array of data.
  3. Loop over that large array of data and format it. (Most application will just skip this step and do it in the previous one)
  4. Set the big formatted array of database information to the template
  5. The template engine loops over the array and displays the appropriate thing for each row.

Woah. That's a lot of looping! Now, before I even tell you how iterators work, I'm going to show you how they can change your application. Here is how all of the above would work with a setup using iterators:

  1. Query the database.
  2. Use an iterator to deal with the database result set. On each iteration, a row will be taken from the database result.
  3. Use another iterator on top of the database result set iterator to format the data. On each iteration, the row will be formatted.
  4. Set the data formatting iterator, which has the database result set iterator in it, to the template.
  5. The template loops over the iterator for the first time, in each iterator the result row is fetched from the database, then formatted, then displayed.

At this point you might be thinking, your list of how the iterator works is longer and more complicated. Not so! You might also not see the benefit of the iterator yet either, so let me explain them in more detail...

» read the rest of this entry.

Accessible Flash

Over the weekend I worked on making flash applications more accessible... And I succeeded. My goal was to get the back and forward buttons working with flash and javascript. Imagine that you're on a small flash website that has all of the usual links in it: home, contact, about, etc. Now, think about being able to click on one of those links (within flash) and then being able to use the browsers back and forward buttons to navigate back to where you came from without refreshing the page or reloading the flash movie! Here's how it works...

» read the rest of this entry.