Monday, October 31, 2005

one-to-one mapping bug in NHibernate

I just filed a bug with one-to-one mapping using foreign keys with NHibernate that at least affects version 0.9.1 through 1.0.0. 

If you like one-to-one mappings, please visit the bug, download the
test case (which is a VS 2005 test project) and run it.  Evaluate
it for yourself and if you agree that it is a bug, please vote on it in
NHibernate's JIRA.

Updated 11/21/05: This bug has been fixed and closed.  Thank you, NHibernate team!

Enabling log4net in .NET 2.0

I am just getting into using log4net, and for the most part I like what I see.  It works with .NET 2.0, but it has a couple of gotchas that do not seem to be documented anywhere.  Here they are:

For ASP.NET 2.0 web sites, since there is no longer an AssemblyInfo.cs file, enable log4net by telling it to search the Web.config file for the appender configuration inside Global.asax:

protected void Application_Start(Object sender, EventArgs e) {

For .NET 2.0 class libraries, test projects  and applications, call this same method where your application starts, or in some static method for your test project or class library.

Not a fan of scripting languages

Let me first be clear, that I am not a fan of scripting
languages.  They certainly have their place, but I would never
write an entire application with one.  I wouldn't even write anything that amounts to more than a macro.  I need compile-time errors.  I hate making typos and never finding out about them until runtime, or never.  [6/7/06 update: I feel better about them lately, and might write much more than a macro.]

That being said, among scripting languages I think Ruby rocks! 
The object-oriented nature of it permeates every element.  Even a
fixed number has methods.  Every object is extensible at runtime
as well, and mixins are brilliant.  Not everything about Ruby is
great (it is a scripting language, after all).  But it's cool
enough that I use it here and there.  So I'll blog about the
lessons I learn and the stuff I create.

Lately I've been  working in an embedded Linux lab, writing
software to drive a car with gizmos on it to collect colored balls and
drop them into a goal.  The lab material suggests C.  I
started with C#
, and it worked great.  The problem is that even
though my code was more readable and object-oriented, it turned 20 line
C program into 60 lines.  Sure, most of those lines were reusable
libraries, but I thought it would be hard to sell my teammates on the
larger codebase. 

Then I tried it in Ruby.  I found that the libraries just looked
smaller.  No compilation was necessary (on an embedded system,
that's convenient for debugging when no compiler is on board). 
The biggest boon was the interactive interpreter so that code could be
run on the fly.  So Ruby is how I'll finish this lab.  Cool.

Sunday, October 30, 2005

Community Server is now running

I have been using Blogger to manage my several blogs up to now.  It is really a great engine, but I find I want a little more control and flexibility, so I am moving to Community Server, because it is built on ASP.NET, is free, and comes highly recommended.  Now that it is installed, I realize it is really a massive system that I understand very little of.  Even figuring out how to create this first post was much more difficult than I expected.  There is no tutorial (that I have found) so I have done a lot of poking around to find it. 

As I said I have a few blogs already.  I am in process of copying all the content to this server.  It's somewhat tedious, so the content will appear over time.  The most useful content (on this blog) is already copied over.