Friday, August 28, 2009

Enthought's reStructuredText editor

Enthought has produced a wonderful tool for getting into reStructuredText: a side-by-side WYSIWYG rST editor.

Screenshot of editor session
Getting it installed, however, just about killed me. Here are the steps I finally puzzled out for Ubuntu 9.04. Miss any steps - or even change the order - and you'll get error messages that don't help even slightly.
sudo apt-get update
sudo apt-get install python-setuptools python-vtk
sudo easy_install -U numpy
sudo easy_install -U docutils sphinx TraitsBackendQt[nonets] AppTools[nonets]

[EDIT] If you're not on 9.04, or you just want to be on the safe side, it doesn't hurt to sudo apt-get install python-dev python-qt4 at the beginning of the whole process.

The other odd thing is that this lovely editor apparently has no name, and certainly no handy start script or presence in any menu. Mine got installed at /usr/local/lib/python2.6/dist-packages/AppTools-3.3.0-py2.6.egg/enthought/rst/; your best bet to find yours is probably sudo updatedb; locate -r rst/$

Then, set up a bash script to make it usable. I'm calling it "rsted". sudo nano /usr/local/bin/rsted and fill it with:

python /usr/local/lib/python2.6/dist-packages/AppTools-3.3.0-py2.6.egg/enthought/rst/ $*

... sudo chmod +x /usr/local/bin/rsted, and live happily ever after.

(The $* in /usr/local/bin/rsted doesn't actually do anything - the editor doesn't seem to accept arguments like a filename - but I'm being hopeful for the future.)

Friday, August 14, 2009

PyCon 2010: Call for Proposals

In the opinion of most attendees I talked to, PyCon 2009 was the best one yet. If you need an excuse to come to PyCon 2010... well, what better excuse could there be than, "I'm speaking"?

Call for proposals — PyCon 2010 —

Due date: October 1st, 2009

Want to showcase your skills as a Python Hacker? Want to have hundreds of people see your talk on the subject of your choice? Have some hot button issue you think the community needs to address, or have some package, code or project you simply love talking about? Want to launch your master plan to take over the world with python?

PyCon is your platform for getting the word out and teaching something new to hundreds of people, face to face.

Previous PyCon conferences have had a broad range of presentations, from reports on academic and commercial projects, tutorials on a broad range of subjects and case studies. All conference speakers are volunteers and come from a myriad of backgrounds. Some are new speakers, some are old speakers. Everyone is welcome so bring your passion and your code! We’re looking to you to help us top the previous years of success PyCon has had.

PyCon 2010 is looking for proposals to fill the formal presentation tracks. The PyCon conference days will be February 19-22, 2010 in Atlanta, Georgia, preceded by the tutorial days (February 17-18), and followed by four days of development sprints (February 22-25).

Online proposal submission is open now! Proposals will be accepted through October 1st, with acceptance notifications coming out on November 15th. For the detailed call for proposals, please see:

For videos of talks from previous years – check out:

We look forward to seeing you in Atlanta!

Tuesday, August 11, 2009

BLOBs in sqlpython

Obviously, you can't query BLOBs in a command-line SQL tool.

Unless, of course, that tool is sqlpython. Bwa ha ha ha.

reStructuredText talk at OLF

It's official - I'm on the schedule!

reStructuredText: Plain Text Gets Superpowers
September 26, 2009, 5 - 6pm
at Ohio LinuxFest

Greater Columbus Convention Center
400 North High Street
Columbus, OH 43215 USA

Introduction to reStructuredText, a simple single-source format that can generate documents in HTML, PDF, .odt, and many other formats.

I also see tasty-looking talks on "Python for Linux System Administration", a "Sysadmins' Rosetta Stone" talk that should help me port my Ubuntu skills to Red Hat, and gobs more - plus the Diversity in Open Source workshop. This will be a great year!

Spend Like a Pirate Day

Why do we Americans continue to carry around drab $1 bills, struggling to cram mushy, wrinkled paper into vending machine readers, when we could carry gleaming, clinking, golden doubloons?

Admire the gleam and the weight. This is the proper sensory experience for money!

I just found out you can buy boxes of 250 coins directly from the mint. Granted, there's $5 shipping, so you're paying $255 to get $250, but your credit card kickback should cover that. Then you can eschew that lame ATM for months! Let's face it, you only use cash for little purchases these days anyway. Make every cash transaction enjoyable!

When you receive your coins, feel free to run your hands through them several times, purring, "Arrrrrr! Thar's treasure for ye, me mateys!" Do NOT, however, bury them in a sturdy wooden chest and draw a map with a dotted line and an X. I know it's tempting! I want to do it, too! But the point is to get more of these beauties into circulation.


Monday, August 10, 2009

workaround: easy_install windows vanish

My employer-mandated Vista machine has gone almost unused for months because of an infuriating quirk in Vista's command-prompt operation. I've come as close to completely forgetting how to use Windows as I've ever been. Giles Thomas (of Resolver Systems) saved me.

The problem: Vista runs programs like easy_install in a new cmd window, separate from the one they were invoked in. The instant the program terminates, the new window is closed, and any messages it returned - like error messages - are lost. No, redirecting the messages with > and 2> does not work. "Why would you want to see error messages, anyway? They're so geeky and depressing!" *gum snap*

Thus, I was unable to install cx_Oracle, and had to turn to my trusty Ubuntu machine for absolutely every pyOraGeekish task.

Giles blogged a lifesaver workaround. If you can run the cmd window as Administrator in the first place, you are entrusted with the awesome power and responsibility of being allowed to view your own error messages.

So, now I can blow the dust off my Vista machine. Wow, controlling the font size of a cmd window is absolutely as primitive as it was in Windows 3.1. Giles, got a workaround for this, too?

Tuesday, August 04, 2009

Oracle at Ohio LinuxFest

I'm going to Ohio LinuxFest 2009
It's not official yet - so you can't find it at the Ohio LinuxFest website - but it looks like Oracle will be a sponsor and exhibitor this year. They're planning to do an Oracle-on-Linux installfest. If you'd like to get your first taste of Oracle on Linux, sign up for LinuxFest (it's free) and prepare to have a blast.

If you're already pretty good at Oracle-on-Linux and would like to help others get started, send me email! I hope to gather a small group of volunteers to help out at the installfest.

bug reports from the public

From "Dr. Kronkheit and His Only Living Patient":
SMITH: Doctor, it hurts when I do this.
DALE: Don't do that.
Dear Enterprise Rent-A-Car,

That was called a "bug report". It was not actually a request for a condescending message about how I can still rent a car by navigating the website in a different way. I knew that.

I took the time to write up detailed instructions for reproducing the bug as a professional courtesy to your developers. Unfortunately, they will never see my message, since your customer service is managed strictly from a "deal with nuisance customers" point of view. Looks like I wasted a couple seconds of your time as well as several minutes of my own.

RESOLVED: If I ever work on a project large enough to have a customer service department separate from development, I will insist upon bridging this gap. I will make sure customer service has the access, knowledge, and encouragement to communicate constantly with me. I will regard customer service as a valuable conduit for end-user feedback rather than a distant, uninteresting group of non-colleagues.

logging is ugly

Instrumenting your code - whether with a PL/SQL package like Quest Error Manager as Steven Feuerstein suggests, Python's logging module, or whatever - is an important part of writing good code.

I don't. Not very often, anyway. When I do, I often delete the logging calls as soon as the code is more or less working. The biggest reason is the ugliness.

def days_ago (ndays):'days_ago called with arg %s' % str(ndays))'arg type %s' % type(ndays))
ndays = int(ndays)'argument converted to integer %d' % ndays)
current_date ='current date is %s' % str(current_date))
result = current_date - datetime.timedelta(ndays)
except ValueError, e:
logging.error('Error converting ndays to integer:')
result = None'returning from days_ago: %s' % str(result))
return result

EWWWWWW! That is ugly! It completely disrupts the comfortable reading of the code. It buries the actual purpose and actions of the function under a steaming heap of chatter. It offends everything that I value in beauty and readability. What to do?

One solution might be a code editor that would toggle the visibility of all logging calls in a program. You could leave them invisible most of the time, and only look at the logging statements when you have a specific reason to. I can see two problems with that, though.
  • The logging calls themselves could get out of synch with the functioning code. This could be partially addressed by having logging calls become visible automatically whenever code adjacent to them is changed.
  • This would create code which is readable and beautiful in my editor, but ugly when somebody else tries to read it. Perhaps if we cooked up a convention whereby a header comment could define the suggested hiding of logging calls for each program, and most editors could be trained to recognize and respect these suggestions?
I don't have the answer for this. I'd love to hear ideas.

EDIT: Gary Bernhardt tweets, "Anything that you want your editor to to be able to hide (comments, setters/getters, logging) shouldn't exist".

An interesting idea... how to eliminate logging? A good logging decorator could log arguments, return values, and error messages to any decorated function - and that level of information could suffice, if the functions are very fine-grained. Having to write fine-grained functions is the sort of constraint that might improve programming style, too, much the way unit testing demands well-defined functions. I think I'll try this philosophy and see if I can make it work.

It's not much help for the PL/SQL side of things, though. I'm trying to imagine if there's some way to make an analog to Python's decorators in PL/SQL.