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

Recent Blog Posts by Ben Nadel

Code Kata: Using Array Reduce() To Navigate An Object Graph In JavaScript

Yesterday, Josh Siok and I were brainstorming on some ways to locate a value in an object graph when given a set of object-properties as a single string. Now, I know (or rather assume) that there are many libraries out there that provide "object query" functionality. But, I figured this would mak... read more »


Practical SVG By Chris Coyier

A couple of weeks ago, I tweeted about how daft I felt when it came to SVG or, Scalable Vector Graphics. SVG has been a viable web technology for several years now; and, a general graphics technology for many more years than that. And yet, it was a total blind-spot for me. I didn't know thing-one... read more »


The Import Statement Creates A "Live" View Of Modules In ES6 And TypeScript In Angular 2

When I first started learning ES6 by way of TypeScript in Angular 2, I thought that the "import" statements, at the top of my modules, were just using object destructuring assignments. This mental model actually caused me a lot of confusion as I was looking through the Angular 2 source-code - seein... read more »


Thinking About TypeScript, Dependency-Injection Tokens, Type-Checking, And Architecture In Angular 2 RC 4

In an Angular 2 application, type-annotations in a constructor function serve two distinct purposes. On the one hand, they tell TypeScript's type-checker what interface that value exposes. And, on the other hand, they tell the Angular 2 Injector which value to instantiate (if not already cached) an... read more »


Implementing A $log-Inspired Logging Service In Angular 2 RC 4

As I've been digging into Angular 2 over the past several months, one of the features that seems oddly absent is a basic logging service. In Angular 1.x, we had the $log service that could be safely invoked whether or not the underlying "console" object existed. In Angular 2, now that we have a mul... read more »


A Promise Chain's API Is Determined By Its Initiating Promise Library

After having read 99 Bottles of OOP - A Practical Guide to Object-Oriented Design by Sandi Metz and Katrina Owen , I started thinking a lot about Promises and the Liskov Substitution Principle (otherwise known as the "L" in the SOLID principles). And, the more I thought about it, the more I re... read more »


99 Bottles Of OOP - A Practical Guide To Object-Oriented Design (BETA) By Sandi Metz And Katrina Owen

Like many people, I am a huge fan of Sandi Metz . I find that she has an uncanny ability to take complex topics and deconstruct them in ways that my brain can understand. So, when I saw that she had recently co-authored a new book - 99 Bottles Of OOP - A Practical Guide To Object-Oriented Design ... read more »


Object Access: Bracket-Notation vs. Dot-Notation With TypeScript In Angular 2 RC 4

When I started learning Angular 2, I did so in the context of ES5. But, after much community push-back and some clear evidence that some of the code would be more readable with TypeScript, I switched over to this type-driven super-set of JavaScript . And, I actually enjoy it. But, I do find that I... read more »


On The Difficult Problem Of Logging Errors In Parallel Promises In JavaScript

Yesterday, in response to my post on gathering data in parallel inside an asynchronous Generator-based workflow , Scott Rippey brought up a really interesting point: if several of the parallel requests error-out or get rejected, only the first error in the group will be caught. Not only is that ... read more »


Gathering Data In Parallel Inside An Asynchronous Generator-Based Workflow In JavaScript

In my post yesterday, I explored the idea of using ES6 Generators and the "yield" operator as a means of writing asynchronous code that looks and feels like it runs synchronously . This is great because it truly simplifies the syntactic boilerplate around Promises. But, when you start doing this, ... read more »


Using ES6 Generators And Yield To Implement Asynchronous Workflows In JavaScript

CAUTION : This post is basically a "note to self" exploration. One of the main reasons that I wanted to read Exploring ES6 by Dr. Axel Rauschmayer was that I needed to learn more about ES6 Generators. At work, some of the engineers have been using ES6 Generators to make asynchronous code look a... read more »


Using AES / CBC / PKCS5Padding Encryption With An Auto-Generated Initialization Vector In ColdFusion

In the last couple of posts, I've looked at using AES / ECB encryption and AES / CBC encryption in ColdFusion and then, subsequently, decrypting those values in Node.js using the Crypto module. And, as I was reading up on ColdFusion's encryption features in Adobe's white-paper on Strong Encryp... read more »


Using AES / CBC / PKCS5Padding / IV Encryption In ColdFusion And Decrypting Values In Node.js

The other day, I talked about the problems that we ran into when using default AES (Advanced Encryption Standard) encryption settings in ColdFusion and then trying to decrypt those values in Node.js. It was a bit sticky trying to figure out what the default feedback mode was (it was ECB) and how ... read more »


Writing Conditional SQL Statements Using Nested Tagged Template Literals In Node.js

The other week, Scott Rippey - one of our senior Node developers - was chatting about nested template literals in ES6. Template literals are one of the most exciting features of ES6, in my opinion; but, the ability to nest them seemed, at first glance, to be more confusing than helpful. That sa... read more »


Exploring ES6: Upgrade To The Next Version Of JavaScript By Dr. Axel Rauschmayer

I love JavaScript. For me, JavaScript has always been a joy to work with. I never understood all the "Good parts" / "Bad parts" drama - once you get your head wrapped around closures and what "this" references , the rest is just limited by your imagination ** . But, my love of JavaScript, and of... read more »


Using AES / ECB / PKCS5Padding Encryption In ColdFusion And Decrypting Values In Node.js

CREDIT : First things first, I can't take any credit for this post. This problem was solved by Josh Barber , our lead mobile engineer. I'm simply documenting the solution for my own future reference and understanding. At InVision , we recently ran into an interesting issue with AES (Advanced En... read more »


Using An Item Template With An HTML Dropdown Menu Component In Angular 2 RC 3

A while ago, I played around with trying to create an HTML Dropdown menu component in Angular 2 . This was quite a non-trivial task, but very worthwhile. Recently, however, I discovered that you could pass Template references into components for dynamic rendering . And, while not exactly the same... read more »


Maintaining JavaScript Date Values During Deserialization With A JSON Reviver

I'm currently making my way through Exploring ES6: Upgrade to the Next Version of JavaScript by Dr. Axel Rauschmayer . While it's a seemly-exhaustive in-depth look at ES6, it's also teaching me a few things about ES5. In particular, I learned that the JSON.parse() and JSON.stringify() methods ac... read more »


Change Detection Strategy Appears To Override The ChangeDetectorRef In Angular 2 RC 3

In Angular 2 RC 3, you can provide a change detection strategy in your Component meta-data. But, you can also inject the ChangeDetectorRef into your component as a way to gain finer control over how your component interacts with the change detection life-cycle. As it turns out, however, doing both ... read more »


Learning About Promises By Implementing The Race() Method Algorithm

If you look at the Q documentation, it doesn't look like it implements the .race() method. But, if you look at the source-code, the .race() method is indeed there. And, when I saw how Q implemented it, I was reminded of just how interesting Promises are. When I had thought that .race() was missing,... read more »


Aggregating Values In A Promise-Based Workflow In JavaScript

I love promises. I find a promise-based workflow much easier to use than the average callback-based workflow (though, of course, Promises still use callbacks). That said, promises are not a panacea; they don't magically turn asynchronous tasks into trivial matters. Asynchronous workflows are stil... read more »


Emitting Cancelable / Preventable Output Events In Angular 2 RC 3

In the one-way data flow philosophy embraced by Angular 2, you don't often have to cancel a component's output event directly; if a component emits an output event that you want to cancel, just don't pipe the event data back into the target component. But, I don't think it's wise to try and reduce ... read more »


ChangeDetectorRef Is A Special Dependency In Angular 2 RC 3

Most of the time, in Angular 2, a Component and its sibling Directives (on the same host element) all have access to the same dependencies from the same dependency-injector. The ChangeDetectorRef, however, is one dependency that is given special treatment. As it turns out, if the ChangeDetectorRef ... read more »


Inline Object Literals Don't Trigger Unnecessary Input Changes In Angular 2 RC 2

A few weeks ago, I experimented with dynamic template rendering in Angular 2 RC 1 . As of Angular 2 RC 2, dynamic template rendering is now part of the core platform functionality. But, the context input for the given template is provided as an object, not as a set of individual inputs (as I had i... read more »


Elegant Objects By Yegor Bugayenko

I'm not an Object Oriented programmer. But, I really wish that I were. I think there's something magical about being able to "think in objects" and to let objects to the heavy lifting for you. Which is why I really enjoy thought-provoking books like Elegant Objects by Yegor Bugayenko . Elegant Obj... read more »


Thinking About Draggability Within A Unidirectional Data Flow In Angular 2 RC 1

CAUTION : This is more of a "thinking out loud" post than an informative one. To be honest, I'm not so good with "draggable" behavior in JavaScript. Historically, this is one of those feature implementations that I've just deferred to jQuery UI or some other 3rd-party library. But, many of thos... read more »


Node's require() Function Can Seamlessly Switch Between .json And .json.js Files

Last year, I wrote a quick blog post about Node.js' ability to read in JSON (JavaScript Object Notation) files using the require() function . This feature, which I use all the time, is an awesome way to synchronously read in configuration or migration data. But, sometimes, the JSON specification i... read more »


Creating A Pre-Bootstrap Loading Screen In Angular 2 RC 1

Last year, I took a look at how to create a pre-bootstrap loading screen in an Angular 1.x application . In the comments for that post, Yaseen recently asked how one might accomplish the same thing in an Angular 2 application. I think the approach, in Angular 2, will basically be the same. But, si... read more »


Q's Node Resolver Will Aggregate Results In An Array When Necessary

As I've been experimenting more with Node.js and the MySQL driver, I've been seeing some inconsistent results. Sometimes, my query callback would receive two result parameters (one for the recordset and one for the fields); and, sometimes, the callback would receive a single parameter that was an a... read more »


The Node.js MySQL Driver Doesn't .end() As Gracefully With Connection Pooling

When you're running a Node.js web application, there's a good chance that you never think about gracefully shutting down your application. In all likelihood, you just let it run forever (or at least until it crashes). When you're using Node.js as a scripting language, however, just the opposite is ... read more »