Election 2010 Anomaly Watcher - revised


I modified the original script to include another check. So the script now checks for two things. First, it checks for candidates having a high percentage of votes and second, it checks for low percentage of votes in a position as compared to the total of people you actually voted. See example below:


In the figure above, the number of people who actually voted for a president is 27 but the total number of people who voted in that CP is 189. What happened to the other 162? On that same page other positions like Governor/Vice-governor looked normal.

So there is my modified script:

Howto Recompile the Kernel - UBUNTU Way


First, why should you upgrade or change your kernel? Here are just some of the reasons:
  • You need a feature that only the newer kernel supports
  • You came across a bug which is fixed in the newer version
  • You have a device driver that needs kernel recompile either as a module or compiled with the kernel
  • You are bored
As for me, I got bored.

Overview of the process:
  1. Update apt sources
  2. Install the necessary pre-requisites
  3. Get the kernel source
  4. Compile
  5. Install the kernel and modules
  6. Reboot with the new kernel

Here are are the steps:

1. Update your APT sources
apt-get update

2. In Ubuntu 10.04, /bin/sh is linked to /bin/dash. This may be a problem during compilation. Change the link from /bin/dash to /bin/bash
rm -f /bin/sh
ln -s /bin/bash /bin/sh

3. Install pre-requisites
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

4.Get the kernel source
cd /usr/src/
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.34.tar.bz2
tar xjf linux-2.6.34.tar.bz2
ln -s linux-2.6.34 linux
cd linux

5. Copy the config of the running kernel as a basis configuration for the new kernel. It's usually a good idea to do this.
cp /boot/config-`uname -r` ./.config

6. Now we are ready to select kernel options. This is also the time to select weather you want a driver compiled as module, with the kernel or not to include at all. You have to options in doing this -- using a nice GTK menu or using the console (curses based). The latter is usually the way to go but if you want the former make sure you install libgtk2.0-dev and libglade2-dev first. For now, we will go with the console (curses)

make menuconfig

or

make gconfig

This will bring up the kernel configuration menu. Go to "Load Alternate Configuration File" and choose ".config" as the configuration file. This will load the configuration for the currently running kernel. Browse through the options and make your changes. When you are finished select "Exit" and choose YES to save.

7. We are now ready to compile the kernel. This process will take a considerable amount of time depending on the speed of your machine and the number of modules you choose to compile.
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers

You can substitute anything for --append-to-version paramater as long as it starts with a "-". This string may be your version or revision number or simply just a tag.

8. When compilation is done, we can now install the new kernel and modules
cd /usr/src/

root@john-desktop:/usr/src# ls -la
total 106128
drwxrwsr-x  5 root src      4096 2010-05-18 14:50 .
drwxr-xr-x 11 root root     4096 2010-05-18 09:29 ..
lrwxrwxrwx  1 root src        12 2010-05-18 09:33 linux -> linux-2.6.34
drwxr-xr-x 25 root root     4096 2010-05-18 14:48 linux-2.6.34
-rw-r--r--  1 root src  67633622 2010-05-17 05:37 linux-2.6.34.tar.bz2
drwxr-xr-x 24 root root     4096 2010-02-10 01:07 linux-headers-2.6.32-12
drwxr-xr-x  7 root root     4096 2010-02-10 01:07 linux-headers-2.6.32-12-generic
-rw-r--r--  1 root src   6675822 2010-05-18 14:50 linux-headers-2.6.34-custom_2.6.34-custom-10.00.Custom_i386.deb
-rw-r--r--  1 root src  34340580 2010-05-18 14:47 linux-image-2.6.34-custom_2.6.34-custom-10.00.Custom_i386.deb 
dpkg -i linux-image-2.6.34-custom_2.6.34-custom-10.00.Custom_i386.deb
dpkg -i linux-headers-2.6.34-custom_2.6.34-custom-10.00.Custom_i386.deb

9. Reboot. Enjoy!

Channel Vision Telephone Lightning Protector

I recently got eight units of Channel Vision Telephone Lightning Protector (model C-0410).Channel Vision C-0410 surge protection (stopper) module is compatible with all Loop start Consumer Premise equipment.

PRODUCT FEATURES:
  • Complies with UL 1459 and UL 1950 power cross requirements
  • Passes FCC Part 68 Type A and Type B lighting tests operationally
  • Provides un-balanced line over voltage and over current protection
  • Automatically resets once surge condition has cleared restoring the phone line
  • 4 lines in
  • 4 lines out
The device is pretty interesting. Its input interface is a 110 block where you can use any standard 110 punch tool. For the output interface, you can either use the 110 block or the RJ45 interface. The device uses thermal fuses. It disconnects the line during a power surge and automatically reconnects when the unit cools down, cool huh! :)




We imported it from the US of A, anyone know where I can get these locally? Product page can be found here.

Election 2010 Anomaly Watcher

While the 2010 Election was generally peaceful and the results came in fast, it doesn't mean the results were correct. I am referring to:

http://electionresults.ibanangayon.ph/res_reg5808114.html
http://electionresults.ibanangayon.ph/res_reg5808113.html
http://electionresults.ibanangayon.ph/res_reg5808112.html
http://electionresults.ibanangayon.ph/res_reg5808111.html
http://electionresults.ibanangayon.ph/res_reg5808110.html

These results are impossible and could not possibly happen. This is just for 5 clustered precincts. The effect of this mistake for a hundred CP is unimaginable lest a thousand. So i whipped out a small script to find other precincts where results are "questionable". The script basically checks for the "percentage" of votes garnered for a particular candidate. If it goes beyond the pre-configured threshold, it flags the file and makes a log.

Also, you need a local mirror of http://electionresults.ibanangayon.ph which can be easily accomplished with:

wget --mirror –w 2 –-convert-links http://electionresults.ibanangayon.ph

If you are on PLDT, use http://124.105.166.195/, for GlobeTelecom, use http://222.127.18.105/

Remember to edit $SearchFor, $mirror and $threshold to suit for needs.

#!/usr/bin/perl
#
# Election 2010 Anomaly Watcher
# John Homer H Alvero
# [email protected]
# May 13, 2010

use HTML::TableExtract;
use LWP::Simple;

# SearchFor:
# Possible Values:
#
# 1 = President
# 3 = Vice President
# 5 = Senator
# 7 = Party List

my $SearchFor = 1;
my $mirror = "/var/www/election/electionresults.ibanangayon.ph/";
my $threshold = 90;

&check_folders($mirror);

# SUB(s)
sub check_folders {

   my($dir) = @_;
   local (*FOLDER);

   my(@subfiles, $file, $specfile);
   opendir(FOLDER, $dir) or die "cannot open $dir";

   @subfiles = readdir(FOLDER);
   closedir(FOLDER);


   foreach $file (@subfiles) {
      $specfile = $dir .  $file;
      if (-f $specfile && $file =~ m/\S+\.html/) {
        my $page = get("file://" . $specfile) or die $!;
        $te = HTML::TableExtract->new( headers => [qw(Candidate Votes Percentage)], depth => 0, count => $SearchFor );
        $te->parse($page);

        foreach $ts ($te->tables) {
                foreach $row ($ts->rows) {
                        chop( $votes = @$row[2]);
                        if ($votes > $threshold) {
                                print "Found filename " . $specfile . " name:" .  @$row[0] . " at $votes%" . "\n";
                        }
                }
        }
#Check for Subdirectories (not really needed)
      } elsif (-d $specfile) {
        if ($specfile !~ m/\S+\.$/) {
                &check_folders($specfile . "\/");
        }
      }#if
   }#for
}#sub

UPDATE: (May 17, 2010)

I ran the script on my local mirror and here is what I found. (note that my local is not complete yet and scanning is not yet over)

root@ubuntu:/home/john/ibangangayon/124.105.166.195# /root/table.pl
Found filename res_reg3629006.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg3615004.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg3636022.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg5512002.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg313022.html name:AQUINO, Benigno Simeon III C. at 99.20%
Found filename res_reg3516000.html name:AQUINO, Benigno Simeon III C. at 98.20%
Found filename res_reg3807028.html name:VILLAR, Manuel Jr B. at 99.09%
Found filename res_reg3826010.html name:VILLAR, Manuel Jr B. at 99.49%
Found filename res_reg6615003.html name:VILLAR, Manuel Jr B. at 98.15%
Found filename res_reg3601016.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg705032.html name:AQUINO, Benigno Simeon III C. at 98.55%
Found filename res_reg3812027.html name:AQUINO, Benigno Simeon III C. at 99.64%
Found filename res_reg6610016.html name:TEODORO, Gilberto Jr.  C. at 98.01%
Found filename res_reg6606006.html name:AQUINO, Benigno Simeon III C. at 98.35%
Found filename res_reg3807036.html name:VILLAR, Manuel Jr B. at 98.84%
Found filename res_reg3835015.html name:VILLAR, Manuel Jr B. at 98.18%
Found filename res_reg302019.html name:AQUINO, Benigno Simeon III C. at 98.88%
Found filename res_reg3812029.html name:AQUINO, Benigno Simeon III C. at 99.67%
Found filename res_reg705034.html name:AQUINO, Benigno Simeon III C. at 98.79%
Found filename res_reg3826008.html name:VILLAR, Manuel Jr B. at 98.97%
Found filename res_reg3803017.html name:TEODORO, Gilberto Jr.  C. at 98.32%
Found filename res_reg3803013.html name:TEODORO, Gilberto Jr.  C. at 98.92%
Found filename res_reg3807018.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg3835014.html name:VILLAR, Manuel Jr B. at 98.73%
Found filename res_reg3832009.html name:TEODORO, Gilberto Jr.  C. at 99.24%
Found filename res_reg3812064.html name:AQUINO, Benigno Simeon III C. at 99.29%
Found filename res_reg3617010.html name:VILLAR, Manuel Jr B. at 99.34%
Found filename res_reg3807023.html name:TEODORO, Gilberto Jr.  C. at 99.57%
Found filename res_reg3626009.html name:AQUINO, Benigno Simeon III C. at 98.84%
Found filename res_reg702017.html name:AQUINO, Benigno Simeon III C. at 98.02%
Found filename res_reg3832010.html name:TEODORO, Gilberto Jr.  C. at 99.37%
Found filename res_reg3812047.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg6615012.html name:VILLAR, Manuel Jr B. at 99.19%
Found filename res_reg3812050.html name:AQUINO, Benigno Simeon III C. at 99.87%
Found filename res_reg3629002.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg6607015.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg6610014.html name:TEODORO, Gilberto Jr.  C. at 98.87%
Found filename res_reg4406026.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg4406026.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg4406026.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg4406026.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg4406026.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg4406026.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg4406026.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg4406026.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg4406026.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg4406026.html name:GORDON, Richard J. at 100.00%
Found filename res_reg112002.html name:TEODORO, Gilberto Jr.  C. at 98.33%
Found filename res_reg6606002.html name:AQUINO, Benigno Simeon III C. at 98.58%
Found filename res_reg3832011.html name:TEODORO, Gilberto Jr.  C. at 99.61%
Found filename res_reg3629018.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg6610010.html name:TEODORO, Gilberto Jr.  C. at 99.37%
Found filename res_reg5535035.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg5535035.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg5535035.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg5535035.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg5535035.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg5535035.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg5535035.html name:GORDON, Richard J. at 100.00%
Found filename res_reg5535035.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg5535035.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg5535035.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg3812025.html name:AQUINO, Benigno Simeon III C. at 99.62%
Found filename res_reg7001014.html name:TEODORO, Gilberto Jr.  C. at 99.70%
Found filename res_reg3812069.html name:AQUINO, Benigno Simeon III C. at 99.58%
Found filename res_reg1529053.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg1529053.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg1529053.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg1529053.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg1529053.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg1529053.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg1529053.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg1529053.html name:GORDON, Richard J. at 100.00%
Found filename res_reg1529053.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg1529053.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg3818005.html name:AQUINO, Benigno Simeon III C. at 98.55%
Found filename res_reg3637008.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg3833002.html name:AQUINO, Benigno Simeon III C. at 99.59%
Found filename res_reg3807022.html name:TEODORO, Gilberto Jr.  C. at 99.67%
Found filename res_reg3802024.html name:AQUINO, Benigno Simeon III C. at 99.37%
Found filename res_reg3836018.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg3635006.html name:TEODORO, Gilberto Jr.  C. at 98.31%
Found filename res_reg3803011.html name:TEODORO, Gilberto Jr.  C. at 98.98%
Found filename res_reg3807007.html name:VILLAR, Manuel Jr B. at 98.72%
Found filename res_reg3835017.html name:VILLAR, Manuel Jr B. at 99.11%
Found filename res_reg6610001.html name:TEODORO, Gilberto Jr.  C. at 99.59%
Found filename res_reg3114084.html name:BINAY, Jejomar C. at 100.00%
Found filename res_reg3114084.html name:CHIPECO, Dominador Jr F. at 100.00%
Found filename res_reg3114084.html name:FERNANDO, Bayani F. at 100.00%
Found filename res_reg3114084.html name:LEGARDA, Loren B. at 100.00%
Found filename res_reg3114084.html name:MANZANO, Eduardo B. at 100.00%
Found filename res_reg3114084.html name:ROXAS, Manuel A. at 100.00%
Found filename res_reg3114084.html name:SONZA, Jose Y. at 100.00%
Found filename res_reg3114084.html name:YASAY, Perfecto R. at 100.00%
Found filename res_reg3812057.html name:AQUINO, Benigno Simeon III C. at 98.96%
Found filename res_reg3812014.html name:AQUINO, Benigno Simeon III C. at 98.59%
Found filename res_reg3812019.html name:AQUINO, Benigno Simeon III C. at 98.92%
Found filename res_reg6604024.html name:VILLAR, Manuel Jr B. at 98.72%
Found filename res_reg5527039.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg5527039.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg5527039.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg5527039.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg5527039.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg5527039.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg5527039.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg5527039.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg5527039.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg5527039.html name:GORDON, Richard J. at 100.00%
Found filename res_reg3836013.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg3817021.html name:ESTRADA EJERCITO, Joseph M. at 98.65%
Found filename res_reg705005.html name:AQUINO, Benigno Simeon III C. at 98.51%
Found filename res_reg3637017.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg3601017.html name:MADRIGAL, Jamby A. at 300.00%
Found filename res_reg3601017.html name:ACOSTA, Vetellano S. at 300.00%
Found filename res_reg3601017.html name:GORDON, Richard J. at 300.00%
Found filename res_reg3601017.html name:DE LOS REYES, John Carlos G. at 300.00%
Found filename res_reg3601017.html name:ESTRADA EJERCITO, Joseph M. at 300.00%
Found filename res_reg3601017.html name:VILLAR, Manuel Jr B. at 300.00%
Found filename res_reg3601017.html name:TEODORO, Gilberto Jr.  C. at 300.00%
Found filename res_reg3601017.html name:PERLAS, Jesus Nicanor P. at 300.00%
Found filename res_reg3601017.html name:AQUINO, Benigno Simeon III C. at 300.00%
Found filename res_reg3601017.html name:VILLANUEVA, Eduardo C. at 300.00%