Garagiste I wanna be :)

I recently did a garagiste course at the University of Stellenbosch presented by Dr Wessel du Toit.  It is a weekend course starting on a Friday night after work and ending on a Sunday afternoon.  We learned quite a lot and made good friends. 

My friend and ex-colleague, Leon Britz, did this course as well, and I had the pleasure of enjoying some of his wine.  You can read about his adventures on his blog

To start my adventures, I thought it wise to start with a starter kit which I ordered from  The kit was delivered on Saturday 22 February 2014 and contains the following:

  • HUGE plastic container for fermentation
  • 50l Oak barrel, syphon and stomper
  • hydrometer
  • Goodies (yeast, nutrients, bacteria, corks, bottle covers, plugs, fermenting cap)
  • 60 bottles
  • 6 buckets of frozen Pinotage (20l each, so 120l)WP_20140223_005

The grapes are indeed very much frozen, and must be defrosted completely before the wine making begins.  The anticipation and excitement is electrifying.  My main concern is keeping the temperature from soaring since Pinotage ferments faster.  I created a section in my garage where all of this will happen, and it is a cool-ish spot.  Let’s hope for the best!


Creating a new Dynamic Data Web Application

I’m cleaning up my machine and found this material that I never posted to my blog.  It’s a bit old news, but still, I want to post it.


In this post we are going to create a dynamic data web application by doing the following:

  1. Create a new Dynamic Data Web Application
  2. Create a data model
  3. Register the data model and enable scaffolding
  4. Run the web application

Create a new Dynamic Data Web Application

  1. Open Visual Studio 2008
  2. Create a new Dynamic Data Web Application
    (a. File -> New -> New Project)
  3. A new solution and project is created

Run the new web application

  1. Run the web site (Ctrl+F5)
  2. You should get an error stating “There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.”

The reason for this error is because our web site doesn’t have a data source. The error message is also very clear in what we should do: (1) Register at least one data model in Global.asax and (2) enable scaffolding.

Create a data model

In this example we’ll use LINQ to SQL to create our datamodel. To do this we need to add a new Ling-to-sql classes file and add tables to the model.

  1. Right-click on the project and choose Add -> New Item
  2. Create a new LINQ to SQL classes file
  3. We now see the Object Relational Designer. Let’s add a couple of tables from the Adventureworks database.

Register the data model and enable scaffolding

Now that we have a data model, we need to tell the website about it.

  1. Open the global.asax file
  2. Make changes to the RegisterRoutes procedure as per the comments in the code.
  3. Uncomment the line and register the context.
  4. Enable scaffolding by setting ScaffoldAllTables to true

The code should look like this:

model.RegisterContext(typeof(AdventureWorksDataContext), new ContextConfiguration() { ScaffoldAllTables = true });

Run the web site again

When we run the website again, we now see our site up and running


Box-and-whiskers graph

I recently had to implement a box-and-whiskers graph and didn’t have any idea what it meant, nor how to do it.  So, Google to the rescue and I found a couple of useful pages.

Jen’s Box-and-Whisker Plot Instructions is a rather good page that explains it quite well.  This image is from the page.


For a guided walkthrough and explanation, this video is from the Box-and-Whisker Plots tutorial on KhanAcademy.  nd-Whisker Plots: Box-and-Whisker Plots

My next goal is to do this in C# using the built-in chart control.  Watch this space …

Handy Tip: Date when a SQL Database was restored

I recently had to confirm when a database was restored. The information is in the MSDB database, and here is the SQL you can use to get the restore history of all the databases on the server:

USE msdb;

DBRestored = destination_database_name,
RestoreDate = restore_date,
SourceDB = b.database_name,
SourceFile = physical_name,
BackupDate = backup_start_date
RestoreHistory h
INNER JOIN BackupSet b
ON h.backup_set_id = b.backup_set_id
INNER JOIN BackupFile f
ON f.backup_set_id = b.backup_set_id

Handy Tip: sheetname without using VBA


=CELL(“filename”) will return the sheet name at the end of the file’s path. For example: C:\My Documents\[PhoneNumbers.xls]Phone
You can then use crazy string magic to get the sheetname from that information. Pretty cool hey?

I needed to get the active sheetname to do a vlookup using the sheetname and found this formula at (thanks Google!)