Monday, October 04, 2010

Windows 7 Phone Development

Well, I'd like to win a free phone, so as Scott Hanselman says on his website, here's my attempt to win a phone with almost no effort ;-)


Here's to winning.

Friday, March 27, 2009

Google Voice

I'm setup with Google Voice now. It's a very nice service. I think it's going to radically transform how the phone works. As a simple example, try giving me a call with the enclosed Google Voice gadget I've just put in the side panel. It will call your phone, then connect back to me via their servers. A nice way to provide connectivity without having to advertise your number. I can't wait to see the pricing for this service. It obsoletes normal voicemail (since it provides a decent transcribed version of the voice mail). The management of voicemail is the same as email is in gmail.

Wednesday, January 07, 2009

NHibernate.MappingException: Unknown entity class

I spent an hour finding and fixing a problem that should have been much faster last night. This post is to make sure I don't forget what I learned :-) I’m experimenting with NHibernate, and specifically the FluentNHibernate functionality. I was trying to get a test running, and I kept getting the error: “NHibernate.MappingException: Unknown entity class BLAH” (where BLAH was the persistable class I was building) during the mapping setup of the test.

I dug all over the place (assuming I had a typo in a namespace or some other stupid thing like that), and couldn’t find the problem until I ran Reflector on the assembly that held the mappings. Only then did I notice that the mapping class was grayed out (in other words, I’d failed to make the map public -- in fact when I created the class, I failed to set accessibility at all so it was set to the default accessibility of internal). Once I set access to the class to public, the test ran as expected, and I was able to finish setting things up.

  public class BLAHMap : ClassMap<BLAH> {

    public BLAH() {...}

  }

I’m sure this is in the docs somewhere, but the bottom line is: don’t forget to make mapping classes public. The other takeaway from this is that it’s good to have multiple ways of looking at something – reflector showed the problem because it had a different way of displaying information that wasn’t visible just by looking at the editor.

Tuesday, June 10, 2008

Live Writer Test Post

Microsoft just released a technical preview of the newest version of Windows Live Writer.  Since this has a couple of features I’ve really been looking for, I’m going to try it out.  If it works well, I’ll start using it for all my (very infrequent) posts.  I apologize in advance for all the random content – I just want to try out the new features to make sure they work how I want them to.

Here’s a picture:

IMG_2049 

Here’s a table:

Heading 1 Heading 2
Row 1 Column 1 Row 1 Column 2

Here’s a map (our old house in Tucson):

Map image

Here is a video:

Emily's Birthday

Here is a code snippet:

   1: using System;


   2: using System.Collections;


   3: using System.Reflection;


   4:  


   5: namespace ExternalDSL {


   6:   public class DslExecuter {


   7:     private readonly Hashtable parameters = new Hashtable(StringComparer.InvariantCultureIgnoreCase);


   8:  


   9:     public void AddParameter(string name, object parameter) {


  10:       parameters[name] = parameter;


  11:     }


  12:  


  13:     public object Invoke(ActionExpression expression) {


  14:       object obj = parameters[expression.Left];


  15:       if (obj == null)


  16:         throw new InvalidOperationException("Could not find parameter with name: " + expression.Left);


  17:       MethodInfo method =


  18:         obj.GetType().GetMethod(expression.Operator,


  19:                                 BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public);


  20:       if (method == null)


  21:         throw new InvalidOperationException("Could not find method operator " + expression.Operator + " on " +


  22:                                             expression.Left);


  23:       ParameterInfo[] methodParams = method.GetParameters();


  24:       if (methodParams.Length != 1)


  25:         throw new InvalidOperationException(expression.Operator + " should accept a single parameter");


  26:       object converted;


  27:       Type paramType = methodParams[0].ParameterType;


  28:       if (paramType.IsEnum)


  29:         converted = Enum.Parse(paramType, expression.Right, true);


  30:       else


  31:         converted = Convert.ChangeType(expression.Right, paramType);


  32:       return method.Invoke(obj, new object[] {converted});


  33:     }


  34:   }


  35: }




Wednesday, May 14, 2008

The Immense Value of Failure

A number of years back, I had the (dis)pleasure of developing software that had to interface with systems managed by a remote team that was paralyzed by the fear of failure. There was so much fear over making any wrong decision, that failure was guaranteed. The desire to “not be wrong” drove intense “Big Design Up Front” (BDUF) discussions and over-large meetings to “build consensus” and “get buy-in” that slowed progress to a crawl on good days, and moved the project backwards on the (frequent) bad days. It made even trivial decisions painful. This delayed the project to the point that it was eventually cancelled. The desire to not fail had let to failure.

I can see two root causes for this problem:

  1. A Dysfunctional Work Environment: Anyplace fear is a major behavior-inducing factor.
  2. An Incorrect View Of Mistakes: A belief that being making any wrong decision will cause permanent harm.

I’m only going to talk about #2 today – I’ve had several thoughts about this subject. #1 would be a topic for another article, but it’s not what I’m interested in right now. My premise is that just about every “good” thing we have in the world today came about because of a whole bunch of mistakes. For every system we have that works well, there are a nearly infinite number of them that failed for some reason, and which led the next person/team to try something slightly better. This failure (aka progress) is extremely valuable. This insight leads to two points:

  1. No real discoveries were ever made without significant effort and trials. Edison with the light bulb. Newton with the laws of motion. Einstein with the general theory of relativity. There was a great show on PBS a long time ago called “The Ring of Truth” hosted by Phillip Morrison that went into great detail on this historically recurring theme.
  2. A “good” mistake is small enough and made quickly enough that fixing it is not difficult and it teaches about the problem.

An often used analogy for project development is driving. When I get in the car, I usually know pretty much where I want to go. I don’t know what traffic will be like, so I’ll have to adjust for it along the way. I also don’t know if I’ll have to adjust for road construction, weather conditions, a flat tire, etc. All of those things get fed into the course corrections I make as I’m MOVING towards my destination. I could spend a long time working out a plan for each of these contingencies before I left, but even if I did, there are certainly things I would have forgotten, and would still have to adjust to. I’m not advocating doing NO planning beforehand, but doing “just enough and no more”. Of course the amount of planning should vary in direct proportion to the uncertainty of the terrain, and the size of the trip.

So, getting back to a project perspective, my belief is that every team should use the following loop:

  • Iterate
  • Fail Early
  • Fail Often
  • Learn From Small Successes & Save Them
  • Be willing to say “I Don’t Know”, but be willing to find out.

Being an “agile” team provides many of these tools. Small iterations keep you from getting hurt too bad along the project. They also allow direction changes to come from stakeholders (although I’ve never seen an actual stakeholder remain a part of an agile team long term – the stakeholders I’ve seen have always assigned a second-rate proxy after the first couple of iterations). The tests written during development and keep the successes alive and in the knowledgebase. They also encourage the “I don’t know” behavior.

The bottom line is that we should be justifiably proud of our failures, much in the same way we are of our successes – as long as we’ve learned the lesson those failures are trying to teach.

There are a few quotes regarding this topic that I really like:

Samuel Smiles

It is a mistake to suppose that men succeed through success; they much oftener succeed through failures. Precept, study, advice, and example could never have taught them so well as failure has done.

We learn wisdom from failure much more than from success. We often discover what will do, by finding out what will not do; and probably he who never made a mistake never made a discovery.

Mohandas K. Gandhi

Freedom is not worth having if it does not connote freedom to err.

Robert F. Kennedy

Only those who dare to fail greatly can ever achieve greatly.

Robert Frost

The best way out is always through.

Word 2007 Test Post

This is a post to see how things look when posting from Word 2007. If this works out ok, I'll be using this for my publishing from now on.

Photo Test

This is a picture of my extended family on my Mom's side (Anderson). My Grandpa Anderson is standing in the middle of everybody. I'm the little boy standing up on the far right side. This was taken in the late 60's sometime. I'm sure one of my sisters will tell me exactly when it was :-)

Added note @ 9:10 5/14/2008 - MS Word 2007 isn't going to cut it as a Blog editor. I tried posting this from Word, and the image didn't make it, I also had several sections below where I had code fragments and other formatting things embedded in this post. None of them worked as I expected them to. Looks like I'll keep using the online editor for posting for the near term. If anybody has found something better, please let me know in the comments.

Tuesday, April 15, 2008

Sharing A USB Drive On XP / Vista

I recently needed to share my USB hard drive on the network, and had a lot of problems making it consistently available as a share. After trolling around on the internet, I found the answer -- since this took a while to find and debug, I'm documenting it here.

In regedit, find the key in HKLM (HKey Local Machine):

\System\CurrentControlSet\Services\LanmanServer\Parameters

Set the parameter IRPStackSize to a value 3 higher than it currently is, and reboot. You may have to do this more than once. If this key doesn't exist, create a DWORD key and set the value.

On the two systems I did this to, I ended up with values of 17 and 18.