I don't know if it's useful to anyone but me, but I was trying to figure out the best way to display a random image on a webpage. What I ran into for using Server Side Includes is that the image to show is defined in my css which isn't parsed by the server for includes and apparently include directives within class= statements are ignored with my server configuration.
Well, it seemed that there should be a simple way to do this. The result was to create a configuration-less perl script that displays a random image from the folder it's in. It currently only does files that end in .jpg, so I'll leave that change as an exercise for the reader.
If you just want to use the script, here are some instructions. In the directory where your source images are stick the code in a file whatever name you like as long as it ends with .cgi or .pl, I'd suggest something like randomimage.pl. Make the file executable (chmod a+x randomimage.pl (windows users are on their own)). In your html or css use the name of your file as the name of the image, something like "http://www.yourdomain.com/randomimages/randomimage.pl" would work nicely. This will work best if all the images are the same size so the web page doesn't look different every time and you can define the image dimensions in the html or css.
#!/usr/bin/perl
opendir (THISDIR, "./") or die "no such directory: $!";
@imagelist = grep { /.*\.jpg/ } readdir THISDIR;
closedir (THISDIR);
$max = $#imagelist + 1;
$imagenumber= int(rand($max)) ;
print "Content-type: image/jpeg\n\n";
open (IMAGEFILE, "<", "./$imagelist[$imagenumber]") or die "can't open file $imagelist[$imagenumber]";
foreach (readline (IMAGEFILE)) {
print;
}
close (IMAGEFILE);
Anyway. No guarantees. No promises. Code provided as is and free for any legal, non-malicious use.
--Ben
This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.This blog post is all about obfuscation.
Looks like I need to add a "Computers" section to my news page here... Done.
So, I use iChat on a fairly regular basis at work. It's great for getting a slightly quicker response to questions. (He says as he waits for a response to a question.) But I discovered an interesting problem and figured that I wasn't alone for once.
When I open up a new chat using the iChat menu-bar icon, I get a second, identical window directly behind the first. Not a big deal. I just close the second window and go on with my chat. It started to get a little annoying though. After a couple of quick googles, I found a forum thread over at Apple that dealt with the issue. They suggested deleting the com.apple.ichat.plist preference file which I had deleted earlier for a different reason. They also suggested deleting the com.apple.iChatAgent.plist which I haven't tried.
Anyway. I found one possible solution. If you're having the same problem, check out this thread at Apple.
Comics
AppleGeeks
The Awkward Yeti
Chainsawsuit [new!]
Ctrl+Alt+Del
Doghousediaries
Doonesbury
Formal Sweatpants
FoxTrot
Happle Tea [new!]
Hyperbole and a Half
Indexed
Joy of Tech
Kate or Die!
Lunarbaboon
Our Valued Customers
RealLife
Romantically Apocalyptic
Saturday Morning Breakfast Cereal
Scenes From A Multiverse [new!]
A Softer World
Sci-ence
Sinfest
Three Panel Soul
Wondermark
XKCD
Blogs
Almost Diamonds Antihero As I See It Black and WTF Caerwyn Farm and Spirits The Catty Life Domestic Sluttery Engrish For Goodness Sake Gizmodo Greg Laden Le Zèbre Bleu Lefse and Kimchee Lifehacker Light-test Linux in Exile Man Bytes Blog Photography is Not a Crime Post Secret Photoshop Disasters
Arts
New Pictures 8: Sarah Jones
Minneapolis Institue of Arts
04/18/2013—02/02/2014 - Free
31 Years: Gifts from Martin Weinstein
Minneapolis Institue of Arts
11/02/2013—08/31/2014 - Free
New Pictures 9: Rinko Kawauchi
Minneapolis Institue of Arts
02/20/2014—08/10/2014 - Free
Finland: Designed Environments
Minneapolis Institue of Arts
05/10/2014—08/17/2014 - Free
Music
Nick Cave and the Bad Seeds
at State Theatre
06/21/2014 \ Doors 8:00pm
Please wait while my tweets load