Auto-imported from old gallery:
A Minor Fix
Many thanks to Mr Zeldman for sharing the random image script I put together. (Twice in about a week, I’m starting to blush.) Shortly afterwords Charles Dietlein (who also has one) dropped an email suggesting that I seed the random number picker for users of old PHP distributions. Done, and thank you for the heads up. I still believe that letting the web server do the grunt work is the most elegant method available.
I have received several questions asking how the individual images may be cached but it still “rotates” on every reload. Well, it’s all in HTTP. The response from the PHP script is never cached because it sends a 302 Temporary Redirect
header, which by specification should not be cached by the browser or caching servers. The images themselves, once served, are just like any other static file, and they are server with Etags and Last-Modified
headers that allows a browser to check later if anything has changed. If the browser receives a 304 Not Changed
header in response, it knows it can go on its merry way and return the image from cache. There you have it.
I had to go back and edit this post because I was dropping in and out of the editorial we. What you read really influences how you write.
Gallery: 5-13-2003
Auto-imported from old gallery:
Birthday Wishes
CSS: The Gathering
So the other day I was over at Josh’s house helping him out with some CSS for his new site, fatalifswallowed.com. Now I know what you’re thinking, what’s an “alif,” why is it overweight, and why are they wallowing around? I wish I had the answers, but I don’t. Maybe there will be answers on the site, so you should go check it out.
Anyway, as a bit of friviolity to start your week with, here is the official Matthew Charles Mullenweg Magic the Gathering card, available in limited quantities only. What really cool is he did it so it’s on actual Magic card paper, and there are also a lot of nice details. Go Josh.
For those wondering, it’s a black card because apparently deep down I’m evil. That is all.
Summer Cleaning
Trying out something a little different. Comments welcome.
Gallery: 5-12-2003
Auto-imported from old gallery:
A Better Image Rotator
The Hiveware Image Rotator, shared by Mr Zeldman, does one thing and does it fairly well: it shows a random image on each reload. However, the approach the script takes is slightly flawed, and could be improved as detailed below.
My first issue with the script is that it is really only set up to handle two types of files, GIF and JPEG, and then only with the file extensions of .gif or .jpg, so something like .jpeg (fairly common) would not be included. Not to mention the noble PNG is left out entirely. Fixing this, however, leads us to a more fundamental problem: the images are served through the script. This means that the script has to handle the content-type
header, something that is messy to do. A better method, I propose, is for the script to merely serve a temporary redirect header, which sends the browser with a minimum of overhead to the actual location of the file, which has a number of tangential benefits including that it allows the image itself to be cached properly, either by a caching server or the browser itself, and it delegates content negotiation and such to the web server, which is most likely infinitely better at it.
So now what we have a script which reads files in a directory, grabs the ones with a user defined set of file extensions, and sends a simple Location
header to whichever file is randomly chosen. The complication now that the location of the image is now important in terms of the web server document root. One bonus of Dan Benjamin’s method is you can use images outside of the web root, though I don’t know why anyone would want to do this. The script could ask for two variables to be defined, the absolute path to the images and the path to the images through the web server, but I would like for this to be as ridiculously easy to setup as possible. Another option would be to subtract the $DOCUMENT_ROOT variable from the absolute path given and use that, but that would require people to know the absolute path of the directory they’re using, and like I said I’d like this to be easy as humanly possible. The best solution is to use a relative path; if the users enters nothing it’s assumed that the images are in the same directory as the script but if they aren’t the path can be entered in a relative manner, like “images/random” or “../rand-img”. Easy peasy.
Finally, instead of the plain rand()
we’ll use mt_rand
, which is about four times faster and slightly more random. What do you get? The Photo Matt Random Image Script. I’ve tested it thoroughly, but if you have any problems don’t hesitate to let me know. It’s just standard HTTP though so I don’t foresee any trouble. Something neat about this is that with the code we just wrote, you can also serve random anything—from zip files to MP3s—just by changing the extension line. Enjoy! Here’s an example of it in action, you should recognize some of the images as the delightful graphics Jeffrey has been putting up, the rest are snips of photographs I haven’t uploaded yet.
Keeping the Faith
If you’re like me, you’ve been very concerned about the direction XHTML 2 has been heading. Very recently I’ve thought to myself that I won’t develop a commercial XHTML 2 site this decade. (Look how long it took them to get simple stuff right!) Only time will tell, but Tantek’s XHTML Considered Hopeful brings back that warm fuzzy feeling that promising new technologies give. Yes, it was going in a bad direction. Yes, it’s coming back.
I’ve lurked on www-html for several months now, maybe it’s time (and I finally have the time) to start seriously reading working draft and lend my voice to the process. That’s assuming of course I have anything cogent to say. I think the lesson to be learned here is if you’re concerned with where the spec is heading, let people know. As Tek says, they’re listening.
(My personal favorite new element so far? Gotta be <l>
. Lots of possibilities there.)
All Done
Free at last, free at last. I took my last final and now I am done with school for at least a couple of months. Now it’s time to dive back into projects I have been neglecting due to school. I have been very much looking forward to this summer.
A Hoax Risk
A Flight Risk, blog of a “twentysomething” “international fugitive.” A good read if nothing else. Hat tip: Wired. Is it just me or does it seem like all the best stuff at Wired comes from Leander Kahney? Incidentally, he’s the author who used one of my photos in a Wired story a few months ago. I’m still giddy about that.
Who Ya Going to Call?
From a trusted correspondent, talking with a contact who works at the Netscape part of AOL/Time Warner. “He said they had decided that weblogs are the next killer app, and that most of the work at the Mountain View office was going into building a weblog component for AOL. He also mentioned that about 400 people are working on that software. This is in constrast to about 20 who are working on Mozilla.” […] If there’s a problem doing this, please contact me, in confidence, if necessary.
Source. Three comments:
- I know Dave isn’t crazy about CSS and all that jazz, but could he at least use paragraph tags? Nothing by line breaks is so… never. Paragraphs have been around forever, no reason not to use them.
- 400 people working on it, assuming that even only 10% are actual developers (is this high?) I find it hard to believe that those 40 people will come upon a technical problem so insurmountable that only help from Dave, in confidence, if necessary, will help them.
- It also follows that if Microsoft and AOL/Netscape’s respective blogging tools or platforms don’t interoperate, I don’t think it will be because either lacks the technical skill to do so.
This is all pure speculation on my part, and I’m not afraid to admit it. I’m trying to think what kind of effect this could have on the blog world. There are already services out there such as Diaryland, Blogspot, Free Opendiary, Livejournal, Deadjournal, and Easyjournal that make the technical and financial barriers to something akin to blogging nonexistent. I know several people from my old school that might be hard pressed to send an email attachment but used one of the above tools with a degree of proficiency. What’s more these services, particularly OpenDiary and LiveJournal, tend to be very closed communities and don’t mingle much with blogs outside their service. So I think these new services in and of themselves will not be a big deal, however if they hook people on the concept and get them running for more advanced tools, then it could be significant. We’ll see.
L’Auberge Espagnole and X-Men 2
Thanks to a Craig’s List posting I got in at the last minute to see L’Auberge Espagno with Josh. I was excited that Audrey Tatou of Amélie fame would be in it, but like the posting said her role was relatively minor. Overall I enjoyed the film a lot, it had some really novel things in it and some great moments. The characters fluency with so many languages made me wish for a similar fluency in at least one other language.
Last Friday I saw X-Men 2, I just forgot to post about it. I went in with very low expectations as I thought the first movie was really mediocre. This was about a thousand times better. If you’re in to that sort of thing, go check it out. It was also neat because it was the first movie I’d seen in months.
It feels strange talking about to movies from very different genres right next to each other, they were both good, but in very different ways. Of course movies will never be the same when the new Matrix comes out in 9 days. Is it over-hyped? Not at all.
Yum
Today has been a wonderful day feeling with code goodness. I don’t know why, but I really, really, really like playing around with XHTML. I find I enjoy programming in other languages (mostly PHP, but Python and Perl more now than before) most when it deals directly with XHTML. Anyway, I’m working on some really fun stuff and by this afternoon this site should be even more on the bleeding edge than it was before. Stay tuned.
Grenade Blows on Channel 8
Several days ago Grenade—which I’m an official groupie of—recorded some tracks at the local PBS station to air twice on a “Best of Houston” show. I missed both, but never fear because the inimitable Kelly Dean, leader of the band, has posted the music with commentary. Go check it out, especially Stage Fright, for some killer grooves and great solos.
Call Me Speedy
Well the 512MB of DDR333 memory I ordered came in today, and so now I’m up to 768MB, which is quite nice. I feel like my applications can breath again. Even more importantly I upgraded the 900MHz processor that was in there on accident to a Athlon XP 1600, and it’s making a huge difference. My desktop is starting to feel like a real work environment again.
In other news, we’re going on 3 weeks since they took my laptop, and it’s really starting to get to me. I really could have used it to keep up with things these last few weeks, which incidentally have been my busiest in a long, long time. I had my next to last final today, and I was really ecstatic afterward. Knowing there is just one more (on Thursday) is a great feeling, and I can’t wait for summer to finally get started.
It’s going to be a summer of road trips, beaches, tans, jogging, and some very cool web stuff.
Another Brand Spanking New Blog
It’s not Sunday anymore, but if you’ve still got nothing to do you should know that idle hands are the devil’s workshop, so by visiting idly.org, the new home of Adam, you’ll be doing a good thing. It seems that splitting blogs into public and personal is all the rage these days; I know Josh has one coming soon and I’ve been considering spinning something off PhotoMatt for a while. Oh just a side note, both of Adam’s domains are now with Spyder Hosting and rumor has it he’s enjoying it.
Blogroll Updated
The blogroll on the menu has been seperated into Pingers and Non-Pingers. People under “Updated” ping Weblogs.com when they update and float to the top of the list, which I check umpteen times a day. Those on the other list ping very inconsistently, or not at all, so I just check them every now and then to see if anything new is going on. If you’re on one list and think you should be on the other, let me know because there’s probably a problem with the URL I have for you not matching whatever you ping with. I also came up with a much, much simpler way to parse blogrolling lists into semantic lists, and I’ll update the script and article accordingly later this week when I have more time.
Waiting For Fries to Catch Up
As I write this I am eating “Cool Guacamole” chips. Yes, chips flavored with guacamole. This is not the first time I’ve encountered this, as I had some tostada chips that were almost just like this before. Does anyone else find this trend of rolling common condiments into what they’re used with disturbing? Before we know it we’ll have ketchup-flavored French freedom fries, milk-flavored cookies, and, God forbid, pre-mixed peanut butter and jelly. Oh wait…
So Sweet. So Spastic.
I’m proud to say that Julie is up and running. After Sarah and Becca, Julie was next in line to be rescued from LiveJournal but the incredible lack of time in the last month prevented me from finishing anything. Anyway her new blog is now up, and it already has some great entries and poetry. Sweetspastic!