Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

background

There has been some discussion in the Monastery about the best nodes not being up to their name, meaning that there are several forgotten treasures that don't get the attention they deserve.

Here is a do-it-yourself alternative, obtained by taking the first 10 highest reputation nodes for each saint as of today.

Since it was generated automatically, according to a numerical criterium and depending on the limited space available, it could be debated whether this one is better or worse.

The attentive reader will notice that a few nodes in the best nodes are missing from this list, since they were produced by non-saints. Moreover, some of the nodes here might not be among the absolute best in PM. They are, however, the best nodes that each saint could produce, according to the other monks evaluation. So they should be worth a second glance.

At the very minimum, I believe that it is a good source of meditation upon the past experience at the Monastery.

First things first, here's the code to build this sort of super best nodes page.

Code

#!/usr/bin/perl -w use strict; use HTML::TreeBuilder; use LWP::Simple; sub get_most_voted ($); my $saints_html = get "http://www.perlmonks.org/index.pl?" . "node=saints%20in%20our%20book"; my $saints_tree = HTML::TreeBuilder->new_from_content($saints_html); my $table = $saints_tree->look_down('_tag' => 'table', 'width' => '70%'); my @rows = $table->look_down('_tag' => 'tr', sub {$_[0]->look_down('_tag' => 'td')->as_text !~ /^#$/}); for (@rows) { my ($rank, $name, $xp, $writeups, $level, $leveln) = $_->look_down('_tag','td'); printf "[%s] \n", $name->as_text; # printf "( XP %d, writeups %d)\n", $xp->as_text, $writeups->as_t +ext; my $wu = $writeups->as_HTML; $wu =~ s/createtime%20DESC/hr/; $wu =~ s/&amp;/&/g; my $address = "http://www.perlmonks.org"; if ($wu =~ /href="([^"]+)"/) { $address .= $1; $address .= "&length=10"; }; get_most_voted( $address ); } $saints_tree->delete; sub get_most_voted ($) { my $address = shift; my $nodes_page = get $address; my $nodes_tree = HTML::TreeBuilder->new_from_content($nodes_page); my $nodes_table = $nodes_tree->look_down('_tag' => 'table', 'id' => 'writeups'); my @writeups = $nodes_table->look_down('_tag' => 'tr', sub {$_[0]->look_down('_tag' => 'td')->as_text !~ /^Node ID$/} + ); print "<ul> "; for (@writeups) { my ($node_id, $node_title, $node_date) = $_->look_down('_tag' => 'td'); printf "<li>[id://%d]</li> ", $node_id->as_text; #printf "<!--%s--!>\n ", $node_title->as_text; } print "</ul>\n"; $nodes_tree->delete; };

Customization

You may customize this script according to your needs. For example, you could just pull the first 5 best nodes for each saint, or the best 20 for the first 35 saints only, and so on.

As for the specific method, I used HTML::TreeBuilder because I know the way it works and it's easy for me to think in terms of trees. Others may find this task easier to accomplish using other HTML::Parser cousins. I would be curious to see alternatives.

List

Then, the list of the most upvoted nodes for each saint.

vroom Ovid merlyn tilly dws tye chromatic jeffa japhy Zaxo davorg footpad Aristotle tachyon mirod blakem Masem grinder BrowserUk Abigail-II rob_au Juerd jcwren dragonchild crazyinsomniac demerphq John M. Dlugosz Corion perrin TStanley broquaint tadman chipmunk turnstep VSarkiss redcloud FoxtrotUniform dvergin btrott ybiC jepri Beatnik jmcnamara Erudil cjf boo_radley hsmyers Fastolfe MeowChow sauoq runrig jlongino andreychek gmax IlyaM arturo pg princepawn vladb JSchmitz shotgunefx larsen Adam rinceWind arhuman thraxil ignatz belg4mit ajt Dominus djw adrianh jplindstrom ichimunki arashi Kanji Mr. Muskrat George_Sherston Chmrr zdog jryan lhoward vek talexb grep lachoy theorbtwo ar0n Albannach PodMaster mdillon TheoPetersen cLive ;-) kudra danger lemming suaveant strat extremely busunsl Dog and Pony mojotoad RMGir jeroenes t0mas I0 Elian Fletch YuckFoo particle deprecated diotalevi atcroft shadox Petruchio KM bikeNomad jima stefp MZSanford frankus ariels OeufMayo kschwab Marza Biker jynx Dragonfly samtregar ChOas AgentM hotshot stephen BigJoe gryphon virtualsue neophyte clintp coreolyn Courage thatguy scottstef mrmick trs80 fever premchai21 valdez petdance thinker Jonathan clemburg azatoth little scain rbc jptxs Zoogie Ryszard petral derby robsv newrisedesigns DamnDirtyApe gav^ davis thelenm athomason tinman gornox_zx wil wog silent11 rdfield Chady
 _  _ _  _  
(_|| | |(_|><
 _|   

In reply to Most loved nodes by gmax

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 drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-20 08:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found