This page (revision-1) was last changed on 2019-12-18 09:13 by UnknownAuthor

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 added 82 lines
The __RandomPagesPlugin__ (aka RandomPages) is a [NeWikiPlugin] that provides a randomly-updated, randomly-sized list of randomly-selected wiki pages. This notably does __not__ update the list each time it is called but maintains a WikiEngine-specific Timer thread that manages the list. The idea being that for a random amount of time everyone on the wiki sees the same set of pages.
There's a certain perversity in the way this plugin works. Rather than provide a different set each time it is queried it updates itself randomly. If there are multiple instances of the plugin on the wiki, the single instance of the page generator (called the ''RandomPagesScheduler'') takes the maximum values specified by all instances. The only way to reset the scheduler to a smaller value than the current maximum is to restart the wiki engine. Whether this is the best policy in the long run remains to be seen. Currently the maximum values (which over time the plugin may end up at) may need to be set a bit lower.
!! Parameters
; maxpages {{ = '''n'''}} : Returns a list of between 5 and {{n}} pages. If unspecified or less than 5, a maximum count of 10 is used (i.e., between 5 and 10 pages).
; refresh {{ = '''n'''}} : The maximum period between refreshes, in hours. See ''Refresh Values'', below.
; exclude {{ = '''page1, page2'''}} : Supplied with a space- or comma-delimited list of page names, will exclude these from the results. Because multiple instances of the plugin may be running simultaneously, this is a cumulative set.
; debug {{ = '''true|false'''}} : displays more detailed debugging information about what's happening
! Refresh Values
Forces an update of the list on a random period between a minimum of 15 minutes and a maximum of set by the {{refresh}} parameter. If a value is:
* not specified : the default value used for the maximum refresh rate is 24 hours
* negative : no limits are set and this acts as a query to return the existing schedule
* zero : sets a random period between 30 sec and 1 minute (recommended for testing only)
Since there's not much sense in permitting enormous values for this parameter its maximum is 168 (1 week, 24 times 7).
!! Notes
The basic idea for the RandomPagesPlugin comes from the ''[RandomPages page|http://www.usemod.com/cgi-bin/mb.pl?RandomPages]'' on MeatballWiki:
%%blockquote
After mulling the idea over, I've hacked together a couple scripts to generate a listing of random pages on Wiki:RandomPages -- SunirShah
Some things I've learnt about running a RandomPages script:
* Randomize the number of pages. This gives some days broader scope than others. Narrower scope allows readers to hit every page. Broader scope increases the probability that something will be of interest. 5 to 20 pages is a good range.
* Run the script infrequently. About once a day is good.
* Run the script at random times. Don't run it at noon every day, but at 10:37am one day, 2:42pm the next.
* Let the RandomPages script float in RecentChanges.
* It is worth noting the kinds of pages that come up in RandomPages. It will give you a feel for what the real interests are of the community.
* Don't be discouraged if not many people read it or if not many discussions flow from it. This is how your mind works. You ignore most of the random thoughts you have, but occasionally you run with one. This happens too with RandomPages.
-- SunirShah
[[30 October 2000] I've stopped the script. I have to fix it.
%%
!! References
* ''[Calculating Java dates: Take the time to learn how to create and use dates|http://www.javaworld.com/jw-12-2000/jw-1229-dates.html]'', \\Robert Nielsen, JavaWorld.com, 12/29/00
* ''[Working in Java time: Learn the basics of calculating elapsed time in Java| http://www.javaworld.com/javaworld/jw-03-2001/jw-0330-time.html]'', \\Robert Nielsen, JavaWorld.com, 03/30/01
* ''[Losing Time on the Garden Path: Calculating the Difference Between Two Datetime Stamps| http://www.xmission.com/~goodhill/dates/deltaDates.html]'', \\Paul Hill, August 2004
----
!! Test
A query on an existing schedule:
{{{
[{RandomPages debug='true' refresh='-1'}]
}}}
[{RandomPages debug='true' refresh='-1'}]
----
A typical call for test schedule (30s - 1min), maxpages at minimum permitted:
{{{
[{RandomPages debug='true' refresh='0' maxpages='5' exclude='Main,Welcome,LeftMenu,RecentChanges,SandBox,LeftMenuFooter'}]
}}}
[{RandomPages debug='true' refresh='0' maxpages='5' exclude='Main,Welcome,LeftMenu,RecentChanges,SandBox,LeftMenuFooter'}]
----
{{{
[{RandomPages maxpages='3' exclude='Main,Welcome,LeftMenu,RecentChanges,SandBox,LeftMenuFooter'}]
}}}
[{RandomPages maxpages='3' exclude='Main,Welcome,LeftMenu,RecentChanges,SandBox,LeftMenuFooter'}]
----
[{Tag NeWikiPlugin}]