Fun with HTML5 localStorage API

Recently had occasion to wonder if I should be storing data in localStorage when available. Thanks to two notable resources (among many others I checked out tonight) I had a little bit of fun and learned a few things; enough to get comfortably started with localStorage. Here are my two takeaways:

(more…)

jQuery Events: It’s .on()

Event management is one of jQuery’s strengths, but there’s a surprising amount of misunderstanding (see Click, Live, or Delegate) surrounding the lifecycle of events. In this article, we will talk about using .on() for its most basic purposes and for ‘translating’ from previous versions of jQuery to 1.7+. I do not discuss the optional data parameter or the .off() function. I would say this is a beginner-level article, for people looking for a re-phrasing of what’s already in the jQuery API docs; if that’s not you, you can probably get more from the docs themselves. Onward!

(more…)

Adobe Camera Raw – Denoise and Sharpen

No intentions for this to become a photography blog (yet), but this one seemed worth noting down.

Like other newcomers to photography, I’ve been blown away by how much better your results can be once you take the time to process a RAW file instead of just using the JPEG the camera stores for you (or not, if you have JPEG disabled). I only have ACR for now, but there are other RAW conversion and development tools. I don’t know those so I won’t be discussing them here.

(more…)

jQuery: Click, Live, or Delegate? (or .on)

I’m a relative newcomer to popular development community StackOverflow (see profile) and I tend to stick to answering questions for tags I have a degree of expertise in: JavaScript, jQuery, and CSS.

[update: before reading on, be aware that jQuery 1.7 has a new event API. Using .on() will be just as easy as .delegate(). Both will be supported (for now) but there's no reason to not move to .on()]

Two things continually surprise me:

1. The rush people are in to answer questions hastily so that they can have the “all things being equal, my answer was first” edge in securing some reputation points.

2. The somewhat poor habits of even the most seasoned members.

(more…)

Reusable jQuery Parameter Maps

Many JavaScript functions (including jQuery plugin functions) accept a map of parameters as an argument. A map takes the form of key-value pairs, with the key being the parameter name and the value being almost anything, from a simple string to a complex function:

{parameter1: 'value', parameter2: 'value2', parameter3: 'value3'}

Using Allan Jardine’s DataTables jQuery Plugin we’re going to see how any function that accepts a map of parameters can be given a basic DRY (Don’t Repeat Yourself) treatment. In other words, we will take some base parameters for a DataTables initialization, and extend them so that particular tables can get specific values.

(more…)