Electoral College Screensaver 1.4

Written by on November 16, 2008, 12:00 am

Because I needed to splice my install directory into the system path to implicitly link to the OgreMain DLL and I figured that NSIS (my install packager of choice) would either provide the functionality natively, or have some code I could use to do this. The later was true and I found some horrible NSIS assemlbyish code to do what I wanted. It came from the NSIS wiki and I felt like I could rely on it.

Sometime after I put up my first version, I discovered that in very rare cases, this code would erase the system path rather than appending to it. It took me some time to discover that the bug occured when a maximum string length in NSIS was exceeded. So the solution was to rebuild the NSIS compiler with a longer maximum string length and for those cases were that maximum was exceeded, handle the error rather than erasing the path.

I have since added a warning to the NSIS wiki, but might be checking out Inno installer for my next project

Permalink - Comments - Tags: Electoral College,Development

Electoral College Screensaver 1.3

Written by on October 30, 2008, 12:00 am

Added support for election day morning. Previously I handled polling data for every state, but on election day, obviously everything will be up in the air and I will be using actual voting data instead of the polls on Electoral Vote. As the results come in on election day I will update my XML in real time.

Permalink - Comments - Tags: Electoral College,Development

Electoral College Screensaver 1.2

Written by on October 24, 2008, 12:00 am

Fixed up states that were exactly tied to show up purple (previously they were displayed blue, no Democratic bias here).

Permalink - Comments - Tags: Electoral College,Development

Electoral College Screensaver 1.1

Written by on October 15, 2008, 12:00 am

Made some cosmetic changes to the main Electoral Vote count bar and the per state info in the corner.

Permalink - Comments - Tags: Electoral College,Development

Electoral College Screensaver 1.0

Written by on October 10, 2008, 12:00 am

This ScreenSaver accesses the Internet to download a compilation of polling data for Democratic and Republican candidates in US Presidential Elections. Polling percentages for each candidate are used to determine a winning candidate and the states are coloured accordingly. A indicator bar at the bottom of the screen shows the Electoral College totals for each candidate. Electoral Votes "won" with more than a 4% up or down margin of error are displayed in a darker colour than those within the margin of error.

This screensaver is developed in C++ and uses the Ogre SDK to perform the onscreen rendering.

There were a handful of technical hurdles that required more interesting solutions:

  • The Electoral Vote data is not accessed directly by the screensaver (and be subject to changing data formats). Instead I use a python script to scrape the data daily and update to an XML file hosted on my domain.
  • I was not able to find detailed geographic data for the United States online, so I wrote a python drawing utility to cut textures out of a larger bitmap. I used a Google maps image to slice out each state texture.
  • I wanted to avoid the UI blocking on startup, so I implemented the WinHTTP requests in a seperate thread.
  • The OGRE SDK is a rich C++ interface and designed with the assumption that client code will use implicit linking. The is fine for most applications where the OgreMain DLL is in the run directory for the application. Because the screensaver has to run in the system32 directory, I had the onerous choice of writing a complicated thunking layer for the rich set of classes in OgreMain or add my install directory to the path. With a few weeks to go till the election, I chose the latter.

Permalink - Comments - Tags: Electoral College,Development