Ben Forta

Blog

November 7, 2000

Trim all Database Fields Before Using Them in Forms

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

Always Encode URL Parameters

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

Expecting Specific Data Types

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

Simplifying Working With Variables

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

Referring to RGB Colors Within CFML Code

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

Access Specific Query Rows and Columns Directly

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

Find Mismatched Tags Easily

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

GettingThe Debugger to Work

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

Generating Non-HTML Content

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

Don't Reinvent The Wheel

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...

Page 484 of 489 (4885 posts)