GNU Patch in Windows 7 or Vista

I just had a little fight with Windows 7 about permissions. It seems that it demands that any executable with the word “patch” in the name must be run with administrative privileges. After fighting with it for a few minutes about the absurdity of the problem, I resorted to a simple hack.

  1. Rename patch.exe to patsh.exe.
  2. Then create patch.bat in the same directory containing the following command:
    @patsh.exe %*

You will never notice a difference, and Windows 7 can go politely F*** itself.

Read More

Accessing SQLite databases in C++ using SOCI

I recently decided to use SOCI and SQLite at work and found that neither there is not a super straight forward path for setting this up. As of SOCI version 3.0.0 there is no support for Visual Studio 2008, so I had to convert and fix a few bugs resulting from that. There were some path issues as well. Also they don’t package the SQLite interface with SOCI so you have to checkout the repo to get access to it. After getting that there are still a few snags, not to mention actually setting up SQLite as a library.

[Updated: 10/13/2009]
After writing this article the SOCI team has resolved some of these issues, so some of these steps are no longer necessary.

Read More

Setting up a Symbol Server for Visual Studio 2008

Debugging an application after its been released can be a total pain.  So, over time I’ve collected some software and techniques for making it a bit easier on myself and my team.  We ship our product with a modified version of  Hans Dietrich’s XCrashReport to provide logs, system information, and minidumps when our application inevitably crashes. If you’re not already using something similar I would highly recommend checking it out.

This utility sends us lots of crash dump files and until now we’ve always had to dig back through our archives to find the corresponding symbols and source code. But today I decided to rid us of the headache and set up a Symbol Server that could automatically determine our version and load it into Visual Studio 2008. The documentation can be a bit lacking at times, so I will try to illuminate the path that I took.

Step 1:
Download Debugging Tools for Windows. This provides you with symstore.exe which will be important for creating the symbol store.

Step 1.5:
Add the Debugging Tools directory to your path, so we have access to symstore.exe.

Step 2:
Create a folder on your build server and share it such that you have something like \\BuildServer\Symbols available to your workstation.

Step 3:
For each build, execute a command like

symstore.exe add /r /p /f U:\Project\Bin\*.* /s \\BuildServer\Symbols /t “My Project” /v “Build 42”

Where U:\Project\Bin is the directory with your .pdb files, \\BuildServer\Symbols is obviously the symbols directory, “My Project” is the name of the project, and “Build 42” is the description of the version.

Step 4:
Open Visual Studio 2008,  go to Tools->Options->Debugging->Symbols. Set your cache directory to something like C:\SymbolCache, then add the location of the new symbol store: \\BuildServer\Symbols.

Step 4.5:
At this point, it would be advisable to add the Microsoft Symbol Store to the locations list too:

This should facilitate debugging crash dumps without tracking down the symbols. Also, check out the Source Server which will access your VCS system to pull out the correct source code files for you automatically too.

Read More