Introducing head.js to My Studio

These are the advantages of adding Head JS, specifically head.load.min.js, to my new Web designs:

  • Measurable and perceived performance boost: Head JS loads scripts in parallel, decoupled from the loading of document visuals. In effect, the conventional jQuery event for $(document).ready() fires before all of the scripts are loaded.
  • Loading of JavaScript libraries can be maintained from an external file instead of locking files into hard <script /> elements.

So here is my Head JS document pattern based on three <script /> elements:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="./Scripts/head.load.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        head.js('./Scripts/jquery-1.5.1.min.js')
            .js('./Scripts/jquery.tmpl.min.js')
            .js('./Scripts/jquery.extensions.rx.js');
    </script>
    <title>My Document</title>
</head>
<body>
    <div>
    //document...
    </div>
    <script type="text/javascript">
        /*jslint browser: true, cap: false, passfail: false, undef: false, white: false */
        /*global window head jQuery */
        head.ready(function () {
            (function ($) {
            // document script...
            } (jQuery));
        });
    </script>
</body>
</html>

What’s the big change for me (besides the switch to HTML 5) is that the both the second and third script blocks can be ‘sourced’ to an external file. This should be a great help for kintespace.com as it runs proudly on primal, static *.html files.

“36 Facts Which Prove The American Dream Is Turning Into A Nightmare For The Middle Class” and other links…

Michael Snyder: “Every single month more American families fall out of the middle class.  Today there are 18 million more Americans on food stamps than there were just four years ago.  More than one out of every five U.S. children is living in poverty.  Things are getting really, really bad out there.”

“Sleepwalking Into the Imperial Dark”

Tom Engelhardt: “It’s not hard to see why. A loss of faith in the American political system is palpable. For many Americans, it’s no longer ‘our government’ but ‘the bureaucracy.’ Washington is visibly in gridlock and incapable of doing much of significance, while state governments, facing the ‘steepest decline in state tax receipts on record,’ are, along with local governments, staggering under massive deficits and cutting back in areas—education, policing, firefighting—that matter to daily life.”

“Apple Is Tech’s ‘Least Clean’ Company: Greenpeace”

Amy Lee via @hannibaltabu: “North Carolina is the hub for what Greenpeace calls a ‘dirty data triangle,’ referring to a trio of giant data centers run by Apple, Google and Facebook. North Carolina provides an attractive set of tax incentives, as well as the promise low-cost energy, offered in an initiative by local economic development agencies to battle high unemployment and draw IT companies to the area. But the generation mix in the area is one of the dirtiest in the country, drawing only 4 percent from renewable sources, and 61 percent from coal.”

“Ethiopia—a Country for Sale”

Alemayehu G. Mariam via @hannibaltabu: “The Indian agribusiness giant Karuturi Global is today the proud owner of the Ethiopian land. Karuturi did not ask for the land and did not even see it when a signed 50-year ‘lease’ was delivered to its offices in Bangalore, India, on a golden platter by Meles Zenawi, the dictator-in-chief in Ethiopia.”


“Everyone hates wireless carriers. Everyone.”

Paul Thurrott: “As a backgrounder, it helps to be perhaps a bit too familiar with the Lady Gaga video for ‘Telephone.’ This is a (NSFW) parody of that video, one that rips on an Australian merger of two mobile operators. And for anyone who’s ever struggled with wireless reception—like I just did in Las Vegas, a notable AT&T sinkhole—this will be appreciated. Well done.”

“African Cabbie vs Juan Cole: ‘The French Cannot Be Trusted In Africa’ vs. ‘Libya 2011 Is Not Like Iraq 2003’”

Baratunde Thurston (Jack Turner): “In between this roundabout reasoning of mine, my driver gave me an update on the level of brutality taking place in Ivory Coast. ‘They are burning people alive in the streets! What Gaddafi is doing is bad, but it is nothing compared to this,’ my driver explained. ‘Also, you cannot trust the French,’ he added. ‘Believe me, if France says yes, you want to say no. They have been draining blood from Africa forever.’”

“How Japan’s Tsunami Massive Debris Plume Will Hit California and Hawaii”

Jesus Diaz: “The model—developed by Nikolai Maximenko and Jan Hafner using data from drifting buoys that have been deployed over years through the Pacific Ocean—shows the unstoppable progress of the debris after the March 11 tsunami. The trash plume—formed by all kinds of junk, from pieces of houses and automobiles to consumer electronics—is now spreading eastward from Japan taken by the North Pacific Subtropical Gyre.”

Installing MVVM Light in Visual Studio with NuGet and the Package Manager Console

I’m an Ubuntu guy so apt-get has my respect. It follows quickly that when Phil Haack and his crew come out with NuGet I’m ready. NuGet should take away one unusual annoyance I’m getting with the MVVM Light binaries installed “by hand”—I’m getting this type-or-namespace-GalaSoft-not-found error continually! I have to manually Add Reference… and rummage through the file system to refresh the Visual Studio project links the binaries. My optimistic assumption is that the NuGet packaging of MVVM Light will prevent this strange error and save me from rummaging.

After reading “Finding and Installing a NuGet Package Using the Package Manager Console” I used this:

PM> Get-Package -remote -filter MvvmLight

A PowerShell table formatted for the console should return one row with the MvvmLight package information—make sure that Package source: is set to All in the Package Manager Console. Running the Install-Package command will install the relevant MVVM Light binaries (for Silverlight or WPF) into the Visual Studio project selected in the Default project: combo box.

In my case I would have to run Install-Packagefour times like this:

Install-Package MvvmLight

Each time I would have to change project the Default project: combo box. Using the, er, power of PowerShell, these are the four projects I’m talking about:

PM> Get-Project -all | where {$_.Name -match "Songhay.Silverlight" -and $_.Name -notmatch "ApplicationLoader" -and $_.Name -notmatch ".Xml"} | format-table Name
Name
----
Songhay.Silverlight
Songhay.Silverlight.Mvvm
Songhay.Silverlight.BiggestBox.IndexPart
Songhay.Silverlight.BiggestBox

So let’s make life a tad easier: let’s list all projects, filter this list and loop through the filtered output, running the Install-Package command:

PM> Get-Project -all | where {$_.Name -match "Songhay.Silverlight" -and $_.Name -notmatch "ApplicationLoader" -and $_.Name -notmatch ".Xml"} | ForEach-Object {Install-Package MvvmLight -project $_.Name}

Related Links

Telecommuting Experiment Concluded


Grid 960: Zapisi 5

Three months ago, folks, I began “The Telecommuting Experiment” with what I now know as a small “start-up” based in the Pacific Northwest. This little ditty has come to a conclusion and I have learned loads of new things about building Web sites. My job now is to ramble though all of these things as best I can, using a few Delicious.com links along the way:

CSS Stuff

My biggest of the spoils taken from this intense Web-building experience is revisiting grid-system theory and frameworking—in short, I was exposed to the 960 grid system. This system is far more mature, modern and elegant than my Biggest Box stuff.

A little less embarrassing than my previous ignorance of the 960 grid system is not knowing about Flash of Unstyled Content (FOUC)—very hip jargon. I got FOUC for free with jQuery UI widgets. In “How to prevent a FOUC but still gracefully degrade the jQuery UI tabs,” Timothée Carry-Caignon writes, “They are pretty useful actually, but I always hated that FOUC they produce. For one split second, you’ll see all your tabs content, then they’ll be neatly re-arranged in tabs.”

In “Styling select, optgroup and options with CSS,” Chris Hope says, “As per my conclusion at the end of the post, it’s probably better to leave styling of select boxes, optgroup and options alone and just leave them as the defaults because cross browser styling is so inconsistent it’s not worth the bother.” I agree with this but I often forget about this—so writing this down (finally) might help me.

Eric A. and Kathryn S. Meyer have CSS Reset. I can appreciate this but do not find it necessary. But remember this coming from the guy that had no idea about the 960 grid system.

“Pure” JavaScript Stuff

The number one “pure” JavaScript takeaway for my 2011 is Underscore.js—whenever there is the desire to some LINQ-like things in JavaScript this is the place to be. The _.sortBy method described in the docs had me at hello.

I do risk being perceived as “negative” instead of accurate when I must mention that there is thing I’m calling JavaScript bloat. My use of the term comes not from seeing file payloads over the wire. What gets me is the sense that the web browser is working very, very hard to crunch though the script code in memory. Because I know what I can do in Silverlight (and Flash/Flex) I am not biased toward trying to get HTML/JavaScript to do “everything” such that the bloat gets out of control—these bloated stacks may be working just fine on a developer’s gaming PC but taking the client-side code to more economical devices (in terms of cost, power consumption and thermal waste) shows how things fall apart.

jQuery Plugins

This article, “Looking for a JQuery plug-in similar to [Accordion], but that allows multiple sections open at once,” underscores the

The jQuery Time Entry plugin seems to work without any surprises.

Eric Hynds has this jQuery UI Multiple Select Widget that impressed me in the field. I’m feeling like it can be alternative to tree views—speaking of which jsTree worked without unexpected inconveniences.

jQuery Plugins: Hiding/Showing Certain Super “Rich” Widgets, an Unexpected Inconvenience

Super rich widgets/plugins like SlickGrid and CKEditor have super-inconvenient unexpected behaviors when attempts are made to wrap them in containers that hide and show (like sticking a grid inside of an accordion panel). It was difficult to accept that I had to call some kind of refresh method (in the case of SlickGrid) or destroy these visuals and rebuild them (in the case of CKEditor—it has a “destroy” method). But I had to accept this for last three months.

Visual Studio 2010, an Early 2010 Version of CodeRush and VS Extensions


Visual Studio 2010 Weirdness

I have this picture that I showed to Seth Juarez of DevExpress. He’d never seen anything like it. I was getting this annoyance every few minutes followed by the error message, “Visual Studio has encountered an exception…” This was really getting in the way over the last few months. I have uninstalled CodeRush and have not seen the error since. I am still not convinced that CodeRush is culprit… it could be other Visual Extensions (as the error message denotes) but the extensions one would suspect are all written by Microsoft and are quite popular (like PowerCommands for Visual Studio 2010 and Productivity Power Tools).


Visual Studio 2010 Weirdness

Mercurial and Bugs

In “The IT Workplace: Doing it Basil Style,” I wrote about the excruciating experience of having my code overwritten—especially when working by the hour with a bunch of miserly cretins. What I have experienced with Mercurial over the last three months effectively takes that pain away… I was using Mercurial with Kiln from the Joel Spolsky camp. Mercurial allows developers to have local repositories—so this whole overwriting thing can happen on the communal server but, locally, there should be a changeset to run hg merge (see “How to fix multiple heads?”).

Yes, speaking of Joel on Software, I did use FogBugz over the last quarter but I can’t really say much more about it—apart from having no complaints about user experience. With FogBugz and Team Foundation Server (before), I am already used to writing comments about resolving a bug—but what’s new for me now is writing down the analysis process—describing what I call the bug situation. I find these advantages:

  • These writings about the bug situation can turn into email messages for another programmer better positioned to resolve the bug and can use your writing as instructions to get the job done, very, very fast (and look very impressive to penny pinchers wearing rose-colored glasses). This happened to me twice just over the last few days—and I’m willing to do this again (I don’t care about making other programmer’s look “good” in the eyes of unobservant managerial types in a healthy job market).
  • It helps me to actually learn about someone else’s code instead of looking like I have learned about the code—I don’t look like that.
  • It helps me to actually manage the complexity of an application instead of being intimidated by the complexity of an application.
  • It helps me to remember the particular viewing angle into the tiers. I often rebel against a design that I assume is too complex and I have difficulty remembering what I’m looking at…
  • In most “fast paced” environments you have no idea which bug will take five minutes and which will take three days (this is actually a sign of managerial/architectural problems or a sign of “rock star” programmers hiding their faults from managers that trust them—or both). By journaling through the bugs you can get a better idea about which ones will be “easy” and then the others…
  • It helps me deal with what I consider one of the worst kinds of bugs: bugs that are actually requests for missing features. What can be quite evil is when these “bugs” are “sincerely” regarded as trivial issues when these are actually serious, full-blown development tasks. What this can mean is that the “rock star” programmer of the IT shop is not really doing their job and is marking tasks as complete when they are not. This makes the “rock star” appear timely, on schedule when they are really passing the buck among penny pinchers.

Formally writing down the bug analysis should be considered a part of the analyst part of the job title Programmer/Analyst, which I have held for many, many years. I have no guilt, hate or deformed respect for any penny-pinching barbarians out there that are quick to assume that you are trying to overcharge them for spending an hour (or more) analyzing a bug. These cheap folks can’t have it both ways: a bug quickly marked resolved and a resolution carefully done that does not cause regression (or a new bug).

One interesting thing about FogBugz is the concept of Evidence-Based Scheduling (EBS): “EBS doesn’t give you a single ship date. Instead, it produces a probability distribution curve. That means that for any given date, it tells you what the probability is that you will ship by that date.” EBS is quite different from GBS—Greed-Based Scheduling.

The Telecommuting Experience

I can find another job. But I am not likely to find another telecommuting job. This job allowed me to take my seven-year-old daughter to school personally every day. In spite of the huge technical benefits, this time spent with my daughter was the greatest reward of the experiment.

It is very likely that I will return to fossil-fuel commuting.

Related Links