Monthly Archives: September 2006

CFHTTP

This is mostly so I don’t forget, but if it helps you, well that’s cool too. I had to google search every which way to sunday, then searched the house of fusion CF-Talk list before finding my answer…. Thank you steven Erat!

The jist is when you use CFHTTP to talk to IIS it may send it’s reply back in a compressed state. CF no likey that very much and you’ll end up getting the dreaded "Connection Failure". However the solution is simple. Add these two params to your CFHTTP and viola!

<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">

Which according to Steven (who knows more about IIS than I do, clearly) tells IIS not to send it’s reply in a compressed state. BAM!! no more "Connection Failure".

Like I said, this is as much for me, as it is for you. I just don’t want to waste time searching again.

State Changing rocks!

I’m working on an app for my company, it’s slow going, but what can I say. At any rate, I’m working on the part of the app where you update your profile. Including adding, and editing contact info and addresses.

In my efforts to not only write as clean a code as I can (I’ve rewritten a few things already), and use the parts of Flex I don’t have as much experience with. I’ve used state transitions once before, so I knew a little. In this particular case I’m simply changing a property and event handler of a button on my component.

V1 was adding the actual button as needed, "Add" or "Update" complete with it’s own label and click handler.

V2 is reducing my code a bit and simply controlling the label property and click eventhandlers on a dummy button. See Below.

<mx:Button id="testButton" click="UpdateContact()" label="Update" />

testButton (to be renamed) is coded with default behaviors. I could probably leave both label and click empty, I’m not sure.

My state transitions look like this.

<mx:states>
        <mx:State name="Add">   
            <mx:SetEventHandler name="click" handlerFunction="AddContact" handler="AddContact()" target="{testButton}" />
            <mx:SetProperty name="label" value="Add" target="{testButton}" />
            <!–<mx:AddChild relativeTo="{buttonWrapper}" position="lastChild">
                <mx:target>
                    <mx:Button click="AddContact()" label="Add" />
                </mx:target>
            </mx:AddChild> –>
        </mx:State>
        <mx:State name="Update">
            <mx:SetEventHandler name="click" handlerFunction="UpdateContact" handler="UpdateContact()" target="{testButton}" />
            <mx:SetProperty name="label" value="Update" target="{testButton}" />
            <!–<mx:AddChild relativeTo="{buttonWrapper}" position="lastChild">
                <mx:target>                   
                    <mx:Button click="UpdateContact()" label="Update" />
                </mx:target>
            </mx:AddChild> –>
        </mx:State>
    </mx:states>

UPDATE
I found out (shame on me. I blogged my solution before running it) that it’s not handlerFunction you want, well maybe, but it’s not what I want. That property passes an event into the assigned function. I don’t want that. My functions take no params. so the handler="" property is what I want. Now that I’ve really run the code. BAM (yeah Emeril is pretty cool) it works.

You can see the V1 approach in this color.  That approach works just fine. I don’t know if it’s any more or less efficient or changes my swf file size at all, but V2 is a cleaner implementation. Especially when the time comes (It always does) when I need to make a change to the button or the state.

State is easy to control. Since this particular component is created and called from a page with user info on it. I simply call my init() when this component is instantiated

private function init():void
            {
                if (ContactID != 0)
                {
                    currentState=’Update’;
                } else {
                    currentState=’Add’;
                }
            }

If the user is editing a contact, ContactID will be populated. New instances of a contact, default to ID 0.

CF Podcast, talking from the arse

After listenning to this weeks podcast, I may unsubscribe.

Michael and Bryan spent almost an hour, talking out of their asses about Flex.

I saw Scotts post about the show, but didn’t read it until I had a chance to listen for myself. He’s right on every single point he makes.

It’s clear from listenning to them, they’ve never built a Flex app, never really even looked into what might be involved in building a Flex app.

They talk about their 3-4 k Line javascript application and how it can only run in the latest browsers… It seems to me, had they known something about Flex, that app would be built in it. I’d be willing to be that a Flex app built to the same spec their AJAX app is built to would be; Done quicker, provide a better user experience, be easier to maintain in the future, run on any browser (flash player required obviously).

FDS is a 1.0 product? I’ve not heard anything like that. Nor had any problems using it.

FlexBuilder is like Dreamweaver? What the hell? I wonder if they know Flex2 is out?

They claimed to be speaking objectively, and hopefully no one bought that. They spoke with thick biase towards AJAX, biase that not only cast Flex in a poor light but provided nothing useful to a developer thinking about which path to take.

Flex is a language, a technology
AJAX is DHTML.

"Pick the right tool for the right job" … as long as it’s AJAX?

Don’t do something for the "cool"??  I’ve always thought that was the whole point of AJAX. I worked on a project with some really nice AJAX features, built because the client asked for sexy.

"AJAX is more seperated from data, Flex isn’t" I don’t know where someone would come up with a statement like that. I can’t even think of a comparison for the sheer lameness of a statement like that.

"Any argument you can make for one, you can make for the other." How come you guys didn’t do that?

I don’t think I ever heard them mention one time that Flex was a good choice. Lot’s of "Flex may be the right choice" Weak sauce, guys.

My blog ate the first two posts, so I’m tired to typing the same things over and over so I’ll end with.

Michael and Bryan, if you’re going to speak on a topic, research it. Build an app in it. Don’t step up to the mic and look foolish. It’s clear you know absolutely nothing about Flex. it was in beta for months, you coulda played with it then, it’s free now (in most cases) to play with at least as a developer. Due your homework.

9.11.01

Nothing to say.