Skip to main content
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Gabriel Zeck
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Gabriel Zeck@GabeZeck )

Recent Blog Posts by Ben Nadel

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 →

Working Code Podcast - Episode 73: On Bad Leaders And Gaslighting Employees

By Ben Nadel on
Tags: Podcast

In the 20+ years of my career, I don't remember ever seeing a person in a leadership position be fired. I've seen plenty of people leave a company to "explore other opportunities", typically accompanied by much praise and congratulations. And, I have to assume that at least some of these people were actually fired; but, were allowed to depart under friendly terms. As such, I pose this question to the crew: assuming that my assumption is valid, is suppressing this information healthy for the company (perhaps in an effort to keep morale high)? Or, is it a form of gaslighting that creates confusion and dissent within the organization?.. read more →

ColdFusion Alive, Episode 113: Adobe ColdFusion And Lucee CFML Roundtable

By Ben Nadel on
Tags: ColdFusion

I recently had the great pleasure of appearing on the ColdFusion Alive podcast, hosted by Michaela Light. On Episode 113, I sat down alongside Charlie Arehart, Gert Franz, and Mark Drew to talk about the state of ColdFusion; and, the healthy tension created by having both a commercial product (Adobe ColdFusion) and a massively successful, open-source CFML engine (Lucee CFML). I make no effort to hide just how much I love modern ColdFusion; but, I'm also not blind to the language issues. Come listen to us talk it out!.. read more →

Considering Approaches To Handling MySQL Key Conflicts In Lucee CFML

By Ben Nadel on
Tags: ColdFusion, SQL

Relational databases are magical. And, as I've become more experienced as a software engineer, I've begun to lean more heavily on the database as a means to enforce data integrity (with UNIQUE KEY constraints) and to drive idempotent workflows. That said, I'm still trying to figure out where in the software stack it makes sense to put all the finer details. As such, I wanted to take a moment and consider my options for handling key conflicts in MySQL and Lucee CFML... read more →

For Consideration: An ArrayFrom() Function In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In my previous post, I took a look at the Array.sublist() method in ColdFusion; and, demonstrated that in order to use it safely you have to create a copy of the .sublist() result. This got me thinking about JavaScript and the Array.from() method. The Array.from() method allows you to create shallow copies of other arrays and Array-like values. Would it be worth having something like an arrayFrom() built-in function (BIF) in ColdFusion?.. read more →

Safely Using Array.sublist() To Generate Slices In Lucee CFML

By Ben Nadel on
Tags: ColdFusion

The other day, in the comments of my post on the performance overhead of arraySlice() in Lucee CFML, Brad Wood mentioned that it would be much faster to dip down into the Java layer and use ArrayList.sublist(). But then, in the comments of the Lucee Jira ticket, Pothys Ravichandran cautioned that .sublist() actually returns a wrapper to the original array, not a new array. As such, mutating the results of the .sublist() call would not be safe. That said, we can easily generate a new ColdFusion array from the .sublist() result in Lucee CFML to keep things running smoothly... read more →

R.O.P.E. And Battling Post-Deployment Depression

By Ben Nadel on
Tags: Life, Work

Yesterday morning, I enabled a feature-flag in production that quietly released a new feature to all of our InVision customers. This was the culmination of a week's worth of incremental builds and deployments. And while a week doesn't sound like a long time, every day leading up to it was exciting—every line of code that I wrote was exhilarating. And when it all finally went live, I was dropping party parrot and rocket ship emojis all over the place! But, when the dust settled, the post-deployment depression set in. As it always does... read more →

Working Code Podcast - Episode 72: Wearing Too Many Hats

By Ben Nadel on
Tags: Podcast

This week on the show, the crew discusses a topic submitted by Mingo Hagen: Do developers wear too many hats, do they spread themselves too thin, and does the work suffer because of it? There are clears benefits and drawbacks to wearing a lot of hats. Knowing a little bit about a lot of things can cut down on communication overhead and enable teams to move faster. But, without specialization, solutions will almost certainly be sub-optimal; and, "best practices" may not even be known to the engineer. Ideally, a team should consistent of both generalists and subject-matter experts (SME). This kind of balance creates a "healthy tension" that tempers perfectionism with pragmatism and keeps everyone moving forward at the right pace... read more →

Considering The Separation Of Concerns When Invoking A Remote API In ColdFusion

By Ben Nadel on
Tags: ColdFusion

When dealing with a local database in ColdFusion, the levels of abstraction and the separations of concern feel somewhat second nature. Yes, I've wrestled with some irrational guilt over returning Query objects from my DAL (Data Access Layer); but, on balance, I love the query object's simplicity and power; and, returning it from the DAL makes life easy. Lately, however, I've had to start consuming some remote APIs (microservices). And, when it comes to making HTTP calls, the separation of concerns is less clear in my head - it seems that so much more can go wrong when consuming a remote API. To help me think through the responsibilities of each layer, I wanted to look at consuming the Datamuse API in ColdFusion... read more →

ArraySlice() Has An Exponential Performance Overhead In Lucee CFML 5.3.8.201

By Ben Nadel on
Tags: ColdFusion

The other day, I tweeted about Lucee CFML struggling with a massive array. I had created a data-processing algorithm that was taking an array of user-generated data and splitting it up into chunks of 100 so that I could then gather some aggregates on that data in the database. Everything was running fine until I hit a user that had 2.1 million entries in this array. This was an unexpected volume of data, and it crushed the CFML server. 2.1M is a lot of data to my "human brain"; but, it's not a lot of data for a computer. As such, I started to investigate the root performance bottleneck; and, I discovered that the arraySlice() function in Lucee CFML 5.3.8.201 has a performance overhead that appears to increase exponentially with the size of the array... read more →

Working Code Podcast - Episode 71: Potluck #4

By Ben Nadel on
Tags: Podcast

This week the crew discusses a potluck of tasty topics. I am trying to figure out what project I want to use as my vehicle for learning Docker and container-based deployments (see Episode 57 on my tech goals for 2022). Adam wants to completely overhaul his data synchronization workflow, but is having a lot of trouble getting excited about the work (despite all of the tasty ingredients). Carol is being worn-down by the analysis phase of a project and just wants to start doing the work and accruing some wins for her team! And, Tim just can't wrap his head around Functional Programming (FP) - I mean, how the heck can you possibly program anything without a healthy number of IF-statements?!.. read more →

On Always Returning Collections From Data Access Layers (DAL) In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In my ColdFusion applications, I always have a "Data Access Layer," often referred to as a "DAL". This layer abstracts the persistence mechanisms for the application; and, encapsulates the complexities of interacting with low-level data inputs and outputs (I/O). While I love using a DAL, I've never felt confident in how I manage requests for records with a unique identifier. And, in fact, my approach changes with new implementations. This weekend, however, after listening to the JS Party episode on Postgres.js, I've decided to always return some form of collection from the data access layer in my ColdFusion applications... read more →

Instrumenting Cache Hits And Misses With FusionReactor Metrics In ColdFusion 2021

By Ben Nadel on
Tags: ColdFusion

Last month, I mentioned that I cache a lot of data in my ColdFusion blog. And, that FusionReactor gave me peace-of-mind regarding resource consumption in the JVM. For funzies, I thought I would take that one step further and use FusionReactor's custom metrics aggregation to track cache hits and cache misses for incoming requests. To do this, I had to refactor some of my ColdFusion 2021 code to prefer composition of inheritance... read more →

Working Code Podcast - Episode 70: Self Reflection

By Ben Nadel on
Tags: Podcast

This week on the show, the crew looks back on our first 70 episodes of Working Code and reflects on what's working, what's not working, and what we'd like to see in the future. We all agree that we've made it a lot farther than we thought we would. And, thanks to Matt at Z-Cross Media, we always end up sounding totes profesh' on tape even when we sounded like bunch of monkeys in the recording studio. We've also been super thrilled to see our Discord community become such a lively and diverse forum, even if half of it is just people mocking me for not having any tests. We're all excited to see how the show evolves; and, we hope you come on this adventure with us!.. read more →

MySQL Query Optimization + Forgetting To Run EXPLAIN = Full Table Scan

By Ben Nadel on
Tags: SQL

Yesterday, while editing some ColdFusion code for this blog, I had a face-palm moment: I came across a query - the "recent comments" query on the homepage - that was almost certainly performing a full table scan of comments. At first glance, I thought I must have forgotten to check the performance characters of the SQL query with EXPLAIN. But, as I began to tweak the SQL query, I realized what happened: an earlier version of the query was using indexes; but then, I made a small change that completely altered MySQL's query execution. I love how clever the MySQL query optimizer is sometimes; so, I thought this might be worth a closer look... read more →

Using sgn() To Clamp Values In Array Sorting Operations In ColdFusion

By Ben Nadel on
Tags: ColdFusion

A couple of years ago, I ran into an issue with array.sort() in Lucee CFML wherein it threw an error if my sort operator returned a value that was larger than a signed integer. Yesterday, Adam Cameron left a comment on that post about using the sgn() function, in ColdFusion, to fix the issue. To be honest, I don't believe I even knew that the sgn() function existed. So, in order to help fill in my lacking mental model, I wanted to quickly look at what the sgn() function does... read more →

Code Kata: Throbbing Buttons Using box-shadow Animation In CSS

By Ben Nadel on
Tags: HTML / CSS

I'm not a huge fan of animations on the web. I do think that they serve a purpose when used well. However, in many cases, animations are overused and make interfaces feel more sluggish than they actually are. That said, they are fun. And the other day, I was on a website (I can't remember which one) that had a fun little throbbing button animation. I didn't look at how it was implemented; but, I assumed it was using a compound box-shadow CSS animation. As code kata, I thought it would help build up my CSS muscles by trying to reproduce this throbbing button animation using CSS @keyframes... read more →

Working Code Podcast - Episode 69: Now I'm Catching Events

By Ben Nadel on
Tags: Podcast

This week, Carol talks to us about how her Support team manages communication with their customers. And, how she'd love to find an easy way for one Support engineer to know that another Support engineer is currently working on a given ticket. She's been exploring the use of WebSockets and "presence channels" as a means to provide feedback within the Support platform. And, more generally, she's been looking into the concept of Publish and Subscribe (often referred to as Pub/Sub) as a means to push information from one service to another. We talk a lot about Pusher - a fully-managed WebSocket SaaS offering; and, consider other techniques that might be helpful... read more →

Adding CreateTimeSpan() To Date/Time Values In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In ColdFusion, it's trivial to add a given date-part, such an "hour" or a "day", to an existing date - there are built-in functions and member-methods for this task. But, it's a little harder to mix "Dates" with "Time Spans". Doing so, often leads to a fractional numeric value. This fractional value is a "numeric date". There are a number of ways to cast between "numeric dates" and "dates"; but, I wanted to look at how we can avoid casting by thinking about what a "time span" actually is; and, how we can efficiently add and remove time spans to and from dates in ColdFusion... read more →

Moving My Short-Code Redirects To Netlify

By Ben Nadel on
Tags: ColdFusion

For years, I've had my own "short code" URL, bjam.in. There's no meaningful reason for me to have it - only, that I was raised in an era when short codes were all the rage. And, an era in which Twitter actually counted embedded URLs as part of the overall message length (something that they no longer do). But, one thing that's always bothered me about bjam.in is that it didn't have an SSL Certificate. I never wanted to pay for one since the site does nothing but redirect to www.bennadel.com, which does have an SSL Certificate. To remedy this, I've moved my bjam.in logic over to Netlify which automatically provisions SSL Certificates using Let's Encrypt... read more →

Adding FusionReactor Sub-Transaction Breakdowns To My ColdFusion Blog

By Ben Nadel on
Tags: ColdFusion

A couple of years ago, I wrote about how we're using the FusionReactor API (FRAPI) to instrument our Lucee CFML apps at work. And, now that I have FusionReactor installed on my ColdFusion 2021 blog, I've been translating some of that logic over to this site. I recently demonstrated that FusionReactor gave me critical insights into my SQL queries and my in-memory caching techniques. And, this morning, I added some "Tracked Transactions" to help me understand how long certain portions of my ColdFusion request was taking to execute... read more →

Moving Comment Moderation To A Form POST Away From "cache.google.com"

By Ben Nadel on

A couple of months ago, after getting deluged with spam comments, I finally broke-down and added comment moderation to my ColdFusion blog. My initial implementation included an email that I would receive with embedded action-links to "Approve Comment" and "Reject Comment". This worked great for me; but, I noticed that I would occasionally see a 404 Not Found error in my logs pointing to one of these moderation URLs... read more →

Using Closures To Bind Naked Functions To Components In ColdFusion

By Ben Nadel on
Tags: ColdFusion

When we think about a "method signature", we often think solely about the arguments that it accepts and the type of data that it returns. But, there's more to a method signature, such as the mode in which it can be invoked. Most methods can only be invoked as a member method. However, in some cases, an Object's API allows for methods to be detached and passed-around as "naked functions". In ColdFusion, we can use Closures / Lambdas to bind a Function reference to a ColdFusion Component instance such that the "member method" can be used - and work correctly - as a "naked function"... read more →