Wednesday, January 23, 2008

HTML 5 Draft

There seems to be a lot of chatter about the HTML 5 draft recently so I thought I'd make the links readily available:

I'll be mulling over the documents for the next few days. More on it then!

Friday, January 18, 2008

A client-side component for managing window resize events

I wrote a while back about fixing IE's window resize event, and while this implementation works well, it was difficult for other components to hook into and use without re-writing the same code.

I decided to write a client-side component that handles the window resize event and fires off its own event when the resize has actually completed.

The code is pretty much the same as my original post, except its encapsulated in a MS AJAX component and exposes a new event.

The JavaScript looks like:

/// <reference name="MicrosoftAjax.js" />


Mbccs.Psp.Web.Manager.WindowHelper = function() {
    this._resizeTimeoutHandle = null;
    this._resizeEventDelegate = null;
    this._resizeHandlerDelegate = null;

Mbccs.Psp.Web.Manager.WindowHelper.prototype = {   
    initialize : function() {           
        Mbccs.Psp.Web.Manager.WindowHelper.callBaseMethod(this, 'initialize');
        if(this._resizeEventDelegate === null)
            this._resizeEventDelegate = Function.createDelegate(this, this._resizeHandler);
        if(this._resizeHandlerDelegate === null)
            this._resizeHandlerDelegate = Function.createDelegate(this, this._resizedHandler);
        $addHandler(window, 'resize', this._resizeEventDelegate);

    dispose : function() {       
        if(this._resizeEventDelegate) {
            $removeHandler(window, 'resize', this._resizeEventDelegate);
            delete this._resizeDelegate;
            delete this._resizeHandlerDelegate;
        Mbccs.Psp.Web.Manager.WindowHelper.callBaseMethod(this, 'dispose');
    _resizeHandler : function(e) {
        this._resizeTimeoutHandle = window.setTimeout(this._resizeHandlerDelegate, 100);       
    _resizedHandler : function(e) {
    // Events
    add_windowResized : function(handler) {
        this.get_events().addHandler('windowResized', handler);
    remove_windowResized : function(handler) {
        this.get_events().removeHandler('windowResized', handler);
    _onWindowResized : function(e) {
        var h = this.get_events().getHandler('windowResized');
        if(h) h(this, e);

Mbccs.Psp.Web.Manager.WindowHelper.registerClass('Mbccs.Psp.Web.Manager.WindowHelper', Sys.Component);

An example of using it on your site:

Sys.Application.add_init(function() {                 
       window.windowManager = $create(Mbccs.Psp.Web.Manager.WindowHelper, null, {windowResized : page_windowResized}, null, null);

function page_windowResized(sender, args) {
    alert('Window has been resized!')

Vista hangs at login with "Windows is waiting for the user profile service"

Along with a change to TCP offloading on our server, a staff member on a Vista machine started encountering a problem when logging in; her computer would hang with "Windows is waiting for the user profile service" on the screen.  Checking the service status from a remote computer showed this service as "Starting..."

Although I really wanted to remotely debug this issue (grab a stack trace with a debugger attached), the user was anxious to get back to work which means I had to work quickly.

I stumbled upon a feature named TCP auto-tuning or TCP window scaling.  It turns out, this feature also ties into TCP offloading, which we just disabled on our server due to a Broadcom issue

You can turn off auto tuning from the command prompt by running

netsh interface tcp set global autotuninglevel=disable

Sure enough, after running this (from safe mode), the user was able to login again.

Dell PowerEdge & Broadcom Issues

For some time now we've been experiencing a problem across the board with Dell PowerEdge 2900/2950 servers equipped with Broadcom Gigabit ethernet cards.  The symptoms usually manifest themselves in the form of slow upload speeds between certain endpoints.  Dell Server to Dell Workstation transfers seem unaffected, however when using non Intel/Broadcome cards (Realtek, for example), upload speeds over a gigabit network come in around 100kbytes/second.  We've also had this problem out to the internet when paired with both Cisco and Dell switches.

Dell Support has been pretty hush on this issue, failing to even admit it is a widespread problem (indeed if you Google about it you'll find lots of complaints).

TOE seems to be to blame and some posters have gone as far to recommend removing the TOE key (the hardware key that enabled the feature) and reinstalling the OS.

Indeed it does appear to be a problem with TOE and Broadcom drivers (among the other issues we have with them, but that's another story).

The good news is that there is a pretty simple fix for this, assuming you are running Windows 2003 SP2 with the Scalable Networking Pack (SNP):

Netsh int ip set chimney DISABLED

This disables TOE offloading, known as "TCP Chimney offload" in Windows.

We've run this on a number of servers now, and in all cases, it has resolved the slow transit issues.

Now only if Broadcom would fix their drivers.

Friday, January 11, 2008

Go away vwd.webinfo

It seems that every time I go to check in some changes to TFS I have about 10 vwd.webinfo's pending.

Some research shows that this file is used to determine what services have to start when running the web application.  You can get rid of it by manually editing the project files to remove the reference, but man that's a lot of work!

It seems to be particularly bad in VS2008.  Some info from Microsoft would be nice!