www.jlion.com

Wednesday, November 22, 2006

Web Services are really cool (duh!). I've been playing around a bit with them lately, and created a web service for making outbound telephone calls. It worked fine from within our network but when I posted it to a remote server as a test, I started seeing this error message:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

I was mystified but a little research soon cleared up the mystery. It seems that there is a property called "keepalive" that is enabled by default with the System.Net.WebRequest object to enable NTLM authentication. When I disabled this property, the error messages went away.

Here's a microsoft knowledgebase article that explains this in more detail:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;915599

To disable the property, the proxy class for the web service must be inherited and the webrequest method overridden as shown in this snippet from the knowledgebase article:
Class MyTestService
Inherits TestService.TestService
Protected Overrides Function GetWebRequest(ByVal uri As Uri) As System.Net.WebRequest
Dim webRequest As System.Net.HttpWebRequest
webRequest = CType(MyBase.GetWebRequest(uri), System.Net.HttpWebRequest)
'Setting KeepAlive to false
webRequest.KeepAlive = False
GetWebRequest = webRequest
End Function
...
End Class

Monday, November 13, 2006

Recently I've been working on some DotNet components intended to be reusable. I've gotten the components to a point where I believe they are solid and now wanted to create some nice documentation for them, something like what's done for the Java or DotNet class libraries.

My initial thinking was to do something with XML, but Microsoft did something with Visual Studio that is just awesome. It turns out that it is possible to add embedded XML comments into the source that are automatically picked up by the object browser and which with a utility called "SandCastle" can be turned into very slick MSDN-style HTML documentation.

The embedded XML comments are automatically added by the C# Visual Studio editor, but if you're working in Visual Basic.NET (like me) then you will need the VBCommenter PowerToy, The VS 2005 SDK (includes the HTML help compiler), the SandCastle compiler, and this great SandCastle GUI.

It's very cool how easy the process of generating documentation is with these tools.

Tuesday, November 07, 2006

In today's Washington Post, there's an article about how get-out-the-vote automated outbound calling systems are annoying and alienating voters. Someone in my office offered the opinion that this could quite likely lead to some kind of legislation. I think this will most likely take the form of poltical calls being added to the class of calls governed by do-not-call lists.

Monday, November 06, 2006

These folks were mentioned in a New York Times article today on outbound vote solicitation. The article states that up to two million calls were made to households in Maryland using software that uses voice recognition to ask leading questions that promote a republican candidate for governer. I wonder if they're using Microsoft Speech Server?

On another topic, I found a workaround for a problem with the dotnet measurestring function that has been a persistant thorn. This function is intended to return the dimensions of a given string with a specified font as a SizeF object. The width value of the result is often much larger than the string when displayed on screen, however there is a workaround that provides for much more accurate results: Set the TextRenderingHint property of the Graphics object is set to TextRenderingHintAntiAlias. A knowledgebase article that explains why this works is available here on the Microsoft web site.

Thursday, November 02, 2006

Each day the bad news from Iraq dribbles in. An IED kills three reservists, or one marine is killed in action. We know the news is bad. However like the frog that doesn't struggle when the water is heated around him we don't get a sense of the growing intensity of the conflict. It doesn't seem like the same sort of war that we fought in Vietnam, or in Korea, or in World War II. In fact, it doesn't seem like a war at all. Where are the grand battles, the enemy armies, the complicated tactics?

When we see a list of news reports of fatalities listed day by day for months (such as the one maintained here the reality hits us like a brick. It is a war. Why are these people dying? The answer seems to be something out of a Stanley Kubrick or Terry Gilliam movie. A bureaucratic mix-up leads to an invasion based on incorrect assumptions and once the invasion has been launched and the mix-up exposed the soliders can't be called home because doing so would be political suicide in upcoming elections.

What a sad, sad world we live in.