Is your code Thread Safe? How do you know?

Code that is not Thread Safe is sneaky, dangerous and leads to bewildering production errors and strange side effects.

As part of my deployment procedure, I run code through an automated code analyzer for improperly scoped variables. Today, while running the analyzer, it flagged this set of code:

view plain print about
1<cfset var ExistingRiskValuesList = "" />    
2<cfset ExistingRiskValueList = valuelist( RiskAssessmentQuery.TotalLeaseRisk ) >

"Wait just a minute", I said, "There is nothing wrong with that bit of code". Upon closer inspection I noted the 's' and quickly made the correction. Had I not used the automated code analyzer, this Thread-Unsafe code would have went into production.

There are many good posts about var scoping your variables, should you need more convincing. Mike Schierberl actually made and posted a video showing a memory leak in action caused by code that is not thread safe and Mike also gives away the automated code analyzer. If you haven't yet, I challenge you to download it and run it against some code. You might be surprised!

Update: Mike Schieberl and Zac Spitzer have made some improvements to the Var Scoper tool. The tool parses cfscript and is now hosted on . Thanks Mike and Zac for the fine work on one of the most important code checking tools out there!

Missing Features from Gmail

If you asked, I would say I like Gmail a lot. However, I have been yelling at it lately because it is missing some vital features.

Missing Feature 1:

The ability to instantly mark a single email as read. I do not like unread email in my box. I am happy when I see 'Gmail Inbox'. I do not like 'Gmail Inbox(23)' even if I know those 23 emails are garbage. Call me neurotic if you must.

To mark email unread, you can open it, which takes much longer than I want to invest, or you can use the drop down command. The drop down command requires clicking the tiny checkbox on the left, going to the drop down box and selecting 'Mark Read'. Sometimes, I accidently select Mark Unread. Or for more fun, 'Add Star'.

Solution: Add a 'Mark Read' button

I'd be happy to trade either my 'Archive' or 'Mark Spam' button for it. I will settle for a context menu option.

Missing Feature 2:

The ability to ignore future emails in a 'conversation'.

I subscribe to quite a few mailing lists and sometimes I lose interest in a thread. I want to push a button and have all future emails in the thread marked read. This way I am not annoyed by the Unread counter, but I have the message for historical purposes when I want to search through all the mailing list posts for an answer.

Solution: Add an 'I Don't Care' button

Ideally, this would be a button on the same level as 'Archive', 'Delete' and 'Mark Spam'. I certainly would use it more frequently than either of those three. If trading buttons is offsides, I'll settle for a drop down entry.

Attention Google

Lots of people want these two features, just read the comments below! Surely you are busy with your new office suite and don't have time to enhance Gmail. You are welcome to hire me on to help you with this. For a small fee and some stock options, I am sure we can get this worked out.

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.

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.

Replacing a small laptop computer

A long time ago in a land far far away, my no-brainer choice for new computers was Dell. I recommended Dell systems over the years as the safe option for businesses, friends and neighbors. In the last year, I have made an about face.


Residents of the Commonwealth of Virginia, beware!

Man, am I glad I am not a resident of Virginia. Those who are should be mindful of a new law put into effect July 1st, the date new laws go into effect in the Commonwealth. Commonwealth, defined as "government based on the common consent of the people", took on on a spurious new meaning July 1st in House Bill 3202 with the addition of Civil Remediation Fees. What is a Civil Remediation Fee, you ask? Allow me to present two scenarios:


Scorpio Beta works with Apache 2.2.4.

Just a quick note to say I was able to get CF 8 working on a fresh install of Apache version 2.2.4.

A few quick observations:

  1. During the CF install, I got a nice message reminding me to stop ColdFusion MX 7 Search Server
  2. After CF finished, I had to run the Web Server Configuration Tool again for everything to work
  3. I also had to open Port 51800 on my local firewall. I suspect this is JNDI.

My initial impressions? The installation process handled the above issues gracefully. This doesn't feel much like beta software... Remind me to tell you about an experience I had with a SQL Studio Express CTP beta once.

Editors note: I suppose I will never be hired by microsoft if I keep making these sorts of comments

Google and the new menu bar

I read Ted Patrick today talking about Google Making Him Think and I laughed. As a programmer, there are lots of reasons to change an application and an interface. Change is good right?

So I get home and go check my Google analytics for the week. Oddly enough, my normal pattern of getting inside Google Analytics does not work. Why? Because the new menu bar has a generic listing of Google services, not the list I used to get. There once was a link to 'My Services' or something like that. It is no longer.

To underscore Ted's point further, I can't even remember the name of the link. I just have muscle memory of clicking in the top left hand corner, selecting the correct link and then clicking Analytics.

This was such an ingrained habit, I didn't even know how to get to the Google Analytic page without searching GOOGLE for it.

To round this out, when I get to the Analytics page, it is asking me for my password. It never did that before.

So while change can be good, I think Google blew it on this round. I want my Insta-Login Analytics link back.

Great New Flex book: Rich Internet Applications with Adobe Flex and Java

I recently purchased Rich Internet Applications with Adobe Flex and Java. At 700+ pages, this book is no lightweight. Street price for the book is $119 and this seems like the higher end for technical books. If you order soon, you can take advantage of the Pre-Order pricing of 69.99. Let me tell you why this book is worth the money.

The pace of the book suited me well. I do a fair amount of research on technical topics on my own so when I get a book on programming, I want to see code and write programs. A lot of technical books begin with a history of the topic followed by a hundred or so pages of background and concepts. If you are like me, you usually skip to chapter 6 and start from there. RIA with Flex and Java begins with a page and a half by Bruce Eckel (of Thinking in Java fame), another page and a half by Matt Chotin (Flex Product Manager) then a quick fourteen pages on RIAs, Architecture and alternatives to Flex. You will build your first application on Page 22.

This book is about building applications in Flex, which is taught incrementally by building a number of applications ranging from an XML fed Gas Station application to a Portfolio/Charting application to Flex+MSExcel integration. As the applications progress, you learn more advanced topics. Even though Java is the server side language used in the book, developers familiar with other languages will gain plenty. The concepts and execution are the same. Don't let the word 'Java' scare you away from this great learning resource.

To further that point, here are the chapters in the book:

  1. Architecture of Rich Internet Applications
  2. Getting Familiar with Flex
  3. Flex Builder Development Environment
  4. Learning Flex Through Applications
  5. A Complete Application with RPC Communications and JMS
  6. End-to-End Rapid Application Development with Flex Data Management Services
  7. How to Write Your Own Data Management Services
  8. Enhancing and Extending Flex Controls
  9. Trees with Dynamic Data Population
  10. Working with Large Applications
  11. Advanced Data Grid
  12. Logging and Debugging Flex and Java Applications
  13. Building a SlideShow Application
  14. Developing Custom Charts
  15. Integration with External Applications

As you can see, this book covers a lot of Flex development scenarios.

As the man on T.V. says "But wait! There is more!

In addition to the book, you also get a DVD with all the sample code on it as well as 10 video sessions on Real World Flex.

The Authors of the book are principals of Farata Systems, rated in the top 10 Flex companies in the world so between the video content and the numerous applications you will build with the help of the Adobe Flex and Java book, this is the best $69.99 you can spend on your Flex Education. You can order the book here and get a PDF copy of the book instantly while the book is being shipped.

Disclosure: I was not compensated in any way to write this article. I paid $69.99 all by myself

Update: Bruce Phillips does not agree with me about my recommendation on this book. In the interest of fair and balanced reporting, please read the comments below.

12712 Views Print Print Comments (2) Flex

Pricing for BlueDragon.NET 7.0 Standard Edition - $1999/server

Newly released on Vince B's blog, 7 pricing. For a long time, the Blue Dragon product had the reputation as being the "Cheaper" cousin of ColdFusion, but no longer.

I don't currently have pricing for Scorpio in front of me, but it seems as if BlueDragon now has the reputation for being the "More Expensive" cousin of ColdFusion.

I, for one, appreciate New Atlanta in the CFML engine marketplace. The competition has been good for the state of the art, if perhaps not for the profits of Adobe nee Macromedia. New Atlanta has several 'firsts', one being cfthread, another being cfinterface.

With that said, the last time I had a decision about which CFML engine to use, I went with ColdFusion Enterprise. I felt the price justified the expense because ColdFusion is the Gold Standard for CFML engines and CF Enterprise and BD enterprise are priced equal. I specifically avoided using the BlueDragon product line because of certain incompatibilities with popular CF Frameworks. Even at a lower costs, the issues and limitations were too much of a negative.

I understand some CFFrameworks vs. BlueDragon issues are resolved. In fact, Peter Farrell announced on a recent cfweekly podcast that he was able to use MachII 1.5 and the ColdSpring BER on top of BlueDragon.

Still, one has to wonder if the 2k entry price for BD Standard is on the mark. It is certainly ~800 more than CF Standard. Of course, I am a lowly programmer and I don't have bastions of Market Research professionals scouring the market with surveys and the like. Nor do I have years of experience developing boxed commercial software like Vince B. and co. ( If you don't already know, Vince has been behind some very successful and innovative products in his time.)

Will there still be a 'free' BlueDragon product? Will hosting companies provide BlueDragon on their CFML hosting plans? Will Adobe counter will a Hosting Specific version allowing cheaper hosting prices? Stay Tuned to the War of the CFML engines.....

Update 1: The reporting above is slanted and inaccurate, like most of my postings. There are some good comments below adding balance. My biggest error was in failing to differentiate between BlueDragon.Net, and the other products in the New Atlanta Stable. Have a look at the Product Matrix. Also Vince B. states "Finally, yes, there will continue to be a free BlueDragon edition--we have no plans to change this. Pricing of the Java-based editions in the BlueDragon Product line remain unchanged." I did not know this and it is certainly good news for the many using BD. Have a read through the comments for a more balanced perspective.