Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with:

Recent Blog Posts by Ben Nadel

Exceptions Are For Exceptional Circumstances Is Not A Value-Add Answer

By Ben Nadel on October 31, 2014

In the world of programming, there are a lot of "answers" that feel like they lack any substantial value-add. "It depends," for example, is a response that typically doesn't clarify anything. Another response that sticks in my craw is that "exceptions are for exceptional circumstances." This is a r... read more »

Implementing ngRepeat Track-By Using A Directive In AngularJS 1.0.8

By Ben Nadel on October 30, 2014

For me, one of the most exciting features of AngularJS 1.2 is the "track by" syntax that was added to ngRepeat . This feature allows ngRepeat collections to be updated without the costly overhead of DOM (Document Object Model) node destruction and recreation. Unfortunately, I'm still using a lot o... read more »

Always Trigger The $destroy Event Before Removing Elements In AngularJS Directives

By Ben Nadel on October 29, 2014

If you're building custom AngularJS directives, you will inevitably find yourself in a situation where you have to clone elements, create new scopes, remove elements, and destroy old scopes. When you do this, the order of operations is very important. At first, it may not seem like an issue; but, o... read more »

A Quick Look At How DOM Structure Affects Text Interpolation Watchers In AngularJS

By Ben Nadel on October 27, 2014

I spend a lot of time thinking about how to improve the performance of my AngularJS apps. Not in a "premature optimization" way - more like in a "customers are complaining" kind of way. As such, I like to stop and noodle on any aspect of the code that may be leveraged for better performance. This m... read more »

Deferring Attribute Interpolation In AngularJS For Better Performance

By Ben Nadel on October 25, 2014

When AngularJS interpolates attributes on the DOM (Document Object Model), it has to install a $watch() binding in order to update the attribute value whenever thew View-Model (VM) changes. This can quickly lead to a very large number of watchers that execute in every digest. At some point, this ca... read more »

You Cannot Link Attribute Interpolation Multiple Times In AngularJS

By Ben Nadel on October 23, 2014

Once you have a compiled directive, in AngularJS, you can either link it to the current scope; or, you can clone the compiled template and link each new clone to a different scope. But, what if we didn't want to clone the template? What if we just wanted to move it around in the DOM (Document Objec... read more »

Creating An Optimized Switch Directive For Use With ngRepeat In AngularJS

By Ben Nadel on October 20, 2014

Yesterday, I looked at how to use a single ngRepeat directive, in AngularJS, to render a list of commingled datasets . In that approach, I used the ngSwitch and ngSwitchWhen directives. While this worked perfectly well, I was concerned that it was causing much of the DOM (Document Object Model) to... read more »

Mixing Data And Templates Using A Single ngRepeat In AngularJS

By Ben Nadel on October 19, 2014

Most of the time, each ngRepeat directive in AngularJS renders a single, homogeneous set of data. But sometimes, the user interface (UI) of your application requires a list to contain several commingled sets of data. In such cases, not only do the individual subsets of data contain potentially-over... read more »

Individual Firebase References Don't Store Unique Event Bindings

By Ben Nadel on October 17, 2014

After my exploration this morning, on the data synchronization behavior in Firebase , I started to wonder about the relationship between unique Firebase instances and event bindings. Specifically, how do event bindings on one instance affect the event bindings on another instance. As it turns out,... read more »

Firebase Won't Sync Reference Data Until Event Handlers Are Bound

By Ben Nadel on October 17, 2014

The other day, I started looking into the Firebase Backend-as-a-Service (Baas) API . The data-syncing aspect of it seems magical; but, with all things magical, it's important to pull back the curtain occasionally and dig deeper. Otherwise, you end up with performance problems down the road. For th... read more »

Counting The Number Of Watchers In AngularJS

By Ben Nadel on October 16, 2014

AngularJS is magical; but, that magic can come with a performance cost as the size of your AngularJS application grows. The more $watch() bindings you have, the more work AngularJS has to do in every digest. The AngularJS team has stated that this should be fine as long as you keep your $watch() co... read more »

Dumping ColdFusion Values Into A String Variable Using WriteDump()

By Ben Nadel on October 16, 2014
Tags: ColdFusion

When it comes to serializing data in ColdFusion (and other languages), my default choice is JSON (JavaScript Object Notation). JSON is a great choice since it is (fairly) human-readable and can be easily deserialized and consumed programmatically. But, sometimes, I know that I'll never need to dese... read more »

Overriding Content-Type And Content-Disposition Headers In Amazon S3 Pre-Signed URLs

By Ben Nadel on October 15, 2014
Tags: ColdFusion

When you upload a file to Amazon S3 (Simple Storage Service), you can provide the content type and a variety of other meta data points that Amazon will automatically serve-up when the file is later requested. Sometimes, however, that data was never provided, is inaccurate, or simply needs to be twe... read more »

Rule Of Thumb: Always Define And Consume An ArgumentCollection Map In A Single Context

By Ben Nadel on October 13, 2014
Tags: ColdFusion

ColdFusion has the awesome ability to programmatically define function arguments before a given function is invoked. Depending on how this gets used, this can be awesome; or, it can be a frustrating debugging nightmare for you or the next developer. To make sure you keep it awesome, follow this rul... read more »

My First Look At Using The Firebase Backend-As-A-Service (BaaS) In AngularJS

By Ben Nadel on October 12, 2014

Over the last couple of days, I've started to dig into Firebase , a data storage and data synchronization Backend-as-a-Service (Baas). Like Pusher and PubNub, it can push events over WebSockets. But, it doesn't [necessarily] deal with arbitrary events; rather, it deals with synchronization events ... read more »

Uploading Files To Amazon S3 Using Pre-Signed (Query String Authentication) URLs

By Ben Nadel on October 7, 2014
Tags: ColdFusion

In the past, I've looked at generating pre-signed (Query String Authentication) URLs as a means to grant download-access to files on Amazon S3 (Simple Storage Service). But, pre-signed URLs can also be used to grant upload-access to files on Amazon S3. This is similar to an S3 upload policy ; bu... read more »

You Have To Explicitly End Streams After Pipes Break In Node.js

By Ben Nadel on October 5, 2014

I've spent the last few months learning about Node.js in an effort to figure out why my Gulp.js script doesn't work (I still don't know). This has become quite the Herculean task, winding my way down the rabbit hole of Node.js streams. This morning, I wanted to look at one interesting behavior - th... read more »

Making ColdFusion Closures More Flexible With Context Arguments

By Ben Nadel on October 3, 2014
Tags: ColdFusion

Yesterday, after I released my BitBuffer.cfc ColdFusion component , I started to think about the transformBits() method. I was using a ColdFusion Closure to map one set of bits onto another. But, what if I wasn't using ColdFusion 10 (or higher)? Or, what if I simply defined my transform-operator... read more »

Transforming Binary Data At The Bit Level Using ColdFusion And BitBuffer.cfc

By Ben Nadel on October 2, 2014
Tags: ColdFusion

For the last two weeks or so, I've been digging into bit-wise operations in ColdFusion. This all started out as an exploration of Base32-encoding , that I needed for a larger project. As I was looking into the Base32-encoding, it occurred to me that a great deal of the complexity in the encoding/d... read more »

Creating Signed Java Byte Values Using ColdFusion Numbers

By Ben Nadel on October 1, 2014
Tags: ColdFusion

For the last two days, I've been baffled as to why I couldn't create a Byte from 8 bits. After much head-banging, I discovered that Java bytes are signed. This means that the 8th bit doesn't represent 128, but rather -128. In ColdFusion, bit-wise functions (such as bitAnd() and bitOr()) return long... read more »

Providing Environment Variables When Executing Node.js Program

By Ben Nadel on September 26, 2014

Lately, I've been trying to wrap my head around Node.js streams by reading through the Node.js source code. In the latest branch, I noticed that there were a lot of calls to debug(). And, when I looked at the source code for debug(), I noticed that it only ran when the environmental variables dicta... read more »

Using Base32 Encoding And Decoding In ColdFusion

By Ben Nadel on September 26, 2014
Tags: ColdFusion

Earlier this week, I looked at converting a binary value into a "bit stream" that would allow for sub-byte reads . I did this because I was trying to figure out how to run Base32 encoding in ColdFusion, which requires splitting binary data up into 5-bit chunks. This was a surprisingly complicated ... read more »

Converting A Byte Array Into A Bit Stream Using ColdFusion And BigInteger

By Ben Nadel on September 24, 2014
Tags: ColdFusion

The other day, I was faced with a situation where I had to split a set of bytes up into smaller sets of bits (smaller than the 8 bits that go into a byte). I was definitely stumped. Not only have I never done this before but, my understanding of bits (especially signed-bits) is rather weak. After s... read more »

Uploading And Sending MMS (Multimedia Messaging Service) Messages With Twilio And ColdFusion

By Ben Nadel on September 19, 2014
Tags: ColdFusion

Last year, I blogged about sending MMS (Multimedia Messaging Service) messages using the Twilio API . However, at the time, Twilio only supported MMS messages on Canadian phone numbers and US short-codes (ie, those 5-digit phone numbers). Yesterday, however, Twilio finally announced full MMS suppo... read more »

You Can Reference Your Derived SELECT Columns In Your ORDER BY Clause In SQL

By Ben Nadel on September 17, 2014
Tags: ColdFusion, SQL

Sometimes, nothing gets me more excited than a well-crafted SQL statement (what can I say, I'm a cheap date). I also love cleaning up and [hopefully] optimizing queries. One thing that I see from time-to-time is someone executing duplicate calculations (typically aggregates such at COUNT) in both t... read more »

EventEmitter Invokes Event Callbacks In The Context Of The EventEmitter Instance In Node.js

By Ben Nadel on September 16, 2014

This is a small but powerful Node.js feature. When you bind an event handler to an EventEmitter instance (or a sub-class instance such as Readable Stream), that callback gets invoked in the context of that EventEmitter instance. This means that, unless you are explicitly overriding the context with... read more »

Buffer.slice() Won't Error On Out-Of-Bounds Indices In Node.js

By Ben Nadel on September 16, 2014

Yesterday, when I was looking at streaming cached Buffers into HTTP responses in Node.js , I discovered something rather useful - Buffer.slice() won't throw errors when you attempt to slice beyond the bounds of the Buffer. This makes iterating over the Buffer more straightforward as you can iterat... read more »

Turning Buffers Into Readable Streams In Node.js

By Ben Nadel on September 15, 2014

So far, I've been digging deep into error handling in Node.js streams , trying to build a more robust mental mode. And, as I've done that, I've mostly created streams that were completely self-contained in terms of "state". As a new experiment, I wanted to look at creating a Node.js stream that ha... read more »

Be Careful About Launching Asynchronous Tasks Inside CFTransaction In ColdFusion

By Ben Nadel on September 8, 2014
Tags: ColdFusion

The other day, I was trying to track down inconsistent behavior in some ColdFusion code. Sometimes it would run properly; other times it would fail. At first, the issue wasn't entirely obvious. But, after digging into the workflow, I realized that it was a transaction race-condition in which an asy... read more »

How Error Events Affect Piped Streams In Node.js

By Ben Nadel on September 3, 2014

Over the weekend, I demonstrated that "error" events don't have any inherent affect on how individual Streams work in Node.js . In that post, I stressed that I was talking about "individual" streams because multi-stream workflows, that use .pipe(), are somewhat affected by "error" events. The "err... read more »