Kurt McKee

lessons learned in production

Archive

Articles tagged with programming

Code styles are the result of personal preferences, past experiences, and code editor settings (and plugins!). Discussing code style in code reviews is unproductive. Put code style checks in pre-commit hooks where they belong.

Monkeypatching is a common word among Python programmers. But what is it?

This post is an introduction to monkeypatching.

Self-documenting code | 26 December 2019

I have to maintain code and narrative documentation for compliance reasons at work, but I don't want to separately update the documentation each time I update the code! Luckily, because I'm using Python and Sphinx, it's easy to the automatically update the docs.

Tera Term subroutines | 8 May 2015

A long time ago I inherited a big monolithic mess of Tera Term macro code. After a few years the code base had grown considerably and become extremely unwieldy. I finally decided that it was time to fix the problem and created some utility code that would allow me to …

Twelve days later | 19 April 2015

It's been twelve days since my shoulder surgery so I thought I'd post a summary of what I've been up to.

In the first 24 hours there was an issue that cropped up at work. The problem was caused by an update to some software released by another group in …

In the beginning | 5 October 2014

My first programming language was some variant of BASIC on a VTech Precomputer 2000. Then one day I discovered that a copy of QBasic was included with DOS and began using it to program. I wrote software to add and subtract arbitrarily long strings of integers (I don't think I …

The Debris Cathedral | 21 September 2014

For a very long time I've been writing code at my job that automates some very tedious tasks. It's not Python code, though! It's a macro language that has saved the company a lot of time and energy but suffers from severe limitations:

  • No scoping -- everything is in a global …
pdb post-mortem debugging | 13 January 2012

I misread a recent feedparser bug report and thought that the author had mistyped a bbcode- or wiki-formatted link. Consequently, I wasted time debugging the code.

Turns out, I wasted a lot of time, because I spent more than zero time debugging the code. Yes, zero time. I was using …

Predictions and facts | 28 March 2011

After porting feedparser to Python 3, I've consistently tested every change on Python 2.4 through Python 3.1. That's four versions of Python 2, and two versions of Python 3. I've also started creating coverage reports for each test run, so I can ensure that the tests are reasonably …

Feedparser porting status | 23 November 2010

I spent some time this weekend working on porting feedparser to Python 3, and found that it will be difficult because there are two separate parsers included (a strict parser and a loose parser), and while each works differently, both use the same core machinery in feedparser.

With the strict …

Porting feedparser to Python 3 | 19 November 2010

Today I'm announcing I'm throwing my hat in the ring to port feedparser to Python 3. There's a ticket open regarding this at the feedparser bug tracker, but the person who's working on porting it appears to be writing Python 3 code instead of writing Python 2 code that the …

Tracking feeds and comments | 4 September 2008

I switched feed readers a while back; I ditched Google Reader in favor of Liferea. Liferea brings some interesting features to the table that Google Reader didn't, like the automatic downloading of comments where available.

After using it for a while, I've begun to consider wrapping comment tracking and feed …

A few days ago I added support for tracking Wordpress.com comments, but its implementation leaves a lot to be desired, as I'm merely using comment feeds for the purpose.

The first problem is that Wordpress.com limits the number of comments in feeds to 10. Thus, it is very …

Earlier this month I wrote about scraping LiveJournal comments. What was I thinking?

While I was able to account for a number of variables in the page by tweaking my XPath statements, it became obvious early on that screen scraping for comments should be a last resort. So I decided …

As a first attempt at expanding my comment tracking software, I did a little testing in regards to scraping LiveJournal comments. Having written some uncomfortably convoluted XSL transformations in the past, I've become familiar with XPath. While BeautifulSoup has served me well in the past for quick excursions into the …

while read i | 8 July 2008

I have finally finished backing up all of my data. It took four DVDs, but I finally did it. It would have required several more had I not filtered my music files for backup, however. In particular, the only music that I truly had to save were the songs I've …

Python's time module | 12 June 2008

So I've been working like a fiend to import all of my comments from around the internet. It has been a herculean effort because almost everything has to be done manually. One comment here, another there, and no uniform way to extract those comments.

Two sites, however, made comment retrieval …