Skip to main content
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Manil Chowdhury
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Manil Chowdhury@keywordnew )

Recent Blog Posts by Ben Nadel

Namespacing Components With Per-Application Mappings In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In my ColdFusion applications, I use a lot of components. But, these components are, for the most part, application-specific and live seamlessly alongside my application's custom mappings. Recently, however, I've been thinking about writing a "module" (ie, a set of related components) that I might want to use in multiple applications. And, it wasn't immediately obvious to me how I might define my ColdFusion per-application mappings in order to avoid conflicts with an application's existing component tree. As such, I wanted to experiment with using per-application mappings to create "namespaces" for shared ColdFusion components... read more →

Looking At The Performance Overhead Of A Read-Only Lock In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

In yesterday's post, I demonstrated that iterating over shared Structs and Arrays is thread-safe in ColdFusion; assuming, of course, that the access is read-only. But, what if I need to occasionally mutate the shared data? In that case, I'd have to acquire an exclusive lock some of the time; which, in turn, means that I'd have to acquire a read-only lock most of the time. This got me thinking about the performance overhead of a read-only lock in Lucee CFML 5.3.8.201... read more →

Updating My Mental Model For Shared Array / Struct Iteration In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In the very early days of ColdFusion, it was considered a "Best Practice" to synchronize access to all shared data structures. Meaning, to single-thread the access in order to avoid race conditions. Over time, this practice became much more nuanced; and, more of the native data types within ColdFusion became synchronized by default. Meaning, they were being made thread-safe internally. I believe that my mental model for iteration over shared data structures is outdated. As such, I wanted to run some parallel iterations in Adobe ColdFusion 2021 and Lucee CFML 5.3.8.201... read more →

Working Code Podcast - Episode 80: Other Duties As Assigned

By Ben Nadel on
Tags: Podcast

In each role, there are the responsibilities that get listed on the job board; and then, there's all the random stuff that they ask you do to once you show up. On today's show, the crew discusses the latter: those strange and wondrous "extras" that sometimes get rolled-up into an honest day's work. Topics include: buying nipple cream, picking up cigarette butts, cleaning bathrooms, taking out trash, driving to remote server locations, restocking photocopiers, and - perhaps worst of all - getting pushed into Sales... read more →

Considering A Stale-While-Revalidate Pattern To Caching In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In a recent episode of Syntax.fm, Scott and Wes discussed HTTP caching headers. From their discussion, I learned that there is am experimental value called, stale-while-revalidate. And, while this post isn't about HTTP caching, their discussion got me thinking about different ways in which I might manage a server-side cache of data that needs to be kept in-sync with a remote data source. I wanted to do some noodling of what a "stale while revalidate" workflow might look like in ColdFusion... read more →

Playing With Java Pattern's Named Capture Groups In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In yesterday's post on the new jreExtract() method in JRegEx.cfc, I was aliasing the Regular Expression (RegEx) capture groups with human-friendly labels as part of my demo-output. This reminded me that the Java Pattern class added named capture groups in Java 7 (circa 2010); and, I've yet to ever try them out. As such, I thought it was high-time to give named capture groups a try in ColdFusion... read more →

Adding jreExtract() To Pluck Captured Groups Using Regular Expressions In ColdFusion

By Ben Nadel on
Tags: ColdFusion

I love Regular Expressions. I use them probably every day in some capacity. And, I've loved having my JRegEx.cfc project to simplify many pattern-based interactions. Today, I'm adding one more tool to that toolbox: jreExtract(). The jreExtract() method matches a Java Regular Expression against an input String and returns a Struct of the captured groups. Sometimes, I want to use a single pattern-match to pluck-out parts of a string in ColdFusion... read more →

ColdFusion Alive, Episode 115: Adobe ColdFusion And Lucee CFML Roundtable, Part II

By Ben Nadel on
Tags: ColdFusion

A few weeks ago, I appeared on episode 113 of the ColdFusion Alive podcast with Michaela Light, Charlie Arehart, Gert Franz, and Mark Drew. In that episode, we had so much fun talking about how wonderful modern ColdFusion is that we decided to have ourselves a part II: Episode 115. In this fast-follow, we talk about the strengths and the weakness of the ColdFusion and Support communities at large... read more →

Ask Ben: Extending A ColdFusion Session On A Long-Lived Page

By Ben Nadel on

Hi Ben, I am trying to learn ColdFusion and have a question. I hope you can help me. I have an application where a user logs into a portal. Session variables are set to time out in 30 mins. But, is it possible to extend the session if the user keeps using the page. For the application, even if the user is moving the page up and down and making some interaction with the page, the session still expires. Thank you so much in advance.!.. read more →

Working Code Podcast - Episode 79: Potluck 5

By Ben Nadel on
Tags: Podcast

This week on the show, Adam and I examine a variety of random topics: Adam loves watching conference videos on YouTube; I am feeling terribly insecure about falling behind in the field of web development; neither of us can believe that Elon Musk is forcing his employees back into the office; and, how is it possible that some people seem have so much free time - what the heck is their secret?! I'm constantly struggling to find time to do all the things that I would like to do... read more →

It's OK To Be Super Explicit In Your Data Access Method Names

By Ben Nadel on
Tags: ColdFusion

This post is mostly a note to myself - a sort of "permission slip" to relax the previous constraints of my mind. The other day, I was writing an Update method in a data access object (DAO) within my ColdFusion application. This update method was updating an optional relationship within my domain model. Meaning, the target row wasn't guaranteed to exist. As such, I decided to author the underlying SQL statement as an Upsert method that would use the ON DUPLICATE KEY UPDATE semantics. This would allow me to either update the existing row or create a new row on-the-fly. Technically, this worked like a charm; but, emotionally, I felt deeply conflicted... read more →

A Relational Database Table To Prevent Double Form-Submissions In ColdFusion

By Ben Nadel on
Tags: ColdFusion, SQL

The other day on Episode 78 of the Working Code podcast, Adam Tuttle and I were talking about handling accidental, double form-submissions when there is no "natural key" in the database on which to attach a unique index. Adam suggested submitting a GUID (Globally Unique ID) along with the form POST and then storing that GUID in the target table. I think this is definitely the right direction; but, I didn't like the idea of storing a value in the table simply for the sake of uniqueness. And then it occurred to me: can I have a separate database table that does nothing but prevent double form-submissions in ColdFusion?.. read more →

Working Code Podcast - Episode 78: User Experience (UX) Guard Rails

By Ben Nadel on
Tags: Podcast

This week on the show, Adam and I talk about the "unhappy paths" in software design. An unhappy path - also known as a "sad path" - is anything that can go wrong during the consumption of a product. Some unhappy paths are nothing more than unanticipated edge-cases in the code while other unhappy paths are caused by poorly designed user interfaces (UI) that lack necessary constraints and affordances. But of course, it doesn't much matter why something is breaking, if our customers are unhappy, it's our job to fix it!.. read more →

Disabling Async Attribute On CFMail For At-Least-Once Delivery In Lucee CFML

By Ben Nadel on
Tags: ColdFusion

When I'm sending emails out in a ColdFusion application, not all emails are created equal. Much of the time, if an email is lost here-and-there, it's not the end of the world. For example, a "Forgot My Password" email can always be sent a second time. In critical ColdFusion workflows, however, when losing an email is unacceptable, I track the processing of pending emails in the database; and, I make sure to set the async (Lucee CFML) / spoolEnable (Adobe ColdFusion) attribute on the CFMail tag to false... read more →

Adding New Regular Expression Parsing To My JRegEx Project For ColdFusion

By Ben Nadel on
Tags: ColdFusion

As part of the recent Regular Expression Day celebrations, I was working on some fun and exciting ways to parse strings and lists using RegEx patterns in ColdFusion. As a quick follow-up to those joyous outbursts, I've gone and added those new methods to my JRegEx ColdFusion component. In fact, I've added a new JRegExList.cfc component to this project for list-specific parsing - I didn't want to mix the two genres together... read more →

More Slicing And Dicing Strings Using Java Regular Expressions In ColdFusion

By Ben Nadel on
Tags: ColdFusion

After yesterday's post on parsing lists using a regular expression delimiter in ColdFusion, I was all high on the celebration of RegEx Day 2022; and, I wanted to keep the party going! So, I started to think about how else I might want to slice and dice strings using RegEx patterns. In a previous post on parsing inbound emails from Postmark, I created a user defined function (UDF) called jreBefore(). For this post, I wanted to showcase that method, and a few other methods like it, in ColdFusion... read more →

Parsing Lists Using A RegEx Delimiter In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

In honor of yesterday's Regular Expression Day 2022 celebration, I wanted to play around with parsing lists in ColdFusion using a RegEx (Regular Expression) delimiter. Lists are the unsung heroes of the CFML language; and, are usually delimited by a single character (or set of single characters). But, the beauty of a list is that it's just a String; and, you can make a list out of anything using any delimiter. And, sometimes, I'd like that delimiter to be something more flexible, more dynamic. To start exploring this concept, I'm going to create jreListFirst() and jreListRest() functions... read more →

The 15th Annual Regular Expression Day - June 1st 2022

By Ben Nadel on

Happy Regular Expression Day! This is your annual reminder to learn you some Regular Expressions for great good! Pattern matching is a skill that comes with a massive return on investment (ROI). It is no exaggeration that I use ColdFusion and JavaScript Regular Expression (RegEx) functions every single day. Literally! Once you understand how patterns work, you see them everywhere! They are a game changer!.. read more →

Working Code Podcast - Episode 77: Mid Manager Blues

By Ben Nadel on
Tags: Podcast

This week, on the show, we check-in with Carol to see how she's adjusting to her new role. Carol was recently promoted to a position in which she is a Manager some of the time and an individual contributor (IC) the rest of the time. This setup has advantages; but, it is certainly not without its challenges. Carol absolutely loves what she is doing; and, she loves being a force-multiplier for her company; but, she's still in the process of finding a comfortable equilibrium... read more →

Parsing Liquid Tag Embeds With jSoup And Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

On a recent episode of Dev Discuss, Arit Amana talked about refactoring the way Liquid Tags are processed in the Forem platform. I had never heard of Liquid Tags before. Apparently, it's a syntax that some platforms use to enable dynamic content. One subset of this syntax allows users to embed external content within their own content. This piqued my curiosity since something like this might give me a way to allow readers of this blog to embed fun things within the comments. As such, I wanted to experiment with parsing and processing Liquid Tags in Lucee CFML 5.3.8.201... read more →

Code Kata: Array Intersection, Union, And Difference In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

For the last week or so, I've had some extreme tunnel vision at work as I was barrelling towards a deadline to finish building a Mail Blasts feature for InVision. And, now that I'm done (crushing it), I need a little breather. As a fun code kata, I thought I might play around with calculating array interactions, unions, and differences in Lucee CFML 5.3.8.201. This isn't something that comes up often in my day-to-day work. But, it's yet another opportunity to showcase the unyielding power of the Struct as Index pattern in ColdFusion... read more →

Working Code Podcast - Episode 76: Ben Needs A Minute

By Ben Nadel on
Tags: Podcast

If I crush it in the woods, and no one is there to see it, am I truly crushing it? Such are the philosophical questions that go through my brain as I continue to pour my heart and soul into a legacy product that no one else at the company cares about. That is, except for the customers that still log into the legacy platform on a daily basis. Don't those customers deserve something? Ultimately, I just want to hear that I'm doing a good job — words of affirmation are my love language... read more →

Dynamically Enabling / Disabling Session Management In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

Currently, my blog is composed of two completely separate ColdFusion applications: one for the public facing functionality (you) and one for the content publisher (me). The public facing ColdFusion application has no session management. But the internal facing ColdFusion application has sessions and login-based authentication. As I've been refactoring this platform, I briefly considered combining the two ColdFusion applications and just dynamically enabling sessions for my user. I dismissed this approach as unnecessarily complicated; but, the fact that it's even possible is a fascinating aspect of ColdFusion. As such, I thought that I might quickly demonstrate that you can dynamically enable and disable session management in Lucee CFML 5.3.8.201... read more →

Parsing Nullish Date "0001-01-01T00:00:00Z" In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

At work, one of the APIs that I consume returns data for a Date column that didn't always exist. And, instead of returning a null or an empty string for rows in which the value in the database is NULL, they return what I assume is a null-coalesced date: 0001-01-01T00:00:00Z. I didn't realize that this was happening until I started to see dates in my system showing up as 2001 - which is many years before the API in question even existed. It turns out, passing a date/time mask into the parseDateTime() function is kind of important in Lucee CFML 5.3.8.201... read more →

SQL "Join Tables" Are Just "Entity Tables" With Hard-To-Name Concepts

By Ben Nadel on
Tags: ColdFusion, SQL

Over the past few months, I've been incrementally modernizing the public-facing portion of this ColdFusion blog. And, all in all, it's been going quite smoothly! But, when I started to work on modernizing the administrative portion of the blog, things got a little hairy. Not only is the administrative code even older and jankier than the public code, it requires CRUD (Create, Read, Update, Delete) operations on "join tables" in the MySQL database. And, up until now, I haven't had to think about modeling these join tables in a data access layer (DAL)... read more →

Working Code Podcast - Episode 75: What Problem Does This Solve?

By Ben Nadel on
Tags: Podcast

Carol - who has recently stepped into a managerial role - is facing an interesting situation: her company wants to start implementing process changes across the board. However, Carol's own team is kicking ass and taking names; and, she can't understand how any of the proposed changes will actually make her team more effective. In fact, she believes that some of the changes will be counterproductive for her team. So, the question becomes: how does she push-back against the proposed changes without looking like an antagonist or a contrarian?.. read more →

Code Kata: Getting Initials For A Name In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

At work, we have many user interfaces (UI) that use initials instead of full names, such as the "face pile" widget. The current technique for extracting initials from names is rather simplistic: we grab the set of tokens defined by the RegEx pattern, \S+, and then pluck out the leading character of each match. As a code kata, I wanted to see if I could author a slightly more clever user defined function (UDF) that could take a name and return initials in Lucee CFML 5.3.8.201... read more →

Working Code Podcast - Episode 74: What's On Your Workbench?

By Ben Nadel on
Tags: Podcast

This week on the show, the crew talks about what we've been working on recently. Adam is exploring the use of AWS (Amazon Web Services) message queues and S3 in order to manage nightly data processing in a way that won't crush his application servers. Tim has been approved to use the national "Do Not Call" list and is now working to integrate this list into a communications workflow. Carol is de-scoping a massive project down into an MVP (Minimum Viable Product) that can be shipped within a single sprint in order to demonstrate the value-add of the concept! And, I am dealing with post-deployment depression, which is often what happens when I'm at the end of my R.O.P.E... read more →

Caveat When Using Umbrella JS With Template Elements In JavaScript

By Ben Nadel on

The other day, when generating PDF document signatures with html2canvas, I was using a <template> element to stamp-out DOM-element clones within my JavaScript application. Those clones were each subsequently wrapped in an Umbrella JS instance for easy DOM-manipulation. However, I ran into some quirkiness if I tried to .appendTo() the clone to the document body before I was done manipulating it. It seemed that none of the API calls that I was making to the Umbrella JS instance were being applied to the clone once the template clone was rendered to the DOM... read more →

Generating PDF Signatures With Google Fonts And html2canvas In JavaScript

By Ben Nadel on

The other day, someone sent me a PDF to sign. This is the modern-day equivalent of sending someone a Fax. And, it's far more complicated than it needs to be. In a perfect world, all signatures would be gathered online in something like DocuSign. But, not everyone has access to a DocuSign-like service. That said, as I was dealing with this chore, I thought it would be a fun project to create a simple JavaScript site that generates signature images (transparent PNGs) that can then be used to annotate PDFs... read more →