Archive | Python

The object-oriented scripting language

Notes from PySIG, 24-May-2007: Python logging and wxPython

Thirteen participants made it to the May meeting of the Python Special Interest Group of the Greater New Hampshire Linux User Group, held as usual on the fourth Thursday of the month at 7 PM at the Amoskeag Business Incubator, Manchester, NH.

It was a busy meeting. A quick round of introductions and announcements was followed by several terrific presentations.

Kent Johnson entertained us with Kent’s Korner, this month featuring the logging module. Simple logging can be implemented in two lines of code and customized with a third, but the module can be expanded almost infinitely to include multiple handlers arranged in a hierarchical fashion with different levels of filtering and multiple output. As usual, Kent did a fine job of showing simple examples and clearly building on them.

Bill Sconce decided to defer his second attempt at describing a hierarchy of data types, a discussion sure to rouse an interesting and educational debate amongst the participants. Stay tuned for a future meeting…

Ric Werme made the main presentation on wxPython. He brought the most extensive handouts we’ve had today, with an engaging backstory of his several-decades tinkering with graphing and the Petals of the Rose patterns. The demo was arresting, and source code can be downloaded here and here. Ric walked us through the wxPython wrapper, explaining the various widgets used and spoke well of the new wxPython book.

Thanks to Ric and Kent for their presentations, to Bill Sconce and Alex Hewitt for arranging the meeting and facilities, to the Amoskeag Business Incubator for their hospitality and to all who attended for their participation!

MonadLUG notes, 10-May-2007, dd and Seth Cohn, Drupal

Ten attendees made it to the May meeting of the Monadnock Valley Linux User Group, held as usual on the second Thursday of the month at the School Administrative Unit #1 offices, Hancock Road, Peterborough.

Bill Freeman presented his thoughts on the Man Page of the Month: dd. Bill provided two pages of notes. Quite the discussion followed obscure and useful things dd could do, such as preserve floppy drive images for posterity, copy music CDs to images for subsequent loopback mount and playing, copy and restore bootblock records and of course read and write tapes.

Seth Cohn was the featured speaker of the night and spoke on Drupal, the content management system. Seth has screenshots of a surprising number and variety of sites that are running on Drupal, presented a bit of Drupal history – seems it’s been around for a long time, and had a fairly stable history – and its current state, with fairly large and active communities of developers and implementors. He covered a bit of the architecture and philosophy of the modular design of Drupal and did the fairly painless install and initial configuration. 9 PM came too soon as there was lots more to see.

Thanks to Seth for presentation, to Bill for MPoM, to Charlie for organizing the meeting and to all for attending and participating.

PySIG Notes, 26 April 2007

Thirteen attendees made it to the April meeting of the Python Special Interest Group, held as usual at the Amoskeag Business Incubator, Commercial Street, Manchester, NH on the fourth Thursday of the month at 7 PM.

Bill Sconce lead off the meeting with a printed agenda and a round of introductions. Several new people were welcomed to the group; a range of levels of experience with computers and specifically Python made for a good mixed crowd.

Martin LeDoux showed off homemade bookbinding of the Python tutorial. Using an HP laser and Adobe Acrobat, Martin printed duplex 2-up folded, cut, glued and bound a pretty handy homemade book. Very cool.

Shawn K. O’Shea showed off the tarfile module which allows creation, querying, extraction and manipulation of tar files (with gz or bz2 compression) from within Python. This can be a real handy way to create cross-platform installable packages that would run on OS X, Linux or Windows.

Shawn also mentioned that there was a Google API for the Google Calendar with examples in Python scripting. Someone asked what that might be used for, and I offered the LUG coordinator Nag-O-Matic as a great example of using automation with calendars.

Bill attempted an introduction to Python datatypes by creating a hierarchy from primitive to complex objects. Kent had an objection to the terminology, and countered with chapter 3 of the _library_ reference (not chapter 3 of the Python reference which Bill was using) and a vigorous discussion ensued. That’s the point of the meeting, after all. And it’s far less likely to erupt into a flamewar in person. All sides had some good points, examples and counterexamples, and most of us learned more about Python internals. Good stuff.

Kent started Kent’s Korner 4: Iterators and Generators at 9 PM, when the milk and cookies were starting to kick in, The crowd was a bit more subdued, having spent their energy harassing Bill (and heckling Ben, in abstentia). Iterators went quite quickly. Generators woke the crowd up. Bill Sconce came up with a great example of greenbar color code generator, where the boss decides there should be two reds, three greens, alternating and repeating, though he may change his mind once he sees it. Off-script, Kent took off with this example, and followed it with a discussion of parameter passing to a generator.

Kent really has a gift for shedding light on these sometimes obuse topics; his examples really helped make the functionality clear, and working through the real-world example proposed at the meeting gave us all some idea of what was involved.

Kent also mentioned that he’s using IPython (note the capitalization; guess it’s not an Apple product!) an improved interactive shell.

Meeting called at 9:44. Wow. Long meeting, but a very productive one. One of the attendees wrote to me this morning that he went home and altered some of his scripts based on what he learned at the meeting. No greater praise could we ask for.

Thanks to Bill Sconce for running the meeting, the Amoskeag Business Incubator for the facilities, Alex Hewitt for wrestling with the network, to Martin, Shawn and Kent for presenting, and to all for attending and participating.

Next meeting May 24th, topic TBA.

Postscript: Like the previous meetings, we saw examples running in Python on OS X, Windows (VMWare on the Mac, I think) and Linux. It Just Works.

Life After VFP

Robert Jennings posts Yet “Another Life After VFP Thread.” For those not following VFP closely, MS recently announced a confirmation of earlier news that there were no plans for a VFP version 10, and that the VFP scripts in the project known as Sedna would be released under some sort of public license. Poor communications lead to media and Slashdot reports that VFP was to be Open Sourced, sadly not the case.

Robert does a good job of outlining the huge cost in moving a vertical-niche application into another development environment, language and runtime. Most sophisticated specialty applications have person-years of investment built into them, knowledge not easily extracted, transferred or translated to any new environment. Regardless of whether that new environment is Dot Net, Dabo, LAMP, Python or Visual Fred, there will be a huge cost and risk with any enterprise making this switch.

Unlike the Open Source world, when a vendor choses to discontinue a product, developers have little choice but to move along. While many folks point out the upside that the product will likely run for years to come, and a lack of Microsoft official support doesn’t instantly obsolete a product (DOS apps can still be found, after all), there is an immediate slowdown in the custom software market, and a longer-term turning away from the product by customers. Large-scale vertical products have to be operating with 5- and 10-year plans for reinvestment and changes in direction, to ensure they can fund “The Next Big Thing” while continuing to deliver good value to their customers today and tomorrow.

This is not a death knell for the product. The writing has been on the wall for years. But developers with large applications have to be looking around for a new platform.

FoxPro developers always viewed themselves with a bit of “Battlestar Galactica” mythology: a rag-tag crew of self-taught developers from the PC Revolution, they survived the dBASE wars and the implosion of Ashton-Tate. Working under a cruel master who never promoted their product, they persevered. MS’ internal team developing VFP did amazing things on a shoestring budget, introducing a fairly smooth transition from procedural to object-oriented, from developer-guided to event-driven interfaces, from characters to pixels, from local ISAM to RDBMS. The VFP IDE was a remarkable environment in which to develop rich-client, component-based, web-driven or even server-based applications. I will miss it, and look forward to becoming as skilled at my next platform.

PySIG, 22-March-2007: Project Night

An even dozen people showed up for the Python Special Interest Groups March meeting, held as usual at the Amoskeag Business Incubator in Manchester, NH.

Bill Sconce called us to order promptly at 7 PM and we proceeded through the printed agenda. It was duly noted the Ben Scott deserved heckling despite his absence. We ran through announcements of a couple of upcoming meetings, plugging the MythTV installfest beta and pointing out Jarod’s book. We mentioned meetings upcoming for the LUGs, including ZFS at DLSLUG, LVM at CentraLUG and the new Ruby group.

Kent’s Korner: Kent S. Johnson presented his month talk, this month on list comprehensions. Kent had a great handout, and has collected his past couple of handouts in one place. Starting with simple examples and building in complexity, Kent lead us through what can be an intimidating topic in a way most couple follow. Some great discussions, on-topic and off-, regarding assignment and Python idioms, always make this a fun part of the meeting.

There was some discussion of Python 3000 and its expected schedule. Bill Sconce had a video of Guido practicing his Py3K presentation in front of an audience at Google, which he went on to present at PyCon.

For the Gotcha of the month, Bill Freeman offered up an “Un-Gotcha:” a=b=4 works, but not for the reason you might think. Assignments of this style in C have a different underlying meaning, and perhaps in some circumstances, different side effects. A key to understanding the single = assignment in Python is to understand that it is a STATEMENT. There is no value associated with the statement and “chained” assignments in Python like the above are specially-coded as an exception case. This lead to yet another great discussion.

Ric Werme showed off the web pages that result from his Python software that collects and forwards weather data from his weather station. His current conditions page, http://home.comcast.net/~ewerme/wx/current.html has links to everything else. Ric bought the weather station in part to have an excuse to write more Python code, and his current code runs the gamut from implementing the weather station protocol through pyserial.py and the serial port to CGI scripts that take data requests, fetches the data from MySQL, creates gnuplot data files that create .gif files, and returns a HTML page to display the results. His description of the software is at http://werme.8m.net/wx/vantage_software.html .

Ric also demonstrated a Python cgi script for collecting data for a weather observers group that Todd Gross created while he was WHDH. It’s customizable, so people can create a form preloaded with their location that offer just the data they collect, and the submission code adds it to a MySQL database and recreates a web page of members reports over the previous day.

Shawn O’Shea showed off Python running in the Win32 and COM environments. Shawn does a lot of work administering and automating Windows configurations, and the COM set of interfaces can allow a lot of internal manipulation of the major applications, a big step up from the VBScripts supplied by Microsoft with some of the tools. Shawn demonstrated the canonical Hello, World with Microsoft Word, but then dug into a couple more concrete and practical examples with querying the Registry and spelunking in the IIS metabase.

Lots of interesting stuff coming up at future meetings: Martin Ledoux offered to show something on the work he’s done with amateur book-binding with pytut/pyref books. Kent has promised an update soon on his real-life experiences with Django. Ray Côté may be able to show off the new web site he used as an excuse to miss the meeting. And I’ll bet Bill will wheedle some more cookies from Janet.

Thanks to Bill Sconce for organizing, Alex Hewitt for getting the networking working, the Amoskeag Business Incubator for providing the great facilities, Janet for the awesome cookies, Kent for his great Korner, Bill Freeman for the csv module and those strange blinking white blocks, Ric Werme for demoing his weather projects, Shawn for the Win32-COM-Automation and everyone for attending and participating.

P.S. Anyone got python running on a WRT54G?

P.P.S. Tom Mosco mentioned to me that the Chicago Python group had a very long presentation on Django by the creators and also a Ruby on Rails presentation by its author. Videos can be found at here and here

Blog, the first five years…

… ended yesterday, and today I start the sixth year of blogging. The first year was blogging on the Perl-based TWiki software, 2003 through 2006 on Radio Userland. This year, I’m using WordPress, on a self-hosting Linux-Apache-MySQL-PHP platform. Wonder what I’ll be running in another five years? It’s been a blast, and I hope it continues to be. Primarily, my blog is my voice online: notes of places I’ve found and want to share (or publicly bookmark so I can find them again), news to pass on, or events on which I comment. Thanks for reading.

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.