tadhg.com
tadhg.com
 

Posts concerning coding

Quick & Dirty Book Info Lookup

21:57 06 Mar 2011

I’m still trying to cut down on the number of books I have in my apartment. That still feels wrong, but the shift to ebooks is making it a little easier. Now I’m getting rid of books that aren’t big favorites of mine, weren’t given to me as gifts, and aren’t in the poorly-defined category of “classics I want to keep”.

Because I’m a pack rat and a data geek, I have a hard time getting rid of books if I haven’t recorded the metadata about them I want to record. Unfortunately, I’m not always diligent about noting that info as I read the books, so the majority of the books I wanted to give away or sell were books where I hadn’t done so—and I really didn’t want to go through them one by one.

Modern technology to the rescue…
[more...]

Permalink     1 Comment     [, , , , , ]    

WordPress 3.0.5 Upgrade

22:07 20 Feb 2011

I upgraded this blog today, the first time I’ve done that in over a year. Everything looks okay.

I’ve become slightly less paranoid about it; I still back everything up first, but I no longer preview the upgrade in my development environment, instead being prepared to restore from backups if something goes wrong. This might not be wise, but I’ve been lulled by the smooth upgrades the past few times.

Permalink     Comment     [, , , , , ]    

sfmagic.org: Stepping Away

22:48 10 Feb 2011

I hate giving up on projects. Especially projects that I’ve spent a lot of time on, that have had some success, and that have come close to being finished without making it the final, crucial steps. I really wanted to get a new version of sfmagic.org written, in Python, with good web development practices from top to bottom, but it’s far past time to let that go.
[more...]

Permalink     Comment     [, , , , ]    

Fun with pandoc, Vim, and email

23:52 21 Jan 2011. Updated: 01:35 22 Jan 2011

I’ve mentioned pandoc once before, and it’s again proved rather useful. I’ve been looking for more ways to use it, as I love its core principle (although I naturally wish that it focused on reStructuredText rather than Markdown) of being a comprehensive text format converter. It might at one point be the answer for getting from reST to PDF—something that the current reST tools don’t help me with because I insist on using Unicode, and XeTeX isn’t yet supported. But today pandoc helped with a different task: going from reST to plain text.
[more...]

Permalink     1 Comment     [, , , , , , , , , ]    

2011 Goals

04:02 02 Jan 2011

My goals for 2011.
[more...]

Permalink     2 Comments     [, , , , , , , , ]    

2010 Goals Review

11:51 31 Dec 2010

I once again had eight goals for 2010, and it’s not too likely that any more of them will be accomplished before the end of the year.
[more...]

Permalink     Comment     [, , , , , , , , , , , ]    

Vim Golf

17:59 28 Dec 2010

That’s right, a competition to do edits in Vim in a few keystrokes as possible. I haven’t even installed it yet and I’m sure it’ll eat large chunks of my time.

Permalink     3 Comments     [, , , ]    

Friday Game Analysis: Pac-Man

22:35 03 Dec 2010

Chad Birch has written a fantastic dive into some of the guts of Pac-Man’s ghost behavior mechanics, and found it highly enjoyable and illuminating, despite not having played Pac-Man in years. Definitely worth reading. I’d previously read Susan Lammers’ interview with Toru Iwatani, which Birch refers to in his post and which I’m happy to see is available online.

If that’s not enough depth about Pac-Man for you, there’s also an entire “dossier”.

Permalink     Comment     [, , ]    

Google Refine 2.0

21:04 11 Nov 2010

This post is actually aimed more at my less technical readers than my programmer friends.

Google Refine, formerly Freebase Gridworks, is a data cleanup and transformation tool. These days, though, it seems as if everyone has to work with messy data. Lists of addresses, employment rosters, film collections, sports stats, and/or any amount of public material. Such data is rarely clean, and that’s precisely what makes a tool like Google Refine so useful.
[more...]

Permalink     2 Comments     [, , , , ]    

Minor Achievements

20:36 18 Oct 2010

Sometimes it’s the little things that make life better, the small victories in ongoing daily battles.

I recently did an overhead squat at 185 pounds (or about 84 kilos, or 13 stone 3); I weigh a little under 180 (that day, 178 pounds) and so that was a bodyweight overhead squat. It actually represents two achievements, because in order to get the bar into the overhead position, I had to push jerk it from behind my neck to locked out above my head, which counts as my best push jerk ever, albeit an unorthodox one. From the overhead locked out position, it’s down into a deep squat and back up; the harder part for me was going down, as once I was at the bottom it wasn’t hard to keep my balance coming back up.
[more...]

Permalink     1 Comment     [, , , , , , , , , ]    

Conditionally Adding dict Keys in Python

20:18 12 Oct 2010. Updated: 03:35 30 Dec 2010

I frequently run across the need to add key/value pairs to a dict subject to some condition. The “traditional” version of that pattern looks something like this:

if condition:
    my_dict[key] = value

Because of my stylistic preferences, I don’t like that, and want to do this:

my_dict[key] = value if condition

That doesn’t work, though, because then key will be set to None in the dict, which is an unwanted side effect.
[more...]

Permalink     Comment     [, ]    

Some Tidbits from my .vimrc

21:44 07 Oct 2010. Updated: 03:54 30 Dec 2010

These aren’t anything particularly major, just some things I’ve found to improve my editing experience.
[more...]

Permalink     2 Comments     [, , , , ]    

Adjusting Keyboard Shortcuts

23:17 27 Sep 2010

This post is about keyboard shortcuts, remappings, application switching, and a little bit of workflow, primarily in the context of OS X and Vim, so it might not be of interest to all readers.
[more...]

Permalink     3 Comments     [, , , , ]    

MacVim 7.3

23:09 20 Sep 2010

I’ve been slow in upgrading to MacVim 7.3, which came out about a month ago. I’m happy with it, but there are only a couple of features that really matter to me so far:

  • colorcolumn
  • Python 2.6 support.

colorcolumn lets you specify columns that will have a different background color—this is primarily useful for source code where you want to stick to line length limits. This is one of the few features I was still missing from jEdit, although I think jEdit’s solution was nicer: in jEdit the visual line was thin and went between the columns, so between columns e.g. 79 and 80 you could have a line; in Vim 7.3 either column 79 or 80 would have a “line”, i.e. a different background color. Still better than the kludge I use now, though.

Python 2.6 support is nice due to the number of Python scripts I’ve written for Vim, which used to have to be compatible with Python 2.3. The main things I really like here are the ability to use .format on strings, conditional expressions, built-in set support, and generator expressions. That list is inspiring me to edit some of my old scripts right now.

Permalink     Comment     [, , , , ]    

Metaweb Acquired by Google

23:57 16 Jul 2010. Updated: 01:20 17 Jul 2010

The official announcements are out, and my former employer Metaweb no longer exists. I’m happy that the ideas, and most of the people, have found a home, but it feels strange that the company is no longer a distinct entity. In many ways it makes a lot of sense for Google to end up owning them, and I hope the former-Metaweb-now-Google employees prosper.
[more...]

Permalink     Comment     [, , , , , , ]    

Unit Testing as Game

23:23 15 Jul 2010

One of the great things about unit testing is that you can get into a game-like mode where you make incremental but measurable progress—“flow”, basically—but what if it’s just not similar enough to a game for you?

Install Unit Testing Achievements, a Python package that works with nose, unittest, and Django. Somewhat crazy, definitely hilarious. Some of the achievements themselves are excellent, such as My God, It’s Full of Dots: The suite has at least 2,001 passing tests.

Sadly not yet working is another one I like, Heisenbug: Make a passing suite fail without changing anything.

Permalink     Comment     [, , , , ]    

8-Bit Cities

21:35 12 Jul 2010

As a geek of my generation, I cannot help but find an eight-bit map of San Francisco (there are maps of other cities too) a wonderful thing. It became even cooler when I found out it was programmed in Python.

Permalink     1 Comment     [, , ]    

iPad First Impressions: Consumption Machine

18:52 23 May 2010

I got an iPad for work on Friday, and have been playing around with it. I would not have bought one for myself, and have grave misgivings about the device, primarily due to its highly proprietary, locked-down, walled-garden approach.

That being said, I think it’s an extremely slick, well-designed device, and may represent the first steps towards a new phase in accessing computer and/or internet artifacts.
[more...]

Permalink     2 Comments     [, , , , , ]    

sabbatical.close()

23:36 16 May 2010

After a highly enjoyable, productive, and extended period, it’s time for me to return to the world of paid work.

I’m quite happy with the things I’ve done during my time off. Many of them are important only to me, but then, it’s been my time off.
[more...]

Permalink     3 Comments     [, , , , , , , , , , , , , , , , , , , , , ]    

Rather Better Than a Cover Letter

18:55 13 May 2010

It might sound like a cheesy stunt, but I have a hard time coming up with a more fitting way to land a job at an advertising agency.

Permalink     Comment     [, , ]    

Improving a Python Word Counting Function

13:33 29 Apr 2010

This post could be summarized as “regular expressions are a lot faster than naive for loops”.

I’ve been working on improving the script I use for live wordcount in Vim, partly for performance and partly so that I can package it up as a plugin and share it with other people. Along the way I’ve improved the speed of the script rather significantly, and will go through the key part of that change here.
[more...]

Permalink     1 Comment     [, , , , , , ]    

How to Solve It and Project Euler

20:35 16 Apr 2010
Permalink     Comment     [, , ]    

Python Flatten/Concatenate Comparisons

23:31 09 Apr 2010. Updated: 15:28 18 Jan 2011

I’m going to compare seven different ways in Python to make one list out of several lists containing different numbers of elements, something that strikes me as a common but not necessarily everyday operation.

The philosophy of Python is that generally there should be one obvious and reasonable way to do things. I really like this philosophy—except when the Python way isn’t the way I prefer, of course.
[more...]

Permalink     Comment     [, ]