Running An Effect on Body Unload

I was recently asked to help with adding a page transition effect. JQuery makes tasks like this blazingly simple. Here is the source code for fading out the body when a link is clicked:

view plain print about
1<a href="" onclick="$(document.body).fadeOut('slow')"></a>

Concise and snappy code! Just the way I like it! But it didn't work 100%. Would you believe the effect didn't work well in one of the browsers?

When using the Firefox browser, the transition worked just fine but clicking the back button after the transition simply showed the greyed out page. Firefox browser cached the effect, rendering the whole page completely useless.

After some research, I found that the Firefox Browser uses a type of caching referred to as bfcache (for "Back-Forward Cache"). BFCache is on for most cases but is not activated under the following conditions:

  • the page uses an
    view plain print about
  • the page sets "cache-control: no-store"
  • the page sets "cache-control: no-cache" and the site is HTTPS.
  • the page is not completely loaded when the user navigates away from it
  • the top-level page contains frames that are not cacheable
  • the page is in a frame and the user loads a new page within that frame (in this case, when the user navigates away from the page, the content that was last loaded into the frames is what is cached)

The cleanest solution for this case? Add an onUnload handler to the body tag:

view plain print about
1<body unload="function(){return true};">

Now the transition works flawlessly and the back button behavior is correct.

Using StructFind for fun and profit

There is a very weird debate going on in the CF-Aussie list about the merits of the ColdFusion function structFind(). StructFind( struct, key ), is an aptly-named native function that fetches the value of the specified key, in the specified struct. If, for some reason, the key does not exist, it throws an error. (The docs are wrong)

Why would you ever need this function? One use case would be returning the value a key in a structure that is the result of a function evaluation. Take this example:


Pablo Vos Presents Ten facts why Coldfusion beats PHP and ASP

Someone just forwarded an article from Pablo Vos, "10 facts why ColdFusion is better than PHP or ASP". The 10 facts are are compelling reasons why IT managers and executives should prefer ColdFusion over PHP or ASP.

In my experience, ColdFusion makes the most sense as an enterprise web application development language. Compatibilities with other languages, integrated libraries and high levels of language functionality all make for the fastest application delivery platform available.

Clients tell me of the extra effort in Offshoring complex projects but feel they have no choice due to the manpower needed to keep IT systems current and competitive. I consistently work with them to show how utilizing ColdFusion will accomplish their goals and reduce needed IT FTEs.

We are entering a new dawn of ColdFusion. Increasing amounts of organizations understand how ColdFusion can tie into disparate systems and quickly offer feature-rich applications requiring minimal maintenance manpower.

After all, success in business is in spending less and accomplishing more than your competitors, isn't it?

The New JQuery UI Launched

The first drop of JQuery UI was released September 16th 2007. This release includes:


My 1 Year Blog Anniversary

I just noticed that I've been blogging for exactly one year.

General Stats
Total Number of Entries: 144
Posts Over Last 30 Days: 12
Average Posts Per Day (Last 30 Days): 0.40
First Entry: 09/16/06
Last Entry: 09/17/07
You have been blogging for: 365 days
Total Comments: 371
Average Comments Per Entry: 2.58
Total Views: 132716
Total Subscribers: 3

Maybe by next year, i'll have posted my About Me page....

Public Service Announcement - Firefox Caches Select Box State

Remember that the Firefox Browser caches the selected position on Select Boxes. I am not sure how to turn this feature off.

This means that if you select an option on a select box, and refresh, firefox will remember your select box index position. I've noticed the same behaviour on checkboxes and radio buttons, so be aware when debugging.

Heuristically speaking, I like the function, especially when filling out long involved forms. It is however, a complete pain in my MULE when I am debugging applications and can't figure out why the box isn't selected to the expected option.

Pressing CTRL+F5 redraws everything sans state.

CFTopper comes to America

Every once in a while I cruise over to the personal blog of Peter Coppinger, an Irish ColdFusion developer. Peter often writes humorously entertaining bits and I recently stumbled upon his most recent visit to the U.S. Make sure to read "Things I Learned in American (this time)" towards the bottom of the post.

Peter also writes about technology issues at his tech blog.

CFTopper, i owe you a beer for the laughs.....

ColdFusion Developers - Spot the Mistake

Take a look at this code:

view plain print about
1<cffunction name="getFilterString" output="false" access="public" returntype="string" hint="I return the search filter list">
2 <cfargument name="avoid" type="string" default="" />
3 <cfset var x = "" />
4 <cfset var dynHasFunct = "" />
5 <cfset var dynGetFunc = "" />
6 <cfset var rtnVal = "" />
8 <cfloop collection="#variables.instance#" item="x">
9 <cfset dynHasFunc = variables["has#x#"] />
10 <cfset dynGetFunc = variables["get#x#"] />
11 <cfif NOT listFind( arguments.avoid, x) AND dynHasFunc() >
12 <cfset listAppend( rtnVal, "#x#=#dynGetFunc()#", "&") />
13 </cfif>
14 </cfloop>
15 <cfreturn rtnVal />
16 </cffunction>

I just spent 15 minutes tracing all this code out trying to find out why nothing was returned. The intent of the code is to build a string containing values present in the object. So if a user searches by Category, UserID etc, the search string is maintained.

Warning, the error is simpler than you might think. Don't over think it.

Rewriting my blog in an emerging rich web technologies such as AJAX, Flex or Silverlight

Effective immediately, I will be rewriting this blog software in an emerging rich web technologies such as AJAX, Flex or Silverlight. Now if I could just figure out how to query a database using an emerging rich web technologies such as AJAX, Flex or Silverlight......

If you get the reference, give yourself 10 points.

If you do not, here is a picture of a funny looking cat.

Any comments containing the name or URL of a certain 'publishing' (read: Microsoft Shill Corporation) company, will be deleted out of hand.

This needs to be said once in a while. For the good of the children, please turn off Report Execution Times in your CF Administrator.

If you are using a framework written in CFCs, or a library of CFCs, or ANYTHING to do with CFCs, Report Execution Times does not return correct information. As a matter of fact, the Report Execution Times feature will bog down your Application, Framework or Page.

So turn it off. Seriously. For the good of the children.