Visual For Dummies usage of Northwind database

There are a lot of questions about Visual Basic.NET 2005 For Dummies and Visual Basic.NET 2008 For Dummies and the use of Northwind for the samples.  When I wrote the majority of that book in 2004, Northwind was still a common sample database for SQL Server.  When I updated it in 2007, it will still provided as a sample.  Since then, it has been totally replaced by AdventureWorks. Now, finding the sample is hard, and installing it is even harder.

I was going to write a large post on how to do the install, but Pinalkumar Dave did such an awesome job on his blog that I don't have to.  Here is the link:

You can get the samples still, from this link:

I hope this helps.  I will be updating the VB book series after I am done with Programming Data, and will change the data samples to use AdventureWorks, or the latest and greatest at that time, if it changes again.

I'll be speaking at DogFoodCon

I'll be speaking at the 2010 DogFood Conference that Microsoft puts on here in Columbus.  Danilo Castilo runs it (largely) and it is pretty cool - a neat community event on a budget.

It's a cool collection of talks about the newest Microsoft products and how people are using them.  Thus the name: 'DogFood' from the phrase 'eating your own dog food.'

I'll be speaking with Mario Fulan about using AFDS 2.0 to cross domain borders.  If you don't already know Mario, he is a beast - one of like ten Certified Sharepoint Masters in the whole freakin universe or something.  He has forgotten more about SharePoint than I will ever learn.  I do know Windows Identity Foundation a little bit though, so that's what I'll be covering.

The conference is at and is selling out really fast.  If you are interested in the hot new stuff, check it out and get registered while you can.  It's next month - November 4 and 5.

On the death of Quadrant.

It's common knowledge that I have been following Oslo / SQL Server Modeling Services very closely.  I am working on a book on the topic, and have posted a number of blog entries.  The speaking circuit has been good to me too, and I have given my Software Modeling With ASCII talk five or six times already this year.

My focus has been on M, but today we are talking about Quadrant.  Quadrant is part of a trio of tools that includes M (a language to build data and domain models) and Modeling Services (a set of common models and repository).  Quadrant itself is tool to interact visually with SQL Server databases.

I've been watching Quadrant for over a year now, and I had a lot of questions about its viability in the marketplace.  As a data management tool, it was underpowered, but as a data browsing tool, it was overpowered.  When I eventually came to realize that it could be a domain model browser, my interest was piqued.  Since you could define the quadrants using M, it would be effectively possible to build comprehensive data management 'dashboards' in Quadrant, and use them in a power user role.

Over time, however, I began to realize that this was an edge case.  The business users and data managers that need these solutions will still find development in M too time-consuming, and the professional developers who would be asked to help them would just rather work in C#.  It will end up that the business users will go back to Access and Excel, data managers will just use SQL Management Studio, and professional developers will use Windows Forms or XAML in C#.

Apparently, Microsoft saw this too.

I am sad to see Quadrant go.  It was a beautiful application, and could have been a foundation to a number of very, very cool tools.  Hopefully the Data team wil find another use for the technology.

It should be noted that SQL Server Modeling is not necessarily dead at all.  Models can still be built with M, and exposed to the world in OData.  Applications can still be built against this model using Visual Studio, and the data can still be managed using SQL Management Studio.  

The loss of Quadrant doesn't impact this vision, and I hope that Microsoft realizes this and continues down the path toward an enterprise-class repository.  It's the last piece of the puzzle that keeps large enterprises from deploying SQL Server in application-centric environments.


The terrorists have won

When I was a sophomore in high school, we had a unit in our World History class about the Holocaust.  Fran LaBuda, a German Jew who escaped to the US through despite the Nazis, would stand at the door of our classroom and bark orders to us in German as we entered, using a pointer to tell us where to sit, and even push us around as necessary.  A militant looking fellow (later I learned it was her son, and as gentle a guy as you could imagine in real life) escorted anyone who didn’t take it seriously out of the room, rather roughly.

The point was to show us in general how easily we could be cowed by a force we didn’t understand taking our power of independence.  These are upper middle class high school students, and used to getting their way.  Their parents bought them the cool clothes and looked the other way when the rules were transcended.  They wore their ego on their shoulder like a badge of honor.

But when the going got rough, they folded like a bad hand at cards.  Only one person tried to joke about the event with Mrs. LaBuda, and was taken from the room.  He was the class clown, but was nearly in tears when pushed out of the door by the enforcer.

Fast forward to today.  I was in line at the TSA’s security gate at SeaTac.  Walking up and down the line was a rather militant looking fellow yelling out in plain, though loud, English:

“If you do not take your liquids and gels out of your carry-on luggage you will not be allowed to get on your plane.  You will be escorted to enhanced screening, and there is a half day wait.”

Next to me stood a seventy year old woman, grey hair, a Russian Jew by her accent; tears were streaming down her face.  She was frantically digging through her plain bag looking for the satchelof toiletries that was plainly sitting on the table in front of her, unnoticed.

“Your bottles are right here,” I showed her.

“Oh, thank you son,” she sighed in relief.  “I’m just trying to get home to Florida to see my grandson.  I’m so terrified that these people will lock me up.”

She was so terrified that those people would lock her up.  People that were purportedly trying to keep us safe, but who were instead driving this woman, others, myself to tears with worry that one wrong move with the toothpaste could cost us time with loved ones, money, business, whatever.

The terrorists have won.

The goal of a ‘terrorist,’ and thus the name, is terror.  They don’t really care, as a group, if they kill anyone.  As  long as the people they attack live in fear.  They state that they want to kill Americans, and then, largely, don’t.  They just want us to think that they will. (Remember, while 9/11 was a huge tragedy, it doesn’t make much of a mark in the numbers that have died in simple in-fighting in the Arab Alliance. The deaths weren’t the point.  The after-effects were the point.)

We, as a country, as a people, as individuals, have folded.  Just like that classroom of sophomores 20 years ago, we have turned in our independence to the authorities with our papers and our shampoo.  Even the clowns in Washington, once a source of hope, are led crying from the classroom the moment the chips are down.

Please don’t think your humble author is putting himself above you, the reader.  I had planned on traveling with a firearm this trip: because I can, then lock my luggage with my locks, and pretend that I am more secure than most.  I did not, fearing hassle, fearing delay, or just fearing – I’m not sure which.

I don’t have a solution to suggest, dear reader.  I simply needed to lament the passing of a once great country – the greatest of social experiments – into the waste bin of political history.  I do not believe that is within any of us to turn the social tide now, unless Atlas truly does shrug and some number of us retreat to a contemporary Galt’s Gulch.  The slope of our decline is too firmly now in place.  We have lost.

Fiction and human achievement


For almost 200,000 years, humans were indistinguishable from animals. 

For 5,000 years, we had only achieved the advancements of agriculture and prostitution.  Nothing to be sneezed at for sure, but certainly not the pinnacle of potential.

In 100 years, we went from farming to the Industrial Revolution.  There were a lot of reasons, but note the sudden easy availability of fiction.  I know, I know, correlation doesn’t equal causation, but I can’t help but wonder how much the insurgence of fiction, and how it influenced the play of children, impacted the next generation and the ideas they worked from.  Factories? Space travel?  Computing?

Fast forward to Asimov, Clarke, and the other Science Fiction writers of the 50s.  They pointed our eyes to the stars and our minds to the unimaginable.  Is it a surprise that the generation that grew up reading their books and reenacting it in their play gave us the fathers of the Internet?

Please don’t dismiss child’s play as a waste of time.  Please don’t assume that the introduction of fictional universes into a children’s playtime is an “overdose of media.”  You don’t know what the availability of universes is doing for our children’s fertile minds.  Wouldn’t you rather let them run with it and see what becomes of it, rather than shut it down, afraid of the future it might bring?

Being Object Stingy


This is clipped content from my C# Book. 

You can’t construct an object without using a constructor of some sort. If you define your own constructor, C# takes its constructor away. You can combine these two actions to create a class that can only be instantiated locally.

For example, only methods that are defined within the same assembly as BankAccount can create a BankAccount object with the constructor declared internal, as in the bold text in this chunk of code:

// BankAccount -- Simulate a simple bank account.
public class BankAccount
    // Bank accounts start at 1000 and increase sequentially.
    private static int _nextAccountNumber = 1000;
    // Maintain the account number and balance.
    private int _accountNumber;
    double _balance;
    internal BankAccount() // Here’s the internal, not public, constructor.
        _accountNumber = ++_nextAccountNumber; 
        _balance = 0;

    public string GetString()
        return String.Format("#{0} = {1:N}", _accountNumber, _balance);


IF you can keep your head when all about you
Are losing theirs and blaming it on you,
If you can trust yourself when all men doubt you,
But make allowance for their doubting too;
If you can wait and not be tired by waiting,
Or being lied about, don't deal in lies,
Or being hated, don't give way to hating,
And yet don't look too good, nor talk too wise:

If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
If you can meet with Triumph and Disaster
And treat those two impostors just the same;
If you can bear to hear the truth you've spoken
Twisted by knaves to make a trap for fools,
Or watch the things you gave your life to, broken,
And stoop and build 'em up with worn-out tools:

If you can make one heap of all your winnings
And risk it on one turn of pitch-and-toss,
And lose, and start again at your beginnings
And never breathe a word about your loss;
If you can force your heart and nerve and sinew
To serve your turn long after they are gone,
And so hold on when there is nothing in you
Except the Will which says to them: 'Hold on!'

If you can talk with crowds and keep your virtue,
' Or walk with Kings - nor lose the common touch,
if neither foes nor loving friends can hurt you,
If all men count with you, but none too much;
If you can fill the unforgiving minute
With sixty seconds' worth of distance run,
Yours is the Earth and everything that's in it,
And - which is more - you'll be a Man, my son!


Brew day: “Get fresh with me” American Ale


I was lucky to be able to pick almost a pound and a half of Nugget hops at Ohio Hops in Galloway.  Nice folks.  Brian was great – I recommend him for all your Ohio Hop needs!  Anyway, I created a recipe with a single hop to showcase the flavor, and I think it will be a good one:

Get Fresh With Me

Brew Type: Extract Date: 9/5/2010
Style: American IPA Brewer: Bill Sempf
Batch Size: 5.00 gal Assistant Brewer: Adam Sempf
Boil Volume: 4.08 gal Boil Time: 60 min
Equipment: Brew Pot (5 Gallon)

Amount Item Type % or IBU
7.00 lb Extra Light Dry Extract (3.0 SRM) Dry Extract 87.50 %
0.50 lb Caramel/Crystal Malt - 40L (40.0 SRM) Grain 6.25 %
0.50 lb Special Roast (50.0 SRM) Grain 6.25 %
2.00 oz Nugget [13.00 %] (60 min) Hops 68.3 IBU
1.00 oz Nugget [13.00 %] (20 min) Hops 20.7 IBU
1.00 oz Nugget [13.00 %] (10 min) Hops 12.4 IBU
1 Pkgs SafAle English Ale (DCL Yeast #S-04) Yeast-Ale  

Beer Profile
Estimated Original Gravity: 1.062 SG (1.056-1.075 SG) Measured Original Gravity: 1.060 SG
Estimated Final Gravity: 1.016 SG (1.010-1.018 SG) Measured Final Gravity: 0.000 SG
Estimated Color: 8.8 SRM (6.0-15.0 SRM) Color [Color]
Bitterness: 101.4 IBU (40.0-70.0 IBU) Alpha Acid Units: 39.0 AAU
Estimated Alcohol by Volume: 6.02 % (5.50-7.50 %) Actual Alcohol by Volume: 0.00 %
Actual Calories: 0 cal/pint

Please brew it and let me know how it goes.  The hop numbers are for dry, to keep th AA calculations right.  You can substitute fresh whole hops for the dry by multiplying by 5 or so. I used 10, 6 and 4.

Obligatory dinner post: ratatouille from the movie


Last night I made ratatouille just like Remy made it in the Disney movie, Ratatouille.  Gabrielle thought of the idea, and got the recipe from Smitten Kitchen, which – if you haven’t been there – has amazing stuff.


It turned out incredible, and only took about 20 minutes to put together.  Gabrielle even tweeted about my efforts – funny.  What’s more, it is a very flexible recipe, and I am betting that you could mess around with it a lot.


We served it with couscous and chevre, and Adam ate so much I thought I would have to wheel him out with a forklift.  Highly recommended.

Handling fixed width text with Regular Expressions (RegEx)


When most developers are faced with a fixed width text file, they reach for the String object.  While this is effective, it isn’t efficient.  .NET doesn’t handle strings that well, and use if SubString is memory intensive.  A better way is to use the RegularExpressions classes in System.Text.RegularExpressions.

A fixed width file is one where the columns are defined by the number of spaces consumed.  For instance, here is a list of the Big 10 (11? 12?), locations, and years founded:

University of Illinois          Champaign, Illinois         1867 
Indiana University              Bloomington, Indiana        1820 
University of Iowa              Iowa City, Iowa             1847
University of Michigan          Ann Arbor, Michigan         1817
Michigan State University       East Lansing, Michigan      1855
University of Minnesota         Minneapolis, Minnesota      1851
Northwestern University         Evanston, Illinois          1851
Ohio State University           Columbus, Ohio              1870
Pennsylvania State University   State College, Pennsylvania 1855
Purdue University               West Lafayette, Indiana     1869
University of Wisconsin–Madison Madison, Wisconsin          1848

The university is 32 characters, the location is 28 characters, and the year is 4 characters.  We can debate up and down the benefits of such a format, but it is what it is, and we often get them from legacy systems.

Instead of using the String.Substring object to get the values out, we can use the Match class in System.Text.Regular expressions.  When you use this class, you get back a Match object, that has a collection of the matches (shocker that) found in the intersection of the expression and the input.

Here is an example program that loads the file, and uses an expression (note that format) to break up the file into a collection, basically an array.  Notice that there isn’t a single String in the project other than the pattern itself.  To run the program, save the above formatted text into a file called “BigTen.txt” on your C drive.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

namespace BigTen
    class Program
        static void Main(string[] args)
            StreamReader sr = new StreamReader(@"c:\BigTen.txt");
            string pattern = @"^(?<school>.{32})(?<location>.{28})(?<joined>.{4})$";
            Regex re = new Regex(pattern);
            while (sr.Peek() != -1)
                Match match = re.Match(sr.ReadLine());

Of course, there are downsides to regular expressions.  They are difficult to debug, and the formatting is arcane.  For this, however, they make for an excellent solution, and for formatting of the expression is quite readable.  Only one expression is used, so it is easier than some to debug.  I think it is a good solution to the problem at hand.  Give it a try!

Bill Sempf

Husband. Father. Pentester. Secure software composer. Brewer. Lockpicker. Ninja. Insurrectionist. Lumberjack. All words that have been used to describe me recently. I help people write more secure software.



profile for Bill Sempf on Stack Exchange, a network of free, community-driven Q&A sites