Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Votes in the pool

by larsen (Parson)
on Apr 17, 2001 at 13:44 UTC ( #73083=CUFP: print w/replies, xml ) Need Help??

I like numbers very much :).
Once I asked myself (I was thinking about cumulative audience and the voting system) how many ++ are in the pool for a single day. Here a simple snippet that counts them for me.

#!/usr/bin/perl use strict; use LWP::Simple; use HTML::TableExtract; my $votes_in_the_pool = 0; my @number_of_votes = ( 0, 5, 8, 12, 16, 20, 25, 30, 35, 40); my $page_content = get( 'http://www.perlmonks.org/index.pl?node=Number +%20of%20Monks%20by%20Level' ) || die ("Can't get page content!\n"); my $parser = new HTML::TableExtract(); $parser->parse( $page_content ); my $table = $parser->table_state(1, 2); print "Today...\n"; foreach my $row ( $table->rows ) { foreach ( @$row ) { if ( /Level (\d+)\n\((\d+)\)/s ) { print "there are $2 monks of level $1\n"; $votes_in_the_pool += $number_of_votes[ $1 - 1 ] * $2; } } } print ".. for a total of $votes_in_the_pool votes\n";

Replies are listed 'Best First'.
Re: Votes in the pool
by mikeB (Friar) on Oct 17, 2001 at 19:10 UTC
    I like it!

    Now, for extra credit, find the number of votes actually cast on a given day and calculate the percentage of votes used :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://73083]
Approved by root
help
Chatterbox?
[Corion]: marto: I'm not sure on how to treat mail archives. I think you could either set an auto-deletion timespan or an auto-anonymisation timespan if you wanted to do it right.
[Corion]: For PM, I think we'll create a user "gdpr", who gets assigned the nodes of users who want to give up their user status here.
[marto]: can I nominate users ? :P

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2018-05-22 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?