found_drama


Discard an axiom.


    Archive for February 2010

    #Linkdump for February 25th


    #Linkdump for February 21st


    #Linkdump for February 16th


    #Linkdump for February 11th


    #my new JavaScript vade mecum

    While I was reading this, I liked to imagine that I was at university and that Douglas Crockford was the insanely popular genius professor that showed up late for lectures, and then either spoke too fast or else mumbled a lot, and then locked himself in his office refusing to answer the door during office hours while he worked on his Next Big Thing that would make everyone oooh and aaah and validate his brilliance.  Meanwhile, in that same imaginary university, Nicholas Zakas was the graduate student that served as the TA to that class—and he happened to be equally brilliant and super-accessible and willing to take the time out to explain it all in a way that was thorough and comprehensible.

    So that being said, if you consider yourself or would like to consider yourself a professional front-end engineer for web applications (or in any way want to become a JavaScript expert), I cannot recommend this book enough.  On the one hand, you have Crockford’s The Good Parts—which does a great job of eviscerating JavaScript while at the same time extracting its (well…) its Good Parts—but it’s like someone ran the text through a minification utility and made it tokenized and super-dense and stripped out all the comments.  And on the other hand, you have Zakas’ Professional JavaScript for Web Developers which one might describe as The Good Parts (the long version).

    What Zakas gives us—while assuming that you are already doing some professional JavaScript web development—is a good overview of JavaScript/ECMAScript, with special care given to make the text practical.  This is not strictly an academic exercise; he is careful to make sure that each example applies to real world scenarios (i.e., web apps running in a browser) and that you are able to take away something useful and meaningful from the text’s discussion.  In other words, he provides a road map for how to make the most of JavaScript as a language[1] and how to make it work in all the convoluted, counter-intuitive situations that you are basically guaranteed to encounter[2].

    In a nutshell, if you are doing professional web development on the front end, this book needs to be on your desk.  I can’t wait to check out his next book[3]

    BONUS ROUND: Zakas says that Wrox has made this book available as a DRM-free ebook.

    DOUBLE BONUS ROUND: Apparently, I made the man laugh.

    TRIPLE BONUS ROUND: Shout from the man himself, albeit with a pointer to this review as it appears on Amazon.

    1. …since, as a front-end engineer on the web, you’re stuck with it. []
    2. Even if you don’t expect to ever work with XML.  Even if you do think that the JavaScript 2 and ECMAScript 4 stuff is a little too future-forward/in-the-weeds type stuff. []
    3. Reading this before Feburary 24, 2010?  Sign up for your chance at a free copy! []

    #Linkdump for February 5th


    #getting academic on the JavaScript Array

    An experiment (in part to settle something of academic debate); what is faster new Array() or [][1]?  The function for the test case:

    function makeSomeArrays(){
    	var outputter = function(fn){
    		var ts = new Date().getTime();
    		fn();
    		var te = new Date().getTime();
    		console.log("total time: " + (te-ts)/1000 +
    			" seconds");
    	};
    
    	// 1 million:
    	var L = 1000000;
    
    	// use Array constructor; push L new arrays...
    	var test1 = function(){
    		var a = new Array();
    		for (var i=0; i<l ; i++) {
    			a.push(new Array());
    		}
    	};
    
    	// same as above - but in each case,
    	// declare a length to the array
    	var test2 = function(){
    		var a = new Array(L);
    		for (var i=0; i<L; i++) {
    			a.push(new Array(0));
    		}
    	};
    
    	// same as above but via index assignment
    	var test3 = function(){
    		var a = new Array(L);
    		for (var i=0; i<L; i++) {
    			a[i] = new Array(0);
    		}
    	};
    
    	// for 4-6: replace Array constructor w/ Array literal
    	// notation except where declaring a length
    	// (container array, 5 + 6)
    	var test4 = function(){
    		var a = [];
    		for (var i=0; i<L; i++) {
    			a.push([]);
    		}
    	};
    
    	var test5 = function(){
    		var a = new Array(L);
    		for (var i=0; i<L; i++) {
    			a.push([]);
    		}
    	};
    
    	var test6 = function(){
    		var a = new Array(L);
    		for (var i=0; i<L; i++) {
    			a[i] = [];
    		}
    	};
    
    	var tests = [test1, test2, test3, test4, test5, test6];
    
    	for (var j=0; j<tests.length; j++) {
    		console.info("test #" + (j+1) + ":");
    		outputter(tests[j]);
    	}
    }

    Yes, I realize that test #2 and test #5 result in an array with a length of 2,000,000 (vs. 1,000,000 for the other 4 tests).

    Now for some chart porn; results:

    As usual in these kinds of performance tests, shorter bars mean better/faster performance.  (And yes, test case #5 was wildly out-of-scale when run in Firefox[2].)

    Test case #3 wins out in Firefox (1.536 seconds), but test case #6 wins in both Chrome and Safari (0.313 and 0.397 seconds, respectively).  Interestingly, Safari out-performed Chrome in 4 of the 6 test cases; but Chrome came out on top overall with that 0.313 second figure for test case #6.  The trick seems to be in assigning a length to the array and then assigning values to the indices instead of just pushing the values onto the end.

    But this seems to wind up not answering the original question about Array() vs. [].  So really quickly (in Chrome), I re-ran test #6 with a new “test #7″ that replaced a[i] = [] with a[i] = new Array().  Console output:

    test #6:
    total time: 0.405 seconds
    test #7:
    total time: 0.892 seconds

    Oh wait… that was basically the same as test #3…  Hooray for Array literals!

    1. Knowing full well that it’s never as simple as that. []
    2. Due in large part to the fact that it paused execution to request my intercession.  But that doesn’t exactly bode well anyway, does it? []

    #tweet my customer service issues

    Or:  on not listening, retail communication break-downs, and getting help via so-called social networking.

    In case you haven’t been following the thread[1], our family just enjoyed quite the roller coaster ride thanks to a broken dishwasher and our (ultimately, eventually successful) attempts to replace it through Best Buy.  I’m sure that there’s a lesson to be learned buried somewhere deep down in the bowels of this tale.  Take extra caution when purchasing from a box store?  Wow, Twitter is actually good for something?  I’m not exactly sure.  But perhaps you can extract that nugget.

    Back in December, just a little before Christmas, our dishwasher broke.  Nothing that put it totally out of commission—just that the handle broke off and in order to get the thing open you had to jam two fingers up into the recesses of the door and use a whole bunch of leverage to unlatch it.  So that was frustrating.  Our initial over-reaction was to gut the entire kitchen and start from scratch.  When we came to our senses, we realized it should just be a simple matter of replacing the dishwasher.

    All other things being equal, we decided to go through Best Buy as a cost-saving measure—we had a gift card, for one thing.  With that part decided, I headed down to the store with my mission:  find the cheapest dishwasher that will at least “replace” the one that broke.  At the store, I reviewed my options and after speaking with a salesman, decided to go up a notch to something that would meet our needs just a little bit better—and for not that much more.

    Now a little bit of back-story:  In the fall we had a microwave replaced (using a different vendor) and it turned into a nightmare.  Delivery went fine but the vendor failed to mention that the installation (which was paid for) was not something they did for over-the-range microwaves.  So we wound up having to install it ourselves.  And then even after multiple phone calls, they never bothered to send their truck around again to haul away the old one, despite the fact that we’d paid for haul-away as well.

    Needless to say, I made a really big deal about the delivery, installation, and haul-away aspects while discussing the dishwasher with the Best Buy sales representative.  He assured me that everything would be fine—even referred me to a “worry-free” poster right there over the register.  ”Sounds good,” I said.  And though he warned me it would be a few weeks before the delivery/installation could happen (“…about four weeks, what with the busy holiday season and all…”), we agreed to terms, signed some paperwork, ran my credit card, and off we went.

    Fast forward to the day before the scheduled delivery.  I get a phone call from someone at the Best Buy store.  She explains to me that she needs to apologize on behalf of the store but it seems that my original sales rep failed to mention that the dishwasher I’d paid for was in fact a special order item (“normally 6-8 weeks”) and that there was no way that they could get it to me the next day.  This was unexpected but it wasn’t a tragedy[2].  We explored a few options:  wait four more weeks?  buy up to the next model “at cost” for another hundred bucks and get it within the week?  or get a comparable item from the clearance line and get it within the week?

    We settled on the comparable item from the clearance line (since even “at cost” I didn’t feel like I should have to pay more) and set up the delivery/installation date[3].

    Fast forward to the next week.  I jet home in the middle of work one day to meet the delivery guys.  They show up and ask:  ”Where do you want us to leave this?”  Leave it?  Immediately the delivery guys look a little sheepish.  They explain that while Best Buy performs the installation for a variety of “drop-in” items (e.g., refrigerators, washers and dryers), that there are also a bunch of more complicated installations that they sub-contract (e.g., dishwashers, gas ranges).  So the delivery guy (who was really quite nice, nothing against him) tries to make a few calls to find out about the installation.  But he can’t seem to get in touch with anyone—no one at the store, and not the installer either.  He assures me that I’ll probably hear from the installer in the next day or so but leaves me with his number in case I need to follow up with him.

    In case I need to follow up with him?

    I’m immediately on the phone with the store trying to reach the woman that helped me with this last round of mix-ups.  I needed to know what was going on.  How is it that no one told me about this before now?  Only, the guy that (finally) picks up the phone tells me that she won’t be in until one o’clock and though he doesn’t offer to take the message (not that I expected him to), he did eventually agree to have her return the call after she got in[4].

    The rest of the day passes.  No call back from the store, and no call from the installer.  And thus out of Sisyphean frustration, this tweet.

    Allow us to pause there for a moment.  About that tweet…  Frustration sparked it.  Actually doing it?  Maybe I was thinking I should be charitable?  Warn my pals, I suppose.  Help prevent others from having dishwashers land in their dining rooms that just… sit there.

    I was not expecting anything like an @reply from @ApplExpert50 with a few suggestions on how to remedy the situation.  Most of which I’d tried… but that was beside the point.  Someone was listening.  A most unlikely set of ears—but someone was listening at least.

    It seemed that a little follow-up was in order for me—but I had that in my future either way.  Next thing I knew, some emails and phone calls started coming in about my order and about the installation which was requested but (apparently) never paid for and therefore never requested…

    Long story short?  Took another couple of days but we arrived at a satisfactory outcome, and I got my dishwasher installed[5].

    So we landed in a good place.  But it was a long and bumpy road.  Still unpacked the whole affair.  Lessons learned?  Anecdotal evidence for the success of social media campaigns in managing customer service…?  Perhaps more?  Like I said:  still unpacking it.

    1. And why should you?  It hasn’t really been posted on this here blog. []
    2. Not yet. []
    3. It’s probably worth mentioning at this point that this has involved a lot of schedule juggling, what with being busy at work, being a one-car family, and having a kid dealing with a series of ear infections. []
    4. Come to find out later she was vacation for another couple of days. []
    5. And the old one got hauled away, too. []

    #Linkdump for February 1st


    #search term haiku: January 2010

    a week with Chrome (Mac)
    CalDAV repeating events
    zombie phobia

    “Search Term Haiku” is a series wherein I examine this site’s log files and construct one or more haiku poems from search terms and phrases that led visitors to the site. Where possible, I attempt to keep the search phrases intact. However, as these are haiku poems, I do need to follow the rules.




    Creative Commons License This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.