Thursday, March 29, 2007

C# 3.0 inches towards Ruby

On Scott Guthrie's blog he talks about new features in C# 3.0. My first thought on seeing some of these is, "Gee, it's looking kinda Ruby-ish."
The new automatic properties get rid of
public string LastName {
get {
return _lastName;
set {
_lastName = value;
and replace with the much more succinct,
public string LastName  { get; set; }

Which is a backing into the Ruby attr_accessor function.

attr_accessor :last_name

The main difference is that in Ruby attr_accessor isn't part of the core language, it's just a helper function that anyone could add.
Also the new object initializers,

Person person = new Person { FirstName="Scott", LastName="Guthrie", Age=32 };

Look so similiar to the Ruby style of passing in a hash of values.

my_func (FirstName=>"Scott", LastName=>"Guthrie", Age=>32)

These are great new changes in C# as we travel towards the Ruby Way.

Microsoft Office Communicator

Being the big fan of Microsoft that I am (ahem), I've been pleasantly surprised with Office Communicator. Here at Innotech we've used Communicator instead of WebEx for over the wire demos and it works great, well mostly great. Sometimes the images lag, but overall it's been great. Watch out WebEx.

Death of the Busy Signal

While dailing the phone my daughter told me, "Daddy, there's this wierd noise on the phone."
I listened to her phone call and the wierd noise was a busy signal. It dawned on me that my little girl had been using the phone for years and never heard a busy signal. With rollover voicemail on all our relatives phones, we never hear busy signals anymore. A more loquicious blogger would make an analogy to how modern humans are now constantly in touch and never have down time and how it's destroying a sense of selfness and privacy, but that's not me. If you'd like to discuss this, call me and leave a message.

Friday, March 16, 2007

A Small Bridge Building Parable

A small county in rural Washington needed a bridge to span a creek for a new road. Joe, the county road supervisor, contacted the Redmond Bridge Company for a bid. The RBC rep, Bill, came on site and said, "Shoot, we can build a bridge here no problemo. It's all prefab so your road crew won't have to learn a thing except how to snap pieces together."
Joe contacted the Penguin Bridge Company for a second bid. Their rep came on site and said, "Yep. We can help you build a bridge here. We can teach your employees how to hot rivet and build it with our steel trusses."
Joe thought about it. He didn't want his employees to learn hot riveting. Joe thought snapping sounded easier. Joe just wanted a bridge, so he gave the contract to Redmond Bridge even though they were more expensive.
Soon massive steel trusses arrived in trucks. Joe's team started snapping them together. True to Redmond's word, that's all they needed to learn. Joe was so pleased he had selected Redmond. The bridge grew everyday. All were happy until Joe ran out of trusses with 20 feet of creek to still span. He called Redmond Bridge, "Hey Joe here. We've got the first 80 feet of the bridge done and it was easy, we just need the rest of the supplies to reach that last 20 feet. Can you have the stuff here in the morning?"
"Well," the Redmond rep said, " unfortunately we only make 80 foot bridges. I thought you knew that?"
Joe replied, "Well how do I finish the last 20 feet?".
The Redmond rep said, "Do you know how to hot rivet?"

The above story from some local newspaper in the Northwest (whose url escapes me at the moment) summerizes so much of my experience with Microsoft tools. They get you 80 percent of the way there and stop. At the end of the day, I have to learn all the stuff Microsoft was sheltering me from.
Yesterday I was setting up a batch build on our nightly build machine. The new MSBuild tool is great. It saved a ton of time until it got to my deployment projects, at which time it said,
"*.vdproj is not supported by MSBuild and cannot be built.". Hmmm. It will build all the projects except the one I need to actually deploy the code.
Microsoft, the 80 percent solution.

Tuesday, March 13, 2007

I finally GET POST

The little popup box in browsers saying "The page you are trying to view contains POSTDATA..." has always annoyed me. I just want to refresh the page, not be interrupted by a confirm dialog box. I even checked for firefox extensions to skip the dialog and just do the repost like the more friendly GETs. Now I realize how wrong I was. The dialog box annoyed me because it's my friend, and friends tell you things you don't want to hear to help you.
I used to think POSTs were used when the data being sent back to the server was bigger than could fit on a URL string, or you didn't want to spend the time url encoding a bunch of data. I now see how naive that was.
I came to this enlightenment late in my career through a little web site I'm building to learn Rails called
Kids submit their jokes and vote on other jokes by clicking an href link on the smiley/frowny faces. I was overjoyed in the first week with the terrific number of voters. Hundreds of votes were being cast. I ignored the fact that the average for all the jokes was something like 2.984 or 3.023. Then the sad truth dawned on me. Search engines were scanning the page and following each link and voting five times for each joke. This made the vote count high and the results close to the average of 3.0.
I needed a way to stop search engines from voting - that way is POST.
POST is not used for large data streams, but operations that are not idempotent. Idempotent basically means operations that can be repeated without altering the underlying data. If you refresh the front page of, no data is changed on the back end - it's idempotent. If you are buying a book and refresh, you can buy two books - that is not idempotent.
Simple hrefs and GETs are cool. GETs are fun. Links with GET allow the user to bookmark pages, search engines to index the page, and users to refresh easily. Only use POSTs when your data is not idempotent. Search engines know not to follow POSTs.
BTW, make the world a better place and share your favorite kid joke at

Friday, March 09, 2007

Free Audio Book Recordings

I've just started listening to "The Time Machine" at and am very impressed with the quality. Librivox organises readers to produce free audio versions of classic literature. You can pop them on your ipod (after creating a playlist for all the chapters in the correct order) and listen to great literature at your leisure.

Saturday, March 03, 2007

Why do gas pump prices fall so slowly when crude falls?

gas prices
I often hear people complain that gas station owners jack the price of gasoline immediately when the price of crude rises, but slowly lower the price when crude falls.
Why is that? Why can they get away with lowering prices so slowly. I'll tell you why.
American consumers are lazy.
Look at the photo above. The closer Shell station is selling gas for $2.30 and the adjacent Chevron is at $2.31. Oddly, the Chevon had three cars filling up and the cheaper Shell station had only two. I've seen these two stations which share a parking lot vary by three cents. How can the price vary so much between two adjacent stations, when Adam Smith's invisible hand tells us that people would flock to the cheaper price? It's because the gas station owners know that the American car driving public are slothful creatures of habit. We will fill up at the same station regardless of the price - we are just too lazy to look out our windows, compare the prices and do a subtraction.
If you want gas stations to lower their prices faster, ruthlessly seek out the best deal in town. This will force the owners to be competitive. As it it now, the owners think we are just herd animals - and they are right.

(BTW, all the gasoline at these stations come from the same pipeline. Shell puts in 300,000 gallons in Houston and draws out 300,000 in New York, but it's not the same 300,000, it's just the same amount. So Shell could be pulling out gasoline put in the pipeline by Chervon. OK, the companies add their own additives just before taking the gas to the station, but big deal, it's just gasoline.)