Extending the SqlDataAdapter with a FillTimeout

The SqlDataAdapter has a CommandTimeout property but does offer any method to set any kind of timeout during the Fill method. If you are returning rather large data sets, you can quickly run into a problem. The obvious solution would be to inherit the SqlDataAdapter and simply override the Fill method, except that the SqlDataAdapter cannot be inherited. As a result, we must implement the same methods that the SqlDataAdapter does and attach them to a private internal SqlDataAdapter to do all the heavy lifting. With the use of anonymous delegates, we can easily rework the Fill methods to offer a new FillTimeout property and throw an exception when we exceed our desired timeout.

public int FillTimeout
{
    get { return _fillTimeout; }
    set { _fillTimeout = value; }
}

public int Fill(DataSet dataSet)
{
    if (_fillTimeout == 0)
    {
        return _adapter.Fill(dataSet);
    }
    else
    {
        int rows = 0;
        Thread fillThread = new Thread(delegate() { rows = _adapter.Fill(dataSet); });
        fillThread.Start();
        if (fillThread.Join(_fillTimeout * 1000))
        {
            return rows;
        }
        else
        {
            try
            {
                fillThread.Abort();
            }
            catch (ThreadAbortException)
            {
                Thread.ResetAbort();
            }
            throw new TimeoutException();
        }
    }
}

Download the full ExtendedSqlDataAdapter class : ExtendedSqlDataAdapter.cs

Improved ASP JSON utility

Most of the projects that I have been working on lately did not require any advanced AJAX. Most of the time, stuffing the results of a simple GET into innerHTML has usually been sufficient. Recently, I needed to do some more advanced AJAX work so I started looking into JSON. There a hundreds of helper classes that people have dreamed up already for ASP.NET, however this project was under the Classic ASP (VBScript) umbrella.

I fell upon a nice little utility on aptly called aspjson. It is a nice utility except the implementation of multi-dimensional array support is flawed. Try to JSON an array that has dimensions with more than 10 elements and you will quickly see what I mean.

I rewrote the multi-dimensional array support from scratch and I am releasing the code under the same license as the original author as well as obviously attributing credit to Tuğrul Topuz for his original code.

Download the ASPJSON 2.1 source

Fixing Dreamweaver CS4’s JavaScript Events for XHTML

One of the first things you learn about XHTML is lowercase. Everything is lowercase. Lowercase tags, lowercase attributes, lowercase, lowercase, lowercase…

I guess it wasn’t obvious enough to the developers over at Adobe because Dreamweaver CS4 has this annoying habit of mix-casing all of the JavaScript event handlers.

Thankfully, there’s a fix. All it requires is to edit the hundreds of entries in the tag library. Doing so through the interface tag library dialog is painful enough to make you want to claw your eyes out. So to save you the insanity, I did some file trickery and fixed all of the event entries within the entire HTML tag library.

Simply download the HTML Tag Library and overwrite your existing one. You’ll find it by default in “C:\Program Files\Adobe\Adobe Dreamweaver CS4\configuration\TagLibraries” on x86 systems and “C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS4\configuration\TagLibraries” on x64 systems.

Undocumented Microsoft ProductID GUIDs

Each Microsoft product is identified internally using a ProductID that is in the form of a Globally Unique Identifier (GUID). Software or updates that refer back to Microsoft products tend to generally establish the relationship using the GUIDs instead of the product name. If you ever wanted develop software that dug into some of Microsoft’s software internals, you’ll quickly find that without a way to map those GUIDs, most of the data is meaningless.

Never before documented or published, here’s a list of all known Microsoft ProductID GUIDs :

Creature House Expression 24AE5CA2-0CAA-4A72-8D41-BA605D0E1E91
Developer Tools C0037913-9E11-4A2D-8FD1-0BA441296CBC
Longhorn B7ABF888-8E44-494B-9CC5-09D2890E70B2
Microsoft .NET C9C8FCFB-BFF3-40CA-B59D-216F6850000A
Microsoft .NET Framework DE7BB609-3FD0-4B0F-865D-5ED2463AD5D0
Microsoft .NET Framework Software Development Kit 363FAD1D-FC68-461A-B459-BE5D41B521B2
Microsoft ActiveSync 44C5CD04-E8D3-4E3A-A3A5-31A4D151F304
Microsoft DirectX 9C954C37-1ED1-4846-8A7D-85FC422D1388
Microsoft Dynamics CRM 835909D0-A755-41FF-93CD-F5207C609EF5
Microsoft Dynamics GP 15EE2E3A-5717-4668-A067-C48D7D808D6B
Microsoft Embedded Visual C++ BC5E494B-612E-46B8-BD95-E1C2B06045CC
Microsoft Forefront 5290A2C0-4434-4401-819A-07F788B332BC
Microsoft Internet Information Server 5.0 C66BACE3-E97D-4F26-A8CF-8DBE6E933F03
Microsoft Internet Information Server 6.0 5EDDDCC6-5993-44B0-8C65-2D156A96A798
Microsoft Internet Security and Acceleration Server 23E0C7B9-FEAA-4E02-9662-31B9BD4CDF8B
Microsoft Office 3A4E9862-CDCE-4BDC-8664-91038E3EB1E9
Microsoft Office Communications Server 5EFC9E68-052F-4CAB-9F29-02BFA05A8F2F
Microsoft Office Excel F3F7AC8A-4EA0-4C36-BED9-8FEAE6D75298
Microsoft Office FrontPage 7D3CDED1-50F4-41E1-BE92-9C85367A4E28
Microsoft Office Outlook 50663FD1-DBAD-4705-B915-E4CF683E70FE
Microsoft Office PerformancePoint Server F52B1E9C-E169-4654-9A83-14A58A51C275
Microsoft Office PowerPoint B157E6F3-5AF9-48CB-A153-895C1AA220F8
Microsoft Office PowerPoint 2003 286C1147-414F-4754-B017-8E9A930A899A
Microsoft Office Project A1D023A3-F612-4DA2-ACB8-FDA8F850D645
Microsoft Office Publisher 3F982193-5FE1-4C5A-BD30-A47DA2551F13
Microsoft Office Word 2003 922C5574-5508-43FC-9C90-141AA3DEB153
Microsoft Platform Software Development Kit 6F6B7367-A11C-49C3-8CC6-92E74D092146
Microsoft Solution Offerings 1DBFC259-ABAE-437C-9601-F76395D283DA
Microsoft SQL Server 2005 9F07F9CC-C308-4EBF-A4E9-2B8530AB1EA8
Microsoft Virtual PC 82B14654-EF9B-4403-8D0E-46CF4D29D255
Microsoft Visual Basic 1652D9A4-F0B3-4630-ACD5-56982EA750AB
Microsoft Visual C++ 23947D52-B2BC-4E88-8C51-E81DC2905B0D
Microsoft Visual FoxPro E794F2FC-0425-40AD-A292-39490679FA65
Microsoft Visual Studio 2008 6527A674-9D67-40B8-A94C-D7AD0304CA0D
Microsoft Windows 2000 Server BC118C5B-4D63-41CC-A609-35CB35C09347
Microsoft Windows 95 635138C9-D296-4260-88B2-55FEDB495C92
Microsoft Windows 98 E884B137-98CA-464B-964D-1BDDCAF3081A
Microsoft Windows Millennium Edition DDDCD0BB-6C44-4027-BD49-82E20617CE33
Microsoft Windows Server 2003 0D02EFDB-60F0-4D05-B3C7-8E6676AC778E
Microsoft Windows Server 2003, Standard Edition (32-bit x86) 4271EA85-F9E5-4986-80EC-5F53ADE3740D
Microsoft Windows SharePoint Services 3.0 2EBD3A50-CDBC-4519-A254-D6E2A281743D
Microsoft Windows XP 4C937A02-BAE0-4317-A1A9-0C56CD979D05
Microsoft Windows XP Media Center Edition 2002 5C52C316-6652-42D1-AC4F-DEE061D5497C
Microsoft Windows XP Professional 2ABF99CD-A5E4-469C-802E-55CA8EC542D5
Microsoft Word 2004 for Mac 907DA265-A4B4-43BF-93C9-5D1D0A73FFA4
Microsoft Works A9BEEF69-0571-43F0-BC3D-DE62CD4D190C
Microsoft XNA 3AC63F4D-131C-4CE4-ABE4-FDB8C7032E8B
MSN BEAE32B8-4A67-4F78-BF4E-C114F922F1EA
MSN Messenger Service 8437C7E3-E073-4FDD-9832-300EF8E82334
Office 4289AE77-4CBA-4A75-86F3-9FF96F68E491
Servers E49D77BF-D5AE-4EC6-9DFA-D7A19DBA995E
Windows 38DF6AB1-13D4-409C-966D-CBE61F040027
Windows 7 166722F0-6926-4A78-82D5-CD021F777A70
Windows Defender F8F1C499-E587-48A5-AC81-164E850DCA48
Windows Embedded CE 6.0 F8AF6708-EDCB-472A-829D-F73D951C35A1
Windows Home Server 2191C786-5371-4F57-8C1F-9E8F052AC847
Windows Internet Explorer 5A8BB164-5FC3-4BE5-95BB-BA73EEED1CA6
Windows Internet Explorer 8 Beta FED6228C-C43B-4086-BF09-2986B9CE4610
Windows Mail ADC75B93-7900-4B86-A81A-9EFF90CD5D90
Windows Mobile 7C1FA894-B2C5-41BE-8D97-E145DD2A883B
Windows Server CA5543FC-6710-4F1F-BDEE-81C42361029E
Windows Server 2008 897417B3-FDD3-48B4-8C45-06CB93154874
Windows Vista 8D7DD8D7-1CA6-4632-BAEF-E7C0750ED02E
Windows XP Embedded 0E9673E9-22C4-471E-B967-7E7C17C1B4AE

Microsoft Software Inventory Analyzer breaks Internet Explorer

A post today on the IE support blog got me really curious. Apparently, if you install the Microsoft Software Inventory Analyzer, you lose print preview functionality. The culprit would be the fact that MSIA registers itself to use the .dlg file extension. Feeling unsatisfied, I decided to investigate further. I can confirm that it’s easy to reproduce and it affects more then just the print preview dialog.

Off the bat, as soon as MSIA is installed, not only will you lose the print preview dialog, but the about dialog mysteriously become blank. It also seems to affect rendering of text inside CSS styled textboxes. It certainly flat out killed Wordpress making all text appear white on a white background. I actually reproduced the issue on Windows 7 RC initially but managed to get the issue to reproduce in Windows XP, Windows Server 2003 and Windows Server 2008. I don’t have a Vista machine close by but I’d guess if 2008 was affected, so would Vista.

I can’t seem to pickup anything unusual with Process Monitor but I’d imagine that .dlg extensions are used by some internal mechanism of Internet Explorer. Considering that other software Microsoft makes also tends to benefit from Internet Explorer’s code, it wouldn’t be a surprise if other software that had HTML based rendering could be affected. It’s hard to believe that something so easily reproducible could get released publicly.

Anyone else care to install MSIA and see what else they can break?

Saving yourself from IE8’s Compatibility View

“Luke, I am your father.”

So now that Internet Explorer 8’s officially been released, it’s to be expected that plenty of users will be upgrading. Even if the common visitor to your site doesn’t immediately install IE8 like a panicked nerd who’s been waiting for his new Amiga, over the next three months the new version of Internet Explorer’s will be pushed out over Windows Update. At this moment, Net Applications reports that 67.44% of all visitors tracked are Internet Explorer users. thecounter.com reported seeing as much as 75% of it’s users as IE users. With such a significant share of Internet users using Internet Explorer, it’s only wise to ensure that your site development works well with the new version of Internet Explorer.

The one-button quick fix.

Microsoft has obviously learned from the past and didn’t want to swiftly speed down the road it’s taken in the past when releasing new versions of Internet Explorer. In the end, it was left with the chicken and egg scenario constantly facing new technologies and software. How do you move development forward and build a new platform to support new technologies (and fix broken already existing technologies) without orphaning the current significantly large user base that depends on what’s already been established? The solution the IE8 team came up with was Compatibility View.

Adding an easy access Compatibility View button tacked on to the end of the url box like a fancy revolving door, a quick click can force the rendering engine to use logic that’s similar to what Internet Explorer 7 previously used. It’s important to understand it does not make the Compatibility View button a sort of one-click IE7 as there are some significant changes that may still break a web page that would normally work just fine under Internet Explorer 7. It is, after all, Compatibility View inside Internet Explorer 8.

Bad dog. Sit.

The Compatibility View button may be a great thing for moving technology forward and still allowing visitors to view pages that appear broken correctly but it also raises an important question. Why is there a Compatibility View button in the first place? Does your site require it’s use? And what do users perceive while viewing a site that displays a compatibility button? The Internet Explorer team focused a lot of their attention on one of it’s most famous stigmas, standards compliance.

The Acid2 rendering test, which was so famously known as the yard stick used to compare browser compliance, was often at the center of debate for browser superiority. In the three years since the release of Internet Explorer 7, new browsers emerged, new standards were ratified and new technologies were developed. With a smaller market share and without the need to provide corporate legacy support, new browsers were quick to adapt and provide active support for all the new changes. This meant that more and more developers were deploying new sites focused around these new technologies and using a never ending spaghetti mess of Internet Explorer 7 (and sometimes Internet Explorer 6) workarounds.

“I’ll tell you how I became the prince of a town called Bel-Air.”

With the release of Internet Explorer 8, the team started fresh and has put together a new browser that is better, faster and more secure then any previous version. Full compliance with the CSS 2.1 specification means that the previously, sometimes endless, slew of Internet Explorer 7 specific workarounds are no longer necessary. This also means that the same markup will generate the same results between different browsers that are also CSS 2.1 compliant. Ironically, developers who thought they were going the extra mile to provide a uniform user experience between visitors by using Internet Explorer specific style sheets, meta tags and other various workarounds will soon discover that they’ve shot themselves in the foot.

It’s true that the standards that new browsers supported weren’t supported by Internet Explorer 7 and it’s true that you could get away with making things appear the same in all browsers with those workarounds, but it never meant that it was good development to do so. The Internet Explorer development team at Microsoft did what they needed to do to meet standards compliance. Now that it’s here, developers who didn’t use workarounds and simply limited themselves to using a subset of the standards that were supported by all browsers prior to Internet Explorer 8’s release will be rewarded.

Emulate your sanity.

If your site requires the use of Compatibility View to be navigated properly, then chances are you will need to spend more time testing cross-browser compatibility and find ways to offer functionality in a different manner. Where you want the bar to start will determine how many features you can use and will mostly be determined by the types of visitors your sites receive. Corporate customers or developers who write for specific targets may be able to raise the bar to recent browsers only while developers who tend to sites that serve the vast public may have to keep it as low as Internet Explorer 6. It is possible to write HTML, CSS and Javascript in such a way to support visitors using browsers as far back as Internet Explorer 5 while still providing standards compliance and cross-browser support for recent technologies, it simply requires more thought, testing and planning.

Once you’ve managed to develop, test and validate proper rendering and functionality between different versions of Internet Explorer without using version specific markup, the Compatibility View button will no longer have a need to exist when viewing your sites. Visiting a quick recap by the IE team, we learn that “use of the versioning <META> tag” will not display the Compatibility View button. Specifically, the X-UA-Compatible meta tag will allow you to set which rendering mode should be used viewing your page in Internet Explorer 8. If you’re fighting a losing battle trying to get your site to display correctly in IE8, setting the rendering mode to EmulateIE7 may be the only way to save your sanity.

Living on the edge.

If you’re quick to adapt, offer golden compatibility between browsers without workarounds and have simply no need for a Compatibility View button, then setting the X-UA-Compatible to Edge is the solution for you. Although Microsoft points out that it’s meant mostly for testing scenarios, it can be used to simply confirm to Internet Explorer that you want to have your site render in standards mode, regardless of it’s version. Forcing your site to render using a specific version of Internet Explorer may seem like a good idea at first except that doing so will also negate the need for keeping your code up to date, eventually falling into the problems that legacy support can bring. Let’s not forget also that setting meta tags to render to your site to a specific version of IE is no different then creating CSS spaghetti workarounds. It’s the same pasta with fresh sauce.

As for me, I prefer living on the edge and keeping my virtual pencil sharp, so you can bet you’ll be seeing <meta http-equiv=”X-UA-Compatible” content=”IE=Edge” /> at the top of my sites.

Internet Explorer 8 released today

In case you’ve missed it somehow, Internet Explorer 8 was officially released today at noon. The final build number is 8.0.6001.18702. Looks like neowin got it wrong again.

Setup packages are available for Windows XP (x86 and x64), Windows Server 2003 (x86 and x64), Windows Vista (x86 and x64) and Windows Server 2008 (x86 and x64) from Microsoft’s download site.

Windows Updates Downloader 2.40 Build 1299 Released

Another build of the Windows Updates Downloader, version 2.40 Build 1299, has been published.

Thanks to the user community for helping me identify a rare bug with the windows update agent. I’ve also extended the Update List specifications to support identification of the base service pack. This should go a long way towards clearing up confusion people had between the Windows XP Service Pack 2 and Windows XP Service Pack 3 update lists. This is also a small but necessary step towards detecting locally installed updates.

Windows Updates Downloader 2.40 Build 1275 Released

I just published a new build of the Windows Updates Downloader, version 2.40 Build 1275.

Mostly little improvements based on community feedback such as allowing the window to resize and removing coloring of alternating rows. I also fixed a bug with the checkboxes that required double-clicking instead of reacting on a single click. Not quite sure how that slipped through in the previous build. At least it’s fixed.

I’ve almost got installed updates identification completed. I’ve managed to plug right into the Windows Updates Agent with a bit of help from a secret agent I know. I’ve identified the active operating system and the processor architecture as well. Once I figure out how to detect the native operating system language (and not the active culture), I’ll be able to implement highlighting and checkbox selection based on installed updates.