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

OverlordQ's scratchpad

by OverlordQ (Hermit)
on Jun 02, 2004 at 20:26 UTC ( #359715=scratchpad: print w/ replies, xml ) Need Help??

sub decrement { my $string = shift; return '' unless length($string); my @parts = split//,$string; my $last = pop @parts; if( ord($last) == 32 ) { my $ret = decrement(join '',@parts); $ret .= (scalar @parts) ? "\x7E" : ''; return $ret; } else { my $ret = join '',@parts,chr(ord($last)-1); return $ret; } }

my $key = ( ( int( str2time($date) / $INTERVAL ) + ( str2time($date) % $INTERVAL ? 1 : 0 ) ) * $INTERVAL );
#!/usr/bin/perl use File::Map qw(:map :constants); use strict; use warnings; use Date::Parse; use POSIX qw(strftime); my $file = shift; map_file(my $map, $file); my %h; my $re = qr/(?-xism:\[((?:\S+)\s+(?:\S+)\s+(?:\d+)\s+(?:\S+)\s+(?:\d{4 +}))\]\s+(?:\[(?:\w+)\])?).*(Timeout.*)/; $h{$1}++ while $map =~ m{$re}g; my $INTERVAL = 600; my %blarg; my $offset = 300; foreach my $date (keys %h) { my $key = ( ( ( int( (str2time($date) - $offset ) / $INTERVAL ) + ( ( str2time($date) - $offset ) % $INTERVAL ? 1 : 0 ) ) ) * $INTERVAL ) + $offset; $blarg{$key}++; } my ($first) = (sort keys %blarg)[0]; my $window = $first; while($window < time) { my $now_string = strftime "%e, %I:%M:%S %p", localtime($window); print "$now_string, " . ($blarg{$window} ? $blarg{$window} : 0) . +"\n"; $window += $INTERVAL; }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2013-05-18 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (392 votes), past polls