.:.:.:.:RTTP.Mobile:.:.:.:.
[<--back] [Home][Pics][News][Ads][Events][Forum][Band][Search]
full forum | bottom

Aren't you glad that picture of the guy from catch 22 is gone?

[views:2501][posts:6]
 _____________________________________
[Dec 1,2005 8:42am - the_reverend ""]
[img]

I fixed the top of the page so he is gone
 _________________________________
[Dec 1,2005 8:44am - succubus ""]
hahaha
 _______________________________________
[Dec 1,2005 8:50am - DestroyYouAlot ""]
NOOOOOOOOO!!!
 ____________________________________
[Dec 1,2005 9:04am - Christraper ""]
yes im very glad thank you
 ___________________________________
[Dec 1,2005 9:59am - BornSoVile ""]
THANK YOU AARON!
 ____________________________________
[Dec 1,2005 10:03am - babyshaker ""]
hahah i noticed he came up alot and then another band like angela rose or somthing like that comes up all the time
 ______________________________________
[Dec 1,2005 10:13am - the_reverend ""]
yes, and god forbid.
it's cause there were holes in my database numbering scheme.

originally, I had the top set to the mysql random
ORDER BY rand()
but with 200K+ entries in the database, it could take up to 15 seconds.

so I was "smart" and got it down to .001 seconds.
by saying "database what is the max number in the database"
then I would randomly select a number between 0 and that max number.
since there are holes in my databases, I would select the index one higher than this randomly selected number.
problem: if there are holes... like there are before the catch22 picture, the angela rose picture, a god forbid picture and more, then there would be up to a 1300x chance that that picture would be selected.

soooo.. what I did was rethink the database in regards to caching. so I went with the SQL command of selecting the entire pictures database.
(this should always be cached anyhow). so what I do now is
select all pictures in the database
find the max picture index
randomly select a picture from 0 to the max index number
and then use the random number to index off the collection of all the pictures in the database.
this runs around .2 second
not bad, better than 15 seconds and better than the catch 22 picture showing up over and over.


Reply
[login ]
SPAM Filter: re-type this (values are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, or F)
message

top [Vers. 0.12][ 0.013 secs/8 queries][refresh][