In defense of speaker shirts and speaker dinners.

Disclosures: I am an occasional SQL Saturday Speaker. I’ve spoken as far north as Nova Scotia, as far South as Georgia, and as far West as Pittsburgh. Fatherhood and budget have made me a strictly regional SQL Saturday speaker for now. Despite over decade of experience on the platform, I work for a PHP and Postgres shop at the moment. However, we embrace micro-services an SQL Server for Linux will be GA very shortly. So, I’ll fix that as soon as I can.

Recently, I’ve noticed a trend away from speaker shirts, often for budgetary reasons. Many regular speakers don’t like them. Some don’t even wear them to the event. I’m very proud of my collection. I wear them to poker night and have received the nickname SQuirreL for this behavior. I’ve also heard talk of cutting out the speaker dinner.

I understand sponsorship is hard. I don’t fault an organizer for skipping speaker shirts for budgetary reasons. I don’t fault them for skipping the speaker dinner if they lack sponsors. However, don’t let this become the norm. Please offer lanyards or name badges at a minimum, and please suggest a venue for the speakers to meet the night before for networking, even if its pay our own way.

SQL Saturday is all about networking. However, it attracts a very anti-social crowd. Many of us in IT, but not all, are introverts. Some of us are also socially awkward. It’s much easier for me to get in front of a crowd and talk about something than for me to approach a stranger out of fear of my interaction being unwanted. However, there are two exceptions. The first is a strong social or physical indication that interaction is acceptable I will engage. The second is if the other party initializes interaction.

If I go to a conference there are two types of strangers I will talk to, speakers and booth people. If you wear a speaker shirt I expect you want to talk to me. Conversely, when I wear a speaker shirt I feel not only comfortable but obligated to respond to social contact. I assume it’s initiated because I’m wearing a speaker shirt. It gives me a (small) degree of agency and that agency comes with responsibility. So, giving me a speaker shirts increases my level of networking at the event.

Also consider the speaker dinner. Humans eat socially. If you are at a cocktail party and don’t know anyone, introducing yourself to a stranger is less awkward than sitting alone. It’s the one time a socially passive introvert will go out of their way to meet new people. Some of us need our hands forced. A speaker dinner is the best way to goad introverts into socializing.

Now I do realize we as a community have done a terrible job with providing properly fitting shirts for female speakers. I also know some people of all genders just don’t have a body type that bulk ordered polo shirts flatter or even fit. I also know may speakers have strong feelings in the opposite direction. about speaker shirts. So, requiring speaker shirts is not practical, compassionate, or an argument I’m going to win. I also realize some sponsors whose employees are also speakers have their own shirts for events. That being said, I think a desire to wear a speaker shirt is the norm, and we can provide properly fitting female shirts.

So, as an introvert of questionable fashion taste, I implore SQL Saturday organizers to try to provide a shirt and speaker dinner. Let the speaker opt out if a shirt won’t fit them or they aren’t going to wear one.

I mentioned I was going to write this article on twitter, and it started a lengthy conversation. I know many in the community have strong opinion on this matter that differ significantly from mine. I invite you to share them in the comments below.

Data professionals, join me in Rochester April 28th and 29th to learn about GIT

Friday April 28th I will be teaching an all day precon, git for the data professional in Rochester. I’ve done git training for companies bere. I am excited about running it as an open event. Buy you tickets before they sell out.

Saturday I will be teaching a one hour introduction to git as part of the SQL Saturday Rochester day of training.

Looking forward to seeing you there.

Giving back to #sqlfamily

I’m way late to the T-SQL Tuesday party, but I’d like to add my opinions to giving back to the SQL community. I think most of the other authors have covered the “why,” so I will talk in terms of the more pragmatic “how.”

So how does one give back to the community? Well there are the traditional ways like answering questions on #sqlhelp, and the forums as well as speaking at meetings, conferences and SQL Saturdays. Those are all well and good, but there are a few other ways.

First, give us your code. I’m a developer, not a DBA, and I was a linux admin before I became a .NET developer. Therefore giving back through open source is something I have been “raised” to do. So write some code, consider putting it under an open source license, and distribute it, preferably on github.

Secondly, tweak the free code out there. Is there an open source SQL script that you like? Did you change it? Send the changes to an author. Just be warned that not all the free scripts created by members of this community are open source, and not all authors will incorporate your changes. For example, Adam Machanic probably won’t accept your changes to sp_whoisactive. Brent Ozar OTOH, will accept a sp_blitz (which is not open source) patch. BTW you can thank me for being able to save output from that script to global (##prefixed) temp tables. Olla Halgreen will accept patches for his maintenance scripts, and Richie Rump will accept pull requests for his statistics visualizer.

Thirdly, curate Edit the questions for grammar and spelling. If you ask a question yourself, try to ask it in a way that it becomes a canonical question. Thinking about blogging about something. Instead, considering self answering a question their. I’ve seen stackoverflow and serverfault greatly improve the level of bingleable development and operations knowledge. The Q&A format is better than forums for things that don’t need to be a discussion. Lets foster that here. BTW, all the stackexchange data is available under a creative commons license. You can download it an query it offline.

Finally, I’d like to take the time to thank everyone in the community that has helped me. I won’t single anyone out, because they’re too many of you. I’ll just try to keep paying it forward.

Microsoft, please open source sqlcmd, Sqlps, SMO, and LogParser

Microsoft has open sourced part of the .NET framework. This is exciting news, although honestly not all that unprecedented. There was a time when AT&T defended the C language as its intellectual property. These days, the language is effectively in the public domain. (Note IANAL, the preceding was not legal advice. UNIX is a trademark of the Open Group). This lead to a few people asking if SQL Server would ever be open sourced. That answer is probably no for the time being. However, I do think certain components of if can be open sourced.

Command Line tools.

sqlcmd is a great command line shell for SQL Server. However, it could be better. The same goes for bcp and the other tools. Microsoft isn’t going to spend the time making sqlcmd read the contents of the EDITOR environment variable if SQLCMDEDITOR is not set to match the behavior of unix command line tools. Its not going to add a simple switch to generate query results as a CSV, or sendout output to the clipboard. Its not going to allow you to colorize RAISERROR messages based on severity. However, members of the community most certainly would do that. Also, I think if sqlcmd got enough pull requests, Microsoft might realize that PowerShell is not the be all and end all of the command line.


By SQLPS, I am referring to all the powershell modules, providers, etc for SQL Server. There are some great cmdlets in that collection. However, can we get Invoke-SqlCmd to do parameter substitution? Yes, I know its unlikely that a PowerShell script will be run by an untrusted user, and if it was, that user probably could already run arbitrary SQL. However, as a matter of best practice and acknowledgement that there are third party solutions to serve web pages by PowerShell, one should be allowed to parametrize their queries. Invoke-SqlCmd2, written by Chad Miller and contributed to by others including myself, allows you to do this. Wouldn’t it be nice if a future version of the builtin cmdlet had the same feature? If it was open source, I swear on my honor as a developer, I’d submit the patch.


Sql Server Management Objects is a bit of a legacy solution. Hwoever, it still has valid use cases. It provides amongst other things a COM API for backing up and restoring databases. I don’t actually use SMO, but many DBAs do. I might some day. I’m sure developers that USE SMO has patches they’d like to


LogParser is actually not part of the SQL Server code base, but its used by SQL Server DBAs. LogParser claims to be intended for dealing with Log files, and it indeed lets you sql SQL queries on IIS log files and other text formats. However, it also lets you read and write from SQL Server using the bulk copy mechanisms. Its a great ETL tool. It exposes a COM object, and can be automated with Powershell. I’ve asked Scott Hanselman about this, and he says the main thing Microsoft needs is an internal sponsor to make this happen.

If LogParser was open source, a proper .NET layer could be added to it, support for more data sources, and the SQL syntax could be improved.


Will Microsoft Open source any of these tools? I think they could safely do so without hurting their current revenue streams. Having these tools open sourced would benefit people who use SQL Server, but not in a manner that would allow people to, for example, use Express instead of Standard Edition or Standard instead of Express. It would not hurt the revenue streams. It would require them to dedicate some resources to the Sql Server client tools. I think these tools need some love anyway, and those resources should be dedicated.

The case for open sourcing the SQL Saturday Website

My name is Justin Dearing. I write software for a living. I also write software for free as hobby and for personal development. When I’m not writing code, I speak at user groups, events and conferences about code and code related topics. Once such event is SQL Saturday. I haven’t spoken in a while because I became a dad in June. However, my daughter is 9 months old now and the weather is warm. I feel comfortable attending a regional SQL Saturday or two. So last night I submitted to SQL Saturday Philadelphia. The submission process (I mean the mechanical process of using the website to submit my abstract) was annoying, as usual. What really got me going though was when I realized two things:

  • My newlines were not being preserved so that my asterisks that were supposed to punctuate bullet points were not at the beginnings of lines.
  • I could not edit my submission once submitted.

I like bullet points, a lot. However, I digress. In response to my anger, I complained on twitter that the site should be open sourced, so I the end user could create a better experience for myself and my fellow SQL Saturday Speakers.

I got three retweets. At least I wasn’t completely alone in my sentiment. I complained again in the morning, started a conversation and eventually Tim sent this out this:

So the site was being rewritten, but it would not be open sourced. Should I have been happy at that point, or at least patiently await the changes? One could presume that session editing and submission would be improved. At the very least, things would get progressively better as there were revisions to the code. If the federal government could pull off the ObamaCare site, with some hiccups, why can’t a group of DBAs launch a much smaller website, with much simpler requirements and lower load? I’d be willing to bet they will. I’d be willing to bet that this site will suck a lot less than the old site, and that it will continue to progress. I’m sure smart people are working on it, and a passionate BoD are guiding the process. At the very least I’ll withhold judgement until the new site is live. Despite my confidence in the skills of the unknown (to me) parties working on the site, there are so many hours in the day and only so many things a team of finite size can do. However, a sizable minority of PASS’s membership are .NET developers. Many of them speak at SQL Saturdays. They have to submit to the site. Some of them will no doubt be annoyed at some aspect of the site. Some of them might fix that annoyance, or scratch their itch in OSS parlance, if the site was open source and there was a process to accept pull requests. I’m not describing a hypothetical nirvana. I’ve seen the process I describe work because I’m submitted a lot of patches to a lot of OSS projects. I’ve submitted a patch to the (not actually open source, as Brent will be the first to state) sp_blitz and Brent accepted it. I’ve contributed to NancyFX. I once contributed a small patch to PHP to make it consume WCF services better. I’ve contributed to several other OSS projects as well. Perhaps your saying SQL Server is a Microsoft product, not some hippie Linux thing. Perhaps you share the same sentiment as Noel McKinney:

However, as I pointed out to Noel, the mothership’s (i.e, Microsoft’s Editors Note: Noel has stated to me he meant Microsoft) beliefs are not anti OSS. Microsoft has fully embraced Open Source. You can become an MVP purely for OSS without any speaking or forum contributions. One of the authors of NancyFX is an example of such a recipient. F#, ASP.NET and Entity Framework are all open source. Just this week Microsoft Open Sourced Roslyn. As a matter of fact I’ve even submitted a patch to the nuget gallery website, which is operated by Microsoft and owned by the OuterCurve foundation. The patch was accepted and my code, along with the code of others was pushed to So I’ve already submitted source code for a website owned and operated by an independent organization  setup by Microsoft, they’ve already accepted it, and the world seems a slightly better place as a result. So I ask the PASS BoD to consider releasing the SQL Saturday Website source code on github, and I ask the members of PASS to ask their BoD to release the source code as well.

Creating a minimally viable Centos instance for SSH X11 Forwarding

I recently need to setup a CentOS 6.4 vm for development Java development. I wanted to be able to run Eclipse STS and on said vm and display the X11 Windows remotely on my Windows 7 desktop via XMing. I saw no reason for the CentOS VM to have a local X11 server. I’m quite comfortable with the Linux command line. I decided to share briefly on how to go from a CentOS minimal install to something actually useful for getting work done.

  • /usr/bin/man The minimal install installs man pages, but not the man command. This is an odd choice. yum install man will fix that.
  • vim There is a bare bones install of vim included by default that is only accessible via vi. If  you want a more robust version of vim, yum install vim.
  • X11 forwarding You need the xauth package and fonts. yum install xauth will allow X11 forwarding to work. yum groupinstall fonts will install a set of fonts.
  • A terminal for absolute minimal viability yum install xterm will give  you a terminal. I prefer terminator, which is available through rpmforge.
  • RpmForge (now repoforge) Centos is based on Red Hat Enterprise Linux. Therefore it focuses on being a good production server, not a developer environment. You will probably need rpmforge to get some of the packages you want. The directions for adding Rpmforge to your yum repositories are here.
  • terminator This is my terminal emulator of choice. One you added rpmforge, yum install rpmforge
  • gcc, glibc, etc Honestly, you can usually live without these if you stick to precompiled rpms, and you’re not using gcc for development. If you need to build a kernel module, yum install kernel-devel gcc make should get you what out need.

From here, you can install the stuff you need for your development environment for your language, framework, and scm of choice.

When your PowerShell cmdlet doesn’t return anything, use -PassThru

The other day I was mounting an ISO in Windows 8 via the Mount-DiskImage command. Since I was mounting the disk image in a script, I needed to know the drive letter it was mounted to so the script could access the files contained within. However, Mount-DiskImage was not returning anything. I didn’t want to go through the hack of listing drives before and after I mounted the disk image, or explicitly assigning the drive letter. Both would leave me open to race conditions if another drive was mounted by another process while my script ran. I was at a loss for what to do.

Then, I remembered the -PassThru parameter, which I am quite fond of using with Add-Type. See certain cmdlets, like Mount-DiskImage, and Add-Type don’t return pipeline output by default. For Add-Type, this makes sense. You rarely want to see a list of the types you just added, unless your exploring the classes in a DLL from the command like. However, for Mount-DiskImage, defaulting to no output was a questionable decision IMHO.

Now in the case of Mount-DiskImage, -PassThru doesn’t return the drive letter. However, it does return an object that you can pipe to Get-Volume which does return an object with a DriveLetter property. To figure that out, I had to ask on stackoverflow.

tl;dr: If your PowerShell cmdlet doesn’t return any output, try -PassThru. If you need the drive letter of a disk image mounted with Mount-DiskImage, pipe the output through Get-Volume.

For a more in depth treatise of -PassThru, check out this script guy article by Ed Wilson(blog|twitter).

Getting the Drive Letter of a disk image mounted with WinCdEmu

In my last post, I talked about mounting disk images in Windows 8. Both Windows 8 and 2012 include native support for mounting ISO images as drives. However, in prior versions of Windows you needed a third party tool to do this. Since I have a preference for open source, my tool of choice before Windows 8 was WinCdEmu. Today, I decided to see if it was possible to determine the drive letter of an ISO mounted by WinCdEMu with PowerShell.

A quick search of the internet revealed that WinCdEmu contained a 32 bit command line tool called batchmnt.exe, and a 64 bit counterpart called batchmnt64.exe. These tools were meant for command line automation. While I knew there would be no .NET libraries in WinCdEmu, I did have hope there would be a COM object I could use with New-Object. Unfortunately, all the COM objects were for Windows Explorer integration and popped up GUIs, so they were inappropriate for automation.

Next I needed to figure out how to use batchmnt. For this I used batchmnt64 /?.

C:\Users\Justin>"C:\Program Files (x86)\WinCDEmu\batchmnt64.exe" /?
BATCHMNT.EXE - WinCDEmu batch mounter.
batchmnt <image file> [<drive letter>] [/wait] - mount image file
batchmnt /unmount <image file>         - unmount image file
batchmnt /unmount <drive letter>:      - unmount image file
batchmnt /check   <image file>;        - return drive letter as ERORLEVEL
batchmnt /unmountall                   - unmount all images
batchmnt /list                         - list mounted


Mounting and unmounting are trivial. The /list switch produces some output that I could parse into a PSObject if I so desired. However, what I really found interesting was batchmnt /check. The process returned the drive letter as ERORLEVEL. That means the ExitCode of the batchmnt process. If you ever programmed in a C like language, you know your main function can return an integer. Traditionally 0 means success and a number means failure. However, in this case 0 means the image is not mounted, and a non zero number is the ASCII code of the drive letter. To get that code in PowerShell is simple:

$proc = Start-Process  -Wait `
    &quot;C:\Program Files (x86)\WinCDEmu\batchmnt64.exe&quot; `
    -ArgumentList '/check', '"C:\Users\Justin\SQL Server Media\2008R2\en_sql_server_2008_r2_developer_x86_x64_ia64_dvd_522665.iso"' `
[char] $proc.ExitCode

The Start-Process cmdlet normally returns immediately without output. The -PassThru switch makes it return information about the process it created, and -Wait make the cmdlet wait for the process to exit, so that information includes the exit code. Finally to turn that ASCII code to the drive letter we cast with [char].

Setting the Visual Studio TFS diff and merge tools with PowerShell

I recently wrote this script to let me quickly change the diff and merge tools TFS uses from PowerShell. I plan to make it a module and add it to the StudioShell Contrib package by Jim Christopher (blog|twitter). For now, I share it as a gist and place it on this blog.

The script supports Visual Studio 2008-2012 and the following diff tools:


Announcing SevenZipCmdLine.MSBuild

This was a quick and dirty thing born out of necessity, and need to make zip files of PoshRunner so I could make its chocolatey package.

I made MSBuild tasks for creating 7zip and zip files out of the $(TargetDir) of an MSBuild project. There is a nuget package for it. Simply include it in your project via nuget and build it from the command line with the following command line:

%windir%\\framework\v4.0.30319\msbuild __PROJECT_FOLDER__\__PROJECT_FILE__ /t:SevenZipBin,ZipBin

This will create and project.7z in __PROJECT_FOLDER__\bin\Target. To see how to override some of the defaults, look at this msbuild file in PoshRunner.

Source code is available via a github repo, and patches are welcome!