Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Y.A.N.F: XML View of Selected, Best and Worst Nodes

by demerphq (Chancellor)
on Jun 29, 2004 at 21:21 UTC ( #370629=monkdiscuss: print w/ replies, xml ) Need Help??

Hi folks. As my hack of the day I added an XML view to Selected Best Nodes, Best Nodes and Worst Nodes.

In order to see this view you need to view these nodes with the following param:

displaytype=xml
(or just use the xml link at the top of the page. :-) Optionally you can specify
xmlstyle=clean
to not have newlines added to the content of data bearing elements. This behaviour is in keeping with the other tickers and as such even though these are new that style is preserved. However like many of the recently modified tickers (not all yet) the "clean" mode resolves this issue.

I know there are some stats junkies out there. Please ensure that you do not fetch this data too often. No more than hourly is acceptable. If people dont respect that it will be taken away. (Sorry to be harsh, but I have to say that.)

Anyway, I hope this makes things a bit easier to supply this to external clients or what have you. Enjoy. :-)

Please consider the XML being output by this new feature to be BETA quality only. Its possible it will change pursuant to comments received. This doesnt mean you shouldnt exploit it, just that you shouldn't bitch if the XML format gets tweaked a bit over the next few days.

Also the observant will have notice that the XML view of user nodes now contains certain user settings. If you feel there is a good cause for more settings to be added please let the gods know which ones and why. (Preferably through a reply to this node, but a /msg will also do.)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


• Update:  
No longer is the passthrough setting required so I removed it, also added a note emphasizing that this initial release is beta quality in terms of the exact XML format being returned.


Comment on Y.A.N.F: XML View of Selected, Best and Worst Nodes
Select or Download Code
Re: Y.A.N.F: XML View of Selected, Best and Worst Nodes
by valdez (Monsignor) on Jun 29, 2004 at 22:46 UTC

    Thank you very much! I really appreciate your work! Thanks again!
    Now some requests :)

    • a "member of" field
    • a flag to indicate if a user is in borg's belly
    • a link to user's image, if applicable
    Is there a bug in Our Best Users? It reports a number of writeups different from the one listed in home node.

    Ciao, Valerio

      It's not so much a bug as a difference... and a bug with the data on the homenode.

      Our Best Users asks the DB to list all users by the number of nodes owned by them -- select DISTINCT author_user, count(author_user) from node group by author_user. The homenode (in both XML and normal displaytypes) simply shows the cached number of writeups. This has some interesting side-effects.

      Sometimes, because of non-attomic updates, the cached number of writeups becomes incorrect. This is why, sometimes, it's possible to go to your user settings, hit "submit", and get a message that your number of writeups has been corrected.

      But, more important then that is what the defintion of the number of writeups on your homenode is: it only counts the following nodetypes: 'note', 'snippet', 'sourcecode', 'perlquestion', 'perlcraft', 'perlmeditation', 'poem', 'CUFP', 'obfuscated', 'perltutorial', 'monkdiscuss', 'modulereview', 'bookreview', and 'perlnews', when authored by you, and 'categorized question' and 'categorized answer' when originally authored by you.

      Well, you may ask, isn't that everything? Not quite. Every user has at least one other node authored by them: their own homenode. Additionally, there are various node types that are writeable, at least by some users, but not counted there. pmdevs can write patches and pmdevnotes (replies to patches) until they are blue in the face, but not have them counted. Even normal users can write editor requests (note: but probably shouldn't, in most cases) and get in on the uncounted action. Gods like theonetwo can write any sort of node they like (but mostly write nodes of types they don't like).

      There's another problem I just barely mentioned, though it may be the most important one: Q&A. All nodes in the Q&A section are considered to be authored by the QandAEditors, no matter who originaly wrote them. (Though you can't tell unless you look at the XML.) This is mostly because at the time it was considered easier to let them edit them that way -- QandAEditors predate the more general janators (who until recently were named editors). The person who originaly wrote the nodes are "original authors". Thus the Best Users search misses those nodes completely, for the same reason that user search does (unless you hit the checkbox).

      Anyway, that was probably Far More Then You Ever Wanted To Know: Number Of Writeups (FMTYEWTKNOW).


      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).

        No, it's not FMTYEWTKNOW :) PM is really intricate, so any explanation is always welcomed!

        Ciao, Valerio

Re: Y.A.N.F: XML View of Selected, Best and Worst Nodes
by Theo (Priest) on Jun 30, 2004 at 13:58 UTC
    Such a cool and thoughtful feature, to have Our Best Users list the viewer's number of writeups also! Thanks.

    -Theo-
    (so many nodes and so little time ... )

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2014-04-19 02:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (475 votes), past polls