Tag: Programming

Bodybuilders Remind Me of DP_DateExtensions

As none of you remember, I released a huge update to my venerable (8 years-old now!) JavaScript date extensions DP_DateExtensions a couple of years ago. The rewrite was prompted by a bug, but sent my brain down a rabbit hole: just how do you calculate the difference between two dates?

You can read about the whole sordid mess, but it turns out that’s a surprisingly complex question. In the end, the new component ended up with no less than three distinct options for calculating the difference between two time periods.

Anyway, this leads me to a bizarre conversation that was detailed by Joe Veix on Death And Taxes: “Two body builders argue on the internet about how many days are in the week“. The whole exchange is hilarious and is well worth spending some time with.

Still, it did remind me uncomfortably of the week where I nearly went insane trying to figure out how to minus one date from another date. Rabbit holes can be dangerous.

Personal Archaeology: Using a GIF as a Data Pipe

Way back in the history-times, in August of the year 2000, I authored an article detailing a technique that allowed for bi-directional communication between a server and a web browser without a page refresh.  The technique was, if I do say so myself, pretty clever in a primitive, kludgy, clunky kind of way.  I have no idea if I was really the “first” to come up with this but I do know that the rise of standardized AJAX a few short years later completely and deservedly eclipsed it.

Using a GIF as a Data Pipe

What I’ve recently realized is that a lot of traffic still points to that article.  I, in fact, get nearly as many 404 errors for people looking for this article as I do legitimate hits to the site (“popular” I am not).  It’s listed in the Wikipedia article on Remote Scripting and in many blogs, forums and resource sites.  For the curious various versions of it are available on the Internet Archive.

Now it’s nothing more than a weird little historical artifact that I’ll keep here on the digital mantle for posterity.

New Version of DP_DateExtensions

I’ve just uploaded a major update to my venerable (6 years-old!) JavaScript date extensions DP_DateExtensionsThis was a near-complete rewrite of the component and like most hard (and some great) work it started with an error.

The question Alexey Vassiliev (who reported the bug) asked me is “how many days are there between March 1, 2012 and March 31, 2012?”  Assuming Midnight for both dates the common sense answer is, of course, 30 days.  My component however was returning 29 days… why?

(more…)