[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Randomly displaying articles from RSS feed
At 07:29 PM 1/10/2008, Abel wrote:
A quite processor-neutral approach is to use a URL that creates your random number on each request (for multiple requests, make sure the url is unique by using the query part of it, otherwise the processor will not do a second request to the same url as the specs require to requests to the same url to be stable). Cool. I don't think the newly created node ID will work for the use case, but the external URL call is excellent (and part of a trend, ain't it). Of course, the URL will have to return a number random across calls, not just the same "random" number each time. :-) In my earlier reply to Brent's post, I also said that if one had a random number, the weighting part of the problem would be relatively easy. I've since been thinking about that, and now I'm not so sure. I have a solution to it, but it's not an especially easy one, at least for a beginner (although I think it is creative :-). But I wonder if an easier one is out there. So, let's say we have <feeds> <feed weight="15">Reference A</feed> <feed weight="50">Reference B</feed> <feed weight="20">Reference C</feed> <feed weight="15">Reference D</feed> </feeds> ... and we can presume a parameter $R giving us a random-for-our-purposes value between 0 and 1. How do we best filter this list into a single 'feed', getting Reference B half the time, C 20% of the time, and A and D each 15% of the time? Do not assume that the weights will always add to 100. As I said, I have a solution in mind, but I trust the list to come up with a better one. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|