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 BFusion / BFLEX 2009 (Bloomington, Indiana) with: Simon Free and Dee Sadler

Recent Blog Posts by Ben Nadel

Does The HTTP Response Stream Need Error Event Handlers In Node.js?

By Ben Nadel on April 25, 2015

When you start programming in Node.js, one of the first things you discover is that a Node.js application is "amusingly" brittle; one uncaught error and your entire applications comes to a grinding halt. This is especially true when dealing with Streams (which inherit error-handling behavior from ... read more »

The User Experience (UX) Of Tipping As Personal Expression

By Ben Nadel on April 23, 2015

Last summer, I was in the Empire Cake Bakery in Chelsea (across from the Google building), when I noticed something that gave me pause - their Tip jar wasn't just your ordinary tip jar; rather, it was a chance to say something about myself. Unlike a typical tip jar, this jar was divided in two wi... read more »

Adventures In Angular, Episode 38: Performance With Ben Nadel

By Ben Nadel on April 22, 2015

Last week, I was honored to be back on the Adventures in Angular podcast over on . I got to ramble on about how much I love JavaScript, AngularJS, performance tuning, and how that all gets applied at InVision App , which is, of course, written in AngularJS. ... read more »

Function Hoisting, Prototype Chains, Exports, And process.nextTick() In Node.js

By Ben Nadel on April 22, 2015

In my demo yesterday, on consuming a Crypto Hash object as a Stream in Node.js , I ran my demo inside of a process.nextTick() callback. I did this in order allow my demo code to be fully defined before I consumed it. Sometimes you need this; sometimes you don't. It depends on what values are being... read more »

Consuming The Crypto Hash Algorithms As A Stream In Node.js

By Ben Nadel on April 21, 2015

The other day, when I was building a static file server in Node.js , I noticed that the Crypto module treats the Hash object as a Transform stream that is both writable and readable. And, that it explicitly has "legacy" support for the old .update() and .digest() methods. In the world of programmi... read more »

Learning Node.js: Building A Static File Server

By Ben Nadel on April 20, 2015

As I've been learning about Node.js, I've come to the realization that learning Node.js is only possible in sufficiently complex contexts. If things are too simple, then the fact that it is "JavaScript" makes it seem deceptively simple. As such, I'd like to embark on some non-trivial experiments th... read more »

The Affect Of Back-Pressure When Piping Data Into Multiple Writable Streams In Node.js

By Ben Nadel on April 18, 2015

As a learning exercise, I wanted to try and create a small static file server in Node.js. I figured this was small enough but, complex enough to help me learn about the Node.js fundamentals. During one of my refactoring efforts, I noticed that some larger files were only being "partially served" to... read more »

Managing User Input Key-Events Across Views In AngularJS

By Ben Nadel on April 14, 2015

Managing click events, in an AngularJS application, is somewhat straight-forward because the structure of the DOM (Document Object Model) very closely mirrors the order in which click handlers will be invoked. Key-events, on the other hand, are not so simple. Not only are the events not necessarily... read more »

Directive Controllers Cannot Use The Revealing Module Pattern In AngularJS

By Ben Nadel on April 12, 2015

This is just a quick blog post (more of a note-to-self) to demonstrate the fact that you cannot use the revealing module pattern with Directive Controllers in AngularJS. And, just to be clear, all controllers, in AngularJS, are "directive controllers." Meaning, the ngController directive is nothing... read more »

$animate:before, $animate:after, $animate:close And The ngAnimate Enter Workflow In AngularJS

By Ben Nadel on April 11, 2015

After my blog post yesterday, on animating an element in from a mouse-click location in AngularJS , I was a little irked that I couldn't get consistent results from the "$animate:before" and "$animate:after" events triggered by the $animate service. I couldn't figure out how they fit into the over... read more »

Animating Elements In From A Mouse-Event Location Using ngAnimate And AngularJS

By Ben Nadel on April 10, 2015

The ngAnimate module, in AngularJS, is pretty awesome. This is especially true when your transitions can be defined entirely within your CSS files. In that case, your code doesn't need to know anything about your animations at all. But, if your transitions need to be partially defined by context-se... read more »

CAUTION: Overloading The ng-Controller Directive In AngularJS

By Ben Nadel on April 8, 2015

I'm putting " CAUTION " right in the title here because I'm not actually recommending that anyone do this. This is just a fun experiment whose only purpose is to demonstrate some of the flexibility and the power that the AngularJS directive architecture provides. We've already seen how powerful it ... read more »

Exposing An Optional Directive Template Using ng-Template And The $templateCachce() In AngularJS

By Ben Nadel on April 7, 2015

Most directives can be easily defined by a single template. But, some directives are not so clear-cut. This is especially true for 3rd-party directives. Case in point, the "tooltip." The tooltip is a rendered element; but, it doesn't replace its contextual content. It's kind of an odd mixture of bo... read more »

Directive Architecture, Template URLs, And Linking Order In AngularJS

By Ben Nadel on April 3, 2015

When it comes to directive compiling, linking, and general timing in AngularJS, it probably feels like I'm beating a dead horse. But, the reason that I keep revisiting the topic is because the directive workflow is a complex multi-faceted process that keeps revealing new quirks and edge-cases. Toda... read more »

Mutating Isolate Scope References In AngularJS

By Ben Nadel on April 1, 2015

When dealing with isolate-scope variable references, in AngularJS, reading data is a non-issue. And, technically speaking, mutating data is also possible. But, just because an isolate-scope component directive can mutate a given value, it doesn't mean that it should. The more I work with AngularJS,... read more »

Asking The User To Confirm Location Or Route Changes In AngularJS

By Ben Nadel on March 25, 2015

The other day, Ward Bell and I were discussing both the future and existing routing features in AngularJS . In that conversation, we talked about what was and wasn't an appropriate responsibility for a routing module. In my opinion, the router itself shouldn't know when it's safe to navigate awa... read more »

Using $rootScope.$emit() As A Performance Optimization In AngularJS

By Ben Nadel on March 24, 2015

Yesterday, I looked at how to create a simple modal window system in AngularJS . In that exploration, I used the $rootScope to bridge the gap between the modal Service and the modal directive. In the past, I've used the same approach to bridge the gap between a global uploader service and its Plu... read more »

Creating A Simple Modal System In AngularJS

By Ben Nadel on March 23, 2015

For most of my web development career, "modal windows" have been something of a blackbox. Meaning, I've never really implemented one myself - only consumed various UI (User Interface) libraries, such as jQuery UI or Bootstrap, that provided a modal window solution. The problem with this is that it ... read more »

$location Search-Parameter Data Type Depends On Source In AngularJS

By Ben Nadel on March 20, 2015

In AngularJS, the $location service provides a two-way relationship between the browser's URL and the model in your application. This means that the URL can change the model and, conversely, the model can change the URL. This creates an interesting situation in which query-string parameters (aka, s... read more »

ngRoute Exposes The Original Route Definition Through Prototypal Inheritance In AngularJS

By Ben Nadel on March 19, 2015

With the ngRoute module in AngularJS, you can put anything you want in the original route definition object . These custom properties will then be exposed on the current route as the user navigates around your application. One thing to note, however, is that the original route definition object is... read more »

ng-Template Requests Are Affected By $http Interceptors In AngularJS

By Ben Nadel on March 18, 2015

The other day, when I was exploring routing, nested views, and caching with ngRoute in AngularJS 1.x , I noticed something very interesting: the network latency, that I was simulating with an $http interceptor , was also delaying the loading and rendering of ng-template content. After a little di... read more »

Simulating Network Latency In AngularJS With $http Interceptors And $timeout

By Ben Nadel on March 17, 2015

Over the weekend, when I was exploring routing, caching, and nested views with ngRoute in AngularJS 1.x , I wanted to slow down the HTTP speed so that the user could experience Views in a "pending state." But, because I was working with my local system, HTTP requests were completing very quickly, ... read more »

Revisiting Routing, Nested Views, And Caching With ngRoute In AngularJS 1.x

By Ben Nadel on March 16, 2015

It's been a few years since I wrote the AngularJS routing system for InVision App . And, once it was done, I didn't really think about it again. But, the recent Adventures in AngularJS podcast, on the Angular-UI router , has me thinking about routing once more. I know that the new AngularJS 2.0... read more »

Forcing $q .notify() To Execute With A No-Op In AngularJS

By Ben Nadel on March 13, 2015

I work with a lot of client-side, cached data. And, before AngularJS added the .notify() event to the $q service in AngularJS 1.2, I had to jump through a lot of really hacky and unfortunate hoops to get deferred values to resolve twice (once with cached data, once with live data). The .notify() ... read more »

Using GREATEST(), LEAST(), And Date/Time Values With COALESCE() In MySQL

By Ben Nadel on March 11, 2015
Tags: ColdFusion, SQL

The other day, I needed to find the largest and smallest date/time values across a collection of tables in MySQL. This gave me an opportunity to use MySQL's GREATEST() and LEAST() functions for the first time; however, I found out that these two functions return NULL if any argument is NULL. To cop... read more »

Using Method Chaining With The Revealing Module Pattern In JavaScript

By Ben Nadel on March 10, 2015

Yesterday, I looked at creating null-prototype objects in Node.js . As part of that exploration, I created a very simple cache class with public methods that could be chained. However, since the public methods were exposed using the revealing module pattern, it dawned on me that the "this" referen... read more »

Creating Objects With A Null Prototype In Node.js

By Ben Nadel on March 9, 2015

A while back, when I was reading the Principles Of Object-Oriented JavaScript by Nicholas Zakas , I came across a tip about using Object.create() to create objects with a null prototype. Such an object wouldn't inherit from Object.prototype and would, therefore, have no keys in it. Zakas suggested... read more »

It Walks Like A Duck, It Quacks Like A Duck, But It's A Donkey - The Problem Of Inappropriately DRY Code

By Ben Nadel on March 6, 2015

I spend a lot of time refactoring old code. And, as I do this, I keep seeing the same problem over and over again. As developers try to keep their code DRY, as in "Do-not Repeat Yourself," they often ignore a critical point of evaluation - the code's reason for change. When this property is ignored... read more »

Thinking About Inversion Of Control (IoC) In Node.js

By Ben Nadel on March 5, 2015

This year, I really want to get serious about building scalable systems with Node.js . And, anytime you move from one context to another, I think it's natural to consider forklifting practices from one context to the next. So, as I expand from AngularJS to Node.js (in terms of JavaScript), I wonde... read more »

When Do You Need To Compile A Directive In AngularJS

By Ben Nadel on March 4, 2015

On the most recent episode of Adventures in Angular, on Advanced Directives , Ward Bell and Joe Eames posed a very provocative question - When do you actually need to use the compile phase of an AngularJS directive? It used to be that you needed the compile in order to access the transclude fu... read more »