Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


‘SQL Query’ Micro Design Pattern

There are a few programming practices, that I like to call Micro Design Patterns, that I use over and over again on various software projects I work on. One pattern that I call SQL Query, and use quite frequently when I need to write ad-hoc SQL queries for use within a Data Access Layer. This pattern lends itself to easier testability and a cleaner separation of concerns. What is the ‘SQL Query’ Micro Pattern? Basically, the SQL Query micro pattern involves using a Factory Method to return an ... [More]

Peeking inside the Twitter Windows 8 App

I decide to peek inside the Twitter Windows 8 App package to see what language they are using and to see if I can find any open source projects being used within. Well, I found some interesting stuff… How to view inside the package You can view any Windows 8 app package that is installed on your computer as it resides within the following folder: C:\Program Files\WindowsApps Each package has it’s own folder within that folder. Here’s the full path to the package folder where the Twitter a... [More]

What “var” really means in C#–It’s not “variant”

With the release of C# 3.0 came the addition (among many others) of the “var” keyword. I’ve seen MANY people confused about what this keyword is, does and means. Among these people with incorrect assumptions to the function of the “var” keyword, I have seen programmers/developers with varying amounts / years of experience. So, I’ve decided to write up a simple explanation; actually the same one I’ve told and/or emailed people over the last couple years. “var” is not variant! Since “var” is the... [More]

Windows 8 App: Simple Weight Log–My first Windows Store App

A few weeks ago I built and released Simple Weight Log (my first Windows 8 app in the store.) The app allows you to enter your weight in a log by date and it charts the different weigh-ins in a line graph to allow you to easily visualize weight changes over time. View in Windows Store “Are you trying to loose weight? or, gain weight? If so, then Simple Weight Log will allow you to easily log and track metrics on your progress.” Application Features Simple and easy to use I purposely bu... [More]

SQL Azure: Calculate Database Usage Percentage of Max Size

Some times it can be useful to programmatically monitor your SQL Azure database usage statistics. Luckily, there is some short SQL code that can be run on the database to check how much disk space is currently used and what the currently allotted max database size is. The following script does just that. DECLARE @dbName nvarchar(255) = '{database_name}'; DECLARE @Max BIGINT = CONVERT(BIGINT, (SELECT DATABASEPROPERTYEX(@dbName , 'MaxSizeInBytes'))); DECLARE @Used BIGINT = ( SELECT ... [More]