Month: December 2007

If you have never used Rails, I highly recommend giving it a try and using its scaffolding and then trying ASP.NET Dynamic DataScaffolding and coming to your own conclusions. 🙂

By the way, MonoRail has had Scaffolding a number of different ways in the past. For a while, it was entirely reflective, like Rails 1. Then that fell out of favor and a generator was used instead, like Rails 2. The current state of things (I think) is that a different generator than the original is now used, and the reflective scaffolding has been resurrected through refactoring.

I have to say I’m a little surprised at my own list of books that changed my life. I’m also disappointed by how short it is, but I guess I just haven’t read that many life changing things.

Not life changing, but definitely entertaining are John Scalzi’s Old Man’s War and the sequel The Ghost Brigades. I finally read The Ghost Brigades last week and IMO it is every bit as good as the first.

I received requirements from a customer that said something about Least-Squares Regression something or another. Having not looked at anything but the most elementary statistics since around 2001, I realized that I needed to refresh myself.

I did some background reading and played with LINEST in Excel (that is a whole ball of insanity : http://support.microsoft.com/kb/828533 ). Tonight I decided to implement something in C#. Even if I don’t use it for this particular client, I will have a better understanding of what I am doing.

First, I asked my wife for help. As a biologist and geneticist she is more trained in statistics than I am. She didn’t know off the top of her head, but she pulled out her book which I then dove into.

The issue isn’t that Visual Studio 2008 (VS2k8) has “sweet compiler sugar that allows you to use the new language features in .NET 2.0, 3.0 or 3.5”.

VS2k8 is ALWAYS using the C# 3.0 compiler. PERIOD. done.* C# 3.0 code ALWAYS compiles down to IL which will run on the 2.0 runtime (there is no newer runtime).

So the “2.0, 3.0, 3.5” combo box is really just a filter for what assemblies you reference. Have you referenced WPF? Then studio (msbuild) will warn you that this is not a 2.0 target, and to use 3.0. Trying to use LINQ or something else from System.Core? You will get a warning to use 3.5.

I’ve done this, and I was (like the igloo coder) a little surprised at what I saw. Then I went and clicked “3.0” and things worked. But it was just an assembly reference that did it. It is nice if you have to deploy to Windows 2000 servers or workstations which only have 2.0 runtime and cannot move to 3.0, or if you target XP machines which can’t install 3.0 or 3.5. But it isn’t the ultimate in 2005 to 2008 migration for which some of us were hoping.

What is a bummer is that all the nice languages features such as auto properties and use of ‘var’ will not ever work in VS2k5. So even though the project format is portable, its a bit useless. This bit me too. I had left a project set at 2.0, and I just started coding in 2008. That damn ‘var’ implicit typing just saves on keystrokes so much that I use the heck out of it. The next day I openned up the 2k5 solution, which openned the same project and now my project didn’t compile. OOPS. Luckily I hadn’t defined any new types using the nice property syntax. I would have cried given all the extra typing I had to do. My fingers hurt from this rant.

* Ok, so ASP.NET can be told which compiler to use, but arguably that isn’t VS doing the compile then, it is ASP.NET doing the compile. Maybe there is an MSBuild target which I can specify which will let me use the old 2.0 compiler so that my use of ext methods, var and property syntax is caught?

I don’t make the choices that David makes regarding free software. I’ve been using Linux for over 12 years now. I like it. It does a lot of things really great. I run Windows Vista on my laptop. I like it. It does a lot of things really great.

I write code in C# and boo for the .NET platform because I feel that .NET is the best development platform in existence today. This means that in the Linux world, Mono is the best development platform in existence today. My choices are purely personal based on my understanding of the underlying technology. If something were to come out which gave me compelling reason to change my mind, I would develop using that other thing.

That other thing is not Ruby, Python, D or any variants. That other thing doesn’t run on the JVM.

I’m going to go double check some boo code which I run using Mono now. Thanks.

Intellisense is great, but it is no substitute for reading documentation. I’m always upset when I hear developers say that their primary source of learning is looking at what intellisense offers them.

There are a few methods which can be considered part of LINQ, which aren’t extension methods. This means that unless you actually type out Enumerable, you will never see then in intellisense. The nature of extensions methods means that you won’t ever type out enumerable, so these methods are less discoverable than others.

System.Linq.Enumerable is where the library implementation of LINQ to objects lives. Empty, Range and Repeat methods are hand tools.

Empty is useful for those cases when you don’t want a null object, but instantiating an Enumerable is wasteful. For example, creating a new empty List of string to pass to a linq expression when some other data source may return null or empty. I’m thinking of combining linq expressions here. The anti-wasteful programmer might say “well, just use a new empty string array”. And that programmer would be right. This would use less memory than a new List. But the really nice part about Empty is that its underlying implementation is just a generic singleton based on type. That means instead of 1000 or 100,000 “new string[0]” in your code, eating up a tiny bit of ram (ok, its pretty small here, I know, but doesn’t every little bit help?) you have only one empty string array that all cases can share.

Range should be familiar to anyone coming from python. It just returns an enumerable range of numbers from start to end. IMO it isn’t as nice as pythons, but I can always write my own. Still not clear? Here is how you would write a summary from one to one hundred million of n-1 + 1/i.