A Small Bug In AIR?

Well, maybe. One of my co-workers, Andy Matthews, has been working on a small app, integrating BlazeDS with ColdFusion to push messages to an HTML/AJAX based AIR application. He and I spent several days configuring the server integration and piecing out the ins-and-outs of how the messaging works (big thanks to Andy Powell on this too). Andy (Matthews), coming from a design background, created this beautiful chromeless HTML interface, with a little JQuery magic thrown in to work with the bridge. That's where this possible bug reared it's ugly head.

The question is whether the bug is in AIR, or within the Flex/AJAX Bridge itself. Basically, if you've defined your transparency setting to true, within your App.xml file, then the load() method of the bridge will not call the function reference.

Andy has submitted the bug to Adobe. He also dropped Christian Cantrell and Ben Forta (hey, it's who he knows...) the following email about the issue:

Christian/Ben...

I believe that I've discovered a bug in AIR and I'm not sure who else to send this to.

I've been working on an HTML/JS based AIR application for my company using BlazeDS. I'd finally gotten everything working in a test environment when I went to port the working code into my already working transparent, custom chrome AIR app. Then it stopped working.

After debugging, I found the reason, or at least part of it. It appears that an AIR app which uses the FDMSBridge.swf provided by Adobe WILL NOT work when the app has transparency.

In my sample app ----------------- 1) I opened my sample code (without transparency), and compiled it. 2) I pushed a message to the gateway and the message was successfully received in the app. 3) I then changed the transparency setting in the App.xml file from false to true and recompiled the app. 4) I pushed another message to the gateway and received nothing.

In the final app --------------------------------------------- 1) Transparency was already set to true, so I compiled the app 2) I pushed a message to the gateway, and received nothing. 3) I then changed transparency to false, recompiled the app 4) Pushed a message and successfully received it.

Further, when the app first loads, it correctly displays the alert window when transparency is set to false, but not when it's set to true. ------------------------ Here's a small code sample:

view plain print about
1FDMSLibrary.load("FDMSBridge.swf", initBlazeDSCode);
2
3function initBlazeDSCode() {
4 alert('why me');
5 var cs = new ChannelSet();
6 cs.addChannel(new AMFChannel("cf-polling-amf","http://domainname.com/flex2gateway/cfamfpolling"));
7 consumer = new Consumer();
8 consumer.setDestination("ColdFusionGateway");
9 consumer.addEventListener("message", messageHandler);
10 consumer.setChannelSet(cs);
11 consumer.subscribe();
12}
13
14function messageHandler(e) {
15 alert('got a message! I GOT A MESSAGE!');
16}

64-bit ColdFusion...On Windows

Yes, it has finally arrived. The ColdFusion 8.0.1 update was released this morning, which is huge news by itself. But, even more importantly, this also introduces a 64-bit version of ColdFusion for Windows, Mac and Linux in both the Enterprise and Developer editions of the server. This is huge, as 64-bit support was previously only available on Solaris. Now almost anyone can take advantage of the numerous advances in hardware technology that have occurred over the past few years, and finally be able to address the RAM capacity of these high powered systems.

Aside from the many advantages and updates that 8.0.1 brings to the platform, Adobe has also release updates to the Report Builder and the Developer Tools.

Code For Scalability

So, a guy by the name of Kyle Neath recently posted a disturbing observation from SXSW. His "most interesting bit" was the idea that Scaling is for nerds. Basically, while listening to some side chatter from Jakob Heuser, a speaker at the conference, he (Kyle) came away with the idea "...don't worry about scaling -- scaling is for nerds. By the time you hit pain points, you can bring in someone who really knows what they're doing. Most importantly, by the time you hit pain points, you should be profitable enough to not worry about bringing in someone who knows what they're doing." Now, something is a little out of context, as Jakob's topic, "Scalability Boot Camp," is on horizontal scalability, according to a recent post to his blog.

My first thought is "I hope this guy Kyle never writes anything in ColdFusion." It's not that we couldn't use some developers, my phone is ringing constantly with recruiters looking for good talent. No, I just think that ColdFusion developers need to have a better mindset than this guy. Part of being a good developer is thinking about your application's scalability, performance, and extensability. To blatantly ignore any of these during your development is to invite future disaster, creating a lot of additional work somewhere along the way. Even if your application might start off with only 10 users on initial product launch, you should attempt to design it as if it will be used by thousands, or more, at a time. This also helps to avoid utilizing the Big Ball of Mud design pattern, because eventually it won't stick to the wall anymore.

The scary thing is, this guy has been around a while. He's been working on the web for some time, he has a seemingly well trafficed site, and some N00b out there will read what he's said and take it to heart. To write an application, knowing that someone else will probably have to rewrite it down the line because you were to lazy to do it right the first time, is wrong. Not knowing any better is one thing, we all learn and grow every day. Doing it with full knowledge, on the other hand, is just irresponsible.

I hope I've read it wrong, and I hope you, dear reader, know better.

Last Call For The WebManiacs Early Bird Pricing

Today is the last day for Early Bird Pricing for the WebManiacs conference in Washington, D.C. at the end of May. They have a truly impressive list of sessions on ColdFusion, Flex, and AIR development, including a small presentation from yours truly on the second day. Sign up today while you can still get the Early Bird Pricing!

ColdFusion 8 Gotcha: The Decrypt() Function

So, at the office we've been developing on top of ColdFusion 8 for a while now, testing our code so that we know we'll be safe to officially migrate to 8 when we migrate to our new datacenter. Last week we actually set up one ColdFusion 8 instance within production, to place inside our load balanced environment, to judge true application performance under load. During the setup, and before placing it into the mix, I use the localhost hosts file to direct specific sites to the localhost for testing. This has always been helpful in the past, and this time was no exception. We fired up the services, hit one of the sites, and it all promptly broke.

[More]

30onair: Why ColdFusion?

At last night's Flex and AIR release celebration, Aaron brought out his new, 30onair branded, video camera for us all to record a 30onair segment. Mine was on ColdFusion (go figure;) The light was bad, and I had just gotten back from the dentist prior to the celebration, but I put my point across.

[More]

Guidelines: Code Readability - Pt1

At work I (with heavy input from the rest of the team) am writing these guidelines for our development practices, so that everyone is working 'on the same page.' I will share this series here for others who may want to know how some folks do it.

In everything there must be balance, two sides to every coin. A debate goes on about code "structure". To indent? Or not indent? One argument persists that unnecessary spaces/tabs within code increase the bandwidth used by our systems, serving up 'empty' content. The other argument is that this cost is minimal, in comparison to the time savings with relation to maintaining 'readable' code.

[More]

SQL Tricks: What's an Upsert?

So, despite the debate on utilizing an Active Record (sometimes called Table Row) design pattern, there are times when it can be incredibly useful. Especially when dealing with simple forms that deal with a single record within a table (go figure). It's also really handy if you're utilizing something like The Illudium PU-36 Code Generator to auto-generate your data modeling. But, occasionally, you hit a glitch and need to rethink.

[More]

WebManiacs 2008 Registration Open

In a previous post I mentioned that I'll be speaking in the CFManiacs portion of the WebManiacs Conference in Washington, DC, May 19 - 23. Registration for the conference is now open, with a spectacular lineup of speakers on very high-end, focused topics, covering ColdFusion, Flex, and AIR. Here's the official line from FigLeaf:

The WebManiacs 2008 conference schedule has been finalized and registration is open. Early bird pricing ends Jan 31. Consisting of a two-day ColdFusion conference ("CFManiacs") coupled with a three-day Flex conference (FlexManiacs), hosting over 70 speakers and 130 distinct topics (some of which are hands-on), WebManiacs promises to have the most comprehensive coverage of Flex, AIR, and ColdFusion at the lowest price. Seating is limited, so folks should register early in order to get into the more popular sessions.

CF8 Ajax Grid: Showing the TotalRecordCount

This morning, Paul Stewart submitted an interesting question to the CF-Talk List:

"Hi, I have been using the CFgrid tag in CF8 (format HTML, bound to a cfc), and i have got it do almost all that i need it do (see below). Except that i don't know how to get access to the TOTALROWCOUNT figure that i can see in the debugger returned from the CFC , and also be able to display that figure either on the bottom of the grid itself (using ext.toolbar???), or even above it on the page using another ajax method??.

I need to do this show the user amount of records returned from his/her search. i.e 'your search returned x number of records.' From reading Ray Camden's blog I know i have to use the underlying Ext library that the cfgrid tag is based on, and i have used his solution to format some columns in the grid (nice one Ray). But i am not really getting anywhere (hopelessly bamboozled) with the records returned figure...."

This is a great question! And so easy to implement using the underlying ExtJS 1.1.1 component architecture of the ColdFusion 8 Ajax controls. The grid component already knows what the beginning and ending rows are for the page, and the total number of rows, so it's just a matter of getting them to display on the PagingToolbar. Paul had included a little code in his post, the primary piece of which (as far as we're concerned) is his formatgrid() function:

view plain print about
1formatgrid = function() {
2 mygrid = ColdFusion.Grid.getGridObject('ad');
3
4 cm = mygrid.getColumnModel();
5 cm.setRenderer(3,myf);
6 cm.setRenderer(5,myf);
7
8 mygrid.reconfigure(mygrid.getDataSource(),cm);
9}

Basically he has most of the pieces that he needs already. He needs a reference to his data.Store object, which we'll add right after he gets his grid instance:

view plain print about
1...
2    mygrid = ColdFusion.Grid.getGridObject('ad');
3    ds = mygrid.getDataSource();
4    ...

Then, after his renderers, but before his reconfigure(), we'll get a reference to his grid's FooterPanel to redefine the PagingToolbar:

view plain print about
1...
2    cm.setRenderer(5,myf);
3    // Get the Footer
4
5    var gridFoot = mygrid.getView().getFooterPanel(true);
6    // Create a new Paging Toolbar
7
8    var paging = new Ext.PagingToolbar(gridFoot,ds,{
9        pageSize:25, //number of records displayed in grid
10
11        displayInfo:true,
12        displayMsg:'Displaying records {0} - {1} of {2}',
13        emptyMsg:"No records to display"
14    });
15    
16    // reconfigure the grid
17
18    mygrid.reconfigure(ds,cm);
19    ...

Hey! Reload the page and what do you get? An adjusted toolbar, giving Paul exactly what he was looking for, the current record from - to and the total number of records returned. Though I've used this before, I wanted to note that this code is almost an exact copy of the example code included in the ExtJs 1.1.1 API documentation. There is a ton of untapped potential within the underlying Ext framework. With a little research you may be surprised what you can accomplish.

Previous Entries / More Entries