Fazal Majid's low-intensity blog

Sporadic pontification

Fazal Fazal

Debugging DCOracle2 applications

DCOracle2 is the Oracle interface module for Python I use most often. It is advertised as “beta”, but quite suitable for production use, aside from a few minor rough edges. There are a few others, most notably cx_oracle, but I can’t vouch for them.

Debugging applications that make use of DCOracle2 can be challenging, as with any database environment, specially in a multi-threaded server context. I have developed a small utility module to aid in development. When it is imported, it will automatically trace all database calls made through DCOracle2, including arguments such as bind variables. More interestingly, it will also automatically run EXPLAIN PLAN on queries taking longer than 2 seconds (by default), to aid in tuning SQL statements. As a side bonus, if run by itself, it provides a (very basic) SQL shell that does offer command-line history and editing, something Oracle hasn’t managed to provide in SQL*Plus in almost 30 years 🙂

This code works with Python 2.2 and DCOracle2 1.1 and 1.3 beta. It will not work with 2.1 and earlier.

The latest version of the module file can be downloaded here: debug_ora.py, as well as the RCS repository debug_ora.py,vfor those who care about this kind of stuff.

An example run of the module:

% python debug_ora.py scott/tiger@repos
SQL> select ename, job, dname from emp, dept where emp.deptno=dept.deptno;
SQL: Oct-03-2003 17:32:39:897
select ename, job, dname from emp, dept where emp.deptno=dept.deptno
ARG: () {}
SQL: !!!!!!!!!!!!!!!! slow query, time = 0.0 sec
SQL: !!!!!!!!!!!!!!!! execution plan follows
000      SELECT STATEMENT Optimizer=CHOOSE
001        NESTED LOOPS
002 001      TABLE ACCESS (FULL) ON EMP
003 001      TABLE ACCESS (BY INDEX ROWID) ON DEPT
004 003        INDEX (UNIQUE SCAN) ON PK_DEPT

ENAME  JOB       DNAME
------ --------- ----------
SMITH  CLERK     RESEARCH
ALLEN  SALESMAN  SALES
WARD   SALESMAN  SALES
JONES  MANAGER   RESEARCH
MARTIN SALESMAN  SALES
BLAKE  MANAGER   SALES
CLARK  MANAGER   ACCOUNTING
SCOTT  ANALYST   RESEARCH
KING   PRESIDENT ACCOUNTING
TURNER SALESMAN  SALES
ADAMS  CLERK     RESEARCH
JAMES  CLERK     SALES
FORD   ANALYST   RESEARCH
MILLER CLERK     ACCOUNTING
SQL>

Inkjet printers revisited

In a recent post, I railed at the Inkjet racket. Lest I be perceived as doctrinaire, I do believe there are some good reasons to use inkjet printers, just that price is not one of them.

Here are the cases where I think an inkjet printer is preferable to Fuji Frontier or Noritsu prints on Fuji Crystal Archive paper:

Speed

There is no question sometimes speed matters, and the convenience is worth the price, specially if only proofs are required.

Black & white photography

Printing black and white photos on color materials usually leads to subtle, but discernible color shifts. Although Ilford makes a paper designed specifically for use in digital enlargers like the Lightjet, very few labs offer true B&W digital photo prints, the only one I know of is Reed Digital, using Kodak Portra BW RC paper. RC papers are not archival in any case.

Inkjet printers modified to use the PiezographyBW system can yield black and white photos that match or even exceed the quality of gelatin silver prints. If they use carbon pigment inks, they will be at least as archival (the carbon photographic printing technique is quite ancient and is considered one of the highest forms of photographic printing art, along with platinum printing).

More recently, Hewlett-Packard has introduced the No. 59 photo gray print cartridge for use with its Photosmart 7960 printer. This is a well-supported solution, unlike the finicky Piezography process, but unfortunately, it requires the swellable-polymer HP Premium Plus Photo paper to give decent durability, and is limited to Letter/A4 size. The drying time on swellable polymer paper ranges from a few hours to a day, taking away the immediacy of inkjet prints.

I compared prints made on Ilford Multigrade IV fiber base (baryta) B&W paper, Agfa Multicontrast Premium (resin-coated) B&W paper, Fuji Crystal Archive on a Lightjet, and the HP 7960 on both the glossy and matte HP Premium Plus Photo papers. The prints were compared under daylight conditions (overcast sky), under an incandescent (tungsten) light bulb, and under a compact fluorescent lamp. The results are summarized in the table below.

Color casts

Print paper used

Daylight

Tungsten

Fluorescent

Ilford MGIV FB

Neutral

Neutral

Neutral

Agfa RC

Slightly warm

Slightly warm

Neutral

Fuji Crystal Archive

Slightly blue

Neutral

Slightly purple

HP Premium Plus Photo

Strong Blue

Slight purple

Strong purple

The HP prints give better highlight detail than the Fuji, but fall short of the Agfa. The HP solution is not the silver bullet B&W aficionados were waiting for.

Update (2004-01-22):

The color cast seems to be an issue when the printer is new. After a few weeks of use, the ink cartridge “settles down” and seems far more neutral, better than the Lightjet print. It is not clear whether (1) this problem will reoccur with every new No. 59 cartridge, (2) or whether it was a defect in the cartridge I have, (3) or whether it only happens the first few days after a printer is put in service. As HP cartridges include the print head, I suspect it is option 1 or 2. This would increase the cost of the prints further by increasing waste, but the good news is, the grayscale output from the printer is competitive with the darkroom given the superior level of control you get from Photoshop, and this is the first mass-market printer that can really make this claim.

Matte prints

Unlike fiber papers, RC papers seldom have true matte finishes. The so-called “lustre” finish is in reality a process in which the surface of the paper is calendared (pressed by textured rollers) to imprint a pebble-grained finish, which is a mere ersatz of real matte photo paper. As this is not a microscopic finish, it diffuses light unevenly and when seen at an angle, the print is washed out by the reflections from the textured surface.

A printer like the Epson Stylus Photo 2100/2200 using pigmented inks can make durable and almost painterly prints on fine watercolor papers from the likes of Hahnemühle or Crane’s. Many fine art photographers favor this printer for that very reason.

Digital Photo Pro magazine

I picked up a photo magazine at my local Barnes & Noble today. Only afterwards did I realize it is their first issue.

The racks are overcrowded with me-too publication bearing funky names like e-Digit@l Photo-zine. They almost invariably serve the same mixture of fawning (yet superficial) product reviews and tutorials that manage to be even more obscure than the poorly translated manuals whose shortcomings they are supposed to address. As if anybody will wait three months for reviews of a camera that is probably already discontinued by the time they reach print, rather than getting them from places like DPReview… Even an old standby like Popular Photography had to re-brand by adding the seemingly obligatory “& Imaging” to its masthead. Magazine publishing is a cutthroat business, and no doubt consolidation will drive most of the dross out. Eventually.

Digital Photo Pro is a refreshing exception to this sad state of affairs. Interestingly, it is published from Los Angeles, not New York, the publishing capital of the USA. The first issue has decent technical content, that would not be out of place in specialized websites like Photo.net. It also has more creative features like a lengthy interview of Jay Maisel. In a way, it is reminiscent of American Photo magazine, but the feature articles are longer and the product reviews cover interesting products rather than every ho-hum digicam around.

The only false note is the presence of two “advertorials” by Minolta, one for flashmeters, one for scanners. I can understand the harsh realities of the publishing business, but sections like those, even when labeled properly as is the case, do not contribute to a magazine’s credibility.

We will have to see if the magazine can sustain the relatively good quality of the first issue, or if it will run out of steam, but the subscription fee is small enough ($15 for 6 issues) to make the risk limited. And we do want to help quality publications drive out the junk, don’t we?

The Ghola asset management program

I am now using Kavasoft Shoebox and thus this whole entry is obsolete and kept only for historical purposes. It is interesting to see one of my requirements anticipated Aperture’s stacks.

Introduction

I am in the process of migrating from Windows to Mac OS X as my primary home computing environment. IMatch is one of the key applications I need to migrate, but it is not available on the Mac. Ghola is an attempt to reproduce the key functionality of IMatch, and possibly go beyond. It is also a good way to learn Cocoa programming (my last programming experience on the Mac goes back to Think C 4.0 accessing raw QuickDraw calls).

Use cases

  1. Assign categories to images or a folder of images.
  2. Search for images matchin an expression of categories.
  3. Restructure a category (e.g. splitting a category grown too large into multiple, more manageable subcategories).

Requirements (incomplete)

The following are the key features from IMatch that need to be carried over:

  • The flexible set-oriented category system.

  • Support for RAW images (CRW and NEF).

  • Fast retrieval performance.

  • Extensible metadata.

  • Offline media support.

The following are the requirements for Ghola beyond IMatch:

  • Ability to group very similar variants of an image together. This would allow to group an image original, retouched versions, cropped and resized versions, or multiple very similar images taken in succession, yet manage them as a single logical unit. The role of each image in the group would be identified as well as part of its group membership, and each group would have a leader used by default.

  • Manage assets beyond images, such as PDF files.

  • Highly efficient categorization user interface.

  • Scriptable in Python.

  • HTML gallery generation, integrated with Mylos.

Implementation directions

The system core will be implemented in Python, and C if necessary. It should be as portable as possible. Possibly even multi-user and remotable.

SQLite will be used as the core database. Fast, simple, easy to manage.

GUI front-ends will use the native toolkits (PyObjC) whenever possible for optimal user experience and Aqua compliance.

A command-line UI could be more efficient for category assignment, if it is augmented with features like completion.

We may have to use bitmap indexes for efficient category indexing. Boolean operations on Python long integers are surprisingly fast, and C might not be needed at this point.

Colophon

The System name is a reference to Frank Herbert’s Dune (the original series, of course, not the opportunistic add-ons by Brian Herbert. It has the nice side benefit of not being already used by another open-source program.

Archival photography

Henry Wilhelm is a well-known authority on preserving photographs. He pretty much wrote the book on the subject, and it is now downloadable for free in PDF format from his website.

In a nutshell:

  • No widespread color process is really archival, unlike black & white
  • Fuji good, Kodak bad

Wilhelm has contributed greatly to making photographs last by raising the public’s awareness of conservation issues, at a time when manufacturers like Kodak were engaging in deliberately deceptive marketing implying that color prints would “last forever”, when they knew the prints would not exceed 10 to 15 years (Fuji has put far more effort in making their materials last).

That said, his simulated aging testing methodology has been criticized as too optimistic, and in one embarrassing instance, Epson Stylus Photo 2000 inkjet photo papers he highly rated for their durability turned out to be very short-lived because they were very sensitive to very common ozone pollution. For an alternative, more conservative, take on inkjet print longevity, Stephen Livick’s website offers a valuable counterpoint.

My take on the subject: I almost exclusively use black & white film because it has a distinct character and is archival without special equipment or active attention. Color film relies on dyes (that fade over time) rather than silver, and fades quickly or suffers from weird color shifts even when kept in the dark. The exception is Kodachrome, which keeps a very long time in the dark despite being also dye-based, but Kodak is not enthusiastic in supporting it and its future availability is uncertain. Given that, it makes more sense to use digital, which has more than caught up in quality, and at least has the potential for lasting images if managed properly (a big if: imagine you were to disappear tomorrow, would your heirs know how to retrieve your digital photos from your computer?).

And of course, I boycott Kodak, a company ruled by bean-counting MBAs whose only concern seems to be how to cut corners in silver content at the expense of product quality, much like Detroit automakers behaved before American consumers wised up to the shoddy quality of their products. Then again, Kodak’s current management is stacked with former HP executives who are turning the company into a HP-wannabe, thus predictably accelerating its slide into irrelevance.