Archive for the 'Software Development' Category

Application Configuration Error Converting to .NET Framwork 2.0

Tuesday, May 20th, 2008

I converted an old console app from .NET Framework 1.1 to 2.0 using Visual Studio 2008. When I ran it I got the following helpful error message

This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

Looking in the Security Event Log I found the following messages:

Generate Activation Context failed for C:\ParsII\bin\server\CCSWinService2.exe. Reference error message: The operation completed successfully.

Syntax error in manifest or policy file “C:\ParsII\bin\server\CCSWinService2.exe.Config” on line 1.

The last one was the key. In the app config file the first line was

<?xml version="1.0" encoding="Windows-1252"?>

That should be perfectly legal for an XML file, but deleting it caused everything to work perfectly.

Flashing the Windows Taskbar Button Forever

Monday, May 12th, 2008

Raymond Chen explains in detail how to be a jerk.

Stylesheet Changes

Sunday, March 23rd, 2008

After testing the site with Safari for the first time I ended up making some massive, long-overdue changes to the stylesheet, which hopefully will allow things to display better in more browsers and screen resolutions.

In particular I eliminated the use of pixel metrics, replacing it with logical sizes (inches and points.) I also reduced the dependence on bitmap images for formatting and fixed some malformed relative URLs, which Firefox and IE handled correctly but Safari didn’t like.

If the site now looks WORSE in your browser, let me know what your configuration is and I’ll see what I can do.

Grace Hopper’s “Bug”

Friday, March 14th, 2008

“Robert X. Cringely” (Mark Stephens) repeats and debunks the story the Admiral Grace Hopper invented the term “bug” (refering to computer problems.)

Actually I’m pretty sure that she never intended to claim that she invented the term. That is a misunderstanding imposed by others. She just said that she found “the first genuine computer bug,” meaning the first bug that was actually an insect.

Visual Studio 2008 Quirk

Wednesday, December 12th, 2007

If you try to debug a web application and get the message

You are not authorized to view this page
HTTP Error 403 - Forbidden

It probably just means that you forgot to set a startup page. Earlier versions of Visual Studio gave a more helpful error message.

Configuring IIS for HTTP GET

Monday, October 22nd, 2007

I recently ran into some frustrating problems doing something that ought to be really simple: setting up a directory on IIS so that the files could be downloaded with a HTTP GET. Some files would work fine; others would get a 404 error (NOT FOUND).

Here’s a checklist of possible configuration problems:

  • Right-click on the top IIS Manager node, select Properties and press the MIME Types button. Make sure a MIME type is defined for the file extension.
  • Click the Web Service Extensions node and make sure there is no web service extension defined for that particular file type. If there is IIS will try to pass the file to it rather than download the file.
  • If the file is executable (.dll, .exe, etc.) bring up Properties for the web application, select the Home Directory tab and make sure Execute Permissions is set to “Scripts only”. (NOT to “Scripts and Executables”.)

Server Configuration Problems with WCF

Monday, October 22nd, 2007

If you have started developing web services with Windows Communication Framework (WCF) you will no doubt have noticed that it is cleaner and more powerful than the old ASP.NET framework. However there are some hidden pitfalls. In particular WCF is a lot more finicky about how the web server is configured. If you aren’t careful this can cause code

that works in your test environment to mysteriously fail when moved to production. Here are some pointers on how to avoid these problems.
(more…)

[Censored]Sweeper

Thursday, September 20th, 2007

via Raymond Chen, David Vronay describes the travails of producing a version of the classic Minesweeper game for Windows Vista, subject to the restriction that it mustn’t offend anybody. I’m not sure whether this is good customer service or political correctness run amok.

Microsoft’s FxCop Rules

Friday, August 10th, 2007

David M. Kean lists the rules that Microsoft considers mandatory for internal development.

Handling XML dateTime fields in .NET

Friday, June 22nd, 2007

The XML xs:dateTime format specifies that the date and time must be passed in ISO 8601 format. Also you will probably want to pass it in a time zone-independed way. The easiest way to do this is to covert the date to UTC (a.k.a. Greenwich Mean Time or “Zulu”). This can be done as follows:

public const string ISO_UTC_FORMAT = "yyyy-MM-ddTHH:mm:ss.sZ";
DateTime date;
XmlWriter w;
String s = date.ToUniversalTime().ToString(ISO_UTC_FORMAT);
w.WriteString(s);

The other thing to be careful about is never to use XmlReader.ReadElementStringAsDateTime() to read this data. At least in Framework 3.0 (an probably earlier) it will IGNORE THE TIME ZONE INDICATOR. Instead use

XmlReader r;
DateTime dt = DateTime.Parse(r.ReadElementString());

The standard DateTime.Parse() handles the ISO format correctly.