I'm a die-hard emacs-and-command-line hacker. Once a year I try to evolve past my 1991 toolset and use an IDE for coding, hoping to find something as transformative as the Smalltalk 80 environment. The various Java IDEs never worked for me, even VisualAge. Visual Studio is great, but I don't program for Windows much. Most of my coding is Python. So for my latest project I decided to finally try a Python IDE. After an abortive attempt with Eclipse + PyDev I settled on good ol' Wing IDE. Which is great, and I'm ready to pony up $180 for a license.

The key thing about Wing is that it works very well for Python and Python alone. This is not the IDE for a multilanguage product. But if you want a simple path into running a quick Python hack, with room to expand to complex Python projects, it's very good. Note you need the full professional version to get the important features.

The key feature of Wing is good integration to the Python interpreter. There's a Python shell built right in for interactive hacking. And you can interrupt or breakpoint a running program to examine variables on the stack or execute new code in the process context (great for exploring state). The underlying integration is built right into Python and I'm sure emacs, Eclipse, etc can drive it too. But I could never make it work productively for me, whereas with Wing it works right out of the box.

Of course Wing has all the basic IDE stuff: indenting editor, syntax highlighting, code completion, etc. There's code analysis for contextual help, although without static typing it's a a bit awkward. There's also some tacked on unit testing and revision control support, adequate but not great. Honestly the whole IDE suffers a bit from having a Python hacker's idea of good user interface, but the quality of the interpreter integration is good enough to make up for any rough edges in the UI.

I still need a command line. For Windows Vista it's good ol' Cygwin for a Unix-like environment along with PuTTYcyg for a terminal emulator. (Note that stock Python doesn't work well with Cygwin TTYs, but it's usable.) I finally have a way to hack as efficiently as I used to in Unix, but driven mostly from the Windows machine in front of me instead of via remote sessions. It's pretty nice.

  2009-05-24 19:01 Z
Yesterday I tried to load some music on my iPhone for the first time in a year. The result was a complete iPhone apocalypse. Long story short; at some point iTunes decided to do an incredibly long and slow sync of some music I didn't want to copy. With no progress bar, no indication of how long it'd take, and no cancel button. So I did the only sensible thing and unplugged the phone.

The result? Not only did I have no music on my phone, but now I had no third party applications, either. Well I had a couple, some random subset were left behind. The other apps were deleted. Along with their data. Including a month's pain-stakingly collected diet data, gone forever.

Two-way sync is hard. But it's not that hard. iTunes' model is apparently that it has the canonical copy of what's on your phone. Only it doesn't update that model correctly in all cases, and then deletes whatever is on your phone that doesn't match the incomplete copy on iTunes.

I can sort of understand that failure with the music library; your iTunes install is the only conduit for putting music on to the phone. But apps can be installed independently, and generate their own data on the phone. iTunes can't be sure it has seen all the app data; so why be so casual about deleting it? Even if you can count on the user not to unplug the phone mid-sync, what happens if iTunes crashes? Or the machine crashes? Or the cat knocks over the phone? Or the power goes out?

I've made a sport of iTunes-bashing on my blog and Twitter the past few years. It's a bit obnoxious, but every time I try to use iTunes I'm stunned at how bad it is, particularly on Windows. Apple's reputation of building humane, user-friendly software is completely misplaced in this case.

  2009-05-23 14:49 Z
India just finished a mammoth election. With over a billion people it's the world's largest democracy by far, and with several hundred languages, at least two alphabets, and only a ⅔ literacy rate communication is a challenge.
So I'm fascinated by this photo of a ballot. Every candidate is represented by their name in Sanskrit, Roman, and with an abstract symbol. Vote for the train, the whistle, or the telelvision set? Such a simple way to help people who can't read pick their candidate.

The collection above is from an incomplete list of symbols I found online. The icons look abstract to my American eye, but they're symbolicly rich for snarky deconstruction.

  2009-05-22 17:52 Z
I pity President Obama. He didn't inherit just one shit sandwich, but two: a deeply broken economy and the legacy of the Bush Administration's disastrous war policies. I have some sympathy with his desire to "put the past behind us", but as Frank Rich argues persuasively today that's impossible.
Until there is true transparency and true accountability, revelations of that unresolved eight-year nightmare will keep raining down drip by drip, disrupting the new administration's high ambitions.
What's new this week? It looks like in 2003 Cheney ordered cooperating prisoners to be tortured to help support the fabricated Iraq/Al Qaeda connection. Meanwhile Rumsfeld was distributing war briefings with Bible quotes about America's Crusade. The Pentagon now admits the truth of the story that they used retired generals to manipulate the media. Nancy Pelosi is either lying about her approval of CIA torture or else revealing just how useless she and the rest of Congress are in the face of an abusive executive. And now Obama is helping hide the photographic evidence of prisoner abuse.

There's no ignoring this stuff. The Bush Administration conducted some very dangerous, ill considered business to get its war in Iraq. And it illegally tortured people. There has to be accountability for that. The truth needs to come out and the people responsible for criminal acts need to be jailed. I know the economy is a disaster and the Obama administration has another agenda, but we have to start from a firm moral foundation.

  2009-05-17 17:56 Z
About once every six months I do some hack which involves caching web pages on disk. While hacking I always just write stuff to a cache directory so I can load it / replay it quickly. And inevitably I forget about the crappy cache and when I run the job for real I only remember three days later when the directory has an unwieldy 200,000 files in it.

Operating systems fail in all sorts of charming ways when you have a directory with "a lot" of files, typically over 10,000. Both the Vista and Linux kernels no longer seem to have O(n) operations on directories, so deleting all the files is no longer O(n^2). But the tools still freak out. For example, rm * doesn't work if the expands to larger than the command line limit.

Vista has a host of joys associated with giant directories. Opening the directory in the file shell actually works. Selecting all files and deleting doesn't, though, and the entire UI becomes unresponsive on a directory with even 20,000 or so files. del * from a command line does seem to work, but is awfully slow. I finally wrote some custom Python to unlink the files quickly only to find they were in a search indexed directory; the entire deletion process would freeze for 20 seconds at a time while the indexer chewed over the removals. Ugh.

By the way, if you ever need to remove a bunch of files the lower level you do it, the better. Even rm does more examination of the file than you want. Here's a quick python hack that seems pretty efficient.

files = os.listdir('.')
for f in files:
  try: os.unlink(f)
  except Exception, e: print e
  2009-05-10 21:40 Z
Want to use Subversion on Windows Vista, with the svn+ssh protocol (you know, the only sane one?). It's remarkably tricky, but it's doable. There's a bunch of incomplete docs on the web, including Wingware and Piwigo. Here's the steps in schematic form.
  1. Install the command line Subversion client for Windows. Yes, you have to register for an account to download this free software, at least from collab.net.
  2. Install PuTTY, the free ssh client for Windows.
  3. Get PuTTY configured so it's using Pageant as an ssh key agent. When you can use Putty to log into your SVN server without typing a password, you're set.
  4. Go to a command line and verify you can run
    plink server hostname
    without typing a password. Plink is what PuTTY named the command 'ssh'.
  5. Go to
    and edit the file config (in Notepad or whatever).
  6. Head down to the [tunnels] section of the config and enter this line (all one line, but with lots of \\ quoting nonsense)
    ssh = C:\\Program\ Files\\(x86\)\\PuTTY\\plink.exe
  7. Test everything from a command line.
    svn info svn+ssh://server/...
  8. Swear at Microsoft for moving the paths for everything in Vista. And swear at the Subversion community for not producing a humane Windows install.
  2009-05-05 21:51 Z