Australian Voting
Our latest project for CS 373 was to create a model that resolves ballots within an Australian voting system. However this voting method also goes by preferential voting and we specifically modelled the instant-runoff version. Simply put, preferential voting is to rank the candidates on a ballot as opposed to voting for a single individual. The instant-runoff variant is used for a single winner within an election.
The voting system is best described as:

IRV Flowchart (Wikipedia)
While this voting system is quite simple to model, professor Downing gave us the caveat that we could not process all the ballots after every candidate elimination with an emphasis to use classes.
To work around this condition, my partner and I decided on implementing two classes. One class was used to represent the candidate and his information such as name, number of votes, and running status. A second class was used for the ballot and simply kept track of the ballot contents and which position within the ballot it should be assigned to.
When a candidate was eliminated, that individual’s ballots were then redistributed amongst all the remaining candidates. This process was repeated until there was a winner or all the remaining candidates were tied.
Outside of implementing the voting system, the grading was also a bit stringent on proper input and output formatting. In addition, this was the first project thus far where we were required to submit a UML diagram in addition to our code and unit tests. There’s quite a variety of UML programs available, but I decided to use one called Gaphor since it was cross-platform and based on Python.
Midterm!
So my first midterm of the semester just had to land on Friday the 13th, not that I’m suspicious or anything.
Unlike past semesters, I really haven’t been slacking off so studying for the test was less “last minute cramming/speed reading” and more review. I’m not sure what to exepct from Downing’s tests but today’s wasn’t so bad. The midterm emphasized reading a bit more than I thought it would, but the coding questions were fairly trivial as the material was covered in class quite a bit.
One of the questions was to create an is_prime() function using no libraries except the sqrt() from the math library. I overthought the problem before realizing the simple answer was testing to see if the number was disable by incrementing odd numbers up to the square root of the input.
Changing default mouse button behavior
It took me a while to find the magical query for what I wanted to do, but hopefully this can help others.
If you want to remap your mouse buttons from one to another, there’s useful documentation here.
On the other hand imwheel gives you the ability to binds your mouse buttons to other actions (e.g. type text, combination key strokes). However you can probably find it within your distro’s repository and install it from there. Once imwheel is set up, you can take a quick glance at the man pages.
If you want to modify system-wide settings edit /etc/X11/imwheelrc, otherwise modify $HOME/.imwheelrc for user specific settings.
One thing to note is that unlike rest of X configuration, tilt wheel is not represented as button 5 and button 6, with thumb buttons represented as button 7 and 8. Instead tilt left is “Left”, tilt right is “Right”, left thumb is “Thumb1″, right thumb is “Thumb2″.
My .imwheelrc is listed below, but feel free to search for other configurations for more ideas.
".*"
None,Left,Control_L|Page_Up
None,Right,Control_L|Page_Down
None,Thumb1,Control_L|w
