coldfusion

Even Better CF DB Error Messages

A few weeks ago I posted about fixing CF's DB error messages so that they include query params you passed as well as the raw SQL of the query.  I also supplied a patch for detail.cfm so your SQL renders in a PRE tag for better readability, but didn't make it general enough to handle [...]

Fixing CF DB Error Messages

Fixing CF DB Error Messages

When you're working on someone else's code and you get an error message (because I know you'd never write code that errors), CF usually does a pretty good job of giving you the info you need to debug the issue.  But for some reason they don't show you query parameters, even though they're included in [...]

Custom Scopes for CFGroovy2

The middle of last week I committed an update to CFGroovy2 to allow an arbitrary number of scopes to be passed in as attributes, just like you have always been able to do with the 'variables' attribute.  If you update, the change is the addition of lines 47-51:
<cfloop list="#lCase(structKeyList(attributes))#" index="scope">
<cfif listFind("language,lang,script,variables", scope) EQ [...]

More Floating Point Madness

Ever the one to fight floating point errors, I thought I'd share my latest troubles.  The context is rendering axis labels for a chart, specifically from 67 to 68, in steps of 0.2.  As you can easily deduce, the desired list has six labels: 67.0, 67.2, 67.4, 67.6, 67.8, and 68.0.  However, ColdFusion might disagree [...]

Beware ColdFusion Floating Point Integers

Adobe ColdFusion uses java.lang.Double to represent numbers in most cases, and it's a floating point representation.  That means it stores a finite amount of precision about the number in question, and discards any bits beyond that.  The stored precision is relative to the magnitude of the number.  So if you ask it to store a [...]

ColdFusion Struct Literals Are Not Thread Safe (CFML Ones Are)

If you read my blog regularly or follow me on Twitter, you know how much I hate Adobe's quasi-implementation of struct (and array) literals.  I'm really hoping "third time's a charm" and CF9's implementation is sane.  The gripe is that this code:
<cfset s = {
name = "barney",
age = 29
} />
is executed [...]

Riddle Me This, CFLOOP

Take this simple loop:

#i#

What is the output?  My answer is the numbers 1-3 followed by 7-10.  But I was dismayed to learn this evening that it doesn't seem to be the case on my server.  There it outputs 1-10 with no breaks.  Can someone please [...]

Minor FB3lite Update (and a Weird CF Bug)

This evening while adding some reporting to PotD (NSFW, OMM) to help nail down some performance issues that I think are Apache's fault, I noticed a strange issue with FB3lite.  If you've used it, you know the core of the "framework" are the do() and include() UDFs.  Both contain a CFINCLUDE tag, and a weird [...]

The Latest ColdFusion Mindƒµ©Ҝ

It's pretty common knowledge that ColdFusion passes arrays to UDF by value, and not by reference like pretty much every other language.  It's a weird behaviour, but as long as you remember to write array-processing functions to be used like this:
<cfset myArray = modifyArray(myArray) />
instead of like this:
<cfset modifyArray(myArray) />
you'll be fine.  However, someone pointed [...]

Ben Nadel – At It Again

Ben Nadel posted another interesting code snippet this moring.  I think Ben and I stand in agreement on the technique: NEVER EVER USE IT.  It leverages a horrible bug in ColdFusion's implementation of struct literals that I've blogged about previously.
Here's the snippet:
<cfset objConfig = {
root = getDirectoryFromPath(getCurrentTemplatePath()),
tags = objConfig.root & "tags/",
[...]