Gratuitous amounts of Imagery
I need images and I mean lots of images. In my head I can only see having more images to make up the tiles the better. Of course every time I add an image it makes searching for the correct image a little slowewr, but ups the chance I may find a better match.
(more…)
Why a Photo Mosaic?
Seems like there have been more and more photo mosaics popping up on digg lately. I figured I could make one, but one up the other people and actually write the program to make them instead of using some program I found online.
(more…)
Oh it’s my birthday, I almost forgot…

So you need to output quick 404 page for some reason? Well the worse thing you can do is make an error page then just send it out like normal because your server is still sending out status code of 200 which means everything was fine. Someone viewing the page would know it’s an error but another computer or bot would have no idea it encountered an error because it’s reading the status code. So simple solution send an status code 404 not found.
|
cherrypy.response.status="404" |
that’s it then output as normal from there and you will have a nice little 404 page.
One of the things I find annoying when I’m looking for a quick solution to some programing problem is that people don’t post everything you need to get going such as the import lines, to you know, actually get their snippets of code to work.
So first off you need to import some stuff
|
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;
import flash.net.URLVariables; |
(more…)
Here’s a quick way to parse the request headers in cherrypy/turbogears and see what kind of formatting the request will accept back. In this case I’m specifically looking to see if the requester will take the data in json string.
Of course you can just replace “text/json” with anything else you want like “text/xml” or what ever.
|
if "text/json" in [item.strip() for item in cherrypy.request.headers.get('Accept', []).split(',')]:
#do some stuff here
pass |