November 7, 2000
Depending on the data type used, many databases (for example, Microsoft SQL Server) pad returned data with spaces up to the length of the field. This is not a problem when fields are displayed (even if there is extra white space HTML will ignore it), but this can be quite annoying if the field is...
November 6, 2000
Any time you use an expression or variable to build a URL parameter, use the URLEncodedFormat() function to ensure that that value is URL safe. You should do this even if you know the value is safe (for example, a simple number). The function will do no harm if the value does not need encoding...
November 5, 2000
Using FORM forms or URL parameters and expecting specific data types (for example, a number)? Make sure you verify that the variable contains the correct type before you use it. You can do this using the CFML decision functions, or you could use the TYPE attribute. The latter is a more efficient...
November 4, 2000
Ever find yourself repeatedly checking if a variable exists (using the IsDefined() function) and then checking it's value? A faster (and more manageable) approach is to always ensure that variables exists with a bank of statements at the top of your page. Use these statements to assign default...
November 3, 2000
The # character has special significance in CFML, and ColdFusion assumes that every # delimits an expression. So how can you refer to RGB values which are usually in the format #FF00FF within your CFML code? By escaping the #. Specify ##FF00FF and CF will send #FF00FF to the browser. (Applies to:...
November 2, 2000
For rapid access to specific query rows and columns, access them as if they were structures and arrays. You can refer to a specific column of a specific row as #query.column[row]#. For example, if you wanted the "price" column for the fifth row of a query named "products" you could use the...
November 1, 2000
ColdFusion Studio 4.5 introduced a feature that allows to you collapse and expand code blocks so as to save editor window space, but this feature is also a great debugging tool. To quickly check for mismatched tags click on any tag, right-click, and then select "Collapse Tag" to collapse all the...
October 31, 2000
Having a rough time getting Studio's debugger to work? More often than not the problem is one of mappings - for the debugger to work you must specify three mappings (one for each of ColdFusion, your Web server, and your Web browser). If those are not correct the debugger will not be able to...
October 30, 2000
ColdFusion is usually used to generate content for use within Web browsers, but that's not all you can do. In fact, ColdFusion is entirely client independent - you can generate content for any client including wireless devices (for example, WAP, iMode, and Palm) and other applications (for example...
October 29, 2000
Visit the Developer's Exchange at www.allaire.com regularly. There are hundreds of great tags and code examples there for you to download, and most in source code form. Before you write it yourself, check to see if someone else has already done it for you. (And of course, contribute your own...