November 2006 - Posts
I love the snow, but I'm stuck here in Australia with our drought.
I am appreciating the photos that people in Seattle are posting this morning though.
Ok, so it finally happened. I am
no longer spam free even with the CAPTCHA. As I write this, someone thinks it is a good idea to waste their time and mine by entering spam comments through the CAPTCHA. Well, now you have to register. Have fun.
Apart from the dash design, there is something else I find interesting about my new car. I occasionally get small static electricity shocks from the drivers door window when I get out of the car. I am assuming that this is because of the tinting on the window. I've never had electric shocks from plain glass before so I am guessing that glass doesn't conduct electricity, or at least not well enough to create an electric shock.
Anyone else experienced this before?
Here's a little tip. If your databound control is not firing it's databinding, make sure that the control and all of its parents are visible on the page. If it isn't visible, OnPreRender doesn't fire and therefore your databinding won't either. Makes a lot of sense. There is no point having the overhead of databinding if you are not going to display anything. That just wasted a couple of hours on a really simple mistake. 
Don't worry Dave, your implementation is still gold! Check this one out though.
My lease was just about up on my car. I have had an Impreza RS for the last three years and it has been an amazing car.

After looking at the finances and getting a good deal, I upgraded (couldn't resist!).

Other than the obvious difference being the addition of the cop magnet, there are more subtle differences between these cars. One of which I find quite amusing.
This is the dash of the RS.

This is the dash of the WRX.

It seems that in a WRX, the speedometer was a distraction so it was moved to the side to make room for more important matters - engine happiness. Crazy...
Microsoft have just announced the RTM date of Visual Studio Team Edition for Database Professionals (aka DataDude). November 30 is the date. To me that seems like a really quick development of this great product. Great work guys.
Via Matt Nunn.
I have been having this interesting problem with my Community Server build. Each time the server reboots (usually due to a Microsoft update), the first time a request goes through to IIS, it gets this error (see the attached file for more details).
[SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +437
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
CommunityServer.Data.SqlCommonDataProvider.LoadSiteSettings(String application, Int32 settingsID, Boolean returnAll) +275
If I then log in and run IISReset, the database connections will be up and running again. I'm stumped.
Visual Studio has this really nice setup page when you first run it after install where it asks you what kind of development environment you are familiar with, such as VB, C++, General etc etc. This is really cool, but not so cool when you pick the wrong one. Anyone know how to get prompted with this page again? There are no obvious registry entries that I can tweak.
Hey, don't bother answering. I just figured it out. The import/export settings dialog allows you to reset the IDE to one of those values. Go to Tools -> Import and Export Settings -> Reset all settings -> No, just reset settings, overwriting my current settings and then select the IDE style you want.
The using statement in the .Net framework is a really good way of neatly using and disposing of an object in your code. It is certainly much more elegant than having Try/Catch/Finally blocks where you manually dispose of your objects. I do however have a minor issue with nested using statements. I can't put my finger on it, but it just doesn't seem that 'right' to me. Maybe it just looks ugly.
The following is an example taken from John Papa's latest Data Points MSDN Magazine article:
using (TransactionScope ts = new TransactionScope())
{ using (SqlConnection cn2005 = new SqlConnection(cnString))
{ SqlCommand cmd = new SqlCommand(updateSql1, cn2005);
cn2005.Open();
cmd.ExecuteNonQuery();
}
ts.Complete();
}
As far as the messy look of it goes, I know that you can also do the following.
using (TransactionScope ts = new TransactionScope())
using (SqlConnection cn2005 = new SqlConnection(cnString))
{ SqlCommand cmd = new SqlCommand(updateSql1, cn2005);
cn2005.Open();
cmd.ExecuteNonQuery();
}
ts.Complete();
I have some vague recollection that someone had a problem with this way of coding the using statement.
Has anyone come across any best practices with regard to nested using statements?
I got hit with an issue yesterday when the local path of a file in TFS had a length greater than 260 characters. I couldn't run a Get Latest and the IDE also seemed to hang on opening other projects. It reminded me about a situation a couple of years ago when I hit this same issue using longer paths in the framework.
Using reflector, I can see the following code in quite a few places in the framework.
if (num14 >= Path.MaxPath)
{ throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong")); }
Path.MaxPath references a constant that has a value of 260. The exception returns this information:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Wikipedia has some interesting comparisons of file systems and Microsoft also have some file naming information on MSDN. Being a developer for the Microsoft platform, the main file system of concern to me is NTFS. Under NTFS, the maximum file name length of 254 characters + "." and a maximum pathname length of 32,767 Unicode characters with each path component (directory or filename) up to 255 characters long. Just for interest, FAT32 is 255 bytes for the maximum filename length and apparently unlimited for the maximum pathname length.
So the file systems we typically use with .Net and Windows support long paths. Why is it that the .Net framework and TFS won't allow them? Being limited to 260 characters for the entire path seems ludicrous when the limitation seems to be each part of the path has to be a maximum of 255 characters.
According to Eric Lam, there should now be a massive flood of blog entries about Vista going RTM. Waiting, waiting, waiting...
Have you ever needed to have nested databound controls using multiple ObjectDataSources, where the nested ObjectDataSource has a select parameter that requires a databound value itself?
You have no doubt tried the following:
<asp:ObjectDataSource ID="odsCountry" runat="server" SelectMethod="GetCountry" TypeName="CountriesBLL">
<SelectParameters>
<asp:Parameter Name="countryCode" DefaultValue='<%# Eval("CountryCode") %>' />
</SelectParameters>
</asp:ObjectDataSource>
If you try this, you will get an error that says:
Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.Parameter does not have a DataBinding event.
So you can't bind to your value to the parameter. There is a really simple way around this. Redirect the bound value through a control that does support databinding.
<asp:TextBox runat="server" ID="txtCountryCode" Visible="false" Text='<%# Eval("CountryCode") %>' />
<asp:ObjectDataSource ID="odsCountry" runat="server" SelectMethod="GetCountry" TypeName="CountriesBLL">
<SelectParameters>
<asp:ControlParameter Name="countryCode" ControlID="txtCountryCode" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
By doing it this way, the containing ObjectDataSource will provide the required value to the TextBox which is not rendered to the browser. The nested ObjectDataSource that requires the databound value can then obtain the value from the TextBox using a ControlParameter. Easy
.
I have read in a lot of blogs this morning about how Office 2007 has gone RTM. This is kinda cool, but obviously the announcement of Vista going RTM is much more interesting (to me at least). As a precursor to the Vista release, I have just come across this post that has the exciting news that NetFx has now gone gold. Sweet!