Archive for the 'work' Category

Odd Old-Style vs. New-Style Class Behavior

Thursday, May 21st, 2009

So we have some older Python code at work that uses old-style classes. We usually try and bring those up to date when we encounter them.
The other day one of the developers did that and one of our tests started failing. A simple change from:

class Foo:
# stuff here

to:

class Foo(object):
[...]

Coffee Shop Bum

Thursday, September 18th, 2008

I’ve been working from Starbucks for the past few days while we’ve been without power from the remnants of Ike. Sounds like I’m not alone:
http://www.cnn.com/2008/US/09/17/ike.recovery.starbucks/index.html
UPDATE: My sister saved me from another afternoon at Starbucks and put me up in a temporary office at KSU*. Hooray!
* My sister designed their website, btw.

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 [...]

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 [...]

SimpleParse Plug

Wednesday, December 19th, 2007

I’ve been doing more parsing stuff at work lately. For my latest project I’ve been using the SimpleParse library. It has quickly overtaken PLY as my Python parsing library of choice.
Here’s a simple calculator example using SimpleParse. It does basic arithmetic and allows you to store values in single letter variable names. [...]

Political Plug

Thursday, November 29th, 2007

Here’s an article from the Economist on foreign policy and the race for the White House.
Foreign policy and the presidential race.
It’s an interesting article, but even more interesting is that the data in the poll came from the organization that I work for. Ok, maybe more interesting is a bit of a stretch. [...]

Those Useful Iterators

Tuesday, November 27th, 2007

I’ve really been enjoying working with Python iterators lately. They make working with iterative tasks so flexible. Lately I’ve been working on adding progress tracking to an application so that we can give our users some feedback on where the application is at in various long-running tasks.
Since the long-running tasks in question are [...]

Safari Gotchas

Thursday, August 16th, 2007

In the spirit of sharing knowledge that will save someone from the sort of tedious pain I went through the past couple days, here are a few Safari (2.0.4) bugs that I had to work around:
1. No Global Javascript eval()
That’s right. You can’t eval() in the global (window) context. Safari doesn’t allow it. [...]