Author Topic: The Last Word!  (Read 190557 times)

Offline buddy

  • Mayor
  • *******
  • Posts: 1477
    • View Profile
    • work
Re: The Last Word!
« Reply #180 on: April 07, 2008, 11:57:57 PM »
I'm waiting 4 Shelby 2 go 2 sleep. tick tock tick tock tick tock
First, do no harm.

Offline Chuckster

  • Mayor
  • *******
  • Posts: 2807
    • View Profile
Re: The Last Word!
« Reply #181 on: April 08, 2008, 12:00:10 AM »
I think Shelby fell asleep at the wheel.  You'll have to contend with me now.
The Chuckster has spoken!

Offline Chuckster

  • Mayor
  • *******
  • Posts: 2807
    • View Profile
Re: The Last Word!
« Reply #182 on: April 08, 2008, 12:00:39 AM »
I won! :rockon: :rockon: :rockon:
The Chuckster has spoken!

Offline buddy

  • Mayor
  • *******
  • Posts: 1477
    • View Profile
    • work
Re: The Last Word!
« Reply #183 on: April 08, 2008, 12:02:11 AM »
Damnit I got distracted.  You did win. Congratulations.  Brava.
First, do no harm.

Offline foobah

  • Resident
  • ***
  • Posts: 36
    • View Profile
Re: The Last Word!
« Reply #184 on: April 08, 2008, 07:11:42 AM »
Better yet, Foobah, could you write a script that automatically tallies the aggregate time that each person has been "winning"? 

Hmm, that's not a bad idea at all.  I'll consider it.

Offline buddy

  • Mayor
  • *******
  • Posts: 1477
    • View Profile
    • work
Re: The Last Word!
« Reply #185 on: April 08, 2008, 09:11:31 AM »
Hmm, that's not a bad idea at all. 

But it isn't a GOOD idea either because it doesn't matter since I win.  All the losers, please mail me $10  for each of your posts.   ASAP. thank you.
First, do no harm.

Offline foobah

  • Resident
  • ***
  • Posts: 36
    • View Profile
Re: The Last Word!
« Reply #186 on: April 08, 2008, 10:49:20 AM »
But it isn't a GOOD idea either because it doesn't matter since I win.

When you're right, you're right, but I had to write the program to find out:

TLW Leader Board as of Tue Apr  8 10:46:37 2008
buddy: 57 posts, last word for 4 days, 10 hours, 45 minutes and 2 seconds
NYCMacUser: 43 posts, last word for 4 days, 5 hours, 21 minutes and 56 seconds
ECG: 12 posts, last word for 1 day, 11 hours, 19 minutes and 30 seconds
toddg: 12 posts, last word for 1 day, 11 hours, 11 minutes and 23 seconds
JHICON: 30 posts, last word for 1 day, 0 hours, 4 minutes and 33 seconds
penguin3017: 6 posts, last word for 0 days, 19 hours, 34 minutes and 29 seconds
Chuckster: 18 posts, last word for 0 days, 13 hours, 40 minutes and 34 seconds
foobah: 6 posts, last word for 0 days, 5 hours, 30 minutes and 57 seconds
JD: 2 posts, last word for 0 days, 3 hours, 29 minutes and 10 seconds
Gherm: 1 post, last word for 0 days, 1 hour, 58 minutes and 10 seconds
Shelby2: 5 posts, last word for 0 days, 0 hours, 34 minutes and 58 seconds

Offline Shelby2

  • Mayor
  • *******
  • Posts: 4955
    • View Profile
Re: The Last Word!
« Reply #187 on: April 08, 2008, 10:52:08 AM »
I think that makes me the biggest loser!

Offline penguin3017

  • Tourist
  • **
  • Posts: 13
    • View Profile
Re: The Last Word!
« Reply #188 on: April 08, 2008, 11:28:51 AM »
Don't be so hard on yourself. :(

Offline Shelby2

  • Mayor
  • *******
  • Posts: 4955
    • View Profile
Re: The Last Word!
« Reply #189 on: April 08, 2008, 11:56:49 AM »
Well, on tv, the biggest loser gets $1 million!   :rockon:

Offline foobah

  • Resident
  • ***
  • Posts: 36
    • View Profile
Re: The Last Word!
« Reply #190 on: April 08, 2008, 01:25:54 PM »
BTW, if anybody's curious what my leader board program looks like, here it is:

Code: [Select]
#!perl
use strict;
use Time::Local;
use LWP::UserAgent;
use HTTP::Request::Common qw(GET POST);

my %months = (January => 0, February => 1, March => 2,
      April => 3, May => 4, June => 5,
      July => 6, August => 7, September => 8,
      October => 9, November => 10, December => 11);

my $ua = LWP::UserAgent->new();

my $postNo = 0;
my $page = $ua->request(GET "http://www.jacksonheightslife.com/community/index.php?topic=648.$postNo");
my($lastPage) = $page->content =~ /Pages:.*<a.*?href=".*topic=648\.(\d+)/;

my(%lastWord, %numPosts);
my($lastFrom, $lastTime);

POSTS:
my @posts = $page->content =~ /(<tr>(?:.(?!<\/tr>))*?View the profile of.*?<\/tr>)/gs;

foreach my $post (@posts) {
  my($from)     = $post =~ /View the profile of ([^"]+)/;
  my($datetime) = $post =~ /on:<\/b> (.*?) &/;

  my($month, $day, $year, $hour, $min, $sec, $ampm);
  if ($datetime =~ /<b>(Yesterday|Today)<\/b> at (\d{2}):(\d{2}):(\d{2}) (\w{2})/) {
    ($hour, $min, $sec, $ampm) = ($2, $3, $4, $5);
    if ($1 eq 'Today') {
      ($day, $month, $year) = (localtime)[3, 4, 5];
    } else {
      ($day, $month, $year) = (localtime(time - 86_400))[3, 4, 5];
    }
  } else {
    ($month, $day, $year, $hour, $min, $sec, $ampm) = $datetime =~ /(\w+) (\d{2}), (\d{4}), (\d{2}):(\d{2}):(\d{2}) (\w{2})/;
    $year -= 1900;
    $month = $months{$month};
  }

  if ($hour == 12) {
    if ($ampm eq 'AM') {
      $hour = 0;
    }
  } else {
    if ($ampm eq 'PM') {
      $hour += 12;
    }
  }

  my $time = timelocal($sec, $min, $hour, $day, $month, $year);
  if (not defined $lastFrom) {
    $lastFrom = $from;
    $lastTime = $time;
  } else {
    $lastWord{$lastFrom} += ($time - $lastTime);
    $lastFrom = $from;
    $lastTime = $time;
  }

  $numPosts{$from}++;
}

if ($postNo < $lastPage) {
  $postNo += 15;
  $page = $ua->request(GET "http://www.jacksonheightslife.com/community/index.php?topic=648.$postNo");
  goto POSTS;
}

$lastWord{$lastFrom} += (time - $lastTime);

print "[u]TLW Leader Board as of " . localtime() . "[/u]\n";

foreach my $from (sort { $lastWord{$b} <=> $lastWord{$a} } keys %lastWord) {
  my $time = $lastWord{$from};

  my $days = sprintf "%d", $time / 86_400; $time -= $days * 86_400;
  my $hours = sprintf "%d", $time / 3600;  $time -= $hours * 3600;
  my $minutes = sprintf "%d", $time / 60;  $time -= $minutes * 60;
  my $seconds = sprintf "%d", $time;

  my $dayLabel = $days == 1 ? 'day' : 'days';
  my $houLabel = $hours == 1 ? 'hour' : 'hours';
  my $minLabel = $minutes == 1 ? 'minute' : 'minutes';
  my $secLabel = $seconds == 1 ? 'second' : 'seconds';
  my $posLabel = $numPosts{$from} == 1 ? 'post' : 'posts';

  print "$from: $numPosts{$from} $posLabel, last word for $days $dayLabel, $hours $houLabel, $minutes $minLabel and $seconds $secLabel\n";
}

Offline NYCMacUser

  • Council Member
  • ******
  • Posts: 401
    • View Profile
Re: The Last Word!
« Reply #191 on: April 08, 2008, 04:25:22 PM »
BTW, if anybody's curious what my leader board program looks like, here it is:

Code: [Select]
blah, blah blah, blah blah, blah
I thought foul language wasn't permitted here!  :angel:

Offline foobah

  • Resident
  • ***
  • Posts: 36
    • View Profile
Re: The Last Word!
« Reply #192 on: April 08, 2008, 04:40:40 PM »
I thought foul language wasn't permitted here!  :angel:

If it makes you feel any worse, it only took me about 30 minutes to whip that up...   :buck2:

Offline NYCMacUser

  • Council Member
  • ******
  • Posts: 401
    • View Profile
Re: The Last Word!
« Reply #193 on: April 08, 2008, 05:10:20 PM »
If it makes you feel any worse, it only took me about 30 minutes to whip that up...   :buck2:
The same time it takes me to whip up a decent meal for 8. Oh! Well, we each have our priorities!


WORD!

Offline toddg

  • Moderator
  • Mayor
  • *******
  • Posts: 3492
    • View Profile
  • Lived here since: 2002
Re: The Last Word!
« Reply #194 on: April 08, 2008, 05:26:34 PM »
Foobah, your script rocks.   The next time I need some programming help, I know where to look!

Perhaps we could use it to declare a new winner each calendar month?