TechNomad

Users' Comments
Login with Facebook
Login with Google
Login with FourSquare
Login with Windows Live
HTML5 Powered with CSS3 and Semantics

Expanded Galleries

20:16

I was walking to my class this morning thinking about my poor website. It's mostly just sitting here with nothing exciting happening. Also, it's hard for me to come up with new gallery ideas and I can't expand my current ones because I don't want them to take too long to download for those on dial-up. That's when I decided that I should change the pictures on my galleries. Then, an even better idea: Create lists of pictures and randomly display five of those pictures!
All I had to do was go to my display script and have it not show the pictures for non-dated galleries immediately. Instead a list of the vital picture information is created. Then I had to come up with some way to randomly pick out at most five pictures from that list to put into another list. Displaying the pictures from this list was quite easy. However, my first attempt would/could show the same picture twice. Figuring out how to pick the pictures and transfer them into the new list was a work out for the brain. Thankfully my Perl book had a simple script to randomise the ordering of a list. It simply looped through the first list and pulled out a random entry into a second list until no more entries in the first loop remained. I just modified the loop to run no more than five times. I also had to add a safe-guard if the list had less than five entries.
So, take a second look at my home page and notice the new pictures in random order but with no more than 100KB per view.
<< 8 Feb 2006
11 Feb 2006 >>
10 Feb 2006