Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -wT use strict; use LWP::Simple; use XML::Simple; use Time::Local; use Text::BarGraph; my $startid = shift || 128020; my $endid = shift || 128303; my $xmlurl = "http://perlmonks.org/index.pl?node_id=37150"; my $user = 'blakem'; my $pass = 'yeahright'; ## Ask the perlmonks XML engine about the nodes my $queryurl = $xmlurl . '&nodes=' . join(',',$startid .. $endid) . "&user=$user&passwd=$pass&op=login"; my $nodeinfo = XMLin(get $queryurl); ## Tally what hour they were posted in %nodecount my %nodecount; for my $node (@{$nodeinfo->{NODE}}) { my ($year,$mon,$mday,$hours,$min,$sec) = $node->{createtime} =~ /(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/; $year -= 1900; $mon--; my $time = timegm($sec,$min,$hours,$mday,$mon,$year); my $hour = (localtime($time))[2]; # print $node->{node_id} .": ". localtime($time) . " => $hour\n"; $nodecount{sprintf("%02d",$hour)}++; } # print out a bargraph my $g = Text::BarGraph->new(); $g->{num} = 1; print $g->graph(\%nodecount); =head1 OUTPUT ( New nodes per hour for 11/28 in PST ) 00 ( 7) ################ 01 ( 3) ####### 02 ( 7) ################ 03 ( 6) ############## 04 ( 3) ####### 05 ( 7) ################ 06 (17) ######################################## 07 (29) ############################################################# +######## 08 (16) ###################################### 09 (28) ############################################################# +##### 10 (16) ###################################### 11 (23) ###################################################### 12 (19) ############################################# 13 (26) ############################################################# 14 (25) ########################################################### 15 (17) ######################################## 16 ( 2) #### 17 ( 5) ########### 18 ( 3) ####### 19 ( 4) ######### 20 (10) ####################### 21 ( 7) ################ 22 ( 1) ## 23 ( 3) ####### =head2 Output for a one-month sampling period... 00 (122) ################## 01 (173) ########################## 02 (176) ########################## 03 (187) ############################ 04 (160) ######################## 05 (241) #################################### 06 (307) ############################################### 07 (440) ############################################################ +####### 08 (399) ############################################################ +# 09 (439) ############################################################ +####### 10 (408) ############################################################ +## 11 (411) ############################################################ +## 12 (444) ############################################################ +######## 13 (368) ######################################################## 14 (347) ##################################################### 15 (281) ########################################### 16 (256) ####################################### 17 (243) ##################################### 18 (207) ############################### 19 (177) ########################### 20 (188) ############################ 21 (149) ###################### 22 (127) ################### 23 (112) #################

In reply to Perlmonks Nodes Per Hour by blakem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-23 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found