Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.
October 31, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
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 Word, and Excel). How do you do this? The trick is to use the tag - a special tag that lets you specify the content MIME type (an identifier used to define the type of any data). The default MIME type, used if you do not use , specifies HTML output. But if you specify the right MIME type you can generate just about anything. (Applies to: ColdFusion All)
October 30, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
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 components when appropriate). (Applies to: ColdFusion All)
October 29, 2000
ColdFusion Studio's design mode has gotten a rather bad reputation, and one it really does not deserve. Design mode works well as long as it's intent and limitations are understood. Design mode was never intended for use on existing CFM pages, it was intended to be used primarily for initial page design (and thus the name "Design Mode"). It is very useful for initial page layout and design before you start plugging in your CFML code, and should really only be used that way. (Applies to: ColdFusion Studio 4 (or later))
October 28, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
The less hardcoded your application is, the easier it'll be to reuse, maintain, and deploy. For example, never specify an actual ODBC datasource name in the DATASOURCE attribute - instead define a variable (perhaps in APPLICATION.CFM) which contains the datasource name, and pass that variable to all tags instead. (Applies to: ColdFusion All)
October 27, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Every page on your site should be dynamically generated, but you probably have many pages that change infrequently and would be served quicker if they did not include run-time CF processing. In situations like this consider using the tag which can cache dynamically generated output and serve it upon subsequent requests without requiring that the entire page be processed. (Applies to: ColdFusion 4 (or later))
October 26, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Using native database drivers? Then you probably have already discovered that you cannot use the ODBC date functions (like CreateODBCDate() and CreateODBCDateTime()). To format dates for native database driver use you must use the DateFormat() and TimeFormat() functions to manually format the date as needed. (Applies to: ColdFusion 4 (or later))
October 25, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
ColdFusion features a "trusted cache" mode whereby cached p-code pages are assumed to always be current and checks for newer CFM files are not made. Turning on this option can improve performance slightly, but there is an even more important benefit - with trusted cache enabled developers will not be able to make changes to production servers (well, they could make changes, but those changes would be ignored). (Applies to: ColdFusion 4 (or later))
October 24, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
ColdFusion developers are familiar with the debug output that can be appended to processed pages. But many don't know that CF4.5 can also show the time to process the page broken down by all the individual pages that were used to compose the final page. This feature is called "Detail View" and it can be turned on in the Administrator's Debugging screen. (Applies to: ColdFusion 4.5 (or later))
October 23, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
ColdFusion caches p-code versions of your CFM files to improve performance. Ideally, the p-code cache should be big enough to contain every single CFM file. While there is no guaranteed formula that you can use to determine what the exact size should be, a good rule of thumb is to allow at least four or five times the total size of all your CFM files. (Applies to: ColdFusion All)
October 22, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
ColdFusion 4 introduced a new administrative option called "Enforce Strict Attribute Validation". When enabled ColdFusion can process requests a bit quicker, but in doing so is much stricter in initial attribute validation. Enabling this option on existing servers (with older apps) is risky, you might find that apps that always worked suddenly stop doing so. But you should definitely enable this option on servers being used for new development. (Applies to: ColdFusion 4 (or later))
October 21, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Locking is important, and must be used in conjunction with shared code or data. But don't overlock your code - long blocks of unnecessarily locked code will negatively impact application performance. Use locking where needed, but don't overuse it. (Applies to: ColdFusion 4 (or later))
October 20, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
"Nesting" refers to the use of tags within tags - for example, statements within statements, or statements within statements. There are valid reasons to nest your code, but avoid nesting too deeply. Nesting impacts application performance - but worse, it also tends to make your code less manageable. Well written (and well planned) code will seldom need deep nesting. If you find yourself nesting more than a few levels deep, take a step back, and rethink your code. (Applies to: ColdFusion All)
October 19, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Ask many developers why native database drivers should be used (instead of ODBC drivers) and you'll almost always be told that it is to improve performance. But the truth is, there is very little performance gain (if any) when using native database drivers, so if that is the reason you are considering using them, don't bother. The real benefits of native database drivers pertain to databases features and operation that are not accessible via ODBC. (Applies to: ColdFusion 4 (or later))
October 18, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
is used to call stored-procedures. can be used to call stored procedures too. So which should you use? is simpler to use, but it does not support the use of multiple result sets, return codes, or output parameters. is a little trickier to use, but supports all of these. Plus, queries can be cached, queries cannot (for now). So, is a good choice for basic stored procedures (and for when you want to use query caching), is better suited for more complex stored procedures. (Applies to: ColdFusion 4 (or later))
October 17, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Form field names, variable names, anything that contains data that corresponds to database columns should be named exactly the same as the columns they represent. This will simplify your coding and debugging dramatically. (Applies to: ColdFusion All)
October 16, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
lets you display a specific page if an error occurs, but that is usually not enough. To take programmatic action when an error occurs (for example, notifying yourself via e-mail, or attempting to fix the problem) you should use try-catch handling using the and tags. (Applies to: ColdFusion 4 (or later))
October 15, 2000
October 14, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
The ParameterExists() function checks to see if a variable exists, so does IsDefined(). But IsDefined() is far more powerful and flexible, and should be used instead of the older ParameterExists() function. You can use IsDefined() anywhere you used ParameterExists(), but there is one important difference - IsDefined() needs quotes around the variable name (or it'll check to see if the variable referred to by the variable exists, probably not what you wanted). (Applies to: ColdFusion 4 (or later))
October 13, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Need to temporarily remove a line or two of code while testing your CF app? Comment the code out by putting after. The code between those comment tags will not be processed by ColdFusion. (Applies to: ColdFusion All)
October 12, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Finding yourself working with lots of APPLICATION or SESSION variables? Instead of creating lots of individual variables within those scopes, consider creating structures and putting your variables within them. This will greatly reduce the risk of variable overwriting, and will help keep your code cleaner and more organized. (Applies to: ColdFusion 4 (or later))
October 11, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
ColdFusion should be running on a dedicated box running nothing else (other than the operating system and HTTP server, of course). So that ColdFusion has access to all the resources possible, make sure that no other unnecessary applications, services, or daemons are running (many are installed and run automatically). (Applies to: ColdFusion All)
October 10, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
The APPLICATION.CFM file is often used to define application wide (or global) variables that are visible to all code. However, Custom Tags do not process the APPLICATION.CFM file, so code within Custom Tags will not have access to these variables unless you explicitly pass them as attributes. You could also include explicit files from within a Custom Tag, but this is generally not a recommended practice as Custom Tags should be self-sufficient and should ideally not rely on external files at all. (Applies to: ColdFusion 4 (or later))
October 9, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
ColdFusion developers use the CreateODBCDate(), CreateODBCTime(), and CreateODBCDateTime() extensively when working with dates and times in SQL statements - but those functions may not work if you are using native database drivers because those drivers may not understand the ODBC date format. If you are using native database drivers, and are experiencing problems when using dates, try using the DateFormat() and TimeFormat() functions instead to format the dates as you need them. (Applies to: ColdFusion 4 (or later))
October 8, 2000
Posted At : 12:00 AM
Related Categories:
Tips (CF) :
Having trouble getting ColdFusion to access files and directories on other servers on your network? It is likely a rights related problem. When ColdFusion is installed on NT (or Windows 2000) it is installed with standard system service access - this allows ColdFusion to access the server it is on, but not any other server. For the ColdFusion service to be able to access other servers you'll need to configure the service to log on with an actual user account. You can do this from within the Services Control Panel applet (or the Services component in Windows 2000). (Applies to: ColdFusion All)
October 7, 2000
Trying to check tag sets to verify that they match correctly? Simply place your cursor in any tag and press Ctrl-M (for match). Studio will jump to the matching tag, and will jump back again if you press it again. If there is no match, or you end up on the wrong tag, you'll have found a coding problem. (Applies to: ColdFusion Studio All)
|