Archive for November, 2006

Hacking Democracy

Thursday, November 9th, 2006

I watched the HBO documentary called “Hacking Democracy” last night and it was quite eye opening. They showed how a Diebold optical scanning voting machine was able to have it’s memory card altered to effectively “stuff” the ballot box in the favour of a candidate while maintaining the accuracy of the total vote count.

Without having looked at the software — because it is illegal thanks to the DMCA — I will speculate my thoughts on this situation.

The machine relies on removable memory cards in the same way that your camera does. This allows machines to be disconnected from a computer network, but relies on “sneaker net” to transfer the number of votes from each individual machine to the “central tabulator” which reads each memory card and sums up the totals for every machine in the election.
(more…)

Visual Studio 2005 Pre-Build Magic String

Thursday, November 2nd, 2006

I had a struggle a while back trying to get a pre-build event to fire before my code was compiled.

The pre-build event generates a class that allows me to inspect the revision level of my code and ties the revision to the subversion source code repository.

Today I had a coffee and revisited the problem. I had a lot more success. The magic string is shown below:
"$(ProjectDir)genSvnVer.bat" "" ModuleTracClient

This expands when run on my laptop to:
“C:\Documents and Settings\cgness\My Documents\Visual Studio 2005\Projects\client\ModuleTrac\genSvnVer.bat” “” ModuleTracClient

There are 3 components to the magic command line above.

  1. The executable needs to be quoted since the $(ProjectDir) macro may expand to something with spaces. C:\Documents and Settings… when parsed by the shell evaluates up to the first space C:\Documents which is not an executable.
  2. Parameter 1 for the batch file allows me to set the output location concatenated to the current working directory for the output of the script.
  3. Parameter 2 sets the namespace to be used in the generated C# class.

The script I’m using is the one I posted to the Subversion mailing list but I added a parameter for where to put the output. That will be left as an exercise for the reader.

To debug your pre and post build events simply change to the output window, check if they possibly would work in the command shell and read the errors carefully. Happy shelling!