Archive for the '.NET' Category

String Formatting FAQ

Friday, September 28th, 2007

My String Formatting in C# article has been one of the most popular on this site for the last two years, and it’s received dozens of comments, many of which were formatting questions or answers to formatting questions. This article is a round-up of those comments – all credit to the original commenters, whose comments […]

Bjarne Stroustrup on C++/CLI

Tuesday, August 22nd, 2006

I hadn’t seen this before; Bjarne Stroustrup’s FAQ has an entry that describes his position on C++/CLI.  It’s worth reading. In a nutshell, he acknowledges that to use the BCL and write .NET classes in .NET you need language features that C++ doesn’t have.  So you need something like C++/CLI. But he also makes it […]

CRegKey::QueryStringValue

Thursday, May 11th, 2006

Seriously, who decided that MFC’s CRegKey::QueryStringValue should return a LONG instead of a CString?  It’s an MFC class.  MFC has a string class.  The purpose of this function is to query a string.  Why do I have to pass in a buffer and a buffer size?  Why can’t it just return me a string? I […]

Parameterized Queries in HQL

Monday, January 16th, 2006

NHibernate supports parameterized queries but unless you go looking in the Java documentation it’s not obvious how to do it.  Turns out it’s really simple: IList results = _session.Find(“from MyAssembly.MyClass as MyClass where MyClass.Foo = ?”,     tagText, TypeFactory.GetStringType(64)); You can pass in arrays of objects and types for the last two parameters if you have […]

NHibernate

Saturday, January 14th, 2006

“Learn NHibernate” has been on my todo list for a while now, and I finally spent some time doing it today. I must say I’m impressed.  The folks who ported Hibernate from Java to .NET did a good job of making it feel like a first class .NET library, and not just a port.  This […]

BackgroundWorker

Thursday, December 22nd, 2005

I just had my first opportunity to use the BackgroundWorker object, and I must say I’m very impressed. Part of creating a user interface is separating the work from the UI thread, so that the UI can remain responsive and report progress while a long operation is running.  This isn’t rocket science, but it is […]

Forms Authentication and Shared Domains

Friday, November 18th, 2005

I have a number of sites that I’m running on the same domain.  I started the Ottawa Events site, and a friend of mine wanted to do a similar thing for Brantford, London, and Woodstock, so I set up a domain for that and have all four of these virtual sites configured in IIS as […]

Mono Status ’05

Thursday, November 17th, 2005

Miguel posted a great Mono status report. If you’re interested in cross platform .NET have a look.

Invalid Use of Default Parameter

Wednesday, November 16th, 2005

If you get this message:  ERROR [07S01] [Microsoft][ODBC SQL Server Driver]Invalid use of default parameter It means you tried to insert a row with a null value in a column that doesn’t allow nulls.  Bad message.  

Data Access using TableAdapters

Tuesday, November 1st, 2005

I just posted an article on accessing databases using the TableAdapter object in VS 2005. It’s mostly for my own reference in the future but maybe others will find it useful.