Constitution as Software

On the way to work this morning, I got the idea for an analogy in my head.

You can compare the U.S. Constitution to a software project. First, there was the Articles of Confederation (a prototype, one to throw away) in 1777. Then in 1790 the Constitution came into effect (v1). Article five of the Constitution describes “the process neccessary to amend the Constitution” (the Change Control Process). Article seven of the Constitution talks about the process of ratifying the Constitution (deployment plan).

After the Constitution came into effect, there were immediately 10 amendments made (the Bill of Rights or bug fixes to those of us in the biz) that were added in response to initial criticism of the Constitution (users unwilling to change). Since the original 10 bug fixes amendments were made, there have been 17 more hacks amendments added to the Constitution. Since 1789, more than 10,000 amendments have been introduced, but few ever get proposed to Congress (triaged).

So what does this all mean? Clearly, the Constitution is an ugly hack, and the framers would have been wise to bone up on some good object oriented design before starting :)

Friends of red-gate

I recently was accepted into the Friends of Red Gate program from red-gate software. red-gate makes some unbelievably useful tools for Sql Server/.Net development, my favorite (so far) being the Sql Compare tool that compares two databases and generates a change script to synchronize them in either direction, very nice.

When I joined the program, they asked for my address so they could send me a “welcome kit.” I was expecting the usual propaganda about red-gate, their products, etc. About a week later I got the kit, and I was shocked. The contents included:

  • red-gate t-shirt
  • red-gate coffee mug
  • red-gate 256MB usb drive

By far the best “welcome kit” I’ve ever gotten, and certainly better than the MCSD certification “welcome kit” that MS sends out :) The best part is that people would be happy enough just to get  licenses of red-gate software as part of the program, but they go the extra mile and send you some cool, useful stuff.

Dual UIs: Windows Forms and WPF in the Same Application

A little bit ago I mentioned that I was working on v2 of Walnut and adding a WPF user interface. As I was thinking about the new UI I thought that it would be convenient to keep the “old” Windows Forms UI around, so that I wouldn’t have to require people to have .Net 3.0 installed to use Walnut. This is kind of similar to an Ajax web application gracefully downgrading when users have javascript disabled.

After thinking about how to implement these dual UIs, I came up with what I think is a pretty cool solution. In v1 of Walnut, there are two projects in my soluion file:

  • Walnut.Core - This is a class library that contains the business logic of Walnut as well as other application code that doesn’t relate to the UI.
  • Walnut.Shell - This is the Walnut.exe executable that contains the Windows Forms UI and references the Walnut.Core project.

When I press F5 in Visual Studio, the project that gets started is Walnut.Shell.

Now in v2 I have three projects:

  • Walnut.Shell - This is now class library project that contains the Windows Forms UI implementation.
  • Walnut.WPFShell - This is the new project that is also a class library and contains the WPF UI implementation.
  • Walnut.Core - This project is now the Walnut.exe project and contains the same business logic.

So now instead of starting the Walnut.Shell project, the Walnut.Core project contains the Main() method that starts Walnut. When the application starts up, it determines which shell to start(Windows forms vs. WPF) and loads the correct assembly. To facilitate this, I added an interface to Walnut.Core called IShell that is defined as follows:

public interface IShell
{
    void RunUI();
    void Initialize();
    void Shutdown();
}

Each of the shell projects has a class that implements this interface. When the application starts and determines which shell to load (which is a config setting for now), it loads the assembly and finds the class that implements the interface, using reflection. Once it finds the class I just have to instantiate it and call the RunUI() method which starts the UI.

After I got this concept working in the code, I had to make some changes to the way the projects build in Visual Studio. I have an MSBuild script which makes a release build so that I can package it up into an installer, but I also like to be able to press F5 in Visual Studio to get some instant feedback on code. Since the Walnut.Core project doesn’t reference either of the two shell projects (that would make a circular reference) I had to set the build directory for each project to the same location, otherwise the assemblies wouldn’t exist in the right locations.

I also had to change the MSBuild script as well as the Wix script, no big deal. Now all I have to do is learn WPF :)

Beer #1: Extra Pale Ale

I received a home brewing kit for Christmas this year and a few weeks ago I finished my first batch, an Extra Pale Ale from Northern Brewer. I made a new category on the ol’ blog for me to track the beers that I make. I just transferred my next beer into the secondary fermenter, I’ll bottle that batch in a week. So, here are the stats for the first batch:

  • Beer: Extra Pale Ale from Northern Brewer
  • 12/26: Beer gets brewed, hydrometer reading: 1.041
  • 1/3: Hydrometer reading: 1.019
  • 1/4: Hydrometer reading: 1.019
  • 1/4: Transferred from glass to plastic secondary fermenter
  • 1/17: Bottled the beer, yield was 40 bottles
  • 2/1: Opened first bottle, it was ready to drink

I gave away several of these beers since it was my first batch and I wanted people to try it out, but I’ve still got some left, I’m drinking one as I write this :)
I was really happy with the way this batch turned out, it would have been really disappointing to ruin my first batch and waste several weeks of my time. My next batch hasn’t taken as much of my time as I know all the steps involved now. The next batch should be ready to drink in ~3 weeks hopefully its just as good.

Back from Mexico

We got back from Mexico last night (finally) after a Minnesota snowstorm had Erin and I convinced that we’d have to stay in Cancun for the night.

ruins in tulum

We had a really good time, you can check out pictures on flickr: Playa del Carmen 2007. The snowstorm ensured that I would have a nice greeting for me this morning:

snow covered driveway

This is a view from the back of my house towards the street. Not exactly the transition that I was looking for, and I spent over an hour clearing the snow from our driveway. There was so much of it that I had to ditch the snowblower and start shoveling. You can see that our house (on the left) is very close to our neighbor’s, so I can’t blow the snow to either side, its gotta go forward or backwards. This makes it difficult to use the snowblower, and it makes shoveling even worse, because I have to get a shovel full of snow, then carry it to the front yard or back yard.
Heres another shot from the front yard towards the back of the driveway:

snow

My Dad would tell me to quit whining, but his driveway is half as long and he can blow the snow to either side. Although he does enjoy getting up to snowblow his driveway, and then the neighbor’s driveway (before they get out there), as a little “joke” on the neighbors.

New Site Design

I spent some time tonight getting a new theme on my blog site. I was getting a little tired of the old one, it was time for a change.

I used the “fresh” theme available at: http://www.ilemoned.com/wordpress/wptheme-fresh/

I modified some of the theme, took out some stuff, added some other stuff. I still need to recreate my “Contact Me” page, but everything else is there, thats whats nice about switching themes in wordpress, not a whole lot of pain involved :)

Branching and Merging Pain

So I’ve started work on v2 of Walnut. I’m adding a new WPF interface for v2 as a way to learn WPF. I started messing around with it briefly, but its so much different than WinForms that its gonna take awhile to figure it all out.

But, the point of this post is about branching and merging in Subversion. I created a new branch for v2 in my repository, in the ‘branches’ directory. I got it all setup and then left it alone for awhile and fixed some bugs, added some small features to the trunk.

Now I want to start work on v2, but first I want to merge all the changes from the trunk first, so I know I’ve got an up-to-date repository. This is where the pain comes in. I cannot figure out how to pull in changes from the HEAD of the trunk to the HEAD of my branch.

The interface in TortoiseSVN doesn’t make sense to me. I’ve tried initializing the merge from the trunk and from the branch, but neither option seems to do what I want. Heres what I’m trying to do:

  1. Update any file in the branch that has been updated in the trunk.
  2. Add any file from the trunk thats been added that doesn’t exist in the branch.
  3. Delete any file from the branch that has been deleted from the trunk.
  4. IGNORE any file thats been added to the branch

All I want is to pull in changes FROM the trunk TO the branch, sounds simple enough.
Since I’ve already added some files to the branch (that don’t exist in the trunk), Tortoise keeps trying to either delete these files when I’m merging FROM the trunk, or adding these files when I’m merging TO the trunk.

Is there some other command that should be using to accomplish this? It seems like a common scenario, but its driving me crazy!

UPDATE 8:54 PM: Jake helped me out with the merge command, and after figuring out how it works, I realized that I made a bad decision by branching version 2. What I should have done was branch the existing trunk to its own branch for maintenance and left v2 on the trunk. It shouldn’t be too hard to rectify that problem though.

The Road to Hell is Paved With Good Intentions

Some background info:

  1. A little while ago, I formatted the second hard drive (the one I had installed Linux on) and moved Erin’s and my “My Documents” folder to the G: drive. I also moved my projects folder, and our folder of ripped mp3’s. This is in preparation for upgrading to Vista. I wanted our files on a separate drive so that if everything goes to hell, we won’t lose our stuff.
  2. Yesterday, I went to General Nanosystems and bought a stick of RAM to upgrade the machine with, also in preparation for Vista.

I got home and plugged the RAM in and tried to restart. When I got to the XP login screen, there was a message about a corrupt registry key that had been successfully restored. This all sounded good to me. I tried to logon and the screen froze up.
I restarted the machine and the same thing happened. I took out the RAM and everything was back to normal.

Sort of.

When I logged in, my user settings had been reset, so all my preferences were gone, including the new My Documents mapping to the G: drive. I remapped My Documents to the G: drive, reset my wallpaper, etc. which didn’t take long. I assumed that my settings had been lost because of the freeze when I tried to login, and that Erin’s settings were fine, because I hadn’t logged in as her.

When Erin plugged in her iPod this afternoon, it wouldn’t let her sync, saying that some other computer “owned” the iPod. Also, there was a lot of music missing from her library. Now, its bad enough when I screw something of MINE up, let alone something of hers.

So I figured out that since I had moved the music directory to the C: drive to the G: drive, thats why it couldn’t find the music. So I re-added the music folder from its new location, hoping that iTunes would recognize that the songs already existed and just update the locations. It doesn’t do that apparently. Now there were a BUNCH of duplicate songs; the new ones I had just added and all the old ones that iTunes couldn’t find. Worse still, all of her playlists referenced the bad songs and there doesn’t appear to be a way to “swap” songs or anything.

There was still the issue of iTunes not letting her sync up. Then I realized it. Her user settings had been reset, just like mine, so her My Documents was still pointing to “C:\Documents and Settings\”, etc. so she now had a brand new iTunes profile, which made the iPod think this was a new machine.

I remapped her My Documents to the new location, and the sync functionality came back, whew.

Back to the invalid songs and all the duplicates. I found the iTunes library xml file and took a peek. Very easy to understand file, you can see the tag where iTunes stores the path to the path on the file system. I thought I was all set, just a quick find and replace on all the invalid file paths, and I’m back in business. I tried this and fired up iTunes. All the songs were still invalid. I looked at the xml file again, and all the invalid paths were back!

It seems iTunes knows if someone had tinkered with the xml file and restores it if its been modified. Ugh.

In the end, I just had to wipe the library and re-import all the folders and now the playlists will have to be recreated. Not the best result but at least everything can be fixed, its just a pain in the ass.

I just have to laugh a little because I rarely buy new RAM for a computer and I also rarely (if ever) add a new hard drive and remap the “My Documents” folder, but since I did both of those, they joined forces to screw me over, and I didn’t even get to add the damn RAM!

(Never did figure out what the problem was, but I don’t want to tempt fate and put it back in, that shits going back to GN)

New Book on its Way

Erin emailed me while we were at work the other day and said that we had some online coupon to Barnes and Noble and asked if there was any book I wanted. I did some browsing and remembered the book I had waffled on buying for a little while:

agile web development with rails

Between this book and Founders at Work, I should have some good beach reading for our Mexico vacation in a week. As an added bonus, I shouldn’t have to worry about anyone stealing, or mistakenly taking, my books :)

Trying out Google Reader, Again

Update 2/6: It only lasted about a day and half and I’m back to Bloglines, I just couldn’t do it.

I decided this morning to give Google Reader another try. I tried it out in its first incarnation, when it really sucked, and I’ve been very happy with Bloglines for a long time now.

Two things that stand out right away that I don’t like:

  • I can’t seem to find a gadget for my Google homepage that simply shows the number of new items. I don’t want to actually SEE the items, just a count.
  • I also don’t see the number of people who subscribe to each feed, which I always thought was a cool feature in Bloglines.

One thing that I like right off the bat (after ~30 minutes), is the starring of items. I typically will “save” items in Bloglines that I want to read later, and those items always add to the unread count that I see on my Google homepage, which is misleading. When I star items in Google Reader they are marked as read and I can access the starred items on top, separate from the new items.

As long as theres some way to get the unread count on my Google homepage I’ll be a happy camper, we’ll see how it goes.