Unescaping HTML in Python

Posted by Michael Giarlo on August 01, 2008

Dear Future Me,

You’ve forgotten how to decode (or unescape) HTML or XML in Python again, haven’t you?  My, my, that old age does catch up with you.

Well, it turns out that xml.sax.saxutils.unescape() works like a charm.  I’m certain that edge cases lurk here and there, so caveat, um, coder.

Stupid terminal tricks

Posted by Michael Giarlo on June 08, 2008

Sometimes I find it useful to keep long-running processes in a session of screen.  And sometimes I launch one of said processes outside of screen, and then I yell something like “doh!” or an expletive, because, as I said, I do find screen useful.  Depending on how far the process has gotten, whether it was the sort of operation that would not run happily again, or how much cleanup a second run would require, I either kill the process and restart it or I suspend it with Ctrl+z and send it to the background with bg % so that it doesn’t die when I log off.  The latter is a decent option.  But, darn it, I like screen.

Well, perhaps I’m the last to know, but there’s this neat little tool called retty that allows you to attach running processes to your terminal.  I installed it in Ubuntu Hardy the typical way (sudo apt-get install retty).  So, the next time I screw up, I’ll Ctrl+z, bg it, and then screen retty {PID}Voila!

Hiccup-y Hardy Heron

Posted by Michael Giarlo on April 29, 2008

In spite of how irksome I find “oh hai i upgrayded!” posts, I’m about to be guilty of same.

I upgraded my Optiplex GX620 from Gutsy to Hardy yesterday afternoon and it seemed to go as smoothly as it did on my HP box at home.  All looked a-okay this morning until, upon returning from a meeting, my display was all funky and jerky and laggy.  The right edges of my windows were uniformly screwy — I would have to click about an inch to the left of whatever I wanted to click on — and the right and left edges of the screen caused visual trails when I dragged windows around.  (And this has nothing to do with my usual breakfast of bacon and psychedelics.)  This wasn’t the first time I’ve run into problems with compiz/beryl and Ubuntu and so I was hopeful that things could be easily remedied.

I was still able to get around a bit and I found a Hardy installation guide that fixed me all up (I hope).

I should probably note that the Optiplex in question has an ATI Radeon X600 series video card.

Pining for the visual trails,

Mike from Arlington

P.S. Ubuntu, I still ♥ you.

Jython scp

Posted by Michael Giarlo on April 17, 2008

In spite of some open questions, I’ve been making some progress on my Jython-based transport tool. Right now it’s pretty dumb and simple: it copies files to and fro via scp.

Being a newb at both Java and Jython made finding the right libraries a bit of a challenge, and so I’m posting some code here for folks in the same boat. It’s not particularly pretty due to 1) wanting to get something working very quickly, and 2) weird errors when I try to make things prettier (such as getting rid of the hard-coded bits), but I’ll resolve these soon.
Continue reading…

Jythons and Javas and bears, oh my!

Posted by Michael Giarlo on April 11, 2008

It’s hard to believe but I’ve been at the new job for six months already, a full half-year come the 29th. Some days it seems like I’ve been here forever; others like I’m still a rank newb. I haven’t written terribly much about what I’ve been up to (but I assure you I’ve been busy). Let me rectify that.

The Transfer Problem

Two of the projects I’ve been working on relate to a fairly general problem that we like to call “transfer,” which revolves around, well, transferring files to and fro. Sounds simple. Is simple. That is, until you start thinking about preservation and accounting for a highly heterogeneous network with idiosyncratic nodes, esoteric storage software, and differential firewall rules. And that’s where it gets interesting (and problematic). Continue reading…