Archive for the 'computing' Category

Caching HTTP Responses with CherryPy

Wednesday, February 25th, 2009

The most basic case is very simple.

import time
import cherrypy
 
class WebSvc(object):
@cherrypy.tools.caching(delay=300)
@cherrypy.expose
def quadruple(self, number):
time.sleep(1) # make the real call somewhat costly
return str(int(number) * 4)
 
cherrypy.quickstart(WebSvc())

That uses an in-memory cache and [...]

My Solution for the Auto Industry (and the Economy In General): Smaller, Faster, Leaner

Saturday, December 20th, 2008

Ok, this post is on a controversial issue, and I’m entitled to my own ridiculous opinion. Therefore …
The fact that we have 3 major automakers in the US that our economy apparently hinges upon is a problem. From the news, the talk is that a failure of any of them is disaster.
The problem [...]

Useful Diagramming Web Application

Friday, October 17th, 2008

I stumbled across Web Sequence Diagrams the other day.
It’s a web-based diagramming application that uses a simple syntax to generate UML diagrams. No clicking around and positioning little boxes all over the place - just type in text that describes the diagram, and voila, there it is. He even provides a number of [...]

Customizing the Python Import System

Thursday, July 31st, 2008

So I’ve been programming with Python since 2001 and I’ve never had the need to do anything that the standard import system didn’t provide - until this week. We are planning on a little code reorganization for a project at work in preparation for collaboration from more developers. I wrote a simple custom [...]

Python’s Enhanced Generators

Friday, June 13th, 2008

So while I was mowing my grass last night, I got to thinking about Python 2.5’s enhanced generators and how I hadn’t tried them out yet. Here is a simple example that uses the consumer/pipeline model described in PEP 342.

Converting docx Files

Wednesday, April 16th, 2008

I’m working on an OOXML implementation in Python and found this handy utility for converting docx files to rtf.
Docx2Rtf
It seems to open docx files that Word complains about, but at least it let’s me know that I am on the right track. Also, it runs under Wine on Linux, so there is no need [...]

Command History

Saturday, April 12th, 2008

Since all the cool kids are doing it …
Work laptop

christian@yga-dowski:~$ history|awk ‘{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’ |sort -rn|head
82 sudo
68 vim
51 ls
49 cd
48 exit
20 hg
16 rm
16 ipython
14 py.test
10 ping

Apparently I do a lot of exiting. I just started using Mercurial for local revision control, hence the presence of hg.
Dev server
(where [...]

Reading Chunked HTTP/1.1 Responses

Wednesday, April 2nd, 2008

For work today I wanted a way to iterate over an HTTP response with chunked transfer-coding on a chunk-for-chunk basis. I didn’t see a builtin way to do that with httplib. It supports chunked reads but you have to specify the amount that you want to read if you don’t want it to [...]

My PyCon 2008 Post

Thursday, March 27th, 2008

WARNING: this is YAPAP (Yet Another Post About PyCon), and a late one at that. Click to read more, else move along fair netizen.

Code Farming

Wednesday, February 13th, 2008

I read a good article that gave an Organic Metaphor for software development. Here is a quote:
As I look at what I actually do in my cramped little cubicle, I realize that my work is more akin to farming than construction. I spend my days cultivating information, and growing a program. I can see [...]