.NET, Archive, Software Design

A Generic Error Occurred in GDI+

Jason / October 14, 2008

You know you’re doing good when your application crashes with an exception as detailed as “a generic error occurred in gdi+”. That is about as, well generic, as it gets :- )

In my particular case I was constructing an Image down in my DAO using the FromStream method, like so:

Image result;
using (FileStream file = File.OpenRead(filename)) {
	result = Image.FromStream(file);
	file.Close();
}
return result;

I was doing this so that I could know for a fact that the file was being disposed of properly. I didn’t want to have any orphaned file references locking up the file in case I later needed to delete it.

The problem was that up in my UI I was attempting to call the Save method on Image to dump its contents out to the ASP.NET response stream, like so:

img.Save(HttpContext.Response.OutputStream, ImageFormat.Jpeg); read more

.NET, Archive, C#

Silverlight Progress Bar

Jason / October 13, 2008

Silverlight 2 provides an attractive platform for creating Rich Internet Applications, however when first getting started both the oddities of the layout model and the strange absence of certain controls and class and be puzzling.

One such puzzling absence from the Silverlight tool chest is a progress bar control. WPF has a progress bar, WinForms has a progress bar, but not Silverlight. Fortunately implementing one is not that hard and provided a great introduction to Silverlight’s layout model.

Silverlight and layers

Unlike ASP.NET, and many other forms technologies, Silverlight uses a multiple layer positioning system. The Canvas control is especially useful for allowing multiple controls to be layered.

Take for example this simple block of XAML:

<Canvas x:Name="LayoutRoot" Background="WhiteSmoke"> <Rectangle Width="60" Height="60" Fill="Green" /> <Rectangle Width="60" Height="60" Fill="Gray" /> <Rectangle Width="60" Height="60" Fill="LightBlue" /> </Canvas> read more

Archive, Virtualization

Vista Can’t Read CDs

Jason / October 6, 2008

I recently encountered a strange problem on my Vista (Home Premium x64) machine, in which Vista seemingly forgot how to read CDs. I would place a factory printed CD in my DVD-RW drive and Windows reacted as if it was a blank DVD-RW by asking me to supply a volume name. read more

.NET, Archive, ASP.NET, aspNETserve, C#

Community Coding Contest

Jason / October 1, 2008

Developing an open source project is a very rewarding experience. But sadly (as an open source developer that is) open source projects rarely get the feedback they deserve. Often the developers only hear feedback from their users when their software is broken, because of this it is often difficult to know when an author’s work is truly appreciated. read more

.NET, Archive, ASP.NET, aspNETserve, C#

aspNETserve 1.3: What’s New

Jason / August 19, 2008

As I mentioned in my last post, aspNETserve 1.3 has just been released. And with it comes some exciting changes. Here is an outline of some of the most notable changes:

HTTP Persistent Connections

aspNETserve’s goal is to target version 1.1 of the HTTP protocol, and prior to version 1.3 of aspNETserve it had an obvious shortcoming in that goal. It did not even attempt to keep “Keep-Alive” (aka, persistent) connections around. The server naively closed the connection after each request.

The new aspNETserve.Server object in version 1.3 has full support for persistent connections, and with it introduces a couple of new properties:

MaxConnections

This property represents the maximum number of simultaneous connections allowed. Once the maximum amount has been reached additional requests will be declined.

KeepAliveRequestTimeout

A period of time (in milliseconds) that aspNETserve will wait for subsequent communications on a previously established connection.

Windows Service Server

A Windows service called aspNETserve.Ice (pun intended) allows aspNETserve to process requests in the background. Additionally, this allows request processing without a user having to first login and launch the SimpleServer UI.

aspNETserve.Ice reads it configuration from an XML file whose schema is define on the wiki page ConfigSchemaOverview.

Here is a simple example of what the XML file looks like:

<?xml version="1.0" encoding="utf-8"?>
<server xmlns="http://aspnetserve.googlecode.com/svn/tags/Release%201.3/aspNETserve/Configuration/Xml/aspNETserve.config.xsd">
        <application physicalPath="c:\temp">
                <domain name="www.example.com" virtualPath="/" />
                <endpoint ip="127.0.0.1" port="80" />
                <endpoint ip="127.0.0.1" port="443" secure="true" />
        </application>
</server>
read more