Tuesday, November 18, 2008

MBC is Hiring – ASP.NET Web Developer Position available in Toronto, Ontario

Description

If you enjoy working on a variety of cutting edge web applications ranging from eCommerce apps to Social Networking sites then this position might be for you! MBC is seeking to hire a talented and passionate developer with a deep understanding of ASP.NET and the .NET framework but who also likely knows their way around windbg.  Experience with standards-based XHTML, CSS, JavaScript and AJAX is a must.  The position is based out of Richmond Hill, Ontario (just outside of Toronto).  Office environment is young and casual.

Experience

Degree or certificate in Computer Science, Computer Engineering or college level application development program. Some experience developing production applications required.

Responsibilities

  1. Design and coding of features and bug fixes in a variety of .NET applications authored in C# (primarily ASP.NET)
  2. Occasionally working on VB6, PHP, ASP applications
  3. Communication with clients regarding progress, feature requests, answering general questions, support

Requirements

  • Strong object oriented design and programming using C# and ASP.NET 3.5
  • Strong knowledge of Microsoft SQL Server 2000/2005 (programming with T-SQL)
  • A desire to take part in the full development processing starting with design of features through implementation
  • Job experience working with C#, ASP.NET, .NET framework, JavaScript, AJAX
  • Experience working in a team environment
  • Excellent verbal and written communication skills

Additional Assets

  • Knowledge of COM+, Active Directory, Exchange, IIS, MSMQ
  • Team Foundation Server
  • PHP, ColdFusion, ASP
  • MySQL
  • Basic use of graphic design tools such as Adobe Photoshop

Salary

Commensurate with experience.

To apply for the job

Candidates will be required to provide sample source code that demonstrates strong knowledge of C# and ASP.NET. An application implementing an n-tier design is highly recommended. Additional consideration will be given to candidates who provide sample code using .NET 3.0/3.5 technologies such as LINQ, WCF, WPF.

Saturday, November 15, 2008

XHTML Strict not supported by ASP.NET

Back in October I opened up a MS Connect feedback item about a validation error I was receiving with a XHTML Strict site that used a ScriptManager with history support.  The site would fail W3C validation because the ScriptManager emits an IFRAME (when history is enabled) , and an IFRAME is not part of the XHTML Strict spec.  I just thought I’d provide the official word from Microsoft on this issue: XHTML Strict is not supported by ASP.NET!

XHTML strict is not supported by ASP.NET. Only transitional doctypes are supported, which enables iframes. Furthermore, the history feature can't be made compatible with IE 6 and 7 without using an iframe.

Posted by Microsoft on 11/12/2008 at 12:34 PM

Monday, November 10, 2008

Don’t forget about the defer attribute for non-essential external scripts

I was recently reviewing a customers eCommerce site and I noticed that the “Please Wait” page that occurs after completing an order but before you view the order was taking a long time to load.  Using Firebug I traced the issue down to an external script that was taking it’s sweet time to download; it was for affiliate tracking on a 3rd party site.

I’m all for tracking, but not at the expense of performance.  Though I haven’t seen an affiliate/ad partner use the defer attribute on their script tags before, there is good reason for you to add it.  Consider the following example:

Default

SlowRequest.aspx is just an ASP.NET page that after a 2 second delay, returns some JavaScript (not my finest code I might add)

SlowRequest

Sure enough, for the first two seconds, all you see is

Waiting

And finally (2 seconds later)

Done

Luckily for this example, this information isn’t overly pertinent – but if it were my order status, it would be.  Luckily a quick defer=”defer” attribute on your script tag and the wait is gone; the external script is loaded after the DOM is ready:

Defer

Thursday, October 23, 2008

Is it really going to take that long?

You have to love Microsoft dialogs sometimes:

capture

I really hope that’s not an accurate number! This was invoked by removing the Encrypted attribute on a folder of about 1GB.

Tuesday, October 21, 2008

OrderDynamics Launches New Website

October 27, 2008

TORONTO - OrderDynamics Corporation, an on-demand eCommerce solution provider, is pleased to announce its new website.

Since 2006, OrderDynamics has had a website that focused more on the technical details of their solution. The new website, and company logo and colors, is designed to provide visitors with a view to the entire OrderDynamics solution, not simply technical details.

"Our success comes from our overall approach, and we wanted this reflected in our brand and website going forward." Michael Benadiba, CEO and founder of OrderDynamics Corporation. The new website contains new content areas that describe all major aspects of the eCommerce solution. The design itself is significantly less busy, more simplistic, and easier for potential Clients to find what they need -all underlying themes meant to support the company philosophy. "The format of the website is exciting for us. Shortly, we will be providing specific content to explain to potential Client’s how we solve real problems for online merchants." Benadiba says.

About OrderDynamics Corporation

OrderDynamics Corporation is a privately owned company that provides turn-key eCommerce solutions to businesses looking to grow their online sales. The success of OrderDynamics is highly attributed to its response to real Client requirements and Dynamic Merchandising concepts which provide superior control and help drive revenue. The OrderDynamics solution is designed for online merchants and services different business such as retail, manufacturing, business-to-business, complex online retail, and more. OrderDynamics officially launched its solution in 2006 after 2 years of research and development.

For more information, please contact:

Michael Benadiba
Chief Executive Officer
OrderDynamics Corporation
1+ (866) 559-8123
news@orderdynamics.com

Wednesday, September 03, 2008

Serving up the MS AJAX Runtime as a CompositeScript

ASP.NET 3.5 SP1 introduces script combining to the ScriptManager.  To take advantage of this feature with your own scripts, you simply wrap  you <Scripts>...</Scripts> block with a <CompositeScript>...</CompositeScript> block.  This is great, but if you've spent any time analyzing your site with a HTTP tracing tool like Firebug, Web Development  Helper or Fiddler, you'll notice that the MS AJAX Runtimes (MicrosoftAjax.js, MicrosoftAjaxWebForms.js) is still served up separately.  It turns out that getting these to be served as part of the combined script is relatively straight forward and entails manually including the scripts within your <CompositeScript> block.  Since the names are unique, the ScriptManager will not re-add the runtime libraries.  The final result looks like:

<asp:ScriptManager runat="server" ID="scriptManager">
    <CompositeScript>
        <Scripts>
            <asp:ScriptReference Name="MicrosoftAjax.js" />
            <asp:ScriptReference Name="MicrosoftAjaxWebForms.js" />
            <asp:ScriptReference Path="~/scripts/YourScript.js" />
        </Scripts>
    </CompositeScript>
</asp:ScriptManager>

Tuesday, August 19, 2008

Watch out for maxAllowedContentLength - its in bytes!

I was just troubleshooting a HTTP Error 404.13 - Not Found error in one of applications that handles some large file uploads.  I had set my maxAllowedContentLength to 2097151 (which is the max allowed value for the httpRuntime maxRequestLength parameter, in KB).  Oddly, it wasn't working and I was still receiving the 404.13.

Some time later, after actually reading the MSDN documentation, it clicked to me that maxAllowedContentLength is in bytes, not kilobytes! Doh!

Tuesday, July 22, 2008

Popup Window Manager

I was just reading a post by Rick Strahl about managing popup windows in the browser.  I actually authored a mini popup window manager a while back that tracks windows, allows you to easily close them, and most importantly (for my app I suppose), can prevent the same window from being opened twice, and if encountered, will simply focus that window.

The code is for MS AJAX but could easily be adopted for other platforms.

To use it, you need to register it globally via the pages Load event:

Sys.Application.add_load(function(sender, args) {
                window.popupWindowManager = new Mbccs.Psp.Web.Manager.PopupWindowManager(); 
            });

And to open a window (using the default height and width):

window.popupWindowManager.openWindow('myPage.aspx', false);

If you want to override the width/height:

window.popupWindowManager.openWindow('mypage.aspx', false, 800, 800)

The code looks like:

Mbccs.Psp.Web.Manager.PopupWindow = function Mbccs$Psp$Web$Manager$PopupWindow(url, handle, allowDuplicates) {
    this._url = url || null;
    this._handle = handle || null;
    this._allowDuplicates = allowDuplicates;
}

Mbccs.Psp.Web.Manager.PopupWindow.prototype = {
    get_url : function Mbccs$Psp$Web$Manager$PopupWindow$get_url() {
        return this._url;
    },
    get_handle : function Mbccs$Psp$Web$Manager$PopupWindow$get_handle() {
        return this._handle;
    },
    get_allowDuplicates : function Mbccs$Psp$Web$Manager$PopupWindow$get_allowDuplicates() {
        return this._allowDuplicates;
    }
}
Mbccs.Psp.Web.Manager.PopupWindow.registerClass('Mbccs.Psp.Web.Manager.PopupWindow');

Mbccs.Psp.Web.Manager.PopupWindowManager = function Mbccs$Psp$Web$Manager$PopupWindowManager() {   
    this._windows = [];   
}

Mbccs.Psp.Web.Manager.PopupWindowManager.prototype = {
    openWindow : function Mbccs$Psp$Web$Manager$PopupWindowManager$openWindow(url, allowDuplicates, width, height) {
        var allowOpen = true;
        var previousWindow = null;
        var previousWindowIndex = -1;
        var windows = this._windows;
        // Check for existing
        for(i = 0; i < windows.length; i++) {
            if(windows[i].get_url() == url) {
                allowOpen = windows[i].get_allowDuplicates();
                previousWindow = windows[i];
                previousWindowIndex = i;
                break;
            }
        }       
        if(!allowOpen) {
            if(previousWindow.get_handle().closed) {
                Array.removeAt(this._windows, previousWindowIndex);
                allowOpen = true;
            }
        }
        if(allowOpen) {
            var _width = width || 750;
            var _height = height || 700;
            var winName = 'win' + Math.floor(Math.random() * 100 + 1);
            var curWin = window.open(url, winName, 'width=' + _width + ',height=' + _height + ',resizable=yes,scrollbars=yes');                   
            var win = new Mbccs.Psp.Web.Manager.PopupWindow(url, curWin, allowDuplicates);                       
            this._windows.push(win);
            return win;
        } else {
            previousWindow.get_handle().focus();
            return previousWindow;
        }
    },
    closeAll : function Mbccs$Psp$Web$Manager$PopupWindowManager$closeAll() {
        var curWin = this._windows.pop();
        while(curWin != null) {
            curWin.get_handle().close();
            curWin = this._windows.pop();
        }
    }   
}

Monday, July 07, 2008

Using Virtual Machine Manager 2008 to manage Virtual Server 2005

I was trying to add a Virtual Server 2005 host to a Virtual Machine Manager 2008 Beta and I kept receiving the following error:

Error (421)
Agent installation failed on MBC02.mbccs.internal because of a WS-Management configuration error. 

Recommended Action
See the Virtual Machine Manager Help for information about configuring WS-Management.

 

Of course, being a beta product, that help section didn't exist and a search for "WS-Management" didn't yield anything.  WS-Management is installed by adding "Hardware Management" from Windows Components > Management and Monitoring tools (WinRM service), and this was installed on my server so I was pretty confused as to why I was receiving this message.

It turns out that you need to install WS-Management v1.1 which is provided as a hotfix from Microsoft.  You can download it from http://www.microsoft.com/downloads/details.aspx?FamilyID=845289ca-16cc-4c73-8934-dd46b5ed1d33&displaylang=en.

 

Hope this helps!

Wednesday, June 25, 2008

Decent online monitor calibration tool

While I don't doubt that an external calibration tool is better for calibrating your monitor, I came across one online that yielded good results for my Dell 2009W 20" Wide Screen LCD's:  http://www.lagom.nl/lcd-test/

Another MacBook hard drive bites the dust

I've had my MacBook 2.16GHz for just under two years now, and I've just had to replace the hard drive for a second time (mind you, this time not under Apple's warrantee).

With most laptops, this would not be much of a surprise to me - after all, most laptops tend to take a beating, and this type of failure is somewhat normal.  The thing is, this laptop is used almost exclusively for testing; it sits on my desk 340 days of the year without moving - the power cord is tie wrapped to my desk even.

If my friends are reading this, they're probably thinking  "Steven is on one of his anti-Apple rants again," and while that might be partially true, the point I'm trying to make (or the myths I'm trying to dispel rather) is simple: MacBooks are not more reliable than Dell, HP, or Lenovo laptops.   They all use almost identical drives, mother boards, video cards and RAM (the RAM I pulled out of this recently was Samsung).

That being said, my experience with this particular MacBook is that it is actually significantly less reliable than other laptops I've owned.  My general feeling is that it suffers from a heat dissipation problem.  The vents on this unit are few and small, and under most of my use, the fan has to run at what seems to be full blast. When I compare this to similar Dell laptops that I've owned/used, they seem to have way better ventilation, and as a result, the fans seem to run less frequently.

Good thing new drives are cheap!

Tuesday, June 24, 2008

Dell 2009W's Finally Arrive

I had previously written about the new Dell 2208WFP 22" Wide Screen LCD's that I had purchased and immediately sent back due to their blinding brightness and poor colour quality.  After nearly a month of waiting, I finally received my 2 Dell 2009W 20" Wide Screen LCD's.  My Dell rep informed me that the delay was due to a warehouse changeover in the USA (whether I believe that or not is unimportant).

Now that I have my new panels, I thought I'd share a few thoughts about them.

First are foremost, they are a significant improvement over the 2208WFP's.  That being said, I don't feel that the colour quality is as good as the Dell 2007WFP's that I have at my office. Also, the colour noticeably changes with the viewing angle, and they look slightly washed out even dead on.  My overall opinion is that Dell is cranking the brightness of their panels to increase the advertised contrast ratio, with colour quality suffering as a result.  But for the price, you can't go too wrong, and the quality is still higher then a lot of panels on the market.

My biggest complaint so far is that the stands don't seem to go high enough.  At my office I have an Ergontron DS100 Dual Monitor Desk Stand that holds the monitors noticeably higher then the highest setting on the height adjustable stands they ship with.  I'm going to need to offset this with a screen platform (aka: phone book).

Overall rating: 3/5

Sunday, June 22, 2008

How to change the temperature scale on a Honeywell T6575 Thermostat

[The complete documentation can be found at http://customer.honeywell.ca/techlit/pdf/95c-00000s/95c-10897.pdf]

 

This was bugging me for a while - the thermostat in my condo was configured to display in Fahrenheit.  I had removed the device figuring there would be a jumper or dipswitch on the back, but I had assumed incorrectly.  It turns out this device contains an EEPROM for storing configuration data.  Getting into the setup is relatively straight forward.

T6575B1003

  1. Change the temperature set point to 10C or 50F.  If it will not go this low then the minimum set point has been modified - you can access setup by selecting the lowest your device will go.
  2. Wait about 3 seconds until the room temperature is displayed
  3. Press and hold the UP and DOWN buttons until tS is displayed
  4. Press  UP once to show the current setting, press UP again so that it changes to Celcius.
  5. Press DOWN to commit your change.
  6. Continue pressing DOWN as you cycle through the available options (db, OP, uC, uH, CO, CL, HL, ES, rt) until you reach rT.
  7. Press DOWN once more and the unit should return to the current room temperature display, this time in the scale of your choice!

Thursday, June 12, 2008

Mac OSX 10.5.2 Freezing Intermittently

I've been having an issue with my MacBook (you know, that computer I hide under my desk most of the time) where intermittently, the UI will freeze up for a period of a minute or so and then return to normal.

I came across an article detailing how to reset the PRAM and NVRAM that seems to have resolved the issue.

Resetting PRAM and NVRAM
  1. Shut down the computer.
  2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
  3. Turn on the computer.
  4. Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
  5. Hold the keys down until the computer restarts and you hear the startup sound for the second time.
  6. Release the keys.

Tuesday, June 03, 2008

Windows Search 4.0 Released .....and searching finally works!

I've been dealing with Outlook 2007's search problems since installing it way back then.  Most frequently, I'd search a keyword; the search pane would fill with information, and then disappear leaving me with "No results found." I can replicate this problem on every workstation in office, as well as my home workstation.

Well, Microsoft has announced the RTW of Windows Search 4.0 as of Tuesday June 3, 2008 and my preliminary tests look promising.  So far, all of my keyword and "from:" searches have worked as expected with no clearing of results.

Downloads

Wednesday, May 28, 2008

Follow-up: Monitor Disappointment: Dell 2208WFP 22" Wide Screen LCD

I previously wrote about how displeased I was with a pair of Dell 2208WFP 22" Wide Screen LCD's and I just thought I'd provide a quick follow-up on what happened and what I settled with.

MBC is a Dell VAR; we order hardware from Dell non-stop, and lots of it, so I was really surprised and disappointed in the experience we had trying to return these, especially when my rep told me that we were one of his bigger accounts.  Apparently Dell does not like to return peripherals because they end up loosing money on them in shipping alone.  Not that I really care - after all, how they ship their product isn't my problem, and I was even willing to pay a restocking fee (which, by the way, we didn't end up paying).  After more then I would have expected back and forth between myself and our Dell rep, Dell finally agreed to return the monitors.  But after about a week of "you will receive the return instructions via email shortly," I began to get even more annoyed, thinking the return would never actually happen.  Finally, the issue was escalated to my reps manager and we did actually receive the return instructions, and off the monitors went.

I decided to settle on a pair of Dell 2009W 20" Wide Screen LCD's that should be arriving any day now.  I certainly hope these are as good, if not better then my current Dell 2007WFP's (also 20").

I will be sure to write about them once I start using them, but I did want to provide a quick overview of my return headaches.  Dell "lesson of the day": be persistent and they'll eventually give in.

How to determine if the clients browser accepts GZIP compression

A quick way to determine if the clients web browser accepts GZIP compression:

string AcceptEncoding = Request.Headers["Accept-Encoding"];




bool gZipSupported = (!string.IsNullOrEmpty(AcceptEncoding) && 
AcceptEncoding.IndexOf("gzip", StringComparison.InvariantCultureIgnoreCase) > -1);








Thats it!

Wednesday, May 14, 2008

Setting Default Values on Automatic Properties

Introduction

C# 3.0 introduces a great new feature called Automatic Properties, and if you haven’t already read about them, I would encourage you to read Scott Guthrie's introductory post.

As great as they are and as much time as they save, Automatic Properties have a serious drawback – you can’t set the default value of the property. Instead, the compiler will initialize value properties to 0, reference properties to null, and enum’s to the first member, and while this might work for some applications, it wasn’t working for mine.

Background

When I thought about the implementation, two options became apparent. One, I could create a base object class and have all of my classes inherit from this base class. This however isn’t a great solution because a number of my classes inherit from other classes outside of my control, and since .NET does not support multiple inheritances, it was clear this wasn’t going to work. To my rescue was the also new C# 3.0 feature, Extension Methods. If you haven’t already heard about Extension Methods I’d recommend reading another one of Scott Guthrie's blog posts about them.

Using the Code

Using the code requires that you decorate your properties with an attribute already available in the System.ComponentModel namespace – if you haven’t already guessed it, it’s the aptly named DefaultValueAttribute attribute. As well, it requires a quick call to the InitDefaults() extension method from the constructor which I will discuss a bit later.

The attached code supplies a demo implementation of the TestObject and TestObjectInherited classes:

public class TestObject
{
public TestObject()
{
this.InitDefaults();
}

[DefaultValue(-45)]
public int DefaultInt
{
get;
set;
}

[DefaultValue(10.23)]
public double DefaultDouble
{
get;
set;
}

[DefaultValue(true)]
public bool DefaultBool
{
get;
set;
}

[DefaultValue(TestEnum.Value2)]
public TestEnum DefaultEnum
{
get;
set;
}

[DefaultValue("DefaultString!")]
public string DefaultString
{
get;
set;
}

public string StringWithoutDefault
{
get;
set;
}

public string ValueOfPrivateProperty
{
get
{
return PrivateProperty;
}
}

[DefaultValue("This is a private property!")]
protected string PrivateProperty
{
get;
set;
}
}


The magical InitDefaults() method is implemented as an extension method which uses reflection to set the value of the properties to the default value:



public static void InitDefaults(this object o)
{
PropertyInfo[] props = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

for (int i = 0; i < props.Length; i++)
{
PropertyInfo prop = props[i];

if (prop.GetCustomAttributes(true).Length > 0)
{
object[] defaultValueAttribute = prop.GetCustomAttributes(typeof(DefaultValueAttribute), true);

if (defaultValueAttribute != null)
{
DefaultValueAttribute dva = defaultValueAttribute[0] as DefaultValueAttribute;

if(dva != null)
prop.SetValue(o, dva.Value, null);
}
}
}
}


Points of Interest



I decided to support initializing the default value of properties in inherited classes, but if you don’t want this behaviour you can simply pass false to GetCustomAttributes()



if (prop.GetCustomAttributes(false).Length > 0)
{
object[] defaultValueAttribute = prop.GetCustomAttributes(typeof(DefaultValueAttribute), false);

if (defaultValueAttribute != null)
{
DefaultValueAttribute dva = defaultValueAttribute[0] as DefaultValueAttribute;

if(dva != null)
prop.SetValue(o, dva.Value, null);
}
}

Wednesday, May 07, 2008

Monitor Disappointment: Dell 2208WFP 22" Wide Screen LCD

I've owned a number of Dell LCD monitors over the years, and with every new monitor I've used, my satisfaction with them increased, that is until yesterday when I received two new Dell 2208WFP's.

The short of it is that they are back in the box, being returned to Dell for another set of 2008WFP's to replace my home monitors (17").

I've read that the 22" LCD's are the "odd panels out" in that 22" is between 20" and 24" where the resolutions increase.  Still, I didn't think they'd be a downgrade from my current 20" panels.

First impression was BRIGHT - man were they bright - I was nearly blinded.  Usually some simple adjustments to brightness, contrast and sometimes gamma will resolve these types of issue, but to my disappointment, once I got the brightness to a reasonable level, all of the colors appeared washed out. I also noticed a red tint to the panel, and gray text appeared blurry.  No matter how I tried, I just couldn't get the color to look good at any reasonable brightness level.  It was either too bright, or washed out.

I'd love to get a pair or 24" wide screen monitors but the truth is that I don't think I have room on my desk for them - the 22" monitors were pushing it already.

So there you have it - stay away from the Dell 2208WFP.  I should add that the rest of Dell's monitor line up is spectacular so definitely don't let this discourage you from buying them!

Monday, April 28, 2008

Toggling display property on TD element in Firefox has unexpected results

I just encountered a really odd behavior in Firefox.  Basically I was toggling the display property between none and block on a TD element via script:

el.style.display = 'none';
el.style.display = 'block';

The element defaulted to style="display:none".  The first round worked as expected, but after showing and hiding it over and over the results were either that the height kept growing, or the TD element was moving to the right and causing the table to exceed its boundaries.

The solution ended up being to just toggle it between "none" and "":

By default:

<td style="display:none" id="el">

To show it:

$get('el').style.display = '';

To hide it:

$get('el').style.display = 'none';

I'm still not sure what the exact problem was, but maybe this will help someone else out in a jam...

Monday, March 17, 2008

Dell, Broadcom & Scalable Networking Pack - Relief is in sight!

I've written before about features of the Scalable Networking Pack, specifically TCP Chimney Offloading / TOE, and the problems it has caused me with a number of Dell Servers and workstations equipped with Broadcom network adapters.  I thought I was the only one having this problem, surely Dell's claims to have never heard about the problem didn't help, but it seems enough users were bickering that Microsoft has released a hotfix for the issue.

The full article can be found at http://support.microsoft.com/kb/948496 and as for downloads:

x86: http://www.microsoft.com/downloads/details.aspx?FamilyId=062E954C-FDEC-45AF-A09C-5A05B8F010A5

x64: http://www.microsoft.com/downloads/details.aspx?FamilyId=38E66572-5D47-4219-82D7-DB0C57478950

Itanium: http://www.microsoft.com/downloads/details.aspx?FamilyId=A4D3905C-DD7D-4B3B-96DF-38B7256C26D2

The quick and dirty summary: "This update turns off default SNP features."

There are also a number of other symptoms listed that can be caused by SNP:

  • When you try to connect to the server by using a VPN connection, you receive the following error message:

    Error 800: Unable to establish connection.

  • You cannot create a Remote Desktop Protocol (RDP) connection to the server.
  • You cannot connect to shares on the server from a computer on the local area network.
  • You cannot join a client computer to the domain.
  • You cannot connect to the Exchange server from a computer that is running Microsoft Outlook.
  • Inactive Outlook connections to the Exchange server may not be cleaned up.
  • You experience slow network performance.
  • You may experience slow network performance when you communicate with a Windows Vista-based computer.
  • You cannot create an outgoing FTP connection from the server.
  • The Dynamic Host Configuration Protocol (DHCP) server service crashes.
  • You experience slow performance when you log on to the domain.
  • Network Address Translation (NAT) clients that are located behind Windows Small Business Server 2003 or Internet Security and Acceleration (ISA) Server experience intermittent connection failures.
  • You experience intermittent RPC communications failures.
  • The server stops responding.
  • The server runs low on nonpaged pool memory

Whether or not this update will make it down to Windows Update remains unknown, but I can tell you for sure, I will be applying this fix liberally - and yes, I will "opt-in" when needed!
Correction - It is on Windows Update, as a high-priority update!

Handling long strings with CLR SQL Stored Procedures

I've been banging my head on this one for a while now, though only now did I finally sit down to figure out to solve it.  I have (inherited from another dev) a CRL SQL Stored Procedure which outputs a long string.  The signature looks like:

public static void DoSomething(SqlString input,out SqlString output)

When output was long, an exception would be thrown similar to:

System.Data.SqlServer.TruncationException: Trying to convert return value or output parameter of size 28726 bytes to a T-SQL type with a smaller size limit of 8000 bytes.

Now you'd think that SqlString would map to varchar(max), if possible, but this is not the case. (I should also mention that the output is limited to 4000 bytes when using nvarchar).

The solution is to use SqlChars instead of SqlString - somewhere behind the scenes, this will get translated back to nvarchar, so the following will work:

DECLARE @output varchar(max)
EXEC DoSomething 'Loren Ipsum Dolar', @output output
SELECT @output

Of course you will have to convert your string to the SqlChars type before returning:

char[] chars = "Some String".ToCharArray();
output = new SqlChars(chars);       

Hope this helps!

Wednesday, March 05, 2008

Internet Explorer "Operation Aborted" - No more in Internet Explorer 8

If you do any amount of DHTML scripting you have most likely come across the dreaded "Operation Aborted" error that plagued Internet Explorer 5, 6 and 7. Sure, in some simple situations it's easy to resolve, but with complex controls tracing the problem can be next to impossible.  I caught up with Chris Wilson, Platform Architect of the Internet Explorer Platform team at Microsoft to ask him about this behavior and see if anything had been done in Internet Explorer 8.  I was pleasantly surprised to hear that as of IE8 Beta 1, IE will now show a standard script error complete with line number instead of wiping out the page and showing the "Operation Aborted Error".  As he explained, the when the parser encountered this particular problem it would completely abort parsing and throw up the error.  Now you'll get the same behavior as any other script error - a completely rendered page (albeit maybe incorrectly).

I'm quite excited to try out IE8, now if only the Internet connection at the Venetian didn't suck so badly...

Tuesday, March 04, 2008

Microsoft Surface at MIX08

As you may or may not know, I'm out at MIX08 (if you're here and are looking for something to do, drop me a line: steven@mbccs.com) and something that I was surprised to stumble upon was a Microsoft Surface. I spent about 20 minutes playing with it and drilling the presenter and I have one word to describe it: COOL!.

What's actually amazing is the photo downloading via bluetooth/wireless that Microsoft has shown off in some promotional videos is real, and it does work.  Snap a picture, put the device (complete with a surface-like barcode on it) on the table and wala - picture on Surface, ready to be manipulated.

I did inquire about public availability and I was told that they won't be commercially available for about 3-4 years.  Right now, they are limited to some "select" partners. Also, the cost of the units right now is anywhere from $5,000 to $10,000

Something that might not be well known is that Surface in its present form recognizes devices and objects via a bar-code like sticker on the device that is made up of large white dots on a black background - this allows Surface's IR sensors to pick up the signature and identify the device.  They say that RFID identification will likely be available by the time the device is mainstream.

Anyway's, they are indeed very cool and if you get a chance to interact with one I highly recommend you give it a try!

Wednesday, February 27, 2008

IIS 7 FTP Availability

When I first installed Windows 2008, the first thing I did was install IIS, but I was stumped when I first launched it.  All of the FTP features I was hoping for (like a GUI to control AD isolation Mode) and integration with the IIS 7 manager were missing, and instead I had to result back to the II6 manager and FTP release.  As it turns out, IIS7 FTP is being delivered out-of-band (this is the topic of another discussion all together), and I was even more disappointed to hear that it wouldn't be available until the official Win2k8 launch!

Well now that it has officially launched, the IIS team has held up to their promise and IIS7 FTP (FTP7) is indeed available.

x86: http://www.iis.net/go/1619
x64: http://www.iis.net/go/1620

Enjoy!

Wednesday, February 20, 2008

MS-DOS Editor still present in Vista

Don't ask why I was trying this, but I found it slightly odd that Microsoft was still shipping edit from the MS-DOS days - in fact, as you can see, the copyright is for 1995.  And yes, it is a 16-bit app being hosted by ntvdm.exe (Windows 16-bit virtual machine).  Weird!

Capture

Examining HTTP responses in kernel-mode cache

I came across an interesting post relating to a problem with a HttpModule caused by kernel-mode cache. The author points out a handy netsh command to view the contents of the kernel-mode cache.

You will need to have some requests before you will see anything - refreshing http://localhost/welcome.png a few times seems to do the trick.

netsh http show cache

Snapshot of HTTP response cache:
--------------------------------

URL: http://localhost:80/welcome.png
    Status code: 200
    HTTP verb: GET
    Cache policy type: User invalidates
    Creation time: 2007.12.10:5.22.23:0
    Request queue name: DefaultAppPool
    Headers length: 186
    Content length: 184946
    Hit count: 15
    Force disconnect after serving: FALSE

Saturday, February 16, 2008

Vista SP1 Installation Results

I thought it might be worthwhile to keep track of my Vista SP1 installs and any particular issues I run into.

Updated: February 20th, 2008

First Install: Dell Precision 380, Vista x86

Installed without any problems, but about 18 hours later I was prompted to re-active Windows.  Reactivation was successful using online method.

Second Install: MacBook with Boot Camp 2.0, Vista x86

Installed without any problems but during installation the computer rebooted and booted OS X (default selection) - I suppose this is my fault and easily rectifiable, but something to watch out for

Third Install: Dell Latitude D620, Vista x86

I first tried to execute the service pack from a network share.  Windows prompted me to run the program, which I did, but after several minutes of waiting I checked Task Manager only to find it was not executing. For the next attempt I copied the file to a local drive and ran it - installation was successful.

4) Dell Optiplex 745

Installed without problems.

Checking the state of TCP Auto-tuning and Chimney (TOE)

I previous wrote about disabling TCP chimney and disabling auto-tuning - but what if you just want to see the status of these services?  In Widows 2008 and Windows Vista, netsh provides a status summary of these. You can view this information by running the following command:

netsh int tcp show global

This yields the following output:

Querying active state...

TCP Global Parameters
----------------------------------------------
Receive-Side Scaling State          : enabled
Chimney Offload State               : disabled
Receive Window Auto-Tuning Level    : disabled
Add-On Congestion Control Provider  : none
ECN Capability                      : disabled
RFC 1323 Timestamps                 : disabled

The second and third line show the chimney status and receive window auto-tuning level respectively.  Auto-tuning is only available on Windows Server 2008 and Windows Vista whereas chimney is available as of Windows 2003 SP2 or SP1 with the SNP (Scalable Networking Pack) installed.

Tuesday, February 12, 2008

Catching JavaScript errors and masking over the alert() method

OK, I didn't think this would be such an amazing concept, but apparently someone did.  JavaScript actually allows you to override the default alert() behaviour; you can use this to display a fancy dialog in place of the standard modal alerts, or just alter the alert:

<script type="text/javascript">
// <![CDATA[
   var originalAlert = window.alert;

   window.alert = function(msg) {
      originalAlert('Altered Message: ' + msg);
   }
// ]]>
</script>

Furthermore, you can apply the same principal to override the error behaviour:

window.onerror = function() {
   alert('An error occured');
}

The result of an error on the page is a popup "Altered Message: An error occurred".

You can test this out by adding another function and method

function throwError(e) {
    throw 'Exception';
}

<input type="button" value="Click Me" onclick="throwError();" />

Tuesday, February 05, 2008

It's the simple things that save you...

If you work on any type of web farm or cluster, they'll come a time when you have to figure out what web server you are actually hitting.  Sure you could enable tracing, but this comes with consequences (like an application restart).  Something I've gotten into the habit of on every site I work on is including the server name and last date/time refreshed in comments at the bottom of the page.

 <!-- Connected To: <%= HttpContext.Current.Server.MachineName.ToString().ToUpper() %> -->
<!-- Last Refreshed: <%= DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() %> -->

Time after time again, I thank myself for doing this..

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" />

Type.registerNamespace('Mbccs.Psp.Web.Manager');

Mbccs.Psp.Web.Manager.WindowHelper = function() {
    Mbccs.Psp.Web.Manager.WindowHelper.initializeBase(this);   
    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;
        }
        if(this._resizeHandlerDelegate)
            delete this._resizeHandlerDelegate;
        Mbccs.Psp.Web.Manager.WindowHelper.callBaseMethod(this, 'dispose');
    },
    _resizeHandler : function(e) {
        window.clearTimeout(this._resizeTimeoutHandle);
        this._resizeTimeoutHandle = window.setTimeout(this._resizeHandlerDelegate, 100);       
    },
    _resizedHandler : function(e) {
        this._onWindowResized(Sys.EventArgs.Empty);
    },
    //
    // 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!