5th December 2006

WPF- WPF/E Hello World

From 2001-2005 I worked on the Avalon team (now called WPF) creating the next generation user-interface and graphics
platform. One of the more disappointing things about leaving in 2005 is that the things I’d been working
on where not ready for prime time yet, and it would be years before it would make sense to really dive in
again for real-world projects. The other issue is just that the size of the platform (huge download) and
big app model changes (Avalon/WPF is mostly code-first so existing web-sites would need to be really rethought
to adopt it.

Yesterday Microsoft put the community preview of WPF/E (E is for Everywhere). They took the core graphics
concepts of Avalon, the XAML language and packaged it in a 1MB download, with an object model designed to work
inside web pages and be programmed from Javascript. Even better it works in Firefox and on the Mac. This is a huge
breakthrough- a 1MB download really isn’t that big of a deal and the broad platform support (hopefully Linux?)
and consistent programming model makes it way easier to buy in to the technology.

Without further delay, here is my first “Hello World” thing in WPF/E. Just a little rotating text on a
gradient, but doing this with existing browser platforms would have been a big pain.

Note- this probably won’t work in most blog readers, if you want to check it out, visit my site. If
WPF/E is not already installed it should take you to the download site. Downloads are available for Windows
and the Mac.

var TheWPF= new agHost(”wpfeControl1Host”, // hostElementID (HTML element to put WPF/E
// ActiveX control inside of — usually a

)
“wpfobj”, // ID of the WPF/E ActiveX control we create
“300″, // Width
“300″, // Height
“#ffB42600″, // Background color
null, // SourceElement (name of script tag containing xaml)
“helloworld.xaml”, // Source file
“false”, // IsWindowless
“24″, // MaxFrameRate
null); // OnError handler (method name — no quotes)

var CurAngle = 0;

function DoTick()
{
wpf = document.getElementById(”wpfobj”);
var rotate = wpf.findName(”RotateID”);

// Determine whether the object was found.
if (rotate != null) {
rotate.Angle = (++CurAngle);
}
window.setTimeout(”DoTick()”, 50);
}

function onHelloWorldLoaded(sender, eventArgs)
{
window.setTimeout(”DoTick()”, 50);
}

Here is the XAML used in this sample:


    Hello, world

And here is the Javascript:


// aghost.js is a library from Microsoft for constructing a WPF/E object on all browsers
var TheWPF= new agHost(”wpfeControl1Host”, // hostElementID (HTML element to put WPF/E // ActiveX control inside of — usually a
) “wpfobj”, // ID of the WPF/E ActiveX control we create “300″, // Width “300″, // Height “#ffB42600″, // Background color null, // SourceElement (name of script tag containing xaml) “helloworld.xaml”, // Source file “false”, // IsWindowless “24″, // MaxFrameRate null); // OnError handler (method name — no quotes) var CurAngle = 0; function DoTick() { wpf = document.getElementById(”wpfobj”); var rotate = wpf.findName(”RotateID”); // Determine whether the object was found. if (rotate != null) { rotate.Angle = (++CurAngle); } window.setTimeout(”DoTick()”, 50); } function onHelloWorldLoaded(sender, eventArgs) { window.setTimeout(”DoTick()”, 50); }

]]>

posted in WPF | 0 Comments

4th December 2006

Cooking- Peking Turkey

For the past couple of years Hillel and I have wanted to do some interesting things for Thanksgiving beyond the usual turkey, mashed potatoes and cranberry. We often talked about ideas like imagining thanksgiving as an Asian holiday.
Last year we tried to do thanksgiving as a small plates meal. Overall I’d call it a disaster. Some of the dishes worked out ok, some failed (truffle mini-souffles) and the many-courses of small plates format kept a bunch of us psycho busy in the kitchen the whole night.
This year Michael agreed to host Thanksgiving and in the end almost 50 people were invited. With that many people we needed some good coordination and we had an opportunity to do both traditional versions of many dishes as well as jazzing things up a little bit. We did three turkeys- one traditional roasted, one deep friend, and my experiment for this year was a Peking Turkey.

Basically the idea was to cook a turkey using the techniques normally applied to Peking duck. Part of the motivation was some less than stellar skin on previous turkeys. Since Peking duck is known for its great crispy skin I wondered if the approach would work on a turkey.

The basic notion is to dry out the turkey and then baste it with some flavored boiling water for 10 minutes. This seals the skin and helps keep the juices in when you cook it. Then you hang it for 8 hours with a fan on it and brush it with a honey-water mix every couple of hours. Then you roast it fairly conventionally. The skin browned fairly quickly, so make sure to cover it in foil and turn down the heat once it browns.

Overall I think it worked out very well and I’d be tempted to try it again. The usual duck recipes tell you to remove the leg bones and I should have followed that- when the turkey was hung the blood all accumulated in the drumsticks and couldnt really drain.

Hillel wrote up some of the meal here on tastingmenu with some pictures. One other observation- I think the class we took at the CIA was some pretty good prep for an event like this. Cooking for 50 can be pretty hectic and we had it mostly all prepped and ready to go with only reasonable amount of work on Thanksgiving afternoon itself.

posted in Cooking | 0 Comments

3rd December 2006

General- Good news from the UK

Two pieces of good news Via Guy Kawasaki’s latest post. First of all, Wagamama is apparently opening a branch in Boston.
Sounds like its time to start campaigning for a Seattle presence. Tastingmenu has a write up on Wagamama that gives
a good feel for what is so cool about this. The bottom line is they just seem to “get it” on many levels. Good
food, nothing too complex, nice high-tech ordering, a great experience.

Guy also brings us news that a UK start-up called SpinVox is bringing email delivery of voice mail to cell-phones.
I’ve pretty much always hated voice-mail. It has always felt like this huge disruptive context switch for me to
go listen to some messages, make sure I have someplace to take notes, and all that. I’m much happier communicating
in email, IM, or in-person meetings that by telephones and voice-mail, but of course I need to be able to adapt
to how other people what to communicate also.

First of all its incredibly stupid that I can’t get my Verizon cell-phone voicemail delivered to my email inbox
as voice attachments. Email systems like Exchange have had this capability for at least 6 or 7 years and really it shouldn’t be hard at all to just configure the voice-mail system to send me an email. But the SpinVox goes a step further and translates the voice message to text. From my perspective this is perfect since everyone can operate in the medium
that they prefer and still get along just fine.

]]>

posted in General | 0 Comments

  • Advertising