Running Redgate SQL tools on Windows Vista – level 100

I was a bit frustrated when I installed Redgate SQL Compare and SQL Data Compare on Windows Vista.  The apps crashed right away with no error message.  I hate the way Vista hides the error message and invites me to the troubleshooting screen (it can’t resolve the problem anyway).

SOLUTION:  Redgate tools need .Net 1.1 in order to run.  You’d think that Vista would be able to tell me that.  I installed .Net 1.1, and the tools work great.

Published! My current podcast list – level 200

 I’ve had numerous requests to publish my podcast list, so here it is.  Here is what I listen to on my commute to and from client sites or, in the case of this month, to and from a buddy’s wedding several states away.

http://polymorphicpodcast.com/podcast/feed/
http://channel9.msdn.com/rss.aspx?ForumID=34&Mode=0&sortby=0&sortorder=1&format=mp3
http://www.hanselminutes.com/hanselminutes_MP3Direct.xml
http://www.dotnetrocks.com/DotNetRocks_FullMP3.xml
http://www.slashdotreview.com/wp-rss2.php
http://www.se-radio.net/rss
http://feeds.feedburner.com/javaposse
http://feeds.feedburner.com/DrNeilsNotes
http://agiletoolkit.libsyn.com/rss
http://syndication.sdmediagroup.com/feeds/public/cmp_podcast_udi.xml
http://feeds.gigavox.com/gigavox/channel/itconversations
http://www.trinitydigitalmedia.com/tnb.xml
http://www.oneminutetip.com/feed.xml
http://www.runasradio.com/runasradio_FullMp3.xml
http://feeds.feedburner.com/NetObjectivesPodcast_LAST

In case you’d rather import the OPML, here it is in its entirety:

  <?xml
version=”1.0″ encoding=”utf-8″
?>
– <opml version=”1.1“>
– <head>
  <title>iPodder Exported Subscriptions</title>
  <dateCreated>Tue, 08 May 2007 Central Daylight
Time
</dateCreated>
  </head>
– <body>
– <outline text=”iPodder Exported Subscriptions“>
  <outline text=”Polymorphic Podcast“
title
=”Polymorphic Podcast“ type=”rss“ xmlUrl=”http://polymorphicpodcast.com/podcast/feed/“ />
  <outline text=”Channel 9: Podcasts“
title
=”Channel 9: Podcasts“ type=”rss“ xmlUrl=”http://channel9.msdn.com/rss.aspx?ForumID=34&Mode=0&sortby=0&sortorder=1&format=mp3“ />
  <outline text=”Hanselminutes“
title
=”Hanselminutes“ type=”rss“ xmlUrl=”http://www.hanselminutes.com/hanselminutes_MP3Direct.xml“ />
  <outline text=”.NET Rocks!“
title
=”.NET Rocks!“ type=”rss“ xmlUrl=”http://www.dotnetrocks.com/DotNetRocks_FullMP3.xml“ />
  <outline text=”Slashdot Review“
title
=”Slashdot Review“ type=”rss“ xmlUrl=”http://www.slashdotreview.com/wp-rss2.php“ />
  <outline text=”Software Engineering Radio“ title=”Software Engineering
Radio
“ type=”rss“
xmlUrl
=”http://www.se-radio.net/rss“ />
  <outline text=”Agile Toolkit Podcast“ title=”Agile Toolkit Podcast“ type=”rss“ xmlUrl=”http://agiletoolkit.libsyn.com/rss“ />
  <outline text=”The Java Posse“
title
=”The Java Posse“ type=”rss“ xmlUrl=”http://feeds.feedburner.com/javaposse“ />
  <outline text=”Dr. Neil’s Notes“
title
=”Dr. Neil’s Notes“ type=”rss“ xmlUrl=”http://feeds.feedburner.com/DrNeilsNotes“ />
  <outline text=”Dr. Dobb’s Ask Udi Podcast“ title=”Dr. Dobb’s Ask Udi
Podcast
“ type=”rss“
xmlUrl
=”http://syndication.sdmediagroup.com/feeds/public/cmp_podcast_udi.xml“ />
  <outline text=”IT Conversations“
title
=”IT Conversations“ type=”rss“ xmlUrl=”http://feeds.gigavox.com/gigavox/channel/itconversations“ />
  <outline text=”Tech, No Babel“
title
=”Tech, No Babel“ type=”rss“ xmlUrl=”http://www.trinitydigitalmedia.com/tnb.xml“ />
  <outline text=”One Minute Tip“
title
=”One Minute Tip“ type=”rss“ xmlUrl=”http://www.oneminutetip.com/feed.xml“ />
  <outline text=”RunAs Radio FullMP3“
title
=”RunAs Radio FullMP3“ type=”rss“ xmlUrl=”http://www.runasradio.com/runasradio_FullMp3.xml“ />
  <outline text=”Lean Agile Straight Talk podcast“ title=”Lean Agile
Straight Talk podcast
“ type=”rss“
xmlUrl
=”http://feeds.feedburner.com/NetObjectivesPodcast_LAST“ />
  </outline>
  </body>
  </opml>

Building with .Net 3.0 will require .Net 2.0 SDK – level 200

Here’s a bit of info that I’ve glossed over for some time.  I always have Visual Studio installed with building projects with .net 2.0 and 3.0, and VS bundles the SDK.  On my current project, we have a graphics designer who works on html and css, but we have a local build that even he uses.  Everything is automated.  The designer doesn’t have VS 2005 installed, and when we started using WCF in .Net 3.0 for some web service calls, his build (and the CCNet box) started breaking.  Before .Net 3.0 libraries were used, all that was needed to build our app was the .Net Framework 2.0.

.Net FX 2.0 includes MSBuild.exe, so all was well.  Using some stuff from WCF causes some other tools to be called, so now the .Net 2.0 SDK is required on the build (CCNet) box as well as the designer’s box.

What a jacked-up name: .Net 3.0, but be sure to mark “2.0” in IIS!!

Speaking at the Austin Code Camp, May 5th, 2007 – level 200

This is the second Austin Code Camp, organized by the Austin .net user group : www.adnug.org.  Get more information on the code camp here: http://www.adnug.org/codecamp2007.aspx

I will be giving a talk on 1 topic, but it will be separated into two parts because of the amount of material to cover.

Fundamentals of modern programming

Join C# MVP Jeffrey Palermo for a talk that gets back to the basics of programming with .Net in the 21st century. This talk will not venture into Test-Driven Development, Domain-Driven Design, O/R Mapping or other recent advances in programming. Instead, I’ll focus on fundamentals that few colleges or training courses are equipped to cover. Some fundamentals include the actual differences between procedural programs, object-oriented programs as well as how to leverage both for service-oriented programs. Code presented herein will be basic and geared toward illustrating specific fundamentals. An example presented will be what a class should look like and how to decide when to create a class. If you feel a bit rusty on your fundamentals or if you’d just like a refresher course, this talk is for you. (Level 200)

In my career, I’ve found that many programmer focus on certain technologies and become very skilled in them, but the foundation of programming knowledge is lacking.  Granted, many of us may get along these days without having to write a compiler from scratch, but there is plenty of knowledge missing from the common base of programmer knowledge.  My talk will not cover net glitzy technology.  Instead, it will cover more foundational knowledge and extensively reference well-known works and software studies.

My goal is that those who attend my talk will leave with a better understanding for how to go about constructing software.

22 hours of podcasts – 3 nuggets to share – level 200

This weekend I was a groomsman at Kevin Dulaney’s (great friend from grade school) wedding in Missouri.  I drove from Austin, TX on Friday and returned Sunday.  11-hour drive each way.  I stocked up my Windows Mobile phone with podcasts and listened the whole way there and back.  For those who ask “why would you do that”?  It’s my study time.  Constant learning.  I get to attend virtual lectures by industry experts.  Invaluable.

There are three things that I MUST follow up on:

  • CI Factory
    • This is a configuration management tool that does the basics of integrating CruiseControl, automated testing, NAnt, MSBuild and other build-related things.
  • Windows 2009 (http://www.pcworld.com/article/id,128888-c,vistalonghorn/article.html)
    • So far Vista isn’t the smashing hit many hoped it would be.  I’m currently running XP on my home machines, XP on one work machine and Vista Business on my main work desktop machine (no issues so far).  I’m curious to see what changes will be in Windows in less than 2 years!
  • Windows Developer Powertools: http://www.amazon.com/exec/obidos/ASIN/0596527543/infozerk-20
    • From James Avery and Jim Holmes, this book covers so many tools and frameworks including many open-source ones I use on a daily basis.  This book reaches out and brings to light that there are many, many great things out there that are not from Microsoft but aid in Microsoft development.

I’m still 3 weeks behind on my podcast list!!!! Arg!

Plan on catching my Birds of a Feather sessions at Tech Ed – level 200

My two BoF’s have been accepted for Tech Ed.  Plan on attending if you are interested.

“Agile development with .Net”

“Techniques for writing less code (frameworks, libraries, and tools)”

The selections were determined from votes from Tech Ed attendees.  It’s encouraging that many others are interested in these topics.

Results of a SOLID pair-programming day – level 200

There it is.  A pile of ripped up note cards denoting all the engineering tasks completed by my pair.  This was an unusual day because it started at 7:30am with some white board modeling and brain-crunching a very, very tough problem.  We wrote out some tasks to get us started, and we played the TDD game.   It was such a tough problem that neither my pair partner nor I could imagine the complete solution, but we could imagine a few things that would be included.  We wrote down the items to do on note cards and ordered them.  The navigator manned the note card deck.  In the course of completing some of the engineering tasks (all part of the same story), we uncovered new tasks that needed to be done.  We wrote those down and added them to the bottom of the pile.  We also ran into a brick wall and had to stop to do another task before we could continue.  We wrote that down and added it to the TOP of the stack.  We used these note cards as a true STACK.  FILO.  It helped us stay on track.  We finally got through the stack, and when we did, the story was implemented.  We didn't have the complete plan at the beginning, but we adapted and changed the plan along the way.

This pile of ripped up note cards is all that's left of that nasty story.  It did take us all day, though, and at 6PM, we both were wiped out!  It was the last day of the iteration, and we had committed to the story.  We ate a quick lunch at our desks and worked straight through.  It was great that we were able to meet our iteration through micro-adaptive planning.

I hope I don't have to do that again for a long time because that was the most difficult pair-programming I have ever done.  We were talking through the problems _all day_.  My brain was hurting on the way home.

My pair partner commented that it would have taken him 3 days if he had had to work through this nasty story by himself.  Pairing on the entire solution cut the delivery by 2/3. 

Streamline Model-View-Presenter with new StructureMap feature – level 300

I'm going to present you with a very exciting new feature of StructureMap that is available in the 2.0 release.  You can download StructureMap from SourceForge.

There are plenty of articles about StructureMap's service location capabilities, and the documentation is quite good, but I'll throw out the bread-and-butter usage scenario for service location.  Here is is.

I have an ICustomerRepository, and an "impl" class that implements the interface, CustomerRepository.  As the names suggest, this interface will return an array of Customer(s) given a whole or partial phone number.  Here is the full code.

    1 using StructureMap;

    2 

    3 [PluginFamily("Default")]

    4 public interface ICustomerRepository

    5 {

    6     Customer[] GetCustomersByPartialPhoneNumber(string phoneNumberOrPartial);

    7 }

    8 

    9 [Pluggable("Default")]

   10 public class CustomerRepository : ICustomerRepository

   11 {

   12     public Customer[] GetCustomersByPartialPhoneNumber(string phoneNumberOrPartial)

   13     {

   14         //do the right thing to find the customers;

   15         return null;

   16     }

   17 }

   18 

   19 public class Customer

   20 {

   21     private string _name;

   22     private string _phoneNumber;

   23 

   24     public Customer(string name, string phoneNumber)

   25     {

   26         _name = name;

   27         _phoneNumber = phoneNumber;

   28     }

   29 

   30     public string Name

   31     {

   32         get { return _name; }

   33         set { _name = value; }

   34     }

   35 

   36     public string PhoneNumber

   37     {

   38         get { return _phoneNumber; }

   39         set { _phoneNumber = value; }

   40     }

   41 }

In another place, I want to make use of the ICustomerRepository interface, so all I need are the following lines:

   49 //imagine this method were real.

   50 ICustomerRepository repository = ObjectFactory.GetInstance<ICustomerRepository>();

   51 Customer[] customers = repository.GetCustomersByPartialPhoneNumber("555-5555");

   52 return customers;

Of course, when my application starts, I'll put these lines to ensure it will work (or I could use a StructureMap.config file).

   47 StructureMapConfiguration.UseDefaultStructureMapConfigFile = false;

   48 StructureMapConfiguration.ScanAssemblies().IncludeTheCallingAssembly();

Now that you get the gist of it, I'm going to use StructureMap to enable the Model-View-Presenter pattern in a cleaner way with ASP.NET UserControls.  First consider the following usage:

I have a page that has a complicated piece which has been delegated to a usercontrol-presenter pair.  The page, of course, will embed this usercontrol in the appropriate place.  Immediately you can spot the problem:  The "Foo" view is responsible for creating the "Widget" view.  Then the Widget view creates its presenter and uses it.  This is too much responsibility for both views. 

Now consider an alternative:
 

Now notice that the FooPresenter is responsible for creating and using WidgetPresenter.  WidgetPresenter, in return, uses StructureMap to service-locate its view, which implements IWidgetView.  Because Widget.ascx.cs implements IWidgetView, this wiring works easily.  The StructureMap change that made this possible is the following usage of the configuration.  Here is the code:

   58 public interface IWidgetView

   59 {

   60     void ShowWidget(RedWidget theRedWidget);

   61 }

   62 

   63 public class RedWidget

   64 {

   65 }

 And the usercontrol that is the view:

    5 public partial class Widget : UserControl, IWidgetView

    6 {

    7     protected void Page_Load(object sender, EventArgs e)

    8     {

    9     }

   10 

   11     public void ShowWidget(RedWidget theRedWidget)

   12     {

   13         HttpContext.Current.Response.Write("Red widget shown");

   14     }

   15 }

 And the configuration that makes this possible:

   66     void Application_Start(object sender, EventArgs e)

   67     {

   68         StructureMapConfiguration.UseDefaultStructureMapConfigFile = false;

   69         StructureMapConfiguration.ScanAssemblies().IncludeTheCallingAssembly();

   70         StructureMapConfiguration.BuildInstancesOf<IWidgetView>().TheDefaultIs(

                        Registry.LoadUserControlFrom<IWidgetView>("Widget.ascx"));

   71     }

 Now that we can service-locate asp.net usercontrols, we can inject them as well.  The next step is having the WidgetPresenter receive IWidgetView in the constructor.  StructureMap will chain-create the usercontrol in order to create WidgetPresenter.  Now, our presenter is in control, and the views can concentrate on presenting information to the user and not worry about control flow.

Houston, April 17, 2007: Come to my automated testing presentation – level 300

If you will be in Houston on Tuesday, come participate in my presentation. http://www.hal-pc.org/CsharpSIG/

HAL-PC C# SIG

April 2007 Meeting

Date April 17, 2007
Time 7:00 PM
Location HAL-PC Headquarters
, 
4543 Post Oak Place
, Suite 200, Houston, Texas
Topic The Benefits of Developer Testing
Speaker Jeffrey Palermo
Meeting Details This month's speaker is Jeffrey Palermo. Jeffrey is an independent
software consultant with special skills in Scrum, XP, and .NET. He runs
the Austin .NET User Group and is the South Texas INETA Membership
Mentor. He enjoys spending time with his wife Liana, riding his
motorcycle and country dancing. He is a member of Journey Bible
Fellowship where he helps with the youth group ministry. Jeffrey is an
Eagle Scount and graduated from Texas A&M University. He recently
served in the Army in Iraq during Operation Iraqi Freedom.

Topic abstract: Developer testing
includes unit testing, integration testing, and acceptance testing.
Jeffrey will present how to test software in an automated way and how
to design code to be testable. He will provide a special focus on
testing ASP.NET and using mock objects.

   
  To receive email notification of C# SIG announcements, please send a message to 
Harry Nystrom

Debugging tip: But that can’t happen!! Ah, but it did. Ensure you are looking at the right object – level 300

Debugging can be easy or hard.  It’s easy if you have an easily reproducible error.  This morning I wrestled a bug where a screen just stopped showing data.  Nothing.  Zilch.

When I debugged through, I watched every piece of data get properly set to labels in my Winforms view that were visible, but the screen shows up without the data!! What gives?

Ultimately, I was looking at the wrong instance of my screen/view. 

Here’s a debugging tip to use if you watch the code executing properly but it still doesn’t work in the end:

Make sure you are looking at the right object.

In the debugger, set a breakpoint in the constructor and ensure you are watching the right instance.  In the immediate window, use the hashcode to track the instance:

this.GetHashCode()
34169857
this.GetHashCode()
61248560

This way, you can clearly identify the object.