Blog

  • I Need An Office

    I’ve been working from home for a year and a half now, and I’ve had enough. It’s time for an office.

    Yeah, I know, I used to brag about how cool it was, and how nice it was to work in pajamas. The conveniences are still there mind you. I can always be available for FedEx, phone guys and plumbers, and accepting various other deliveries. I spend 2 minutes making coffee, and that is the gist of my “getting ready” in the morning. I don’t have to drive to work, and suffer the 3 hours a day sitting in a hot car, wasting money on gas, and robbing myself of 3 weeks of my life a year. All that stress during the commute is never accumilated. I’m in my home environment, in my personal office, with copious amounts of food (sometimes) in comfortable surroundings. My puppy dogs are asleep at my feet. What setting could be better to code in?

    And that’s the problem. It’s my home, not my work.

    A friend of ours once diagnosed her majesty and I with a problem. She noticed my gaming systems in the bedroom, with the bed aimed at the TV, and all of her majesty’s toys next to the bed. This wasn’t a bedroom, but where her majesty and I relaxed. You are supposed to do that in the living room if you have one. It was just nice to be relaxed while I played games and could spend time with her majesty while she knit or blogged or whatever. However, it cost us sleep. I already have mild insomnia, and she can’t sleep if I’m not sleeping. We were bluntly told to only sleep in the bedroom; if I wanted to play games, if she wanted to knit or blog, or if either of us wanted to watch a movie or TV, we’d have to do so in the living room.

    So, I moved all of our shiz, and we re-arranged, the bed to not face the TV. We moved the TV out, too. Within 2 weeks, I was finding it easier to sleep, and other positive things came from the living room situation as well. In short, it was an appropriate use of rooms.

    I think I’m not using my office appropriately. Although it’s my “man cave”, it harbors a lot of negativity. All the pain, frustration, and anger of my day stays there. I’m not very good at dropping things either. That attitude is what helps me spend hours solving a simple problem. It’s also a curse, though, when working from home. You can’t “leave it at work”. It’s one thing to discuss your day to get it off your chest; it’s another to return to the room to finishing working. I’ve even found myself some days dreading going into the room. This is the same room that inspires me to create, the same room that has Flex 2 & Flash 8 installed on my gaming box… and I even hesitate? Do you see the horror of the situation?

    When her majesty comes home from work, the home becomes a different place. She “lives here” while I’m working. It’s hard to switch modes. I’ve done it, but it robs me of distraction sometimes. If she catches me at a stopping point, or when I’m merely merging & checking code in, it’s really not a big deal at all. But if I’m in the middle of debugging, or on the phone, conversing with co-workers, or talking to clients… it’s rough. I want to be the house husband, but I need to be working. Taking a break is hard because so near to the end of the day, it’s hard to keep the momentum going if you haven’t started something cool at like 3:00.

    I always thought working from home would be awesome. I remember reading Sean Voisen’s experience about he was lonely, and wanted to be on a team in person. Hah! Dude, I so was not going to be lonely, and I can still work with a team I thought. Yeah, but you can never leave the tribulations elsewhere, you never have a sanctuary, and work is always a click away. Without a proper balance, you end up like me, blogging when you should be passed out exhausted. Don’t get the wrong idea; the good and great days I have at work do propagate into the house hold, but they don’t belong there. They belong at work.

    I had her majesty do reacon last week, and I did some searching today. A wide vareity of places are available, but I’m taking my boss’ advice, and only getting what I’m excited about. I was planning on getting the cheapest place I could find, but he said I’d hate it, and I believe him after playing it out in my mind.

    One thing that won’t change is telecommuting. I’ll still telecommute to work. We have consultants all over the place, and my team and I can still collaborate, kick arse, and take numbers regardless of where we are. If a client needs me on site, I can do that too. For the day to day operations, I’ll need a new base of operations, and it’s not my home.

    I think in the meantime, I’ll fix the regenerated Alienware laptop, and head to the local mom and pop donut & sandwhich shop to work at a few times a week. They have the fastest wireless I’ve ever seen, and overpriced sandwhiches. Being forced to get dressed daily will be weird, but something’s gotta give.

    Any office buying advice?

  • Flex Chronicles #22: Embedding Fonts in a Button

    There are a few dark little secrets to the Button control in Flex 2 that can trip a designer up. It took me 2 1/2 hours to figure this shiz out so I just HAVE to blog it. I’m running on fumes, and this is the 3rd blog entry in the past 30 minutes, but my fingers never tire; they’re always willing to move furiously. They know I have words I need to get out, and fast because there is so much to do and so little time. My head feels like lead… it keeps swaying… wtf, am I at sea?

    The mx.controls.Button class utilizes a mx.core.UITextField for it’s text label. This class basically wraps TextField, and add some CSS & measurement support so it’s easier to work with. By default, a Button’s label is bold.

    This may seem minor, but if you try to embed a font, and apply the style to the button, it won’t work. You’ll apply the same style to Label’s, and see it work just fine, and go, ‘WTF?“. You can use a horrible hack, and utilize the mx_internal namespace, call getTextField on the Button, and call embedFonts on it to true. You can then apply this to every event a Button emits, and duct tape that mofo into submission. This looks & works horrible.

    The problem stems from the fact that when you are embedding a font, you aren’t always embedding the bold version of it. Some fonts don’t have bold equivalents, and some are specifically to be made bold, but aren’t seen as bold by some tools. Lame.

    The fix? 3 lines of CSS.

    Let me stop and just say right quick that Flex 2’s implementation of CSS is off the hook! It’s come a long way from Flex 1.5. I spent 4 hours the other day in CSS. That’s right… 4 hours in Firefox & CSS skinning & incorporating a design. Not MXML, not ActionScript, but CSS! Insanity. It feels so much like web design, but… something’s different… oh yeah, I know! My design actually, you know, works the same in every browser and looks like I intended with no compromises!

    Anyway, you overwrite the Button’s main style attributes. You ensure he’s embedding fonts, you set his font weight to normal, and you set his default font, like so:

    Button
    {
    	embedFonts: true;	
    	fontWeight: normal;
    	fontFamily: oldSkool;
    }
    
    @font-face
    {
    	src:url("PAPYRUS.TTF");
    	fontFamily: oldSkool;
    }

    This is a big deal because a lot of components use Button. You’ll have the same font problems with them as well, such as TabBar/TabNavigator, and LinkButton/LinkBar to name a few. Doing the above vs. using a custom style ensures that all LinkButtons and Tab’s will now use your font. w00t!

    :: collapses ::

  • Porting Flashcom Applications to ActionScript 3

    Regardless if you Flex or Flash, I ran into a porting issue with a Flashcom app I wrote in Flex 1.5 & ActionScript 2. A lot of the server-side code, which is written in case sensitive JavaScript 1, utilizes the Flashcom Component Framework. This framework utilizes a namespace scheme to allow clients to identify server components, and server components to identify client components. This allows them to send messages to each other, and works really well…

    …except in Flash Player 9. For some reason, the namespace mechanism doesn’t work for ActionScript 3 classes. This isn’t a big deal for playing existing content. All of my existing Flashcom apps I wrote in Flash MX 2004 & Flex 1.5 (Flash Player 7) still run just fine in Flash Player 9 in both Firefox & IE.

    It’s when you have a server-side script do a NetConnection.call on an Flash Player 9 created SWF that things don’t work. You CAN call a method that your class has defined as public assuming you point the NetConnection’s client property to your class; protected and private don’t work. However, the namespace mechanism commonly used in ActionScript 2 doesn’t work with the server; it constantly reports method not found. You’d typically decorate the client side NetConnection object reference that you’re component got passed in via it’s loose interface “connect” method. This decoration with the namespaces pointing to your component allowed the server-side to find it. The server-side Flashcom Component Framework already has a built-in namespace mechanism that still works just fine.

    You can emulate this by extending NetConnection, and making the class dynamic. Still, you’ll get the method not found error.

    My only guess at the problem is I think it has to do with the lack of support of “slash syntax”. I’m not sure the new ActionScript Virtual Machine supports it. I know AVM does; it’s how Flash Player 4 SWF’s will work the same as they always have. However, it seems the FCS Component Framework utilizes this behind the scenes somehow. When you do this on the server-side:

    nc.call ( this.callPrefix + "method" );

    You’re basically going:

    nc.call ( "YourComponent/InstanceName/method" );

    …I guess. I gave up after 3 nights of trying to get it to work. I didn’t mind porting client code, but I didn’t want to port server-side code. Anyway, fix for me is to pass in the callPrefix as the first parameter to the method, and have the client side Observer class just parse out “who this message goes to”.

    If you get it to work on your end, drop a note in the comments. I’m using Flex 2 & FCS 1.5 on Windows via Flash Player 9 in Firefox 1.5.

  • NetConnection, SharedObject, & NetStream’s client Property in ActionScript 3

    Past two weeks, I’ve been porting over some Flashcom & Flex 1.5 code to Flex 2 (still using FCS 1.5 vs. FMS 2). One nice addition I found in the ActionScript 3 SharedObject class is the client property. This little gem allows you have events that are called by SharedObject.send to be called on a proxy class instead. What this means is, if someone in a Flashcom application causes the remote SharedObject to be updated, and it fires a “onChatMessageUpdate” method, it’ll actually get called on the client object if you set it to something. Since a lot of intrinsic classes are now “final”, meaning you can’t futz with ‘em as easily as you could in AS2, this is a great way to incorporate it via Composition.

    var my_rso:SharedObject = SharedObject.getRemote("chat", nc.uri, false);
    my_rso.owner = this;
    my_rso.onChat = function(str)
    {
            this.owner.onChatMessage(str);
    };
    
    function onChatMessage(str)
    {
            textArea.text += str;
    }
    
    

    In the past, you’d use something like the above; proxying the message yourself, or even putting the logic inside the method closure if you were in a hurry.

    Now, you can forward it to an anonymous object, yourself, or even a class instance.

    var my_rso:SharedObject = SharedObject.getRemote("chat", nc.uri, false);
    my_rso.client = this; // onChatMessage needs to be a public function in this class
    my_rso.client = {onChatMessage: function(str){ // }}; // anonymous function
                    my_rso.client = new ProxyClass(); // you can make a class specifically to handle events
    

    David Simmons from Adobe told me it was on NetConnection as well. Just checked, and she’s on NetStream too. In my tests, for classes, it only works on methods in the public namespace; protected & private don’t work. I didn’t test custom namespaces, nor do I know how to make it “see” them.

    Handy! Thanks Adobe.