Thursday, November 29, 2007

Capturing shell output in Python

I need to capture the terminal text returned after I run some shell commands to create SVN repos. Unfortunately, os.system() doesn't capture the text, just the numeric value. Fortunately, Python has the command library. So now I can do this:

>>> import commands
>>> print(commands.getstatusoutput('ls -l'))
(0, 'total 0\ndrwxr-xr-x    9 dgreenfe  dgreenfe  306 Nov 28 19:02 bar\ndrwxr-xr-x   11 dgreenfe  dgreenfe  374 Nov 28 19:02 baz\ndrwxr-xr-x    9 dgreenfe  dgreenfe  306 Nov 28 19:00 foo\ndrwxr-xr-x   25 dgreenfe  dgreenfe  850 Nov 27 12:33 svn_bo11282007\ndrwxr-xr-x    9 dgreenfe  dgreenfe  306 Nov 29 10:37 tsvn1\ndrwxr-xr-x    9 dgreenfe  dgreenfe  306 Nov 29 10:46 tsvn2')

Monday, November 26, 2007

How fast can I convert a Zope 3 app to Grok?

Figured it would be quick and easy to make a conversion. I'm still new with both frameworks, but since Grok is built doing DRY and KISS and various Ruby/Django-isms, this should be pretty easy.

The application in question is a Zope 3 Captcha server that I wrote. It served as my learning box for doing Zope 3 and got me past most of the Zope 3 hump.

Complexity added to Plone 3

Mikko Ohtamaa raises some good points about the problems with adding viewlets in Plone 3. It is too complex. Design patterns are good, but they can capture your focus and make you do lots more work than you need, and not just necessarily up front.

Friday, November 23, 2007

Playing with Django

I've been playing with Django over the past few days. I'm not going to compare it to Plone or Zope. But I will happily compare it to Pylons. Ready?

Django is easier than Pylons.

There. That sums it up.

Easy, intuitive, and fun.

Thursday, November 22, 2007

Happy Thanksgiving!

I'm thankful for:

  • My wife and son
  • My students
  • Everyone who helped out when my bike got stolen
  • Only two minor injuries this year
  • My friends
  • My family
  • My crazy coworkers
  • The trip to Italy
  • My NASA customer
  • Python
  • The Plone and Zope communities
  • Good training partners
  • Good teachers

Tuesday, November 20, 2007

RIA arguments

I don't like to work in RIAs. Why reinvent the web when we have AJAX?

That said, I have a bit of respect for what Adobe has done with Flex and little respect for OpenLazlo, Silverlight, or JavaFx.

Anyway, someone I know is a huge OpenLazlo fan. I think they are mistaken to be entranced by OpenLazlo. Flex does all that OpenLazlo does, does it better, and does it for the same cost (free). Furthermore, the chart here shows just what the job market is for OpenLazlo, Flex, and other RIAs:

http://blogs.msdn.com/rohant/archive/2007/11/19/so-how-safe-is-your-bet-on-silverlight-wpf-and-net-3-0.aspx

Friday, November 16, 2007

Need to get into the habit of using Python sets

Periodically I have use cases where I want lists with unique values. And I so often write logic to do it on my own. You know, things like if 'hello' not in mylist: do x(). Well, I need to stop doing that and remember to use sets.