« June 2006 | Main | August 2006 »

July 30, 2006

I was dumb today

I swear my IQ drops in half most of the times that I'm on inline skates. Thankfully this hasn't led to any permanent damage. Oh sure, I've got quite a few nicks and scars from various accidents over the years but they were only temporary with a little bit of humility thrown in. Today was another of those days but with a twist. I thought it would be nice to take a morning blade along the Minute Man Trail starting out in Arlington. After having breakfast and watching a movie I packed things up in my car and drove out to Arlington Center.

There is a great parking lot right next to the trail and at this early morning hour it was mostly empty. I found a spot and proceeded to get ready. I had placed my skates on the passenger side and figured it would be best to put them on from that side. I hit the door lock/unlock button, got out, closed the driver side door and walked around to the passenger side. Huh, the door is locked. Oh I thought, this must be like the remote door unlock where you need to hit it twice to unlock the passenger side door. Back around to the driver's side. Huh, that door is locked too.

I'm sure given the detail thus far you can guess the outcome. The important piece in this story is that after turning off the car I put my car keys into my camel back so I wouldn't have them in my pocket as I was blading. Net result, they weren't with me when I stepped out of the car. A side note is that I can probably count the number of times I've actually used the lock/unlock button on my car using just my fingers. I even remember explicitly looking at the lock on the door after hitting the button and thinking, oh that's in the right position. I thought wrong.

All was not lost, I still had my wallet on me. There is a pecking order with things I really hate to be without. My wallet is at the top. Next would be my mobile phone. The house keys and lastly car keys. I'm sure I could ramble on a lot about why that order exists, but I'm going to pass on that digression for the time being. Needless to say, having my wallet I had options. I chose the walk home one. My intent was to enjoy the weather and get some exercise, I figured the walk home would be as nice as the blade I had been planning. It's at least a good 4 miles from Arlington Center back to my house. That's a long way to speed walk in sandals.

Granted I have ran a couple miles in my sandals, today's walk didn't turn out as well as I had hoped. I made it back fine, but ended up with a couple of blisters on my feet. A quick ride back from a housemate with my spare set of keys and everything was back to "normal". No permanent damage and a little bit of humility thrown in.

Tags: life

July 29, 2006


It's hot today. Last I looked it was about 90. It's also very humid. Currently running around 46% humidity. This past week I've also really gotten back into inline skating. I still have my very old blades. Going on about 10 years now. They show many signs of being that old. Scraps and nicks each with their own little story of how it came to pass. Unfortunately my blades are almost getting too old. The tongue on the inner shell has cracked in half on one and is all but cracked on the other. This doesn't affect the usage of the skates, just another sign that maybe they are past their prime. They don't really owe me anything. I spend most of college in then using them constantly. And I mean constantly. There were many days that a pair of blades was the only footwear I wore. I can safely say I feel very comfortable on a pair of inline skates. Hell, I was stupid enough to transport 21" monitors across campus a few times on a pair of blades.

With that digression aside I come back to today. Today's 90 degree day. Today's crazy idea that blading along the Esplanade would be a neat idea. I used to blade along the Esplanade a lot. I'd first head over to the Christian Science Center to warm up and practice my footwork. Crossovers, skating backwards, and stuff like that. I'd then head down Boylston street and catch one of the footbridges that brings you across Storrow Drive. Once on the Esplanade I'd cruise east or west depending on which way the wind was blowing that day. Always blade into the wind first. The one bad thing about the Esplanade is the wooden section that goes under the BU bridge. That is only two steps removed from cobblestone for horrible surfaces to blade on.

In general blading along the Esplanade is great. Nice paved surface. Plenty of nice views and people to look at. What wasn't wise was trying to blade in 90 degree weather. I was smart and packed my camel back full of water. I drank lots of water. I don't think I drank enough water. I parked at the Boston Common and started my blade at the Fiedler Footbridge. I stayed on the Boston side and went all the way out to the JFK Bridge. I then came back, crossed back over the footbridge and then bladed up Newbury street. Newbury street is fun to blade on. Because of all of the stop lights you can usually keep pace with the cars. The secret though is treat it like a slalom course where each street is a post. The reason to do this is that each street going up Newbury is an alternating one way street. You always want to be on the side away from any cars that are turning. So if the one way street is pointing left you want to be on the right side of the street.

After reaching the top of Newbury street I crossed over Mass Ave and had lunch at The Other Side Cafe. They serve brunch until about 2pm on both Saturday and Sunday which was just what I wanted. A small CAPS and some yogurt, granola, and fruit later I was done with brunch and heading back to my car. This was a straight shot down Boylston back to Boston Common. I then drove home, which is when this blade started to feel like a bad idea. A pounding headache and what seemed like an inability to drink enough cold liquids to feel like I was cooling off. Part of the problem is that while I have an A/C unit, my house has casement windows. Standard A/C units and casement windows don't mix.

While my housemate rigged up a way to mount his A/C unit, I've not done anything similar, so it's very warm in the house. I'm also lame in that I don't have a fan running. We have fans that I could use down in the basement, but I don't. I'm not 100% sure why, but well that's the state of affairs. The headache got worse. Then the feeling of having an upset stomach set in. I took some fast acting Tylenol and laid down for another nap. It was a very fitful nap. I think it lasted about 30 minutes. By that time my laundry was done. I grabbed that folded it, but even doing this simple activity didn't help take my mind of the fact that I felt horrible. I blame the heat.

Then a lame idea hit me. I needed to cool off. My car has A/C! My car has very good A/C. My car doesn't have much room in it so the good A/C makes it cool very fast. I didn't even bother changing out of my moccasins, I just hopped in my car. Now my first that was to just sit outside in my car, but that just felt odd to me. I like driving anyway so I decided to meander. Possibly not the brightest idea since my head was still hurting and my stomach was still upset but I started to drive anyway. I'm not really sure I could retrace the route I took. I'm not really sure where I went. I passed over some streets I recognized the names of but didn't really know the road I was on. After about 30 minutes I somehow managed to end back up somewhere that I knew. After some more less random driving around I finally came back home.

I should state that after driving around in the car for about an hour I was feeling much better. I'm sure some of that was the drugs, but I can only think that lame as it was, sitting in my car helped a lot. Of course now I'm back in the warm house but it is starting to cool off and will be about 10 degrees cooler tomorrow. I'm ignoring the fact that it might reach 100 this coming Wed.

Tags: life

July 10, 2006

Flex 2 Runtime Error 1009 and Runtime Modules

While the following error is most often encountered when trying to access a property or function through a null object reference, it can also rear its head when working with runtime modules.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at mx.containers::Panel/mx.containers:Panel::layoutChrome()
	at mx.core::Container/mx.core:Container::updateDisplayList()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:2910]
	at mx.containers::Panel/mx.containers:Panel::updateDisplayList()
	at mx.core::UIComponent/validateDisplayList()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:5672]
	at mx.core::Container/validateDisplayList()[C:\dev\GMC\sdk\frameworks\mx\core\Container.as:2731]
	at mx.managers::LayoutManager/mx.managers:LayoutManager::validateDisplayList()[C:\dev\GMC\sdk\frameworks\mx\managers\LayoutManager.as:594]
	at mx.managers::LayoutManager/mx.managers:LayoutManager::doPhasedInstantiation()[C:\dev\GMC\sdk\frameworks\mx\managers\LayoutManager.as:646]
	at Function/http://adobe.com/AS3/2006/builtin::apply()
	at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:7789]
	at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()[C:\dev\GMC\sdk\frameworks\mx\core\UIComponent.as:7732]

The problem seems to be that if the runtime module makes a side-effect reference to a component, which is not included in the main application, it never really gets included in the SWF and as such causes problems when accessed. That's a jumble of words so I think an example is needed.

Create a Flex Application with two files in it. The first one is called com.example.PanelComp.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="400" height="300">
    <mx:Text text="Hi"/>

The second one is the main application, call it LoadTest.as:

package {
    import com.example.PanelComp;
    import mx.core.SimpleApplication;

    public class LoadTest extends SimpleApplication {
        private static var panelComp:PanelComp;

For more information on that SimpleApplication business check out Roger Gonzalez's blog.

Now in a different Flex Application we want to load the first application and then create an instance of PanelComp.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
            import mx.containers.Panel;
            import flash.utils.getDefinitionByName;

            // must uncomment for "Add Panel" to work
            // TypeError: Error #1009:
            // private static const panel:Panel = null;

            private var _loader:Loader;

            private function loadSwf(location:String):void {
                _loader = new Loader();
                var ctx:LoaderContext = new LoaderContext();
            	ctx.applicationDomain = ApplicationDomain.currentDomain;
            	_loader.contentLoaderInfo.addEventListener(Event.INIT, swfInit);
                _loader.load(new URLRequest(location), ctx);

            private function swfInit(e:Event):void {
                _loader.content.addEventListener("ready", swfLoaded);

            private function swfLoaded(e:Event):void {

            private function createPanel():void {
                var clazz:Class = Class(getDefinitionByName("com.example.PanelComp"));
                // see note above about TypeError: Error #1009:
                addChild(new clazz());
    <mx:Button label="Load" click="loadSwf('../../LoadTest/bin/LoadTest.swf');"/>
    <mx:Button label="Add Panel" click="createPanel();"/>

As noted in the comments, until you uncomment the static reference to Panel in the wrapper application, you will get the stack trace. Something to keep in mind if you are using runtime modules.

Tags: actionscript as3 flex programming

July 6, 2006

Flex 2 Runtime Error 1065

Today while working on some code I started getting this error and stack trace:

ReferenceError: Error #1065: Variable LoadTest is not defined.
	at global/flash.utils::getDefinitionByName()
        at ... (rest of stack trace deleted)

Looking the error up in the documentation didn't help point the way to what might be going on since this had nothing to do with a "variable":

1065 Variable _ is not defined. You are using an undefined lexical reference. For example, in the following statements, the statement trace(x) generates an error because x is undefined. However, the statement trace(y) doesn't generate an error because y is defined: trace("hello world") trace(x) // x is undefined var y trace(y) // No error, y is defined.

In this case I was trying to dynamically instantiate a class by first finding the definition of that class and then newing it. Something like this:

public function createInstance(className:String):Object {
    var instance:Class = Class(getDefinitionByName(className));
    new instance();

It turns out the reason why the error was being thrown was that in my Flex Application I didn't have anything which "used" the class. In other words the compiler thought that the class was left over junk and didn't include it in the compiled swf. By adding in a use of it, everything started working. As example use would be something like:

private static const loadTestRef:LoadTest = null;

If there is another way to get this same behavior, please let me know.

Tags: actionscript as3 flex programming