Friday, December 29, 2006

Nasty Apple Mail Bug

Update, 3 January 2007: Apple knew about this and had it filed under Bug ID# 3725615.

Setting the "Image Size" for a Mail attachment in a Mail compose window can modify the file names of non-image attachments.

Steps to Reproduce:
1. Start Mail
2. Open a New Message window
3. Attach a PDF file
4. Attach a JPEG image
5. Select the "Image Size" select widget in the lower right of the compose window and change the setting to "small" or "medium".
6. Observe that the PDF attachment's filename has changed to '.jpg' instead of the correct value of '.pdf'.

Expected Results:
Changing the image appearance in a mail message should only impact image attachments. Further, no filenames should be changed when changing the image size since that action should only change the message view, not the underlying content.

Actual Results:
The filename of the PDF attachment was changed, although the MIME type was not. The changed filename promulgated to the sent message.

Tested on Mail serision 2.1 (752/752.2) and 2.1.1 (752.3). The problem exists on both versions.

Wednesday, December 27, 2006

Wall Building

This should sound immediately familiar to anyone living around Washington, DC, this year:

"Court intriques intensified, leading to a near total paralysis of policy. Frontier policy became a political football passed between court factions, each mouthing angry patriotic platitudes, each vying to win favour with unpredictable emperors who sat, cloistered in the Forbidden City, angrily nuturing a futile sense of superiority over the foriegners snapping at the frontier.

Against this backdrop of racist arrogance, military incompetence and murderous factionalism, only one course of action was beginning to look both defensively viable and psychologically satisfying: wall-building."1

The year was 1457 and the place was Ming China. These days we build our own walls. Sadly, they are likely to do us as much good as they did the Ming. That is, of course, none at all.

1. Juia Lovell, The Great Wall; China Against the World 1000 B.C. - A.D. 2000, Grove Press, New York, 2006, pp. 201

Tuesday, December 26, 2006

The Tiniest Terrorist

On Tuesday, 19 December, I found myself traveling again, this time to Florida to visit with my parents and in-laws. We flew from Washington Dulles. Pre-holiday traffic was light. One quarter of the seats on the plane were unoccupied - the first time I have seen that in years.

B and I were traveling with our six-year-old daughter. Our son was staying with a friend for the short trip to avoid missing his school Solstice festival. We grabbed some lunch at a terminal burrito stand (err, a burrito stand in the terminal - one must be careful with ordering adjectives) while waiting to board. An unexpected movement caught our eyes. An electric cart belonging to the airport police zipped across the terminal at high speed with a three-year-old boy at the helm and a frantic mother giving chase.

The cart smashed into a row of chairs and took out a brochure stand at about fifteen miles per hour. People scattered left, right and over. The row of chairs - connected as they are in groups of four - broke, bent and slid into the next row, trapping two elderly ladies in their seats.

The recalcitrant cop finally arrived on the scene. He gawked and proceeded to do, umm, nothing. A crowd gathered instantly. Not one of them attempted to help the trapped women.

Now, I get on a soap box about this. Nothing, and I mean nothing, provides me with such burning, passionate feelings of disdain than a gawking, ineffectual crowd in times of crisis. I stand appalled at the ineptitude of my fellow humans, rubber neckers all. You would think that in the post-9/11 United States, in a major international airport, with multiple military and TSA personnel passing by, with a policeman present on the scene that someone in charge would be able to right such a minor situation immediately. Sadly, it is not so.

I rendered first aid and directed the moribund cop to call for paramedics. My wife took the mother and child in hand and calmed them down. The lady in the line of transit had a patella the size of a grapefruit in the thirty seconds it had taken me to reach her. Not good. Her leg was largely purple and almost assuredly broken. The other woman had a minor abrasion. I turned to a uniformed airport service worker and directed him to go to the restaurant and get some ice. "Ice?", he looked at me. "Who the hell are you?" The idiot! I gave him The Look. The Navy gave me The Look and I passed it on in turn. "I'm a medic. Get the damn ice.". He did. Lucky for him.

A doctor showed up on the scene about the time I had palpated and elevated their legs and cleared most of the debris. That cart hit hard. It sheared two metal uprights holding the back of a chair clean off. Each was about 40 by 5 millimeters of steel in cross section. The chair seats were steel and of similar thickness. They were just plates, covered with foam padding. One of those plates had rammed edge on straight into the tibia of the lady, just below the knee. Ouch!

We got the ice on both women. When I requested that the airport worker look for some towels, either paper or cloth, to put under the ice, he replied, "Oh, now you are really pushing it." I was too busy to kill him, so I found some myself. The doc was young and probably an intern. He had never treated anyone outside of a hospital. He hesitated when the women wanted to board their aircraft and left it to me to recommend that the shouldn't and to explain why. Then he agreed. The injured one was clearly in shock and not thinking straight yet. She was clearly distraught to think that she would miss Christmas with her family. We got both of them some water.

The paramedics finally arrived. I gave them the brief and turned it over to them. Then I did the only thing left to do - I faded into the crowd and went to my own gate with my family. To hang around was to be part of the lawsuit for the next six months of my life. The airport staff, from the cop who left the cart on and unattended to the bozo who topped out his skills getting ice, were clearly negligant. I didn't have anything to say to their lawyers that would help them any.

An airport staffer went looking for me later. I had my coat on, my glasses off and my phone in an ear. My wife waved him away and refused to speak English. He went away and we boarded our flight. I have no time for organizations who only get efficient when it becomes clear that they are guilty and about to be sued. I hope that old lady's retirement account gets a nice boost. She deserves it. Throughout the entire ordeal, she was polite, orderly and competant, in spite of being in a great deal of pain.

Can you imagine the chaos that would ensue if a terrorist hit such a facility? These people couldn't handle an errant three-year-old!

Monday, December 11, 2006

The Little Penguins of Phillip Island

I had the privilege of seeing one of nature's wonders first hand yesterday. So many people travel by air on Fridays and Saturdays that I was able to save US$600 by flying on a Sunday, thus giving me an unexpected Saturday in Melbourne. Tourist brochures offered a variety of trips into the Victorian countryside and I chose the nightly "Penguin Parade" on Phillip Island. Andrae decided to accompany me. I was excited at the prospect of seeing the world's smallest penguin species in the wild. The little penguins (Eudyptula minor) are called just that. They were once called fairy penguins in Australia, but use of that name is passing.

Phillip Island is two hours by bus from downtown Melbourne, East and South through former horse country turned into new suburbs. The bus picked us up at my hotel at 4:30 PM, circled through the city's other large hotels and stopped at the tour office for 15 minutes. Andrae and I did the natural thing for geeks; we spent 14 minutes at a nearby bookshop. Andrae spent most of the trip out reading my copy of Patrick Cleary's The Myth of Nations; The Medieval Origins of Europe while I got stuck into Terry Pratchett's hilarious and insightful Thud.

The island is dominated by human activity. A four-lane pylon-and-arch bridge traverses the bay and leads to an economy split by agriculture and tourism. Residents grow wheat and grapes, raise horses and cattle, mine sand, operate caravan parks and services businesses and do a bit of commercial fishing. The Penguin Parade used to ring the island's coast nightly before the coming of humans, but the twentieth century saw so much habitat destruction and interference with breeding and brooding that only a single colony at Summerland Peninsula remained by the 1980s. That colony was saved by the concerted efforts of the Penguin Parade staff and a bit of entrepreneurial eco-tourism. They even used tourism money to purchase land from an adjoining housing development to extend the reserve land. The population is slowly increasing.

Biologists have been counting and studying the penguins since the 1960s. A full-time biologist was funded in the 1990s and now runs the research effort. Counting is done manually, through binoculars from an observation tower. We were told that the penguins have so far defeated more technical and exacting techniques. There is also the issue of observational consistency. Using the same method of counting year after year ensures the numbers do not require complicated normalization.

A large welcome centre includes the critical food and gift shops, ticket sales and offices. A wide boardwalk leads to the sea past acres of penguin burrows. The boardwalk splits two thirds of the way down. The main path goes to the observation tower and two large viewing stands. A smaller walk leads to a separate and lower set of raised bleachers for those who were willing to pay a bit more. Andrae and I paid up to get closer to the penguins.

No cameras were allowed, although photos were naturally for sale in the gift shop. The penguins would be quite bothered by flashes and people, being people, cannot be trusted not to shock them into abandoning their eggs for the chance of a good shot. Rangers were on hand to police that decision and also the strict ban on littering. It seemed to work. I saw little trash and no flashes. The seating areas were lit with monochromatic yellow light that penguins cannot see. Humans found it comfortable, if a bit dim and odd in a way hard to explain. Penguins see only in the blue portion of the spectrum, so the yellow lights do not bother them.

The penguins come ashore after one or two days' hunting for juvenile fish and squid. They come ashore carefully after sunset. A few will surf ashore, and scuttle back to the sea at the first sign of trouble. A larger group will eventually gather near shore and make a break for land in a grouping aptly called a raft.

They really are small. An adult is about 33 centimeters (thirteen inches) tall and weighs just a kilogram.

They scramble over the seaweed, walk and hop up the sand dunes and head straight for their burrows. The burrows themselves are dug in firm sand, or in this area, some are in man-made boxes to encourage population growth. Penguins can live long lives and may change partners several times, but like to return to the same burrow if they can. The oldest penguin studied is over twenty years. That is quite an accomplishment given the average life span of six and a half years!

December is breeding season. We saw one mating pair and heard others. Coos of little chicks erupted as one parent returned from fishing to regurgitate food to them. Parents take turns feeding and protecting chicks until they are old enough to grow their own waterproof adult feathers and hunt for themselves. Babies have a short 35 day gestation and undergo very rapid growth. After only six weeks, the young can hunt in the open ocean. The young, full of energy, can go as far as Adelaide on their early trips! The average is more like 10-15 km in a day, but some penguins from this colony have been found as far away as Sydney.

Most will fish for a day and return, some may stay out for up to five days.
They hunt alone when in the open ocean. They must return to the colony to preen their feathers (and get them preened), socialize, mate, lay eggs, care for young. All of their eating is done at sea; they eat nothing on land.

Little penguins can dive as deep as 65 meters, as determined by depth gauges strapped to a few by the researchers. Average depth of a dive is about 10-15 meters, but diving depths have recently increased due to a virus is one of their main food sources. They breathe air, and so have to return to the surface after each dive. Dives can last as long as a couple of minutes, but average around 40 seconds.

These penguins, like most birds, have eyes on the sides of their heads. This is a common trait of land-based prey animals, but these little guys are hunters. They are also prey. They are vulnerable at sea to sharks, tiger seals and some seabirds, and on land to falcons and mammals such as foxes, dogs, cats. Seagulls won't eat them but, as scavengers, will sometimes attack them to make them vomit their food.

Phillip Island provides an opportunity for the general public to participate live in one of nature's dramatic events, close to a major city. Yet the experience is safe for the penguins, too. The experience is eco-tourism done right. One can see the full panoply of a species living, growing, feeding, breeding, surviving predation just as if David Atenborough were there narrating and yet they are safe and uneffected by our presence. The organization of the facility and constant watch by the rangers allow the species to thrive in spite of us. That is a beautiful thing. I highly recommend that anyone who can see the little penguins of Phillip Island, especially since all proceeds go to the operation of the not-for-profit foundation and its research program.

Friday, December 08, 2006

OSDC 2006, Melbourne Australia

Day 1

I attended this year's Open Source Developers Conference in Melbourne, Australia, from 6-8 December 2006, after a week in Brisbane at The University of Queensland to research and use the library.

The fabulous exhibition of aerial photos by artist Yann Arthus-Bertrand was in Melbourne and set up by the Yarra River near the centrally located Flinders Street Station. The Internet version is good and I recommend viewing it, but it doesn't compare with interacting with a live crowd. I had the good fortune to see this exhibit a couple of years ago while in Bristol, England.

Randal Swartz gave the first keynote. He presented a tried and true talk regarding his position on Open Source licenses. He is a BSD/Artistic adherent, compared with Richard Stallman's insistence on the GPL. Randal and I discussed this in some detail after dinner and he saw my point regarding the desire to keep free code free - while being pragmatic about the need to license looser than the GPL to encourage use. In return, I freely acknowledge his point that very unrestrictive licenses encourage the wider use of Open Source software. It was a pleasure to discuss this with someone who both knew the licenses and could have a discussion about it without getting religious and emotional.

On the other hand, Randal did get emotional when I asked him about Perl 6 and Parrot ;) He made the fine point that Perl 6 will continue to scare him until a real release date becomes guessable. He needs to prepare training material (and pay for it) in advance, and that makes it a big deal for him.

My talk on RESTful Software Development and Maintenance went quite well and I was pleased to see that people were interested. It was a bit risky discussing pure future-oriented research at a (pragmatic) Open Source conference, but I'm glad I did it. Lots of interesting discussions ensued, fostered by breaking the mould a bit. I changed the talk at the last minute to include an longer introduction on why software maintenance is so hard, primarily to see whether it resonated with people. It did, and I plan to blog a bit of it as I get my head around it better.

Dr. Damian Conway presented his amazingly cool The Da Vinci Codebase (see the O'Reilly page on this here). If you get the chance, it is not to be missed.

Paul Fenwick of Perl Training Australia provided some entertainment on the train ride back to Flinders Station by showing the World of Warcraft version of the song The Internet is for Porn on his laptop at the highest volume. Reactions from other passengers were, umm, mixed. Several (male) commuters watched avidly while a group of Sikhs went stoic. Paul's girlfriend put up with it, while suggesting headphones occasionally.

Day 2

The second day of the conference was not tailored directly to my interests, but I took the opportunity to learn about other areas. The recent advances on Python's ctypes library are very useful and will, upon release, allow python programmers to have wonderfully powerful access to OS and hardware. I also learned a bit about the Mono project, the Boo scripting language for Microsoft CLI/Mono and attended a cool talk on the Australian Synchrotron and its use of Open Source software. It is worth noting that the control systems engineer from the synchrotron had no idea what licenses his free software was under because he was "not interested in I.P." I consider that sort of attitude dangerous to the entire Open Source software movement. Very little software is actually in the public domain due to implicit copyright rules, so licenses are the only protection for Open Source users and developers alike.

The highlights of the day were the incredibly high quality lightening talks. These included an understandable five-minute description of the RSA algorithm, a quick-and-dirty Catalyst application and some useful discussion on community building.

Andrae Muys gave a five-minute lightening talk on Mulgara. He presented (in five minutes!) his theory that RDF data stores exactly match the relational fifth-normal form, where each table contains exactly one data element and some number of foreign keys. He used C.J. Date's classic parts-suppliers database description and extended it with optional data. It was a good explanation of Mulgara's sweet spot.

At night, Andrae and I went to a funky little bar off of Little Lonsdale Street called the Horse Bazaar. The walls were covered with moving projections of city scenes and a live band played rapid Gypsy music. We were supposed to meet Randal and crew, but they never showed.

Day 3

Scott Penrose gave a keynote on his project Zaltana. Zaltana uses HTML tag attributes as hints for styling, including Javascript behavior. I haven't looked at it in detail yet, but it appears to be a similar idea to Behavior. Behavior uses CSS class attributes instead of namespace-id'd special attributes. Zaltana's goal is to wrap existing content with minimal effort with a new or custom style. I was more interested in it until I realized that the existing application has to be directly modified - I was hoping that some form of dynamic filter or preprocessing script could be used to map CSS class attributes to actions, but no.

Miles Byrne spoke on Programs are just words: Designing domain-specific languages in Ruby. I like Ruby, even though I have only coded a couple of toy applications in it so far. Miles gets the award for the best cat pictures in the conference. He gave an overview of the Ruby language, and then pushed on to many, many examples of dynamic languages written in Ruby. He showed examples for HTML parsing, Rake, ActiveRecord and several others.

Simon Raik-Allen presented on JasperReports (see the Sourceforge project for downloads). JasperReports is a Java library for generating nicely formatted SQL reports. It is LGPL licensed.

JasperReports has some commercial add-ons from JasperSoft, the initial developer. JasperSoft is busy creating an enhanced infrastructure layer focusing on the semantics. Given that they already have OLAP support and industry-sufficient GUIs and query- and report-building tools, the semantic mappings are about all that is left. I wouldn't want to be working on Crystal Reports this year and wonder how threatening this will be to data integration companies like Experian, Nimaya and Data Infinity.

Distributed Development

Martin Pool and Robert Collins reported on the Bazaar distributed version control system that does not have a centralized repository (GPL license). They have some very radical, but potentially useful, ideas. For example, they prefer to encourage many, many branches - even a branch per bug fix/feature addition. Merges to the mainline are also done early and often and become the equivalent to an update. They thus have some tools, such as reports, to manage and view the status of all those branches, not all of which have been released as OSS yet (although at least one is available as a free service on LaunchPad). Bazaar is for use specifically by distributed development teams and is used by Ubuntu Linux, a sizable project. That makes it particularly interesting to me since I am working on software maintenance for large and distributed teams.

Martin noted that an anti-pattern has developed in Bazaar use; some developers tend to put all of their work in their own branch instead of one branch per feature. Robert also gave a number of good reasons for having a main line, or trunk.

The fear of forking is often thrown up as a reason not to do version control the Bazaar way. Martin and Robert suggest that good distributed version control also makes potential reintegration easier.

Merging (especially often) can have some pitfalls. Adam Kennedy asked particularly about code conflicts. He wanted to know in advance of a merge whether a merge would be clean. Martin said that they are thinking about this, but the solution for the moment is to just ensure that the main line is always clean.

Andrew Bennetts carried on this theme after lunch. He talked about using Bazaar and Patch Queue Manager to ensure that tests always pass on the main line. The only way to ensure the main line is safe, of course, is to also use Patch Queue Manager (or some similar systems) to manage dependencies.

Andrew suggested that code reviews are more important for distributed teams than for teams who can informally and routinely overhear each others' conversations. This is an interesting thought because it begins to sound like a methodological requirement for larger OSS systems (that have historically not operated that way, possibly due to size). VOIP is also making distributed pair programming more affordable, especially for OSS projects.

The lightening talks were awesome, again. I am suddenly thinking about a conference format that starts with a series of lightening talks so that individuals can have a basis for choosing which sessions to attend.

Richard Jones showed the Selenium IDE, a test suite IDE for Firefox. Selenium tests themselves are cross-browser. There are heaps of (poorly implemented) test suites for browsers, but this one seems worth a look. It is also OSS under an Apache 2.0 license. The addition of an OSS IDE to this market makes it very easy to construct tests.

A talk was given on SELinux, when what I really needed was a talk on chcon :)

A wild talk was from a guy who implemented Lisp without (most) parentheses. It was actually readable! Kinda cool...

Jon Oxer proposed a really simple, but complete, language he called OSDcLang (actually yesterday). Today, Paul Fenwick introduced the ACME::OSDC perl module to compile it. Scary. Cool, but scary.

There were too many lightening talks to really capture. One guy proposed that OSS apps have source code inspection/editing access in the GUIs. Another introduced a perl module he just wrote and uploaded to simplify for/else syntax.

Andrae and I had a discussion with Adam Kennedy regarding spam prevention. I won't steal his thunder, but I am going to introduce him to friends at Yahoo! who are constantly looking for better anti-spam techniques. Adam is great at solving general problems and categorizes well between people and automation. I have some hopes for this one. I thought I had a solution last week, but it was shot down upon more detailed review.

I learned a lot about Perl internals after dinner by listening to Randal, Adam, Paul, Andrae and some others discussing Adam's attempt to make a perl parser. It turns out that nothing, not even perl, parses perl. There is no grammer, and there are places in the code where perl actually makes probabilistic guesses about how a token should be interpreted based on following information. Throw in dynamic language extensions and you start to see where this is going. Adam was trying to parse perl entirely in order to provide an API for editors to use. He still has some hope, but I was surprised at how hard it was.

Overall, it was a great conference. I look forward to coming next year, hopefully to Hobart, Tasmania.