to your HTML Add class="sortable" to any table you'd like to make sortable Click on the headers to sort Thanks to many, many people for contributions and suggestions. Licenced as X11: http://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ var stIsIE = /*@cc_on!@*/false; sorttable = { init: function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); if (!document.createElement || !document.getElementsByTagName) return; sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { sorttable.makeSortable(table); } }); }, makeSortable: function(table) { if (table.getElementsByTagName('thead').length == 0) { // table doesn't have a tHead. Since it should have, create one and // put the first table row in it. the = document.createElement('thead'); the.appendChild(table.rows[0]); table.insertBefore(the,table.firstChild); } // Safari doesn't support table.tHead, sigh if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; if (table.tHead.rows.length != 1) return; // can't cope with two header rows // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as // "total" rows, for example). This is B&R, since what you're supposed // to do is put them in a tfoot. So, if there are sortbottom rows, // for backwards compatibility, move them to tfoot (creating it if needed). sortbottomrows = []; for (var i=0; i
In the days following the November 2, 2004 U.S. election, I set up a simple spreadsheet in Microsoft Excel to work out just what percentage of the uncounted votes either George W. Bush or John Kerry would need to be able to claim victory in Ohio. It was such a simple tool that it immediately leapt out as being a natural fit for this blog - even with the 2004 election over, it can easily be modified to accommodate other political races, meaning lots of future use here for races of interest.
Instead, developing this tool has been a complete pain in the you-know-what on account of the Kerry campaign's continued drive to count questionable ballots in Ohio. (Editor's note: If it isn't already, Captain Ed's blog is well deserving of a place of privilege in your blogroll.) Every time I think I have the web-friendly version of my calculator finished, along come the Kerry people with another set of unmarked, mismarked, and even properly marked ballots that they want to have counted, recounted or otherwise included in the previously certified vote totals. With any luck, they'll accept reality soon (but I won't believe it until I see it....)
I've dealt with the ongoing shenanigans by providing for three categories of uncounted votes: absentee, provisional and other. (One development version also included categories for spoiled ballots, overvotes, undervotes and fraudulent ballots, but as more time went by, "other" seemed a better solution.) I could go on, but to make a long story short, I am finally happy to present:
Keeping in mind that this tool is still subject to change due to the issues discussed above, here is the first released version of my Simple Majority Calculator. What it does is really simple - it starts with the votes that have already been counted for the given candidates for an elective office, then it adds those numbers to the total number of estimated votes cast that are still uncounted, then it figures out how many votes it takes to win a clear, simple majority as well as what percentage of the uncounted votes a candidate would have to receive in order to win. Simply enter the known or estimated values in the appropriate fields in the input table and click the "Calculate" button to get the results.
While not a perfect tool, the Simple Majority Calculator does offer some insight into how the uncounted vote totals have to break in order for a given candidate to win office. Improved, and more timely versions will follow in the future.
Welcome to the blogosphere's toolchest! Here, unlike other blogs dedicated to analyzing current events, we create easy-to-use, simple tools to do the math related to them so you can get in on the action too! If you would like to learn more about these tools, or if you would like to contribute ideas to develop for this blog, please e-mail us at:
ironman at politicalcalculations
Thanks in advance!
Closing values for previous trading day.
This site is primarily powered by:
The tools on this site are built using JavaScript. If you would like to learn more, one of the best free resources on the web is available at W3Schools.com.