ColdFusion Cheat Sheet: Ripping HomeSite's Help Directories

Posted August 22, 2006 at 1:25 PM by Ben Nadel

Tags: ColdFusion

I am making a real push right now to learn more about the ColdFusion language as a whole. I know there are a lot of functions that exist that I either don't know about and/or don't use. That's about to change. In an effort to learn ColdFusion, I have made my own ColdFusion cheat sheet. Now, I saw "my own", but really, it's just a stripped down version of my HomeSite 5.5 help files:

ColdFusion Function Cheat Sheet

The HomeSite help docs have a lot of stuff that I am not interested in such as the Examples, History, and Usage. I am stripping those out. Further more, I am putting it all on one page (about 100+ printable pages) so that I can easily scroll through and search for stuff. Again, nothing here is new, only that I find it more accessible.

Perhaps the most interesting aspect about it is the way it was created. HomeSite stores the function help files as individual files. I read each one in, strip it down, and then output it:

  • <!---
  • Read in the directory files from the Functions help
  • file (copied over from HomeSite program files).
  • --->
  • <cfdirectory
  • action="LIST"
  • name="qFunctions"
  • directory="#ExpandPath( './CFMLFunctions/' )#"
  • sort="NAME ASC"
  • />
  •  
  •  
  • <!--- Loop over every file in the help directory. --->
  • <cfloop query="qFunctions">
  •  
  • <!--- Read in the file. --->
  • <cffile
  • action="READ"
  • variable="strFileData"
  • file="#ExpandPath( './CFMLFunctions/#qFunctions.name#' )#"
  • />
  •  
  • <!--- Get rid of body. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "^[\w\W]+?<body[^>]*>",
  • ""
  • ) />
  •  
  • <!--- Get rid of post-body. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "</body[^>*]>[\w\W]*",
  • ""
  • ) />
  •  
  • <!--- Get rid of post usage. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "<h(3|4)[^>]*>((?!Usage).)*Usage[\w\W]*",
  • ""
  • ) />
  •  
  • <!--- Get rid of example. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "<h(3|4)[^>]*>((?!Example).)*Example[\w\W]*",
  • ""
  • ) />
  •  
  • <!--- Get rid of history. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "<h(3|4)[^>]*>((?!History).)*History[\w\W]*?(<h(3|4))",
  • "$3"
  • ) />
  •  
  • <!--- Get rid of category. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "<h(3|4)[^>]*>((?!Category).)*Category[\w\W]*?(<h(3|4))",
  • "$3"
  • ) />
  •  
  • <!--- Get rid of 'see also'. --->
  • <cfset strFileData = strFileData.ReplaceFirst(
  • "<h(3|4)[^>]*>((?!See).)*See[\w\W]*?(<h(3|4))",
  • "$3"
  • ) />
  •  
  • <!--- Fix table. --->
  • <cfset strFileData = strFileData.ReplaceAll(
  • "<table",
  • "<table border=""1"""
  • ) />
  •  
  • <!--- Output file data (Remember: it is a Java string). --->
  • #strFileData.ToString()#
  •  
  • </cfloop>

This is a smaller version of what I did, but the end result is a rather nice version of the ColdFusion Function definitions. The help docs themselves were not totally consistent, so not all of the headers come out looking perfect, but it's pretty darn close.

One cool thing about what I am doing above is that I am reading the file data in as a string but then I am using the underlying Java String::ReplaceAll() and Java String::ReplaceFirst() methods. Sweeeet.

I will be doing the CFML tags in the same way and those will be accessible at http://www.bennadel.com/cfml/.



Reader Comments

Aug 23, 2006 at 9:44 AM // reply »
304 Comments

Maybe consider using frames. THe left frame would just be an alpha list of the funcs/tags.

Of course, it is nice having it as one simple page. Right now I use cfQuickDocs for all my doc needs, but I may download yours for times when I'm offline.


Aug 23, 2006 at 10:02 AM // reply »
74 Comments

Yeah, the frames thing would be nice for presentation, but exactly as your are saying, its nice to have them all in one page to just scroll through. The problem is, there is too much info and printing it out to read on the train (as I did), is akin to just having a CFMX reference book. I guess the difference is that the help docs are *free* and you would have to buy a book. But I think its gonna be nice to be able to just hit up bennadel.com/cfml/ to get a quick guide.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Feb 12, 2012 at 3:37 AM
Learning ColdFusion 8: CFImage Part III - Watermarks And Transparency
Hi Ben, Just to ask currently it is placed bottom right corner, if i need to replace the same rendered image on the bottom left side or in the bottom center, how that can be calculated. bottom ce ... read »
Feb 11, 2012 at 9:29 PM
Use jQuery's SlideDown() With Fixed-Width Elements To Prevent Jumping
I can't say how glad I am that I found your post. Thank you very much. ... read »
Feb 10, 2012 at 7:21 PM
jQuery AJAX Strips Script Tags And Inserts Them After Parent-Most Elements
Update! Instead of $(eval(options.insertAfter)).after(data['insertData']); I now use: var ajaxNode = document.createElement('span'); var parent = $(eval(options.insertAfter))[0].parentNode; ... read »
Feb 10, 2012 at 6:18 PM
jQuery AJAX Strips Script Tags And Inserts Them After Parent-Most Elements
encountered this same, what I consider, jQuery bug last week. I'm building a site in which I load some content via AJAX. This content contains Linkedin share button placeholders which Linkedin API ne ... read »
Feb 10, 2012 at 11:30 AM
Cross-Origin Resource Sharing (CORS) AJAX Requests Between jQuery And Node.js
After you understand the concepts here, this is an awesome cheatsheet for enabling CORS in just about anything http://enable-cors.org/ ... read »
JM
Feb 10, 2012 at 9:10 AM
My Safari Browser SQLite Database Hello World Example
@Amy, Here is a very good tutorial on how to use JOIN: http://www.sqltutorial.org/sqljoin-innerjoin.aspx ... read »
Feb 10, 2012 at 4:42 AM
Building A Twitter-Inspired RESTful API Architecture In ColdFusion
This is great, very useful Ben. I spotted a small typo in the api.cgm listing: <cfthrow type="Unauthroized" /> Cheers Stefan ... read »
Feb 9, 2012 at 10:35 PM
CFDirectory Filtering Uses Pipe Character For Multiple Filters (Thanks Steve Withington)
I was wondering if there would be a filter you could apply so that you got everything but what you included in the filter. As in show me all docs that are not a .pdf. ... read »