Replacing head.js with concatenated.js in My Studio

In “Introducing head.js to My Studio,” I was optimistic as ever about a new technique that is supposed to make life easier. It did not happen for me. Head JS was having trouble with the beta version of jQuery Color—knowing the details of this problem is irrelevant because when I rolled back to plain <script /> elements everything worked (and I am also certain that I was using the proper Head JS syntax to ensure loading in sequence).

So, instead of getting into yet another intimate relationship with yet another island of JavaScript, my alternative to Head JS is to concatenate my ‘library’ of JavaScript files into one, big-ass file, concatenate.js. This is the PowerShell script that does the job:

$newFileName = "concatenated.js"
New-Item -ItemType file $newFileName –force
$jquery = Get-Content "jquery-1.6.1.min.js"
$jqueryrx = Get-Content "jquery.extensions.rx.js"
$jqueryui = Get-Content "jquery-ui-1.8.6.custom.min.js"
$jquerycolor = Get-Content "jquery.color-2.0b1.min.js"
$underscore = Get-Content "underscore-min.js"
$jquerytmpl = Get-Content "jquery.tmpl.min.js"
Add-Content $newFileName $jquery
Add-Content $newFileName $jqueryrx
Add-Content $newFileName $jqueryui
Add-Content $newFileName $jquerycolor
Add-Content $newFileName $underscore
Add-Content $newFileName "`r`n"
Add-Content $newFileName $jquerytmpl

This very simple alternative does not solve the performance problems that Head JS is meant to solve. But for me, at my current scale of operations, maintainability is more important than maximizing performance.

WordWalkingStick.com Launches Songhay Studio Server

I reserved WordWalkingStick.com to have a domain available for a hosting plan with Internet Information Server (IIS). WordWalkingStick.com sounds like some kind of commercial play for my open source project on CodePlex.com for Microsoft Office Word. But, as of today, consider the similar names a ‘coincidence.’

Instead of having a personally useless “code gallery,” my Songhay Studio Server at WordWalkingStick.com is built to be a part of my active, work-week-daily workflow. Whenever I learn something new about Silverlight, WPF or ASP.NET MVC, it should show up on the Studio Server. This Studio Server concept is a self-educational tool (beyond my relatively passive Funky KB at SonghaySystem.com) that often serves as a co-worker educational tool.


Songhay Studio Server at WordWalkingStick.com

This Studio Server concept, by the way, is direct descendant from my intranet-based ‘Development Server’ concept that I’ve used in the workplace since the early 2000s. I thought it was cool to take a slice out of my Desktop and point it at this ‘Development Server.’ The rise of the SharePoint “My Site” makes this work habit largely obsolete in the average Microsoft-based enterprise.

I have avoided Microsoft-based hosting on the public internet for years because Microsoft technology simply was not designed for the “shared” hosting model. Phil Haack led the way here and I followed him into a deal with Newtek Web Hosting.

As of this writing, the Songhay Studio Server contains:

  • Active Web Designs—page layouts for the few web sites I maintain.
  • Live Samples—CSS, jQuery and Silverlight samples online; I use these to keep current—so studying these carefully covers my current skill set.
  • Hosted Source Code—active CodePlex.com projects and legacy SourceForge.net projects (in Java).
  • Utilities—stuff for me, dating back to my Intranet days.

So, after I showed Scott Hanselman my Silverlight BiggestBox live sample, he politely asked for something more interesting. In reply to his prompt reply, I told him (I think this came across—because Twitter is terse) that he was looking at a blank canvas. In the specific Silverlight case, I had to spend quite some time getting the plumbing to work to my satisfaction. The problem is that most people can’t see the plumbing—often I lose myself in the plumbing!

This new Songhay Studio Server allows me to see an IT executive summary of what the hell is going on! I can look at the home page and click though the index and see:

Coming soon will be my Adobe Flex-based BiggestBox! Ideally I’ll have Silverlight and Flex parity. This new tool called Tofino allows me to work on Flex in Visual Studio, which is currently very convenient for me.

So, am I spread too thin? Am I “over preparing” and getting “lost” in the technology? What this new Songhay Studio Server does for me is allow me to consolidate, summarize and simplify. The work of the last two years finally comes to the surface.

jQuery Notes


Amazon.com product

Hey: there’s early 2009 jQuery and then there’s 2010 jQuery (but not quite the latest). These notes serve to mark my jQuery experience as ‘updated’ compared to, say, Bryan of three months ago.

“New Official jQuery Plugins Provide Templating, Data Linking and Globalization”

John Resig: “Today, we’re very happy to announce that the following Microsoft-contributed plugins—the jQuery Templates plugin, the jQuery Data Link plugin, and the jQuery Globalization plugin—have been accepted as officially supported plugins of the jQuery project. As supported plugins, the jQuery community can feel confident that the plugins will continue to be enhanced and compatible with future versions of the jQuery and jQuery UI libraries.”

My notes today will not include any experience with these new features in jQuery. It is worth mentioning that jQuery “Templating” is an appreciated addition that addresses what is lively (as in not “dead”) about Silverlight declarative UI programming.

jQuery UI and Theme Roller

jQuery UI now includes the Auto-Complete plug-in from Jörn Zaefferer. The Theme Roller Web application displays the plug-in. Now, some remarks about Theme Roller:

  • The URI-based format for a ‘saved’ theme is cumbersome.
  • The ZIP archive of the custom theme uses earlier versions of jQuery, so, like Visual Studio IntelliSense support, it is out of date with the latest jQuery release. John Resig is awesome but he’s not that Blue Guy from the Watchmen!

I need to see a Theme Roller workflow that someone is proud of…

New and awesome (to me) API features…

  • The jQuery.closest()method was there in version 1.3 (c. 1/2009). I use this quite a bit now.
  • The jQuery.addClass() and .removeClass() methods were in jQuery since 1.0 (which is an embarrassment to me) but less than a month ago I was using .attr('class', 'foo') and .removeAttr('class') (which also betrays a lack of understanding of how HTML supports multiple CSS classes).
  • The jQuery.is()function provides truth tests for selectors. Another one from version 1.0 that escaped me!
  • This is how to use the .val()function with select element options: $('select.foo option:selected').val();
  • About the :nth-child()selector: “Because jQuery’s implementation of :nth-child(n) is strictly derived from the CSS specification, the value of n is ‘1-indexed’, meaning that the counting starts at 1. For all other selector expressions, however, jQuery follows JavaScript’s ‘0-indexed’counting.”

Exotic Internet Explorer Issues

Using $('…').css('background-color', '…') to set the backgroundColor property on a DOM node that does not have this property throws an “invalid property value” error for Internet Explorer 8, running in IE7 mode (with Developer Tools). Evidently, in IE7, tr, td and option do not have a backgroundColor property. Instead of doing this, it is better to use jQuery.addClass() and .removeClass() methods (see above)—or the .toggleClass()method—to toggle the CSS class that controls background color.

C# Influences

The way I use Func<T> and Action<T> in C# influences how I share ‘local’ functions in JavaScript. Here is a pattern I’m indulging these days:

$.irpc.renderTable = function (serviceData) {
    var func = this;
    $('#DataTable tbody').each(function () {
        func.enableEditButton = function (editButton) {
            //define rules to enable/disable edit button:
        }
    }
}

The idea here is to avoid Doug Crockford’s “too many vars error” (but I actually dial this down in JSLint for Visual Studio 2010).

The jQuery Validator is freaking huge!

Any documentation introducing the jQuery Validation plug-in should never underestimate its conceptual size and complexity. Simultaneously, it’s quite easy to use (for ‘simple’/declarative cases). My attempt to capture all of the aspects of this plug-in are preserved on my new Azure server. Here are some additional points:

  • The .rules()method requires $("form").validate() to be called first.
  • It is quite tempting to assume that naming form elements with array notation will make Validator validate all elements of that name. No! It only validates the first element of that name. One solution to this problem is to rewrite the Validate source code (not attractive to me). Another solution is to imperatively handle the click event of the form-submit button.

The Grid is Not Trivial

There are reasons why—after over four years of jQuery—there’s no accepted (free) grid solution. (Here, by the way, is where Microsoft can really kick ass.) Some points below sketch out this space:

Related Links

Back to Windows Live Writer

Live Writer UnthemedBack in 2008, I experimented with Windows Live Writer. Those were the salad days when working at UCLA provided me with more-than-20% time. Now that I’m back in the commercial sector (or, alternately, the poor house) there’s trouble finding any time for growth and experiment without feeling like a sneak.

So let’s eek out fast with follow-up bullets, addressing the 2008 version of Live Writer with the current one:

  • “Smart” or curly quotes now work!
  • Semantic markup like code or kbd must be written in HTML Code View (Shift+F11).
  • The concept of styles (from the world of MS Word) is still limited.
  • I’m almost sure that my ancient MS Word custom dictionary can be used with Windows Live Writer (see “Edit the Windows Live Writer Custom Dictionary”).
  • I’m hoping the “Set publish date” feature works with WordPress correctly.

I’m optimistic about the plug-ins I’ve installed but no mention here until they get into my comfort zone.

My return to Windows Live Writer is another attempt to deal with the current “challenges” in my miserable life, specifically those mentioned in a previous post. It’s clear to the happy few regular readers of my Blog that I’m getting about one post a week published, down from five per week when my situation was more flexible and stable.

What’s out of whack? What on earth does Bryan have to complain about? Here’s the “nice” list:

  • My web sites need to be upgraded, getting me out of YUI and into jQuery—out of SQLite as a first-class repository and into OData—out of so-so visual design and into something supposedly better, etc.
  • More kinté cast episodes!
  • My work currently fails to address the mobile space, which is just pathetic.

Back to the Black Board with Tech Plans: Sketching out My Personal Production Lines

I showed off my last sketch which was really a mess. This one is a bit saner:

Back to the Black Board with Tech Plans

The number-one take-away: Windows Presentation Foundation will be the center of my production efforts. What’s liberating for me is that it does not matter that WPF is less popular than, say, Adobe Flash. The latest iPhone ‘revolt’ against Flash and the promise of HTML 5 encourages me to declare that WPF is the state of the art UI technology—so why not build the “concept car” with the best tool—then it should be an academic exercise to transfer the “concept” to other platforms.

There are multiple directions out of WPF land:

  • WPF to Silverlight
  • WPF split into ASP.NET MVC and Silverlight (this implies that a WCF service is in reuse)
  • WPF to Flex/AIR
  • Silverlight to Moonlight (should be ‘easy’)
  • ASP.NET MVC and Silverlight to Zend Framework and Silverlight (jQuery/CSS should travel without modification)