charlescfenwick.com

March 31, 2008

Making a Photo Mosaic: Building the Image Library

Filed under: Programing, mosaic, python — Tags: , , , , , , — chuck @ 7:14 pm

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…)

March 27, 2008

Making a Photo Mosaic: Getting Started

Filed under: Programing, Uncategorized, mosaic, python — Tags: , , , , — chuck @ 9:12 pm

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…)

March 26, 2008

Oh it’s my birthday

Filed under: Uncategorized — Tags: — chuck @ 5:51 pm

Oh it’s my birthday, I almost forgot…
Birthday Kitty

Quick 404 page in cherrypy/turbogears

Filed under: cherrypy, python — Tags: , , , , , — chuck @ 3:37 pm

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.

View CodePYTHON
 
 
  cherrypy.response.status="404"

that’s it then output as normal from there and you will have a nice little 404 page.

March 12, 2008

How to send a post or get request with Actionscript 3

Filed under: Actionscript, Programing — Tags: , , — chuck @ 2:11 am

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

View CodeACTIONSCRIPT
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;

(more…)

March 8, 2008

First Post

Filed under: Programing — Tags: , , , — chuck @ 6:51 pm

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.

View CodePYTHON
if "text/json" in [item.strip() for item in cherrypy.request.headers.get('Accept', []).split(',')]:
  #do some stuff here
  pass

Powered by WordPress