Recent Web Log Entries By Ben Nadel
Using jQuery Deferred.notify() To Provide Locally Cached Data
Posted: September 27, 2012 at 9:57 AM by Ben Nadel
Most of the data in your application hasn't changed. Sure, things are being updated all the time; but, the large majority of the data remains the same from moment to moment. As such, it might make sense to show the user outdated, locally cached data before taking the time to go to the server for the true data. But how can we do this in a way that ... read more »
Comments (0) | Post Comment | Ask Ben | Permalink
Detecting Spam In User-Submitted Content With SpamAnalyzer.cfc
Posted: September 25, 2012 at 9:34 AM by Ben Nadel
Fighting SPAM is a never-ending battle. My blog uses a "blacklist" approach that checks user-submitted content against a set of regular expression patterns. For the last 6 years, this has been implemented as a compound CFIF statement containing REFindNoCase() function calls. To-date, this single CFIF statements has close to 2,000 OR operators. Lat... read more »
Comments (12) | Post Comment | Ask Ben | Permalink
Decorating Scope Methods In The AngularJS Prototype Chain
Posted: September 24, 2012 at 9:57 AM by Ben Nadel
Last week, I looked at how to pass values up the $scope chain in an AngularJS application . We used a setter method in order to get around the asymmetric nature of prototype property access and mutation. This allowed us to set values into an inherited $scope instance. Now, since we needed to use a setter method; and since that setter method is in... read more »
Comments (2) | Post Comment | Ask Ben | Permalink
Setting Prototype Properties Using Inherited Scope Methods In AngularJS
Posted: September 20, 2012 at 10:15 AM by Ben Nadel
In AngularJS, every Controller gets its own $scope instance. This $scope instance binds the model - defined by the Controller - to the View - which renders the model using HTML annotations. Every instance of $scope has, as its prototype, the $scope of its parent context in the DOM (Document Object Model) tree. This is true all the way up the HTML ... read more »
Comments (9) | Post Comment | Ask Ben | Permalink
Exposing A Mouse Service For Click Events In AngularJS
Posted: September 18, 2012 at 10:01 AM by Ben Nadel
Yesterday, I looked at creating an AngularJS directive in order to capture the click-event on the Document node . This required the underlying jQuery event object to be passed into the $scope of the given directive. While this worked, exposing the event object could be seen as letting the DOM (Document Object Model) leak into the Controller, wher... read more »
Comments (3) | Post Comment | Ask Ben | Permalink
Capturing Document-Click Events With AngularJS
Posted: September 17, 2012 at 11:17 AM by Ben Nadel
As I have been trying to learn AngularJS, one of the biggest stumbling blocks [for me] is the extreme separation of the Controller layer from DOM (Document Object Model) manipulation. In an AngularJS application, none of the Controllers are supposed to touch the document in anyway; all mutation should be done through the two-way data binding. If y... read more »
Comments (6) | Post Comment | Ask Ben | Permalink
Creating AngularJS Controllers With Instance Methods
Posted: September 13, 2012 at 10:45 AM by Ben Nadel
In AngularJS, just as in any MVC (Model-View-Controller) framework, Controllers respond to events, gather data, and make that data available to the View. In most of the AngularJS demos that I have seen, Controllers are defined as free-standing, globally-scoped functions. In my opinion, this approach is problematic for two reasons. First, it pollut... read more »
Comments (20) | Post Comment | Ask Ben | Permalink
Mapping AngularJS Routes Onto URL Parameters And Client-Side Events
Posted: September 12, 2012 at 9:11 AM by Ben Nadel
Earlier this week, I talked about mapping RESTful resource URIs onto URL parameters and server-side events . When developing a thick-client application, much of the same URL routing functionality is required on the client. Only, with the ever-growing complexity of rich user interfaces, routing and partial page rendering on the client becomes much... read more »
Comments (26) | Post Comment | Ask Ben | Permalink
Mapping RESTful Resource URIs Onto URL Parameters And Server-Side Events
Posted: September 10, 2012 at 10:18 AM by Ben Nadel
When I think about implementing a RESTful API , my philosophical understanding is very simple: RESTful URLs need to be mapped onto a collection of URL parameters and an event type that is processed by my ColdFusion application. This means that, at its most superficial level, a RESTful API is nothing more than a set of URLs that lay on top of an e... read more »
Comments (4) | Post Comment | Ask Ben | Permalink
Win A Free Copy Of The Regular Expression Cookbook 2nd Edition
Posted: September 5, 2012 at 9:09 AM by Ben Nadel
A few years ago, I was thrilled to find out that Steven Levithan had co-authored a book on Regular Expressions . After witnessing his Flagrant Badassery on the topic, I had no doubt that the cookbook would be a must-have reference. In the years since its release, I've given away copies on International Regular Expression Day, handed them out at... read more »



