Skip to main content
Ben Nadel at cf.Objective() 2014 (Bloomington, MN) with: Jonathan Dowdle
Ben Nadel at cf.Objective() 2014 (Bloomington, MN) with: Jonathan Dowdle ( @jdowdle )

Recent Blog Posts by Ben Nadel

Recursive Template Rendering In Alpine.js 3.13.5

By Ben Nadel on

Yesterday, I created a "template outlet" directive in Alpine.js. This directive allows me to take a template reference and render it at any arbitrary point within the document and provide it with local data bindings. This opens the door for recursive template rendering since the template definition can include a template outlet which is a reference back to the current template definition. Let's take a quick look at this recursive template rendering in Alpine.js 3.13.5... read more →

Creating A Template-Outlet Directive In Alpine.js 3.13.5

By Ben Nadel on

In my previous post, I looked at cloning templates in Alpine.js. More specifically, I was looking at the mechanics of supplying intermediary data to the cloned element that exists in between the clone's local x-data binding and the ancestral scope chain. In that post, I was explicitly cloning a template in my controller logic. In this post, I want to explore a more declarative cloning technique using a template outlet in Alpine.js... read more →

Cloning Templates In Alpine.js 3.13.5

By Ben Nadel on

Over my last few blog posts, I've developed a better understanding of how scopes are applied in an Alpine.js application. Each x-data node receives an "expando" property (_x_dataStack) which contains an array of reactives scopes that represent the "scope chain" for the given component. This understanding filled-in the missing pieces that I needed in order to understand <template> cloning. Specifically, I now understand how and why an intermediary scope can be applied during the cloning process... read more →

Overcoming Asymmetric Prototype Property Access With Proxies In JavaScript

By Ben Nadel on

I don't use JavaScript proxies all that often in my day-to-day programming life. Proxies are very cool; but, they solve a set of problems that don't normally present in the business logic of applications. As such, proxies are mostly used by library and framework authors. In fact, much of the "magic" in modern JavaScript frameworks is based on the Proxy object. For example, in Alpine.js, the reactive "scope tree" is managed by proxies. And, as I was looking through the Alpine.js code this morning, I saw that they were using proxies to overcome the natural, asymmetric access of the prototype chain... read more →

Working Code Podcast - Episode 167: Do You Have A Brand?

By Ben Nadel on
Tags: Podcast

The first duty in life is to assume a pose. What the second is, no one has yet discovered. —Oscar Wilde.. read more →

Scoping Reactive Object References In The DOM In Alpine.js 3

By Ben Nadel on

From what I can gather, Alpine.js works by maintaining a stack of reactive objects in the background; and then, attaches those reactive objects to the DOM tree via "expando" properties. When you then reference a value within an Alpine.js expression, Alpine.js walks up the DOM tree, finds the closest expando property, locates the appropriate reactive object, and evaluates your expression. Essentially, Alpine.js is creating a sort of "prototype chain" for its data bindings... read more →

Creating A CSS Class Name Directive In Apline.js 3

By Ben Nadel on

Alpine.js uses the x-bind:class syntax (or :class shorthand notation) to dynamically apply CSS class names to a given element. This binding can take either a single class name or an inline object that defines multiple class names. This directive provides good developer ergonomics; but, I miss the additional way in which Angular allows individual CSS classes to be bound with separate attributes. Today, I wanted to see if I can recapture some of that Angular magic in a custom Alpine.js directive... read more →

Submitting Forms With CMD+Enter In Alpine.js

By Ben Nadel on

Now that I've taken the Alpine JS Masterclass by Sofiullah Chowdhury on Udemy, I need to start considering ways in which I can use Alpine.js to progressively enhance (PE) my web experience. That is, how can I take an already functioning site and provide a more luxurious user experience (UX)? One PE technique that has become somewhat of a standard is using the key-combo CMD+Enter to submit forms while in a <textarea> element. Let's consider ways in which this can be done in Alpine.js 3.13.5... read more →

Hello World In Svelte JS 4

By Ben Nadel on

After completing the Udemy course, Svelte.js Complete Guide by Maximilian Schwarzmüller, I wanted to build a small Svelte JS application for myself. It needed to be something complex enough to try a number of the features; but, not so complex that it would become a deterrent. I decided to build a JSON Explorer (much like the one I built in Angular 9). This small application uses a custom input, custom events, and recursive component rendering in Svelte 4.2.10... read more →

Working Code Podcast - Episode 166: Successful Onboarding

By Ben Nadel on
Tags: Podcast

On today's show, we respond to a listener question from Kamil Maráz:.. read more →

Casting Java Structs And Arrays To ColdFusion Structs And Arrays

By Ben Nadel on
Tags: ColdFusion

Most of the time, in modern ColdFusion, data flows seamlessly in between the ColdFusion layer and the underlying Java layer. Behind the scenes, ColdFusion is working to cast or proxy objects, as needed, so that we can consume these objects as if they were native ColdFusion data types. But, this magic isn't always perfect. In some edge-cases, we have to explicitly cast Java objects into ColdFusion objects in order to consume the full object API (such as member methods)... read more →

Polyfill Form Field Grouping Using Bracket Notation In Adobe ColdFusion

By Ben Nadel on
Tags: ColdFusion

One of the small features that I absolutely love in Lucee CFML is the ability to group form fields as an array by suffixing the form field names with []. As in name="tags[]". When a group of related form fields have this same name, Lucee CFML will automatically aggregate the field values as an array and remove the [] suffix from the field name (in the form scope). Unfortunately, Adobe ColdFusion doesn't offer this behavior. But, we can polyfill it at the top of each request... read more →

Working Code Podcast - Episode 165: Agile Methodology With Brian Sadler

By Ben Nadel on
Tags: Podcast

For the most part, software engineers like the concept of Agile methodology; and, they have a sense that agile development practices are the best way of getting work done. But, that doesn't mean we know how to put these agile practices in place (especially at scale). Today, we talk to Brian Sadler (@brian_sadler)—a seasoned software developer and Agile coach—about what Agile is, what parts of it work the best, and where teams often go wrong in their interpretation of best practices... read more →

Conditionally Updating Columns When Using ON DUPLICATE KEY UPDATE In MySQL

By Ben Nadel on
Tags: SQL

A couple of weeks ago, I talked about the lessons I learned while sending 7M emails using ColdFusion. In that post, I mentioned that I needed to store a cache of email validation codes in order to avoid sending an email to any address that was known to be invalid. But, an invalid email address isn't the only reason to skip a given send. If a user explicitly unsubscribes from a broadcast stream, I need to omit the given user in the next send (or my SMTP provider—Postmark—will mark the email as bounced)... read more →

Comparing Binary Values In ColdFusion

By Ben Nadel on
Tags: ColdFusion

I have a MySQL database table in which I'm storing a binary token (ie, a byte array). This binary token is easily passed from ColdFusion to the database. And, the database will happily compare binary values within an executed SQL statement. But, when that binary token is in a ColdFusion context, there's no native way to compare that binary token to another binary value. As such, I wanted to look at two possible ways to compare binary values in ColdFusion... read more →

Working Code Podcast - Episode 164: Potluck

By Ben Nadel on
Tags: Podcast

On this week's show, we explore a variety of topics. I want to perform a mini retrospective on my desire to support the legacy platform at work. Carol is feeling isolated as the only engineer on her team—her dog is a good listener, but isn't very helpful when it comes to brainstorming. And, Adam wants to talk about the browser landscape; and see which browser(s) everyone is currently using... read more →

Performance Of Struct vs. Ordered Struct In ColdFusion

By Ben Nadel on
Tags: ColdFusion

Yesterday, in the Working Code podcast Discord, Sean Corfield and I were discussing the trade-offs of various data structures. The conversation started from a code-comment that I had made about using an ordered struct. To which, Sean mentioned that ordered structs were slower than regular structs due to the fact that they have to maintain insertion order in addition to the key-value pairs. This has never occurred to me before; especially since the size of my standard data structure makes any difference inconsequential. But, I thought it would be an interesting things to test more explicitly in ColdFusion... read more →

Powering Email Unsubscribe Links Using Signed URLs In ColdFusion

By Ben Nadel on
Tags: ColdFusion

Earlier this week, I talked about using signatures to prevent URL tampering in ColdFusion. Then, yesterday, I was having a conversation about spam emails and unsubscribe links. It occurred to me that using signed URLs is one way in which unsubscribe links can be implemented in ColdFusion. As such, I wanted to run through a small demo... read more →

Converting Strings To Integers Using Hash, HashCode, And CRC-32 In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In my Feature Flags book, I had a snippet of code that uses the CRC-32 checksum in order to map strings to integers for user targeting. In his review of the book, Adam Cameron suggested that my code was longer than it needed to be; and, that I might use the hash() function for brevity. This gave me pause; especially in light of James Moberg's recent post on using .hashCode(). I want to take a moment and step back and think about how and why I'm converting strings to integers in ColdFusion... read more →

Working Code Podcast - Episode 163: Exposing Yourself To New Technology

By Ben Nadel on
Tags: Podcast

In web development, we tend to hold learning as a virtuous activity that's worthy of our spare time. In fact, there can be a lot of pressure on us to always be learning; and, to some degree, those of us who don't ride the wave of cutting-edge tech are "othered". But, is dabbling in new technology really moving the needle? Does learning a little of this and little of that really make for a more robust engineer? Or, is there more value to be gained from depth of understanding? And, at the end of the day, does the biggest impact on what we know actually come from switching jobs and joining new teams?.. read more →

Always Identify Your Calling Service Within The HTTP User Agent Header

By Ben Nadel on
Tags: ColdFusion

As part of a large cost-cutting initiative, we recently cancelled our Pingdom uptime monitoring service (which is no knock against the Pingdom service itself). But, when I checked our request logs, I saw that we still had steady traffic hitting our Pingdom end-point from the US, Japan, and Ireland. There was nothing in the request logs to help identify who was initiating these requests. And, after some additional debugging code (that I deployed to production), I saw that the requests were coming from a New Relic Synthetic Monitor. To their credit, New Relic included an X-Abuse-Info HTTP header with more information; however, this felt like a good lesson: your calling service should always be identified in the HTTP user agent header... read more →

Generating Secure URL Signatures To Prevent Tampering In ColdFusion

By Ben Nadel on
Tags: ColdFusion

Earlier this week, I was talking to my colleague, Max Nunes, about generating a URL that was locked-down for a single user's consumption. We settled on including a secure URL signature that prevented tampering. I've used URL signatures in the past, but I don't believe that I've ever addressed them directly. As such, I wanted to run through generating and validating a URL signature in ColdFusion... read more →

Define Your Email Content Using Pure Templates In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In general, when rendering content in a ColdFusion application, I find it best to define your view templates as "pure templates". Meaning, the rendering logic within the view template file is completely driven by inputs that are either passed into that template (as a module attribute) or made available to that template (as an include context). This keeps the view template devoid of data fetching and manipulation logic. An email template is, essentially, a view template that's rendered to the CFMail tag instead of being rendered to the browser. As such, the same "pure template" principles should be applied... read more →

Working Code Podcast - Episode 162: Not Enough Time

By Ben Nadel on
Tags: Podcast

I never have enough time to accomplish everything that I want to accomplish. On its own, this isn't necessarily a "bad thing". But, it can quickly lead to feelings of guilt: am I not good enough, am I not effective enough, am I letting everyone down? So much of this angst is emotional. And I know this. But, I don't have the wherewithal that I need in order to evolve my own perspective. The crew jumps in and tries to help me out... read more →

Timeboxing Code Execution In ColdFusion

By Ben Nadel on
Tags: ColdFusion

In my post earlier this week, about sending 7 million emails in 5 days, I mentioned that the underlying mechanics were driven by a ColdFusion scheduled task that executes every 5 minutes. In order to prevent scheduled tasks—like this one—from overlapping in execution, I will often include timeboxing logic that makes sure that a given algorithm executes within a given time period. Seeing that I use this logic in a number of places, I wanted to think about what an abstraction for timeboxing code might look like in ColdFusion... read more →

Using Per-Application Mappings To Alias Files In ColdFusion

By Ben Nadel on
Tags: ColdFusion

For as long as I can remember, I've been using the per-application mappings in ColdFusion to alias directories. And then, using those aliases to prefix file paths and CFInclude template paths. Yesterday, however, as I was looking at consuming configuration files in ColdFusion, it occurred to me that per-application mappings might be able to do more than provide prefixes—they might be able to alias full file paths. I can't believe this never occurred to me before; so, I wanted to try it out in both Adobe ColdFusion and Lucee CFML... read more →

Consuming Large Configuration Files Inside A ColdFusion Component

By Ben Nadel on
Tags: ColdFusion

A few weeks ago, I stumbled across a GitHub repository that maintains a large collection (3K+) of disposable email address domains. These are domains that will generate a random email address that is only valid for a short period of time. I was considering adding some email validation logic to one of my ColdFusion applications; which is when I had to decide where to put the list of domains in my ColdFusion code. This isn't a use-case that I encounter very often, so I wanted to do a quick write-up... read more →

Working Code Podcast - Episode 161: Goals For 2024

By Ben Nadel on
Tags: Podcast

As we jump into the new year, the crew talks about their new year's goals—both for the podcast and for ourselves. We strongly believe in the power of "learning in public". And, to that end, we've created a Google Form in which you can submit suggestions on how to improve the show: what do you like, what do you not like, what can we be doing better? No suggestion is off limits, so long as no people or animals are harmed!.. read more →

Lessons Learned From Sending 7 Million Emails In 5 Days Using ColdFusion

By Ben Nadel on
Tags: ColdFusion, Work

At work, I was asked to send an email notification to every one of our users. When originally presented with this problem, I said it was a terrible idea—that there are professional services that do exactly this thing; and, that I have no experience sending a massive amount of emails; and, that anything I built would end up being the "Dollar Store" version of such a feature. None of this persuaded the powers-that-be. And so, I ended up building a small ColdFusion system that just finished sending 7 million emails in 5 days. It was a lot less complicated than I had anticipated; but, we learned a number of important lessons along the way... read more →

Using Cloudflare Turnstile reCAPTCHA-Alternative In ColdFusion

By Ben Nadel on
Tags: ColdFusion

A couple of weeks ago, I looked at using Google's reCAPTCHA to block spam in my Dig Deep Fitness website. In response to that post, Alex Skinner suggested that I look into Cloudflare Turnstile. I wasn't having any issues with reCAPTCHA. But, I do love Cloudflare as a company; so, I figured it'd be fun to take a look. Here's a quick demo of using Cloudflare Turnstile in order to block spam in ColdFusion... read more →


I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel