Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with: Dee Sadler
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with: Dee Sadler@DeeSadler )

Recent Blog Posts by Ben Nadel

A Quick Look At Rendering White Space Using JSX In ReactJS

As I've been getting into ReactJS, I've been surprised a few times at how my JSX code gets translated into rendered HTML. In particular, it took me a little while to understand the rules around rendering white space: when does JXS follow the "natural" HTML concept of white space; and, when does it ... read more »

How JSX Renders Different Data Types In ReactJS

As a quick experiment, I wanted to see how JXS renders different types of data in ReactJS. And, think about how the rendering algorithm can be leveraged to generate conditional output. Of course, I am referring to "JSX" as the renderer. But really, JSX is just the syntactic sugar over the core Reac... read more »

Should The Relationship Between Object Mode And Read Size Be Symmetric In Node.js Streams?

After looking at how Object Mode affects string decoding in Node.js , it got me thinking about Object Mode at a more philosophical level. How should we, as Node.js developers, think about streams in Object Mode? And, how should the nature of the data reflect the configuration of streams? This is a... read more »

Object Mode Streams Do Not Decode Strings Into Buffers In Node.js

In Node.js, when you work with Readable and Writable streams, string values are decoded into Buffers by default. You can override this by initializing a stream with "decodeStrings: false"; but, if you omit this configuration, it defaults to true. But, what happens if a stream is running in "Object ... read more »

You Don't Need To Use .bind( this ) When Using .forEach() Or .map() In ReactJS

Often times, in a ReactJS Element (Component), you need to map a data collection onto an Element collection for rendering. The ReactJS community seems to have settled on using the ES5 methods .forEach() and .map() to fulfill these kinds of tasks. But, unfortunately, I'm seeing people using the .bin... read more »

Class Attribute Interpolation Is Safer In AngularJS 1.2 And Newer

NOTE : If you started using AngularJS with 1.2 or later, this post will only have academic value for you. As of AngularJS 1.4, you can now mix Array and Object notation in the ngClass directive. This would enable you to pass in both dynamic class names as well as conditional classes. But, this ... read more »

Error Object Properties Are Not Iterable / Enumrable In Node.js

Over the weekend, I was playing around with custom Node.js errors and error logging when I noticed something weird: none of the ".stack" properties (ie, the stack traces) were showing up in my log files. After a bit more experimentation, I realized that none of the core Error properties were enum... read more »

Thinking About Tracking Requests And Errors Across Micro-Services

Caveat : This is all just me "thinking out load." Take that as you will. As we start to break apart our monolithic applications, destructuring them into a collection of independently scalable micro-services, things simultaneously become both more simple and more complex. While each individual ser... read more »

Managing Conditional Links And Route Changes In AngularJS

Sometimes, in an AngularJS application, you have a context in which a particular link might not be clickable based on the current view-model state. In the past, I've dealt with this by either injecting the $event into the Controller (which is a code-smell and an anti-pattern); or, by hiding the loc... read more »

Using Bit Values In COALESCE() In MySQL Results In Binary Values

Every now and then, this one throws me through a loop: if you use a COALESCE() statement in MySQL , and one of the values is a BIT, MySQL returns a binary value, not a numeric value. In ColdFusion, this causes a problem because ColdFusion sees the resultant value as a Byte Array (like a Blob); as ... read more »

Using Module.decorator() In AngularJS 1.4

In the past, we've been able to decorate AngularJS services by using the $provide service in the configuration phase of the application bootstrap. As of AngularJS 1.4, however, the concept of a decorator has been promoted to the Module API, finally living alongside .service(), .factory(), .run(),... read more »

Using Anchor Tags And URL-Fragment Links In AngularJS

Yesterday, Derek Knox mentioned on Twitter that he was having trouble getting anchor links to work in an AngularJS application. And, by anchor links, I mean the ability for a user to click on an <A> tag and be taken to another location on the same page (typically identified with a name="" o... read more »

Fun With Emoticons And Service Providers In AngularJS

At InVision , we recently released emoticon support in comments. I wasn't directly involved with the feature, but I like it as a concept and I think it presents an interesting playground in AnuglarJS. So, I wanted to take a little time to think about how I might personally organize such a feature.... read more »

Quick Note: Favor $exceptionHandler() Over $log.error() In AngularJS

This is just a really minor note. I was looking through some AngularJS code the other day and came across someone using a try-catch block that passed the error off to the $log.error() method. While this works - it logs the error to the console - it doesn't add as much value as the $exceptionHandler... read more »

FusionReactor Offers Excellent Insight Into Java And ColdFusion Server Performance

I remember the moment that I got my first pair glasses down at Union Square in New York City. I was in my early 20s. It was shocking. Suddenly, the world was sharp. Street signs were visible. Presentations were visible. Nothing was fuzzy. The world was clear. This is kind of what it felt like when ... read more »

Performing Online ALTER TABLE SQL Migrations Without Any Downtime

The other day, I tweeted about how much I love the INSERT IGNORE INTO syntax in MySQL . In response to that tweet, Ken Auenson asked me what kind of a use-case I had for ignoring duplicate records. Typically, I use IGNORE when migrating and / or transforming data. And, since I don't think I've e... read more »

Rendering Large Datasets With AngularJS And ReactJS

There's been a lot of talk lately about the performance benefits of ReactJS. Both externally and internally on my own engineering team. This post doesn't really offer up anything new; but, as a diehard AngularJS fan, I wanted to see, feel, and experience the difference in performance for myself. Pl... read more »

Breaking Direct Object References At Cache Boundaries In AngularJS

After I blogged about encapsulating the localStorage API in an AngularJS application , a couple of people asked me about why I was using angular.copy() when returning objects from the storage service. This is a great question and is not something that I've ever touched upon specifically. The goal ... read more »

Sometimes I'm Tempted To Use Try / Finally In The Worst Way

Yesterday, I posted a tweet about how I am sometimes tempted to use a Try / Finally block as a way to get around creating an intermediary variable. I've never actually done this, as I think it's a bad idea. But, so help me, I have been many times tempted. And, while I still don't recommend it, I ... read more »

Encapsulating LocalStorage Access In AngularJS

The other day, the following JavaScript error starting showing up in one of our logs, "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota." After a bit of debugging, it turned out that this was the error that Safari throws, when running in ... read more »

An Experiment In What React's JSX Might Feel Like In AngularJS

The other week, I took my first look at ReactJS . While I believe that ReactJS and AngularJS do the same thing (in terms of the View), I'm trying to see what kind of cross-pollination of ideas I can generate. I already took a look at using a .setState() method in AngularJS . Now, today, I want to... read more »

Sending AngularJS Errors To New Relic, Raygun, Sentry, etc.

A few weeks ago, I looked at how to capture global JavaScript errors and pipe them into an AngularJS application . That approach works; but, it requires you to deal with the global error handler which is an unfortunate API. If you are already using a client-side error service like New Relic, Raygu... read more »

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 »