Cloud Experts Unleashed

Ben & Ryan Show - ColdFusion Custom UDFs


Listen Later

Ben & Ryan Show Episode 18


In this episode, your hosts, Ben Nadel and Ryan Brown, are joined by longtime ColdFusion developer James Moberg, CTO of Sunstar Media, for a deep-dive into the wild world of user-defined functions (UDFs) and decades of real-world development hacks. From building custom tools that bridge gaps in ColdFusion and Lucee, to mastering performance and security through clever abstraction, the crew shares a treasure trove of lessons learned from the trenches.


Key Points

• James shares his approach to building reusable ColdFusion UDFs that work across Adobe CF and Lucee.

• The crew explores performance wins using command-line tools versus built-in CF tags like CFZip and CFImage.

• Strategies are shared for data sanitization, accessibility, and obfuscation using tools like Jsoup and hashing functions.

• They discuss how caching, output buffering, and shadow DOM techniques can power dynamic web experiences and secure flows.

• Real talk on AI’s limits when it comes to ColdFusion code generation—and why real-world testing still matters.



Different kinds of UDFs and how naming collisions and platform differences have influenced his work.

• Three main categories of UDFs: logic abstraction, proxying functionality, and UI simplification.

• Discusses how CF versions and Lucee differ in function availability and behavior.

• Talks about CF Backport as a strategy for extending older ColdFusion versions.


A spirited discussion on real-world cross-platform quirks, unscoped variables, and strategies for HTML standardization.

• Importance of using scoped variables to prevent unexpected collisions in code.

• How ColdFusion's HTML output can be sanitized using Jsoup and AI-assisted validation.

• Real-world examples of legacy platform quirks that led to better testing and abstraction strategies.


They unpack the use of executables and CFExecute for performance-heavy tasks like PDF generation, image processing, and zipping files.

• CFZip and CFImage are shown to be slower than OS-level executables like 7-Zip or GhostScript.

• Explains how using external tools avoids Java heap memory issues.

• Highlights the benefits of file-based tools for consistency and speed across deployments.


James walks through some of his favorite UDFs

• hashID: CFML user-defined functions (UDFs) provide a simple mechanism for generating and validating hash-based identifiers.

• createShadowHtml: CFML user-defined function (UDF) generates HTML and inline JavaScript to create a dynamic, client-side preview of a given HTML document within a shadow DOM

• streamFindNoCase: user-defined function (UDF) searches the currently accumulated output buffer for the presence of a given string, performing a case-insensitive comparison.

• generateEmailHashCode: user-defined function (UDF) processes an email address by extracting the domain, sanitizing the username by removing periods (dots) and any part after the first "+", converting both parts to lowercase, and then returning a Java-generated integer hash code of the resulting string.

• enableWKHTMLTOPDFForms: user-defined function (UDF) modifies the binary of a non-Adobe-generated PDF file to enable the editing of form fields in Adobe Acrobat.

• tempCache: user-defined function (UDF) allows you to temporarily store data in the ColdFusion cache and retrieve it using a generated UUID.

• jreEscape: user-defined function (UDF) ensures strings can be safely used in regex patterns by preventing special characters from being interpreted as regex metacharacters.

• maskCC: user-defined function (UDF) takes a text string as input, searches for patterns that resemble credit card numbers, attempts to validate these potential numbers using ColdFusion's built-in credit card validation, and then masks the validated numbers by replacing all but the last four digits with asterisks.


Helpful Links

http://www.mycfml.com/ - James's website showing these functions and more.

...more
View all episodesView all episodes
Download on the App Store

Cloud Experts UnleashedBy xByte Cloud