Types Of ColdFusion Variables

Up until recently I had been using request.variablename for pretty much all my variables when coding in CFML. I’m not sure why I have always used the ‘request’ scope.

Then it dawned on my that maybe the ‘request’ scope should only be used for certain types of variables.

Thankfully a quick search on Google returned the following useful LiveDocs page that does a pretty good job of explaining the various type of ‘variable’ scopes. If this is something you’ve never really looked into then I highly recommend you do.

Using the correct variable scope will help improve your application’s performance.

ColdFusion and MySQL

Have you ever had the following error when trying to connect to a MySQL database via the ColdFusion admin area?

Connection verification failed for data source: mysql_bad
java.sql.SQLException: Communication failure during handshake.
Is there a server running on localhost:3306?
The root cause was that: java.sql.SQLException: Communication
failure during handshake. Is there a server running on localhost:3306?

If so, then read the following TechNote to solve the problem.

Building an Editable Grid

I have recently been looking into the whole AJAX thing with ColdFusion and came across this tutorial on EasyCFM.com. It provides a good example of how to create an editable grid / table, complete with the source code and an example.

Create A Neat UUID

For any seasoned ColdFusion developer you will be well aware of the CreateUUID() function in ColdFusion that generates a unique string.

Here’s something that I use on a regular basis, just to neaten up the generated string:

<cfset request.thisUUID = Replace(CreateUUID(), "-", "","ALL") />
 
<p><cfoutput>#request.thisUUID#</cfoutput></p>

This then produces a 32 digit string.

Another way of generating a custom uuid is:

<cfset request.dateUUID =
    "#DateFormat(Now(),'YYYYMMDD')##TimeFormat(Now(),'HHMMss')#" />
<cfset request.2digitUUID = RandRange(10,99) />
<cfset request.myUUID = "#request.dateUUID##request.2digitUUID#" />
 
<p><cfoutput>#request.myUUID#</cfoutput></p>

This then produces a 16 digit string. The thing I like about the above example is if it is used for say order id’s then just by looking at the UUID you know when it was made.

Dreamweaver 8.0 Code Wrapping

If you are finding the default setting for Dreamweaver’s code display where it wraps lines of code automatically very frustrating then here’s how to solve it:

View > Code View Options > Word Wrap

Thanks to Michael van Leest for this tip.

ColdFusion Developer Certification

Yesterday I ordered the Macromedia Coldfusion MX 7 Certified Developer Study Guide from Amazon.co.uk to help me study and obtain the Certified Developer status.

I’ll definately keep you all posted on how it pans out.

Advanced ColdFusion MX Development

Between the 3rd and 5th of November 2005 I attended the Advanced ColdFusion MX Development Course held by Highlander.

The course was well worth the money as it dealt with things like structures and arrays (which I really didn’t have a grasp on what so ever!) along with cfc’s and extending these to web services.

It also covered trapping errors in database queries, which is useful.

Next? Well it’s got to be certification!

Serious Sam 2

I’ve had a few moments spare today so I thought I’d have a go at Serious Sam 2, seeing as I enjoyed the first edition so much.

I’ve not spent much time on it, but there do seem to be some great improvements on the actual engine itself. But I need to spend more time on it before I can really comment completely.