Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
Ben Nadel at the New York ColdFusion User Group (Nov. 2009) with: Ruslan Sivak
Ben Nadel at the New York ColdFusion User Group (Nov. 2009) with: Ruslan Sivak

Recent Blog Posts by Ben Nadel

What If AngularJS Had A setState() Method Like ReactJS

After digging into ReactJS for the first time , over the weekend, I was very interested in the way ReactJS thinks about state. State, in React, isn't strictly immutable; but, the framework only reacts to it (no pun intended) when the state is mutated in certain ways - namely, when the .setState() ... read more »


Hello World: Comparing ReactJS And AngularJS

I love AngularJS. You know I love AngularJS. I write poems about AngularJS. But, at InVision App , some of the engineers have started using ReactJS; so, it's time that I start digging into ReactJS a bit such that I can remain relevant on the team and be able to jump in and fix bugs. Since I didn't... read more »


Consuming The Uniform jQuery Plugin In AngularJS

In the world of AngularJS, we concentrate so much on the View Model (Scope) that it is not always obvious as to how to consume functionality that reacts to the DOM (Document Object Model). Take, for example, the Uniform plugin in the jQuery ecosystem. The Uniform plugin presents more visually pleas... read more »


Piping Global Errors Into The $exceptionHandler Service In AngularJS

Out of the box, AngularJS has excellent error handling in so much as that everything that AngularJS "knowns about" is executed inside of a try/catch block. These managed errors are handed off to the $exceptionHandler service, where your application may or may not process them further. But, errors t... read more »


AngularJS In Firefox: TypeError: Missing Argument 1 When Calling Function b.get()

Yesterday, I was up until 11PM (which is late for me) trying to track down an AngularJS error that suddenly popped up and was only affecting Firefox users. The error seemed nonsensical and manifested as a problem in the $digest loop of the AngularJS framework. Firefox kept complaining that it was m... read more »


ngShow / ngHide Classes Get Applied In The $$postDigest Phase In AngularJS 1.3

The other day, when I was working on the AngularJS version of Absolute Grid , I noticed a small change in behavior in the way that the ngShow and ngHide directives were working. After digging into the source code a bit, it looks like there was a change in the default implementation of the $animate... read more »


Understanding How To Use $scope.$watch() With Controller-As In AngularJS

Right now, in the AngularJS community, the "controller as" syntax is becoming very popular because it disambiguates view-model references within the view. However, with the use of the controller-as syntax, people are also using the "vm" notation within their controllers. This is totally fine; but, ... read more »


Absolute Grid (ReactJS) Knock-Off In AngularJS

Right now, it's "cool" to hate on AngularJS. This is unfortunate because AngularJS is an extremely powerful framework. Sure, it has some problems in the same way that no framework is perfect. But, once you dig into AngularJS and understand how it works, there are very few problems that can't be sol... read more »


The Beauty Of Modular Code: Adding Different Transports To StatsDGateway

Earlier this week, I released StatsDGateway , which is a set of ColdFusion components that facilitate the sending of messages from ColdFusion to a statsD server. When I first wrote the library, it was a single component. However, after watching Corey Haines presentation on Simple Design , I went ... read more »


StatsDGateway.cfc - A ColdFusion Module For Communicating With StatsD Servers

A while back, I wrote an experimental ColdFusion module called GraphiteD.cfc . This was intended to allow ColdFusion applications to send statsD metrics to the statsD SaaS (Software as a Service), HostedGraphite.com . Most of the time, however, people are running a statsD server on their local ne... read more »


Thought Experiment: No Private Methods In Object Oriented Design

In the Sandi Metz / Hashrocket lunch-n-learn video, on "The Design of Tests" , she says something that I found particularly interesting. While discussing whether or not to test private methods, she mentions: There's a school of thought that says, you should never have a private method .... anythi... read more »


Added Manual String Serialization To JsonSerializer.cfc ColdFusion Project

A couple of years ago, I created a ColdFusion component - JsonSerializer.cfc - to help me serialize values in ColdFusion . There is a native method for this already - serializeJson(); but, going from a case-insensitive language to a case-sensitive specification is fraught with peril. That said, Js... read more »


Encoding And Decoding Base64url Values In ColdFusion

I've been using base64-encoding in ColdFusion for a long time; but, until yesterday, I had never heard of the term, base64url. Over the weekend, I was doing some research and development (R&D) with JSON Web Tokens (JWT) and I saw that the specification kept referring to "base64url" encoded valu... read more »


The Philosophy Of Extending Lodash In JavaScript

At work, I sometimes get into a philosophical debate about our use of the Lodash library. I love lodash and use it in our AngularJS applications all the time . But, I will often extend the lodash library with additional utility functions. This is where things gets heated. Some of the engineers que... read more »


Structs Can Use The Empty-String As A Valid Key In ColdFusion

The other day, I accidentally stumbled upon an awesome feature in ColdFusion: You can use the empty-string as a valid key within a Struct. On its own, this feature may not seem that great. But, when you do a lot of data manipulation, having a struct that can map the empty string onto a value usuall... read more »


Manually Serializing A String Using JSON-Encoding In ColdFusion

After coming across a rather unfortunate bug in ColdFusion's JSON (JavaScript Object Notation) serializer - serializeJson() - I was curious as to what it would look like to manually serialize a string value in ColdFusion. The JSON specification is rather small; there's really only a few character... read more »


SerializeJson() And "The Input And Output Encodings Are Not Same" Errors In ColdFusion

Over the weekend, I was hit by a very peculiar bug in ColdFusion. I was taking binary data, encoding it with the Base64 character set, and then serializing it as part of a larger JSON (JavaScript Object Notation) payload. The serialization went fine (seemingly); but, when I went to deserialize and ... read more »


The 8th Annual Regular Expression Day - June 1st, 2015

It's been eight years since we started international Regular Expression Day and my love for regular expressions hasn't lost momentum. When you're married to such an awesome piece of technology, there is no "seven-year itch;" the romance just keeps getting more and more intense. Hardly a day goes by... read more »


Trying To Understand Unicode Normalization In ColdFusion And Java

Just when you think character encoding can't get any worse - it gets worse. Apparently, in Unicode, some characters can be represented by more than one sequence of bytes. This means that two sequences of code may be structurally different but, functionally equivalent in so much as they render the e... read more »


AngularJS Will Parse JSON Payloads In Non-2xx HTTP Responses

This is probably an AngularJS feature that you're already using; but, you may not be cognizant of the fact that it's happening. When you make an HTTP request with AngularJS, the request and response goes through a promise chain that applies a series of pre and post transformations . The default tr... read more »


Reading Environment Variables In ColdFusion

The other day, when I was experimenting with the default credential provider chain in the Amazon Web Services SDK (Software Developer's Kit), I had to do something that I've never done before - read environment variables from ColdFusion. Since ColdFusion is built on top of Java, however, reading en... read more »


Parsing Various Units-Of-Measurement As Bytes In Node.js

After the long holiday weekend, I wanted to do a fun little exercise to help get the machinery firing again - you know, a little something to brush away the cobwebs. I thought it would be nice to parse strings as bytes. Now, I'm not talking about buffers; I mean taking a string like, "10Mb" (ie, te... read more »


Anonymous Functions, Assigned To References, Show Up Well In JavaScript Stack Traces

The other week, as I was reading Programming JavaScript Applications by Eric Elliott , I came across a passage that didn't feel right. Or, at least felt outdated - the book was written 3 years ago. On pages 31-32, Eric talks about "anonymous functions" and how they show up in error stack traces wi... read more »


Normalizing Untrusted Deferred / Promise Values For The $digest Lifecycle In AngularJS

The other day, in my blog post about the $q.when() method in AngularJS , Jordan brought up the question at to what the AngularJS documentation meant when it referred to, "the promise comes from a source that can't be trusted." My guesstimation of this statement was that we couldn't trust that the ... read more »


Angular Air Episode 15: Architecting Huge Angular Apps With Ben Nadel And Aaron Frost

Yesterday, I had the pleasure of being on the 15th episode of the videocast / podcast, Angular Air , with Aaron Frost , talking about architecting huge AngularJS applications . InVision App is a collection of large AngularJS applications that we've been building and maintaining since AngularJS... read more »


Programming JavaScript Applications By Eric Elliott - Revisited

A few years ago, I read the "early release" edition of Programming JavaScript Applications by Eric Elliott . At the time, the book was only a fraction complete, so there was very little to review (shame on O'Reilly's early release program - what a diservice it does). Now, three years later, I've... read more »


Exposing Promise / Deferred Functionality On Streams In Node.js

As I've been diving into Node.js, I'm starting to see that Streams will often live side-by-side with Promises (I use the Q library for promises). Some of those streams make sense as streams; but, some of those streams might make more sense as promises. Or, at least, they might be easier to consume ... read more »


Rethrowing Errors In JavaScript And Node.js

When dealing with errors, handling them at the perimeter of your application isn't always sufficient. By the time the error bubbles up, you've often lost a lot of the context in which the error was thrown. As such, people will sometimes catch an error, record it locally in some way, and then rethro... read more »


Learning Node.js: Building A Simple API Powered By MongoDB

For the next step in my Node.js learning journey, I wanted to try and build a simple API powered by MongoDB. As per my usual approach to learning, I am purposefully avoiding established libraries like Express (for routing and rendering) and Mongoose (for MongoDB connection management and object map... read more »


String Interpolation Using util.format() And util.inspect() In Node.js

In my blog post yesterday on creating custom error objects in Node.js , you may have seen me use the util.format() method to prepare some of the error data. The util.format() and util.inspect() methods are my two new favorite methods in Node.js. Together, they make string interpolation painless an... read more »