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

XP Barometer

by MZSanford (Curate)
on Jan 17, 2003 at 21:46 UTC ( [id://227811]=monkdiscuss: print w/replies, xml ) Need Help??

I don't think this is a killer-app kind of idea, but more of just a thought. I find myself using the Other Users nodelet as a quick barometer of levels-logged-in (since it is sorted by XP). I was wodnering if anyone else would like the addition of a <HR /> in the list at the begining of your current level ?

The idea being that if you are an initiate, you can see how many people are initiate and above by looking above the line.

As always, just my €0.02

from the frivolous to the serious

Replies are listed 'Best First'.
Re: (nrd) XP Barometer
by newrisedesigns (Curate) on Jan 17, 2003 at 23:26 UTC

    You could use the Other Users XML ticker and write your own application, using LWP, XML::Simple and Tk or any other nifty-keen module out there. Then you can post it here, gain XP, and watch yourself move up the other users list. :)

    John J Reiser
    newrisedesigns.com

Re: XP Barometer
by theorbtwo (Prior) on Jan 17, 2003 at 22:33 UTC

    Anything that increases the DB hits for the Other Users nodelet is probably bad. In fact, I'm going to go remove the nodelet from my user settings now.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: XP Barometer
by valdez (Monsignor) on Jan 18, 2003 at 01:17 UTC

    Very nice feature!!! ::Simple snippet :)

    #!/usr/bin/perl -w use strict; use LWP::Simple; use XML::Simple; my $base = 'http://www.perlmonks.org'; my $other_users = XMLin(get("$base/?node_id=15851")); foreach my $user ( @{$other_users->{user}} ) { my $xp = XMLin( get("$base/?node_id=16046&for_userid=$user->{user_id +}") )->{XP}->{level}; printf "% 2s %s\n", $xp, $user->{username}; }

    Ciao, Valerio

      Does this snippet work? Yes. Should it be used? Depends. Maybe if you run it at large intervals, caching the results for the time in between. I hardly doubt you need real-time verification of where you stand in the XP world. It takes N+1 hits to the site to get the data (where N=number of users logged in). Hitting the site 41 times when 40 users are logged in is not playing nice. Perhaps throwing in a 'sleep 4' in the foreach() loop would help.

      Another thread in Perl Monks Discussion very recently discussed why the site is being sluggish. The last thing we need is 20 people hitting the site 30 times every 20 seconds.

        I don't use that code, its purpose was to see what MZSanford said in his message.In real life it would have everything you described; actually it shows a simple solution to the UI problem pointed out by Wysardry.

        Anyway, I disabled nearly every nodelet from my pages to be gentle with the Monastery many months ago.

        Ciao, Valerio

Re: XP Barometer
by Wysardry (Pilgrim) on Jan 17, 2003 at 23:47 UTC

    On the whole I would be against an idea like this, mainly because I don't think it would be worth the extra resources it would consume.

    Okay, I know it wouldn't use much, but it wouldn't give much functionality in return either. It would have to be smart enough not to print multiple rules if there weren't users of a certain level logged in.

    i.e. It should display:-

    Level 7 users
    -------------
    Level 3 users
    -------------
    Level 1 users

    not

    Level 7 users
    -------------
    -------------
    -------------
    -------------
    Level 3 users
    -------------
    -------------
    Level 1 users

    Also, it would have to be an HTML <HR> rather than an XHTML <HR /> tags as the rest of the site is HTML 4.0 compliant (according to the DTD anyway).

    Maybe on a smaller, less busy site, without a chat box etc. it would work, but the default layout is already very crowded.

    That's just my personal opinion, feel free to ignore it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://227811]
Approved by Mr. Muskrat
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-28 16:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found