Monday, April 19, 2010

P(ythonic)L/SQL?

I'm itching to begin creating a bunch of PL/SQL packages that will emulate certain handy Python features. Before I sink too much time into it, does the LazyWeb have anything to recommend? Or, perhaps, volunteers to help make the dream come true?

I want to start with a package for Pythonic string manipulation:

'The {0} brown fox jumped over the {1} dog'.format('quick','lazy')
.join()
.split()
.splitlines()

... and so forth

I think this package would not just implement the ones that don't exist in SQL or PL/SQL, it will provide Pythonically familiar names and interfaces to the ones that do exist.

Granted, there's only so Pythonic you can get in PL/SQL. A perfect set of packages would be a heroic task. Still, it's easy to imagine helping PL/SQL to suck less...

Sunday, April 18, 2010

templating engine cookoff

There are more Python string templating engines in the world than homemade chili recipes. Which is tastiest? Let's have a cookoff!

We all have different criteria, of course. The only organized comparisons I've seen between them are based mostly on measuring speed of rendering. Huh? I have never said to myself, "Wow, I'm wasting so much time because these templating engines aren't rendering fast enough. If only they would finish in 0.4 seconds each instead of 0.6!"

I have said to myself, "Wow, I'm wasting so much time because there are errors in my templates, and my templating engine isn't helping me find them." Writing templates is tricky. Errors are common. So, for me, clear error messages are the key virtue. My cookoff focuses on recognizing the engines that report the filename and the offending string when a rendering failure occurs. It also displays a typical simple syntax for writing and using each type of template (so it can serve as a cheatsheet as well).

My results? So far, only jinja2 and genshi report both filename and the error-causing string. The jinja2 error stack is more concise overall, so I award it the prize by a nose.

I'm really happy with the framework I wrote for doing the cookoff, too, so I posted it on Launchpad. It is really, really easy to add new engines for comparison - feel free to suggest or submit them! In fact, I hope that others can adapt my cookoff framework to other situations that call for side-by-side package comparisons.

Incidentally, why are comparisons like this usually styled "smackdowns" or "shootouts"? What's up with that? We're not trying to put anybody in the hospital! We're just trying to select our favorite from a banquet of delicious offerings. Eat up!

Monday, April 12, 2010

I'm speaking at Penguicon

Ren'Py: A Visual Novel Engine

Computer gaming, anime/manga, Python programming, fiction writing: Ren'Py is everything you love about Penguicon rolled up into one. It's an open-source visual novel engine that lets you program graphical games and stories with the greatest of ease. Creating basic linear or branched stories is almost as easy as writing them on paper - yet Ren'Py is also a full-fledged Python environment, so there's no limit to what you can program as you learn. This intro will show you everything you need to start creating your own masterpiece. Ikimashou, otaku-san!

May 1, 2010, 12 noon - 1 PM
Detroit Marriott Troy
200 W. Big Beaver Rd.
Detroit MI 48084

YOU: Okay... but will you give the presentation wearing a homemade Elizabethan-era dress?
ME: Yes!
YOU: Cool! Um... why?
ME: Because this is Penguicon!

What's Penguicon? It's an open-source software conference... it's a science fiction fandom conference... it's an awesome hybrid of the two! Super-sharp technical people come for some awesome knowledge sharing, and the SF fans help make the atmosphere even more relaxed and imaginative than at a normal FOSS con. I love both sides of the con and especially the ways they mix together, which is why I wanted to give a talk this time that would really encompass it all. (Costumes are totally optional, by the way. But they sure are fun!)

(Psst - if you install Operator, you'll be able to automatically process the microformatted data in this post and add it to your calendar. Cool, huh?)

See you in Detroit!

PyOhio Call for Proposals

PyOhio's http://www.pyohio.org/CallForProposals is out, due May 10. Let your imagination run wild; PyOhio is what we make it, no more and no less. Help us make this year's PyOhio the best yet!

Friday, April 09, 2010

daytontechevents

daytontechevents.com

A free service aggregating information about tech events in Dayton

There's too much geeky awesomeness going on in town to track with your brain alone. daytontechevents fixes that. If you're in or near Dayton, keep an eye on it so that you don't miss something fantastic! If you know of a group or event around here that isn't yet on daytontechevents, add it!

Thanks to Sarah Dutkiewicz, who got the idea and put the infrastructure in place not just for Dayton, but also for Columbus and her hometown Cleveland. Ohio thanks you, Sarah!

Thursday, April 08, 2010

Pooled nonprofit IT

File this one under "Daydreaming".

There are lots of small, local nonprofit organizations that really can't afford to do their IT well. They can't afford a full-time professional, so they make do with unskilled labor, plus a smattering of donated services and what short-term contractual help they can afford. Each time, the solutions implemented depend on the skills and tastes of the implementor, and rarely build usefully on what has been implemented before.

Imagine the efficiencies if many organizations could share a small, full-time IT staff dedicated to their needs. Most organizations share many of the same needs, and could share the same set of solutions. A full-time pro would become familiar with those needs and could efficiently apply a well-known solution to each group. (S)he would provide continuity, well-informed decisionmaking, and perfectly specialized skills.

Providing this would seem like a natural role for, say, an organization like the United Way; or perhaps for a small meta-charity created for the purpose. I'm sure private firms have attempted to set themselves up in this role, but anything that demands a steady funding outflow from the benefiting agencies is a tough sell, no matter how beneficial it would be in the long run.

I'm just daydreaming, but I'm interested in people's comments. Has anybody heard of something like this being done?

Wednesday, March 24, 2010

Community Service Award

Facundo Batista and I received the 4th-quarter Python Software Foundation Community Service Awards!

I actually heard about it several days ago, and have been tongue-tied (keyboard-tied?) since then. I'm mostly seen in and around Ohio these days, but I grew up thoroughly Minnesotan. If you pay Minnesotans a really extravagant compliment, you'll send them into a kind of blushing panic. All of our ancestors who enjoyed the limelight were found and eaten by bears, you see, so we evolved a genetic terror of having attention called to us.

Anyway, this is one of the most flattering honors I've ever received. THANK you, PSF! I hope I'll always be one of the Python world's many valuable contributors.

Wednesday, March 03, 2010

cmd2 0.6.1

Many thanks to the audience at my PyCon cmd/cmd2 talk for your interest and enthusiasm! It was my first full-scale PyCon presentation and I absolutely loved it.

I need to follow up on three things I claimed in my talk:

1. "My presentation is already online at http://pypi.python.org/pypi/cmd2". FALSE (at the time I said it, and for several days afterward). I actually had posted the docs and edited the PyPI page to point to them, but forgot to update url in setup.py, so it overwrote the link when I registered cmd2's 0.6.0 release.

It's fixed now, though. The cmd2 PyPI page has a link to the cmd2 documentation, which in turn links to my talk slides. You can also watch the talk thanks to the fantastic PyCon video crew!

2. "A more stable version will be out within a couple weeks of PyCon." TRUE. 0.6.1 is not exactly stable stable, but I think I've smoothed out bugs that snuck in while I was pushing to release 0.6.0 for PyCon.

3. "sqlpython will be more presentable in a couple weeks, too." TRUE. The new sqlpython 1.7.1 brings the postgreSQL functionality (thanks Andy!) to pretty near 100% (except for the can't-see-other's-schemas problem, which should be fixed for 1.7.2.) I believe that MySQL should be fully functional, too, but that's very lightly tested because I barely use MySQL and don't know much about how to test it.

Tuesday, February 16, 2010

Computer Engineer Barbie

I'm happy about Computer Engineer Barbie. No doll will save the world, but every little bit helps.

It's annoying, though, that some people only see one more opportunity to trot out this classic:
def belittle(geek):
prejudice = "Well, then, she's not much of a {0}, is she?"
if geek.is_femme:
excuse = 'geek'
else:
excuse = 'woman'
return prejudice.format(excuse)

Wednesday, February 10, 2010

sqlpython 1.7 pre-release

First off: PyCon online registration ends TODAY. Go do it NOW.

I intend to show off sqlpython at PyCon. Version 1.7 works with postgreSQL and MySQL as well as Oracle. (In fact, a single sqlpython session can keep connections to all three types of databases open at once!)

1.7 isn't quite ready for PyPI yet; I've just posted an appeal for sqlpython testing, with instructions for getting the development version, to the sqlpython google group. If you'd like to take the new-and-improved sqlpython for a spin around your databases, I would hugely appreciate it. Anticipate a PyPI release just before PyCon, once the ugliest of the bugs are worked out.

See you in Atlanta!

Tuesday, February 02, 2010

Hey, Oracle!

You're scaring me!

In the last couple months, we've learned that the new Sun will be going forward without Frank Wierzbicki, the Jython project lead, and now without Ted Leung.

The Oracle Technology Network is working hard to foster dynamic language use with Oracle. It's got publications, PyCon sponsorship, resources, and so forth. OTN delights me.

I'm afraid, though, that the larger Oracle corporation doesn't share OTN's interest. Oracle's absorption of Sun is proceeding without any apparent interest in dynamic languages. Oracle is discarding some of the finest talent it could possibly acquire, people who could have helped bring on a real flowering of dynamic language use in Oracle environments.

I, for one, would have loved to see Jython harnessed on Oracle's many Java-based tools and even the JVM in the Oracle database - imagine the wonders Frank and Ted could have worked with that, had Oracle assigned them to! Instead... there will be nothing Oracle-related from them. Meanwhile, Microsoft funds development of several dynamic languages, including IronPython, which integrate to SQL Server through .NET.

I don't know. I just dread the thought that, five years from now, SQL Server will be the proprietary database of choice for any environment where dynamic languages are used... which will soon be most environments. Oracle, you really want to give this market away?

Wednesday, January 20, 2010

How to write a bad abstract

Ironically, the only talk that disappointed me at all at CodeMash was... mine. I thought my delivery was a little rough - pretty much because it's a really bad time of year for me to practice a talk.

I had a (great, attentive, but) smallish audience, too. One of the reasons was simple scheduling - there were some amazing talks opposite me. I was tempted to slip out and watch one myself! The biggest problem, though, was me. I wrote a bad title and abstract for the program guide.
reStructuredText: Plain Text Gets Superpowers
Technology/Platform: Python
Difficulty Level: Beginner

Abstract: Write a document, just once, in plain text. Enjoy all plain text's benefits - speed, simplicity, scriptability, version control. Now, from this single plain text source, automatically generate beautifully-formatted webpages, presentations, .PDFs, auto-indexed documentation trees, and more. It's time to quit slacking on documenting your software. reStructuredText will make you actually enjoy writing docs!
What's wrong with this? It's a nice narrative that fits together and builds to a nice little conclusion... but it's bad for a program guide.

I assumed attendees would read the whole abstract carefully. Then, when I got to CodeMash, what did I do to select sessions I would attend? I quickly scanned over the list of titles, and based on that, hastily read some of the abstracts. I forgot that geeks are pressed for time, especially at conferences!

There were three important messages for attendees to know to decide whether to come:

1. This is a talk about writing documentation
2. It is independent of what programming language you use
3. This talk provides a helpful tool (i.e., it's not just a preachy sermon)

You have to read all the way to the end of my abstract to get messages #1 and #3, and #2 is never communicated clearly at all. So, what would a good title and abstract have looked like?
Your Docs Won't Suck Anymore
Technology/Platform: Other *
Difficulty Level: Beginner

Abstract: No matter what programming language you write in, it's the English language that's killing you - your lack of good documentation is driving potential users away. reStructuredText is a technology and a family of tools that will make writing documentation easy, powerful, and satisfying. We'll introduce reStructuredText and get you started on writing beautiful documentation for any program or language.
* - "platform-independent" would have been the best choice for "Technology", but it wasn't in the dropdown. I worried that choosing "Other" would imply reST was implemented in Scala or something. I should have done it anyway, though, because most CodeMash attendees don't know Python and probably read "Python" as "not for me".

The take-home lesson here: when writing titles and abstracts, be very mindful of the divided and rushed attention of the typical geek. Don't be coy and save the good stuff for the fine print. Get your message across up front.

Monday, January 18, 2010

Fear is not a virtue

I know there have been a million news items like this, but this is the one that puts me over the edge.
SAN DIEGO — Students were evacuated from Millennial Tech Magnet Middle School in the Chollas View neighborhood Friday afternoon after an 11-year-old student brought a personal science project that he had been making at home to school, authorities said.

Maurice Luque, spokesman for the San Diego Fire-Rescue Department, said the student had been making the device in his home garage. A vice principal saw the student showing it to other students at school about 11:40 a.m. Friday and was concerned that it might be harmful, and San Diego police were notified.

The school, which has about 440 students in grades 6 to 8 and emphasizes technology skills, was initially put on lockdown while authorities responded.

Luque said the project was made of an empty half-liter Gatorade bottle with some wires and other electrical components attached. There was no substance inside.
...
Luque said the project was intended to be a type of motion-detector device.
...
Both the student and his parents were "very cooperative" with authorities, Luque said. He said fire officials also went to the student's home and checked the garage to make sure items there were neither harmful nor explosive.

"There was nothing hazardous at the house," Luque said.

The student will not be prosecuted, but authorities were recommending that he and his parents get counseling, the spokesman said. The student violated school policies, but there was no criminal intent, Luque said.

I finally understand Al-Qaeda's master plan, and it's freaking brilliant. Resenting American technological dominance, they have found a way to end it, convincing us to semi-criminalize technical curiosity and thus lobotomize our culture. I'm just surprised that we're choosing to participate in the plan. I thought we were on opposite sides?...

Is there a political movement or group I can join to fight this? Common-sense people grousing about how stupid each incident is is failing to hold back the tide. Something vaguely like the EFF but with a broader scope - because all science and technology is under attack now.

Fear is not patriotic. Fear is not a public service. Fear is not a virtue.

Sunday, January 17, 2010

MongoDB

Gloria Jacobs told me about MongoDB at PyOhio, but I was too busy conference-chairing to see her talk, and time has flown by. Her enthusiasm prompted me to see Mike Dirolf's MongoDB talk at CodeMash, though, and wow. Thanks, Gloria and Mike! I like it, I really like it!

My frustrating experience with BigTable had given me a "Bah, humbug!" attitude toward the NoSQL fad, but it really looks like MongoDB is the cure for that. It surrenders much less query capability than the other NoSQL contenders do. The simplest of those are useful only if you already have the key for your desired record in hand, and BigTable's limitations make it feel only moderately better to me. But MongoDB's query capabilities are really rich, good enough for many (though of course not all) real query needs.

Now, don't get me wrong; there are a *whole lot* of tasks for which an RDMBS is still very much the answer. When you need transactions, or child items that aren't tucked neatly under single parents, or complex queries - and how often do you really *know* that you'll never need complex queries? - it's safer to use an RDMBS.

I think that, when the database is an enduring construct, important in itself - when multiple applications may be written against it, and new applications yet unforeseen may appear in the future - then a good RDBMS is the only way to go. In such cases, it's just impossible to safely predict what you'll need to do with the data one day, so you need database software that can do virtually anything.

But when the database will play a supporting role to a single, well-defined application, and will not outlive the application. then a non-relational database could be very convenient, and MongoDB looks to me like a fantastic choice.

Let's call this Devlin's Doggy Directive of Databases:
If the application is the dog, and the database is the tail, consider a non-relational database.
If the database is the dog, and the application is the tail, stick with a relational database.
If you doubt that I'm qualified to go naming rules of thumb after myself, let me remind you that have ten years of relational database experience, a sparse smattering of non-relational experience along the way, and that my parents owned a boarding kennel when I was young.

CodeMash general recap

Believe the hype. CodeMash is all that. It's people from all over the region and beyond whose enthusiasm and intelligence is too much to stay channelled in one technology. There are consistent preferences - for agile methods, open-source code, etc. - and a majority user community - .NET - but it's full of people who know that cross-pollination and cross-training are where it's at.

The one problem is the same one that all big conferences have: the scheduled talk track is so rich that it's almost impossible to pull yourself away to the Open Spaces. As next year's planning begins, I'll agitate for a schedule that somehow makes some Open Space time that doesn't run parallel to sponsored talks; I actually think Open Spaces on the precompiler day (maybe as the entire content of the precompiler day) would be a great idea. Except that it's probably best to let the regular conference content prime the pump first... hmm...

Saturday, January 16, 2010

reStructuredText talk follow-up

Thanks to everybody who saw my reStructuredText talk at CodeMash 2010! My slides are at the end of catherinedevlin.pythoneers.com. Those who asked questions I couldn't answer - thank you! I'll be researching the ones I remember so that I can post on them; commenting or emailing me reminders of your questions - or new ones - would be much appreciated.

I had a great time at CodeMash; the organizers deserve a huge round of applause. I'll post more extensively with some of what I learned... after catching up on sleep.

Thursday, January 14, 2010

Codemash - day 0 (precompiler) report

A good start to CodeMash. I started with a session on the Ruby Koans, a very nice way of teaching; it tempts me to join the crew building a corresponding set of Python Koans. In fact, it would be really interesting to host Python Koans on Google App Engine... Hmm...

Next I went to Mary Poppendieck's session on leadership in software; alas, for me, it was as much frustrating as inspiring. She described techniques proven to produce good software consistently, and I see very few of them in use in the Air Force. Worse, the Air Force is driving hard to make the problem worse: centralizing, centralizing, centralizing - building up the separation between decisionmakers and IT professionals and IT users with thicker and thicker walls made of miles, layers of management, internal organziational boundaries, and government:contractor barriers. *sigh*

She did, however, make me realize that my employer - a small contractor that sends IT professionals in ones and twos to work on projects as our customers need - can do a lot more to improve skills among our employees. We could get together occasionally from our various customer sites to work together on our skills, or at least have a mailing list for technical chat among our employees.

But here's a question - from a purely selfish point of view, is this the right way to spend my energy? After all, there are already plenty of groups of professionals dedicated to mutual skill improvement. They're called user groups, and the time I spent on internal skill development could just as well be spent deepening my involvement in local user groups; the payoff may be bigger, because I'd be involved with a self-selecting group, with people who already believe it's worth going out of their way to hone their own skills and others'. User group members have an attitude, a hunger and thirst and personal committment to excellence, and trying to create that attitude among my company coworkers may be a lot less fruitful than taking advantage of people who alreay have it.

Your thoughts?

Anyway, today begins CodeMash in earnest, and I'm loving it. Most of all, I like meeting up with old friends and meeting new ones. Geeks - particularly geeks who are active in the user community - are just fun, interesting people to be around!

Tuesday, January 05, 2010

Thursday, December 10, 2009

microfinance gift

Cash is almost always the most practical gift you can get somebody. I have trouble not feeling that it's too crass, though. Here's one possible solution.

Microplace, my favorite microcredit site, recently introduced a Gift feature where you can give an investment to somebody else. You pay the money, it goes to the developing world as a loan, and the interest and eventual repayment go to your gift recipient. Everybody wins!

This makes the most sense when you know somebody will need the money more later than they do now; it's a nice way to put the money "in transit" to them - and it does some good on the way. For instance, my sister is facing a gap in her income for maternity leave this spring; I chose a gift that would mature then. It was a perfect solution! Future students are other obvious recipients. Seasonally employed people... people planning an upcoming major trip... etc.

(Incidentally, another great microfinance site is Kiva, and there's actually a Pythonistas' lending team.)

Wednesday, December 02, 2009

Windows vs. Linux for Oracle

I found myself fielding a "Windows vs. Linux for Oracle" question on StackOverflow, and realized that my answer was detailed enough to deserve a blog entry... my humble contribution to the great war. (I know most experienced Oracle DBAs are chuckling, because "Which OS is best?" is more likely to make them think "Linux or commercial UNIX?")

Note that I'm speaking here of my preference strictly for Oracle-hosting purposes, and that everything I say about "Linux" really applies to all POSIX-based systems (like Solaris, which I started on as a DBA).

I've used Oracle on Windows and Linux for many years, and on Solaris many years ago. I prefer Linux because:

1. Oracle releases patches, new versions, and sometimes security updates for Linux significantly before they are available for Windows - there's usually about a two month lag for Windows (one month for Critical Patch Updates).
2. Our Windows servers have crashed or locked up occasionally, and very frequently require reboots for patch installation. Oracle itself stays up very nicely, but Oracle can't keep running on a machine that is down. This hasn't been a problem for me on Linux.
3. Oracle's interaction with Vista's User Access Control is a nightmare. I'm constantly finding that the dedicated Oracle user account, which was used to install Oracle, nonetheless lacks permission to edit or even see Oracle-generated files - like newly generated logfiles. It could be that I'm making some mistake, but permissions shouldn't be confusing; and on Linux, they aren't. (Most servers don't run Vista, but I'm afraid of what this forebodes for future versions of Windows Server.)
4. Thanks to the Windows Registry, cleanly removing an installation of Oracle from Windows is tricky and tedious. The Oracle Installer has gotten better at this since version 10g, though.
5. Better tools. Linux find is infinitely better than any native Windows search tool. It can take you minutes on Windows to track down what Linux which tells you in an instant. Also, Oracle uses and generates plenty of plain-text files, and Linux comes with better tools for handling text files - good text editors (unlike Notepad), shell commands like head, tail, grep, etc. You can try to catch Windows up by installing Geanie, Cygwin, Google Desktop, etc. on a Windows machine, but it's better not to have to (especially since Cygwin installation is not completely newbie-friendly).

I can only think of two Windows advantages over Linux:

1. In Oracle's command-line tools like sqlplus, rman, etc., you can scroll through and re-run past commands using the up- and down- arrow keys - but only on Windows. You can fix this on Linux by installing rlwrap and always invoking the Oracle tools under rlwrap: rlwrap sqlplus me@myinstance
2. Quest's TOAD is only available for Windows, and it is an infamously useful tool. It doesn't need to be on the database server, though, just on a machine that can connect to the database. Also, Oracle's free sqldeveloper is one among several viable alternatives; it will probably never catch up to TOAD completely, but it's good for the bulk of what most people use TOAD for.

In general, however, I should emphasis that Oracle's ancient boast of running on everything really is true. As a DBA, I prefer Linux for the reasons listed above, but to my database users, it's absolutely irrelevant (downtime aside). I could move my production databases to a different OS overnight, and tomorrow, my users would have no idea that there had been a change.