Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Auto create names

    Hi All.

    I'm looking at making the following script.

    I want to have 3 text files

    1st will have 100's of Forenames.
    2nd will have 100's of Surnames.
    3rd will have 100's of countries.

    The script will pick completly random from each text and display on a webpage.
    It should run continuesly and show many 20 results at a time and then if someone refreshed it would show maybe 2 or 3 new ones and still have the others

    Lets say a new one should be posted every 5 minutes. But 20 would be displayed at a max. Meaning if looked at the web page.. you'd see 20 names/country -- if you waited 5 minutes and refresh you'd still see 20, But there would be 1 new one at the bottom.

    Is this easy to do ?

    Thanks.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Is it easy? Sure. Just write a bunch of random access files, and use an identifier that dictates the number of entries. Jump randomly between 1 and the max records to the appropriate field and pick it out. Drop these into a new file, and each time a page loads check the timestamp of the file to see when it was modified, and shift out the first entry and push a new one on using the same scanning method prior. This file could be serialized to make it easier since you can just leave it as an arraylist or, for ease of push/pop, a linkedlist.

    I'd presume you'll be using JSP for this if you want it on a webpage, and I can't help with that as I don't program either JSP or servlets.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •