Blog Tag - Five Things You Don't Know About Me

Sunday, December 31, 2006 by scott
4 comments

The Moth tagged me, so now you'll find out more than you wanted to know about me.

1. I scream like a 7 year old girl when I see a cicada bug.
In 2004, Brood X cicadas overran the eastern United States. Three days a week, I had to get in and out of an office building surrounded by swarms of cicadas. At first, I was curious about the bugs. Curiosity turned to terror. After one week, I lost all traces of rationality. I started to think the bugs were carnivorous space aliens who wanted to crawl inside my ear and eat my internal organs. The security guard at the building once wanted to call for an ambulance to pick me up. The guard though I was having a cardiac arrest - I was only trying to shake a cicada off my shoulder.

2. My crab cakes are the best ever!
In school I needed to make money for, um, books - that's it, so I had some formal training in the kitchen and logged quite a few hours as a line cook in a steak house. I still love cooking. One of my specialties is crab cakes.

Scott's Crab Cakes Recipe
1 lb. Backfin crabmeat
1 large egg
A touch (~ 1 tsp) of Worcestershire sauce
A touch (~ 1 tsp) of dry mustard
A heavy touch (to taste) of Old Bay seasoning

I combine all the ingredients in a bowl and gently mix with my fingers. I then shape the mix into 6 firm cakes. Cooking without filler and breadcrumbs can be tricky, but to me those ingredients ruin the taste of crab. If the cakes are firm enough, and the pan (with very little butter) is just the right temperature, I can make nice, brown crab cakes in about 10 minutes, and without the cakes falling apart.

3. I almost went to school to be a musician instead of an engineer.
Not an uncommon occurrence in the software world, it seems. I still play the trumpet and flügelhorn in the occasional community theater production. I wish I had the time to practice more often and keep my chops up enough to play a tune like Maynard's Chameleon. RIP, Maynard - we miss you.

4. The K stands for Kenneth.
My parents named me after an uncle who passed away before I knew him, but they wanted me to be called by my middle name of Scott.

5. Retirement Plans
I'm thinking of one day retiring in Goa. I might open a small jazz club with a dining area. Maybe I'll call it Ken's.

Now I have to tag 5 others to see if they'll play in this meme and tell us 5 things we don't know about them. In no particular order:

Phil Haack
Rick Strahl
Anil John
Sahil Malik
Milan Negovan

WPF versus WPF/E

Thursday, December 28, 2006 by scott
7 comments

I sat down to look at WPF/E this evening. WPF/E is Microsoft's cross-platform XAML engine that runs in a web browser. The technology is currently in a community preview stage.

I thought a good first step would be to port my "Game of Life" WPF application to WPF/E and see the game run in a browser. A quick look at the documentation revealed that WPF/E doesn't support data binding, resources, or layout controls (like the Grid). 

A good contrast will be to compare the following snippet of WPF code to my hacked up WPF/E equivalent. This C# code dynamically creates a "life" indicator in each cell of a grid control.

Ellipse ellipse = new Ellipse();
Grid.SetColumn(ellipse, column);
Grid.SetRow(ellipse, row);
ellipse.DataContext = _cells[row, column];
mainGrid.Children.Add(ellipse);
ellipse.Style = Resources[
"lifeStyle"] as Style;

With no data binding, no resources, and no Grid control, the JavaScript code for WPF/E has to take an alternate route.

var xaml = '<Ellipse Height="7" Width="7" />';
var ellipse = this.agControl.createFromXaml(xaml);
ellipse.Fill =
this.CreateBrush();
ellipse.Opacity =
this.cells.isCellAlive(i,j) ? 1 : 0;

gameBoard.children.add(ellipse);

ellipse[
"Canvas.Top"] = (this.agControl.height / this.size) * i;
ellipse[
"Canvas.Left"] = (this.agControl.width / this.size) * j;

WPF/E has some clever solutions to tough problems. There is no Ellipse constructor function as you might expect. That approach would require a massive JavaScript file with functions defined for all the WPF/E objects. Instead, we create objects graphs using XAML fragments. The code merely needs to pass these fragments to the WPF/E ActiveX control's createFromXaml method and receive an object in return. Also, notice the syntax for attached properties in WPF/E (ellipse["Canvas.Left"]).

If I had $100 to spend on WPF/E features, I'd spend the whole lot on adding data binding and layout controls. Overall, WPF/E is a bit different from what I expected before I started this evening. At this stage, the technology is good for performing animations, and playing media. No small feat, really, but anything the team can add that will facilitate day-to-day business requirements (build a dashboard of key performance indicators, fill out an insurance claim form) would make the technology terrific.

Google's Big Move

Wednesday, December 27, 2006 by scott
6 comments
the golden goose

Google has deprecated their SOAP Search API in favor of an AJAX Search API. This move provoked a great deal of discussion.

Some say the move was purely technical - Google is leaving its angled bracket XML partner to move in with the younger, sexier JSON. Others say the move was a business decision - Google can't afford to let advertising opportunities slip by.

I think Google did solve a technical problem. The problem was unregulated XML data. The solution was an AJAX control. Control is the essential word. The scripts that Google requires for the new search API keep them in control of the search results, the branding, and the advertisements. Producing data from an XML web service doesn't afford this level of control, but producing behavior through a ubiquitous scripting language does.

This could be the first of many backlashes against the bohemian goal of creating free-for-all mashups. Companies with balance sheets and stockholders aren't looking for a technology that will give them data interoperability, but a technology that will protect their investments.

AJAX is the DRM technology for the Web 2.0.

JavaScript Targets and the this Reference

Tuesday, December 26, 2006 by scott
4 comments

I've been catching up on JavaScript basics recently.

Here is a simple example to demonstrate the difference between the event target (where an event takes place), and the this reference (where an event handler is defined).

Consider the following hunk of HTML:

<div id="List">
    <ul>
        <li> One </li>
        <li> Two </li>
        <li> Three </li>
    </ul>
</
div>

We could write an event handler like so:

<script type="text/javascript">
  
  window.onload =
function()
  {
      List.onclick =  List_onclick;
  }
  
  
function List_onclick(e)
  {
      
var evt = e || window.event;
      
var evtTarget = evt.target || evt.srcElement;
      
      alert(evtTarget.nodeName);
      alert(
this.nodeName);
  }          

</script>

Clicking on one of the list items will reveal that evtTarget references an LI element, while this references the DIV element. I like this style, but for various reasons we often wire event handlers like so:

<div id="List" onclick="return List_onclick()">
    <ul>
        <li>One </li>
        <li>Two </li>
        <li>Three </li>
    </ul>
</
div>

And the script, which doesn't change a great deal:

<script type="text/javascript" >
    
    
function List_onclick(e)
    {
        
var evt = e || window.event;
        
var evtTarget = evt.target || evt.srcElement;
        
        alert(evtTarget.nodeName);
        alert(
this.nodeName);
        
return false;
    }

</script>

Clicking in a list item will show us that the evtTarget is still an LI element, but this.nodeName will now show as undefined. The function List_onclick in the second example is part of the global object, which doesn't have a nodeName.

I always have to think about what this will reference in JavaScript, which is one reason the language makes me queasy.

The Case of the Miniature Reminders Window

Thursday, December 21, 2006 by scott
14 comments

It was a quiet December evening. In the distance, a chime rang. Suddenly, an Outlook Reminders window appeared on my desktop.

outlook reminders

This is an actual picture of the window as it appeared at the time. The window would not resize. The window would not maximize. I made torturing gestures with my mouse, but the window held my reminders as closely guarded secrets.

I poked around with the registry editor and found a value named WindowPos under HKCU\Software\Microsoft\Office\11.0\Outlook\Options\Reminders. Deleting this value and restarting Outlook made the Reminders window appear with a normal, visible size. Problem solved ...

... except, I couldn't remember what I was working on before my reminders appeared.

Sidebar Gadgets

Wednesday, December 20, 2006 by scott
2 comments
sidebar gadgets

I find the Sidebar gadgets in Windows Vista appealing. I never thought this would happen. I've looked at desktop widget technologies like Konfabulator before, but I've always felt like I'm looking at a traveling carnival.

Traveling carnivals transform a grassy field of rural America into a noisy assortment of amusement rides, games, and food stalls. The bright colored lights attract people to the midway hawkers, who in turn entice the crowd with prizes at games of chance and skill. The magic of a carnival eventually wears off when you realize the food isn't that great, the games are rigged, and rides are one spin away from creating a newspaper headline.

Likewise, the irregular windows and glossy colors of most gadgets are inviting. It's not till they've been hanging around awhile that the novelty wears off and you start to wonder if they are providing any value. How many distractions do I need eating up CPU-time and RAM?

The turning point came for me when I thought about how easy it is to create a gadget, and how pervasive the Vista sidebar will presumably become. This opens the possibilities for highly specialized gadgets that have staying power. In the software development world, I'm thinking of gadgets to monitor build status, work item counts, and bugs.

I've been experimenting with gadget development in the evenings, and I can say they are fun to work with (JavaScript notwithstanding). I hope to have an article posted here soon.

In the meantime, here are some interesting resources I've found.

WPF Vista Gadgets - Part 1: Using XBAP and IFRAME

Gadgets: Write Once, Run Everywhere

Vista: Sidebar Gadgets

The Outlook Gadgets Are Here

Introducing IIS Stats v1.0 for Windows Sidebar

Vista Sidebar Gadget for Cruise Control.NET

Windows Workflow Foundation - The Book

Wednesday, December 13, 2006 by scott
7 comments

I spent a fair amount of time this year with Windows Workflow Foundation. I wrote about WF and posted a handful of articles about WF here on OTC. However, not everything I wrote ended up online….

Packt Publishing took all my work and ran it through a top-notch editorial and technical review. The result is a new book:

Order now and avoid the rush!

by K. Scott Allen K.Scott Allen
My Pluralsight Courses
The Podcast!