Brad's Blog

web dev, django, running, food, or whatever

Django: Generating an Image with PIL 2008-07-16

I've been reading through the Django Book, and in chapter 11 they talk about generating non-HTML content (such as PDF files, Images, RSS/Atom Feeds). They mention using PIL to generate images, but they don't give an example. So, I thought I'd post a simple example View that generates an image.def pil_image(request): ''' A View that Returns a PNG Image generated using PIL''' import Image, ImageDraw size = (100,50) # size of the image to create im = Image.new('RGB', size) # ...

The Structure of a Django App 2008-07-15

Previously, I'd lamented the difficultly present in choosing an web development framework. I'd worked through several symfony tutorials, and though I could see the benefits down the road, it just didn't feel right to me (yes... "feel" is a technical drawback).So, I checked out a copy of Django, and I haven't looked back. If you're the least bit proficient with python, and you need to build a database-driven web site, USE DJANGO! They have superb documentation, a free book (the ...

Why Bluetooth headsets didn't catch on in the '90s 2008-07-12

Games for Kids: dodger 2008-07-11

I've always thought it would be fun to build video games, and when my daughters were born, I knew I would eventually want to build some simple games that they could enjoy while they're young. My original attempt at this lead me to pygame, and the result was a simple alphabet/number game that plopped letters and numbers on the screen (very similar to AlphaBaby, but not nearly as good!). Unfortunately, I never continued to develop that one.Since my oldest daughter ...

Mac OS X, Python, and Fink: Playing Nicely Together 2008-06-25

Since upgrading to Leopard, I've been using Mac's default install of Python (which is 2.5.1). For the most part it's worked well for me, namely because I've installed additionaly packages either using Mac installers or through easy_install. I recently needed to install python-ldap which didn't work using easy_install. So, I turned to Fink.Unfortunately, Fink wanted to install it's own version of python (2.5.2) as well. (I say unfortunately only because I now how two separate python installations, which I think ...

Lions, Tigers, and Web Development Frameworks, oh my! 2008-06-17

Apparently I've stumbled upon a problem that has recently faced many web developers. That is, I would like to adopt an open-source web development framework for mid-sized project. Well... searching that phrase only yields 200,000+ results. So how does one choose?I guess Ruby on Rails sparked the whole "Web Development Framework" movement (among other things). I've typically used PHP for my web-based projects in the past, but over the last 2 years, I've also become a huge fan of Python. ...

Folding@Home 2008-05-24

I've recently started running Folding@Home. This project (out of Stanford) has been around for a number of years, and apparently they're still going strong! They simulate the way that proteins fold (or assemble themselves t) in order to investigate diseases that occur when the proteins don't fold correctly. Check out their link for more info.Anyways, I've got these computers, so why not do something good with them while I'm not using them! Here are my Stats!

pyCropper 2008-05-20

Occasionally, I need to crop some images. I suspect this happens to a lot of people, and they simply use their favorite photo editor to perform the task. For a few images, this works just fine. Plenty of people have Photoshop, the Gimp, or even iPhoto. This past weekend, however, I found myself needing to crop about 1000 images, and I need to do it quickly. This was more than my machine could load into the Gimp at once. Even ...

A Go at California Rolls 2008-05-02

Well, I've tried to make some California rolls. I think they turned out OK. Not the prettiest rolls, but they tasted good... maybe I shouldn't have eaten them all, though!These were made with the following ingredients: 1 cup of rice. (most recipes call for short grain rice, but I used long grain rice)1Tbsp of Rice vinegardash of saltNoriCarrotsCucumberImitation crab meat (or real crab meat if you have it)1 AvacadoBoil 1 and 3/4 cups of water and salt. Once the water ...

Review: Beginning Game Development with Python and Pygame 2008-04-13

It's been out for a while now, and I'd always meant to write a review for this book... I pre-ordered it, and I've had it for awhile, but I haven't worked through the whole thing (though I've hit most of the latter chapters). Actually, this is not really a review, per se... just my succinct list of pros and cons.So, without further ado:Pros:Very easy to read.Great examples that actually workChapters 1 & 2 give a great intro to python, so ...