SQL Server – count the records in every table in your database

Posted by Andy on January 24, 2012
Computers / No Comments

Here’s a script to create a simple text-based report containing the record counts for every table in your database:

Essential Windows Development Tools

Posted by Andy on December 01, 2011
Uncategorized / 2 Comments

I just had the good fortune of getting a new computer at work, so I thought I would write down all of the tools that I normally install for doing software development on Windows.  I’ll probably update this over time, and put in links and all that jazz.

Before I start, I’ll just add a link to an awesome list of Windows tools that puts my list to shame.  It’s developer focused, and there’s a ton of stuff here, but there are some true gems in here.  Thanks to Scott Hanselman for putting this together and updating it over time:

Scott Hanselman’s Ultimate Developer/Power User Tool List

Operating Systems

  • Windows 7 Professional – pretty solid and nice to use once you turn off UAC
  • Windows XP (VMs) – for testing legacy stuff
  • VMware Workstation – not really an OS, but it runs OSs.  Solid and useful for spinning up extra machines for doing whatever.

IDEs

  • Visual Studio 2010
  • Visual Studio 2008 (we are still doing legacy Windows Mobile development at my work…)
  • Visual Studio 2008 Database Edition (I’m not a huge fan of the dbproj stuff, but it can be nice, and my company uses dbprojs on a lot of solutions, so I have to install this.)
  • Eclipse - still my favorite IDE, and a pleasure to use, but I rarely do any Java anymore.  It’s too bad Java just hasn’t kept up with C# in terms of language innovations.  Maybe I’ll do an Android project someday.

Web Browsers

  • Chrome - best browser hands-down
  • Firefox – used to be my go-to browser, but at the time I decided to move on, it was being a memory hog and was crashing a lot.  That may have improved since then, but I haven’t looked back
  • Internet Explorer – ugly browser (yes you IE6, IE7, IE8, and IE9), but unfortunately required for certain things that I have to use (…Sharepoint… cough…  Infor EAM… cough…)

Text Editors

  • gvim - best text editor in the world!
  • Notepad++ – has some nice plugins that I use to do things that I don’t know how to do in Vim (formatting XML…)

Command Line Tools

  • Cygwin – absolute must-have for day-to-day work
  • Unxutils – Unix command-line tools built for Windows
  • Powershell – I tried to get on the Powershell bandwagon for awhile, but ultimately had to go back to Cygwin.  Powershell requires too much thinking and cryptic syntax to do simple tasks, and is just not quite fast enough.  You could probably say the same thing about Cygwin, but I know the Unix/Linux commands already, so I’m already over that learning curve.

Networking/Debugging Tools

  • Fiddler
  • Wireshark
  • .NET Reflector – once the king of .NET decompiling, but the Red Gate buy-out scandal has left most of the former Reflector community scrambling for a replacement.
  • ILSpy – nice Reflector replacement from SharpDevelop (the Mono guys).  Seems to be almost a clone of Reflector in terms of features and UI.
  • Telerik JustDecompile – Reflector replacement from Telerik.  Seemed nice, but haven’t used it too much yet.

Image Tools

  • Paint.NET – nice for quick image fixes and stuff. I rarely need to do anything other than this.

Other Tools

  • WinRAR
  • DropBox
  • SourceGear DiffMerge
  • WinMerge
  • Ninite - a nice way to quickly install most of the stuff listed on this page!  I was skeptical, but I tried it and have to say that it works really well!

Chatting

  • Pidgin – can be a little janky sometimes, but it has support for everything I use, and at least it’s not MSN messenger
  • Google+ Hangouts
  • Skype

Music

  • Last.fm Radio client- ad-free radio with a great catalog
  • Spotify – great for listening to pretty much whatever you want, but the ads are a little excessive.  I demand free music with no ads!

SQL Server 2008 Installation Errors with Visual Studio 2008

Posted by Andy on June 01, 2011
Uncategorized / No Comments

I recently ran into a problem when trying to install SQL Server 2008.  Near the end of the install, it does some dependency checking, and my particular install was throwing this error:

A previous release of Microsoft Visual Studio 2008 is installed on this computer. Upgrade Microsoft Visual Studio 2008 to the SP1 before installing SQL Server 2008.

I found a few useful blog posts on the topic:

http://brianpeek.com/blog/archive/2008/08/13/sql-server-2008-visual-studio-sp1-and-visual-studio-express.aspx

http://it.toolbox.com/blogs/programming-life/fixing-sql-server-2008-rtm-installation-issues-due-to-visual-studio-2008-dependencies-26646

I verified that I did, indeed, have Visual Studio 2008 SP1 installed, and it appeared that I did.  I then checked to see if I had any versions of Visual Studio Express installed on the machine, and I did not.  At this point I was not quite sure what to do, so I decided to try to find the SQL Server 2008 install log.

The install logs are put here by default:

C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\

If you then check the folder with the appropriate timestamp (e.g. \20091016_132538\), you’ll see various log files.  If you open up Detail.txt and search for “visual studio”, you’ll find the places where the installer is checking the registry settings for the Visual Studio SP version.

In my case, I had installed Visual Studio Developer Edition, and a few plugins, then upgraded to SP1.  After that, I had installed the Visual Studio Database Edition addons.  It turns out that my instance of Database Edition was still at the pre-SP1 version, which was causing the SQL Server 2008 install to fail.

SQL Server – kill all processes connected to a database

Posted by Andy on April 27, 2011
Computers, Software Development / 7 Comments

Below is a little script to kill all the processes which are currently connected to your SQL Server database.  I’m posting this mostly for myself for future reference.  The preferable way to do this is to use the alter database set single_user thing, but that doesn’t always work, so this is the “drastic measure” option.

Window Mobile (6.5 and below) Development Tips

Posted by Andy on September 01, 2010
Computers, Software Development / No Comments

I wanted to link to a few good blogs/articles regarding the wonderful world of Windows Mobile  development.  I’m not talking about Windows Phone 7, this is the old-school Windows Mobile 6.5 and below.

This first article has some must-know tips for writing Windows Mobile apps that can run on either the full or compact frameworks.  Following these conventions gives you the ability to run the same application on either a Windows Mobile device or emulator, or as a full .NET framework desktop application (without re-compiling or re-configuring).

Write Code Once for both Mobile and Desktop Apps

Of course, you can’t have this both ways:  You cannot run full-framework code on Windows Mobile, you can only go in the other direction and run CF code on the full framework.

This next article (written by the lead developer at my company Blue Dot Solutions), shows how to setup Visual Studio to debug .NET CF apps on your PC, rather than the emulator.  This is a super-useful trick that makes Windows Mobile development much faster, and almost tolerable.

Deploy to My Computer

The following articles talk about “provisioning” of Windows Mobile devices.  “Provisioning” is a term you don’t hear too often, unless you work in an “enterprise” environment.  Provisioning has to do with the initial configuration of a device (applications, settings, etc.) by the manufacturer, or continuous setup and configuration by an administrator or user.  There are several industry standard mechanisms for provisioning devices, and Windows Mobile supports several of these, including OMA Client Provisioning and OMA Device Management (among others).  This set of documents is pretty poorly organized, but it contains a ton of really useful information, and provides examples on all the different things that you can provision.

Managing Windows Mobile Devices

Configuration Service Providers

I hope to add more links as I come across more information.

Tags: