pf » Top 10 Underrated Functions in ColdFusion
Top 10 Underrated Functions in ColdFusion
I gave a presentation at my local CFUG yesterday called 10 Underrated Functions in ColdFusion, I plan on doing one for tags as well at some point. Here was my list of functions, in no particular order:
- ValueList - Returns the contents of an entire query column in a string list.
- ExpandPath - Returns a server file path relative to the calling template.
- Hash - Encodes a string using MD5, or in CFMX 7 you can specify any hashing algorithm such as SHA.
- RandRange - Returns a random number bound by two integers.
- XmlFormat - Escapes special characters in XML, and can also be used to prevent cross site scripting attacks.
- IsValid - Validates that a string is in the specified format (email, ssn, integer, etc).
- GetMetricData - Gives server metrics, like average request time, etc.
- ToScript - Serializes a ColdFusion variable into JavaScript or ActionScript
- GetPageContext - Gets the JSP PageContext object. Can be used to include JSP files in a CFM page, and more.
- XmlSearch - Search an XML document using an XPath Query
Did I have any obvious omissions? What would be on your list?
add to del.icio.us
| Tags: functions, cfml, coldfusion, valuelist, expandpath, hash, randrange, xmlformat, isvalid, getmetricdata, toscript, getpagecontext, xmlsearch, xpath, cfug
Related Entries
- Parsing RSS 1.0 with ColdFusion MX - April 8, 2004
- RSS and XPath - April 8, 2004
- Getting the Application Root Path in ColdFusion - April 9, 2007
- CFSCRIPT Cheatsheet - May 5, 2008
- ColdFusion 8 Update 1 Fixes some Image Processing Quirks - April 5, 2008
incrementValue/decrementValue: If you don't need to keep the result, this is handy in urls, for example, linking ot the next page.
isDebugMode - add your own debug stuff (I need to blog this)
A big amen on isValid. I think it is probably the least known cool feature of CF7.
I'm even more amazed that I still do it from time to time =)
monthAsString(month(now())) would do the trick.. also for days. Much overlooked function. LSDateFormat(now(),'mmmm') would also do it.
I'd love to see an example of where XmlFormat doesn't work. I haven't had any problems with it, not to say there aren't - I'd just like to see first hand.
I had to use the udfs above xmlFormat2(xmlsafe()), lazy I know but it works.
- CFSCRIPT Cheatsheet
- 3 New Image Effects for ColdFusion 8
- Googlebot to Submit Web Forms
- ColdFusion 8 Update 1 Fixes some Image Processing Quirks
- 10 Most Useful Image Functions in ColdFusion 8
- Speaking at NYC CFUG This Week
- Adobe AIR Tutorial for HTML / JavaScript Developers
- INFORMATION_SCHEMA Support in MySQL, PostgreSQL
RSS
Pete Freitag is a software engineer, and web developer located in










