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 »
319 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
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 17, 2013 at 7:42 PM
HashKeyCopier - An AngularJS Utility Class For Merging Cached And Live Data
Ben - thanks so much for posting these Angular articles and findings, they've been a huge help towards learning one of the more 'complex' JavaScript frameworks out there (IMO). I have been using Angu ... read »
May 16, 2013 at 5:01 PM
UPDATE: Parsing CSV Data Files In ColdFusion With csvToArray()
Your code was the closest thing I've found to obtaining some direction for converting ISO fields to values that CF can translate properly. Thank you for posting! ... read »
May 15, 2013 at 10:37 PM
Very Simple Pusher And ColdFusion Powered Chat
hi id making plz easy ... read »
May 15, 2013 at 6:07 PM
Making SOAP Web Service Requests With ColdFusion And CFHTTP
Ben, you once again saved my bacon at work. Thank you, thank you, thank you! ... read »
May 15, 2013 at 4:15 PM
What If All User Interface (UI) Data Came In Reports?
@Josh, Thanks! @Ben, I definitely recommend the David West book "Object Thinking" I've been quoting from. It goes deeply into the philosophy and history of OO programming. His breadth ... read »
May 15, 2013 at 11:36 AM
Ask Ben: Print Part Of A Web Page With jQuery
I found this helpfull when you need to keep (refresh) the original parent page after closing the iframe child print dialog (Hoping you're not using a form at this time so it won't submit again): On ... read »
May 14, 2013 at 7:13 PM
What If All User Interface (UI) Data Came In Reports?
@Jonah, If there's any books you'd recommend on the subject of domain modelling, I'd love to hear it. I just downloaded the free PDF of "Domain Driven Design Quickly". Figured I'd give it ... read »
May 14, 2013 at 6:57 PM
The UX Of Prototyping: Low-Fidelity Is The New High-Fidelity
@Phillip, I'm not sure I follow what you mean? Are you saying that you looked at the list of widgets provided by the jQuery UI and let that be your style guide? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools