The keyboard and mouse as input devices

I just ran across a couple of interesting articles about keyboard vs mouse input: and the followup:

The idea is that we should really be using more of the keyboard to be productive, but only for tasks which can be qualified as discrete, such as managing documents, launching applications, and working with text. I definitely agree with the premise. We have long had keyboard shortcuts, part of the problem is how to associate the shortcut with an action: there are so many, memorizing them is impossible. As an aside, f-keys are the absolute worst way to implement shortcuts as there is no mnemonic to help with the association, and no consistency save the F1 key for help (why not just label it “help”).

Playing with AS3 – An example MP3 player component

I have finally gotten around to playing with AS3, and I decided to pick the Sound object as one to play with. In the end, I ended up creating a simple music playback “component” that uses a whole number of AS3 features. I am including the example here along with the source. Enjoy! Note: error handling is not yet very robust, but it still shows numerous aspects of AS3 in use. Requires Flash Player 9.

Grrrr… WordPress is munging the object and embed tags. The example can be seen here for the moment.

An Algorithm for Finding Common Elements Across Data Sets

I was recently working on a search algorithm for a Flash piece I am working on, and the way the algorithm worked involved doing separate searches for each keyword from an index that I had created, recording the number of occurrences for each keyword, then finding out which elements were common between each of the keywords. I came up with an algorithm to do this operation linearly, that is it only has to do one pass through the data which means that it scales well for large data sets. The gist is that if you have three sets of data, then any data element needs to appear three times in the search for it to be common across the data sets. As such, all that is needed is a tally kept of how many times each data element appears and anything that has a tally of three is part of the intersection of the data sets.

Note: this only works if there are no duplicated elements in each data set, which fortunately is not too hard a condition to impose.

Here is some code representing the algorithm:

A Potential Solution to the Eolas Flash Woes – The Object Replacement Method

There are a number of solutions out there for the limitation that Microsoft just put into place to deal with the Microsoft-Eolas plug-in patent dispute. The ones that I have seen (e.g: Flashobject) are nice but involve changing how you publish your Flash files and embed them into the HTML. I was thinking, it is possible to rewrite the HTML on the fly with JavaScript, so what if we just loop through all the Object tags within the Document Object Model, and replace the HTML? It could be done with one function call, and would not affect how you put the <object> and <embed> tags on the page.

The experiment that I tried does exactly that: it loops through all the <object> tags, and just replaces the HTML with exactly the same HTML. This makes IE think that the HTML is dynamically placed on the page, even though it started as just straight HTML.

It’s official, I’m an author!

Just a little bit of shameless self-promotion: my book is just about to hit store shelves!

book cover

I’m the dude on the left, and my co-author on the right is Jeff Berg.

Man, that is a long process (probably about 1 year total from contract to publication). Prepurchase now! Buy them as Christmas presents, birthday presents, Bar Mitzvah presents, even chew-toys for your dogs! (Discounts for bulk purchases for 5 dogs or more). They also work great as monitor supports (about 3 inches per book). If you reeeeeeeeeeally want, you can even read it yourself and learn how to script with ActionScript 2.0 and Flash 8 (perish the thought)!

A couple of useful Firefox extensions

I have come across a couple of really useful Firefox extensions aside from the excellent web developer extension which I wanted to share with the community.

The first is called View Rendered Source Chart, which renders the HTML source in a way that is very easy to visually see the nesting.

The second is one called View Formatted Source, and not only shows your HTML source in a way where you can collapse nested tags, but when set to inline mode, shows you the major divisions within your document, and clicking on “source” for that division brings up just the HTML for that division. Finally, mousing over tags in the source view shows you what styles currently apply to that tag, and where in the CSS file the styles are located.

A Divergence of Web Applications From the Browser?

Disclaimer: this piece (as well as this blog in general) is personal opinion and not endorsed by or representative of my employer.

I just came back from a conference where I was presenting on Web 2.0. A related discussion around Microsoft’s foray into the Rich Internet Application space ensued, and as part of that discussion, I was sent a link to an interesting Information Week article that talks directly to our discussion. The article talks about MS and Eclipse-based development environments for web applications, and one quote in the article demonstrated one of my major concerns perfectly:

Plotter Exercise with Bitmap Class

I was recently at FlashForward, and was inspired by some of Grant Skinner’s experiments using the Bitmap class. This example takes my previous plotter exercise and uses off-screen rendering instead. I also added the use of Perlin noise to feed the motion randomization routine. The result is definitely faster from the Bitmap use, and more organic from using the Perlin noise.

Genographic Project Online

I did a bunch of work on a nice little Flash piece for an IBM – National Geographic collaboration. It is a really cool project where the goal is to provide research on the geographic origins of the world’s different ethnic groups. Through this project, you can purchase a participation kit where you can provide a sample of your DNA from a swab of your cheek, and National Geographic will send you back information showing how your genetic ancestors travelled the world to get to where you are today. You can find out more about the project and about IBM’s role at Click on the main banner to launch the Flash piece. I did the ActionScript coding for the little pop-up modules, plus oversaw the project’s architecture.

Thumbnail representation  of Genographic Flash piece

Using ASFunction to Call Class Methods

One of the problems with ASFunction is that it will not let you call class methods. This is inconvenient if you are using your own custom class that builds an interface, and you need to have clickable links within a text field. A couple of solutions that I have seen uses a homemade proxy class or the built-in Delegate class to do it, but there is another way to do it that uses the same technique that is used within the XML object and within event handlers to retain the handle to the class instance. When an ASFunction link is clicked, the text field automatically looks to the parent movie clip for the function to call. A proxy function is placed in the text field’s parent movie clip, then a “parent” variable is created to hold the reference to the class instance. That variable is visible within the proxy function, and allows the function to then “redirect” to the class method.