Fear clouds the mind -- in which Mail.app refuses to send mail via SSH tunnel and we learn about localhost, IPv6, debug Mail.app, and mostly anger and frustration
(If you're here looking for a solution to SSH tunneling in Mail.app, skip to the bottom.)
When I talk about fear and peace of mind and how the mind works, I often wish I had specific examples for illustration. Friday and today delivered that wish for me. When people talk about fear they usually mean something life-threatening. When I talk about fear I mean something not life-threatening, but nevertheless disruptive. Day-to-day, its non-life-threatening stuff behind our dysfunctional behavior. Changing how we deal with non-life-threatening fear can profoundly improve our lives.
On Friday, I was confronted with some kind of bug in Mail.app. I couldn't get it to send mail through an SSH tunnel. I spent the entire day troubleshooting. I left work without a solution and as angry as I can remember being in years. I was seriously considering giving up on software development altogether. No exaggeration. I was that angry. (As I type that I'm truly stunned. Some stupid little email problem and I'm looking for a career change? Man was my fear of failure out of control on Friday. Sheesh! At least it provides a useful example.)
I used to throw temper tantrums when I was that angry -- mostly punching or kicking inanimate objects, occasionally throwing one object at another. That is self-evidently self-destructive behavior. The stuff I was punching or kicking or throwing was usually my stuff. Either I was trying to destroy something I cared about or I was hurting my hand or foot trying to express my anger. [1]
I once played a lot of video games and I would get angry when I wasn't playing well. I used games to measure my self-worth and got really angry when I came up short. Some of the anger I had on Friday reminded me of the days when I would cuss, slap the controls, or punch the cabinet (or all three) after loosing or failing to get a perfect score or failing to set the high score. I always hated pinball machines for having a built-in penalty (tilt) for that kind of inappropriate behavior. I was really, really good at video games 'cos I played them a lot. But I also got really, really mad at myself when I didn't perform as well as I expected.
At my worst I'm completely intolerant of my own failure. And that's what happened on Friday. Mail.app was doing something stupid and I should have been able to fix it. When I couldn't fix it and when I couldn't make any progress against the problem, I just got more and more angry. As my anger increased, my ability to usefully investigate the problem diminished while my expectations increased. It became ever more important that I be able to prove myself and ever more difficult to actually pull that off. That negative cycle fed on itself until I was nearly ready to quit my job, quit my career. It's not a rational experience.
What I was experiencing was a simple case of inadequacy. I couldn't figure out how to fix Mail.app. That by itself is harmless. But my *fear of* inadequacy kicked in. My mind dutifully reminded me of all the various strategies I've used in the past when I've been inadequate and afraid at the same time. Most of those strategies are variations on the get-angry-at-myself theme with a few get-angry-and-break-something variations mixed in.
One of those strategies might have succeeded: try to find a different way to solve the problem. I had been investigating some resources on the net about using launchd to spontaneously create an ssh tunnel on demand. But it depends on having 'nc' (netcat) on the remote server. We don't have nc installed so I dug around for an RPM. I couldn't install it for various reasons. The technical details aren't important for this story.
When that failed it was just another failure. But I was still swimming in fear of failure and my mind, noticing the fear and the failure, dutifully reminded me of other things I could be afraid of: I wasn't billing any hours that way, haven't billed enough hours this month, if I don't bill enough hours I might have to pay some bills with credit cards. As I write this now all of those fears are pretty trivial but Friday they were completely gripping. I might as well have been standing between a mother bear and her cub. Well, not quite *that* afraid. I wasn't actually in mortal peril, but there was a definite sense of danger. Maybe more like driving too fast in an icy parking lot -- something that could wreck my car and cost thousands of dollars to fix, but not something that would necessarily kill me. It was threatening enough that I was seriously considering a career change by the end of the day.
Today was a sharp contrast. First, I changed my expectation. I probably won't fix Mail.app, but maybe I can get some more information about what's going wrong. Or maybe I can get enough information to get specific useful help from the Apple Genius Bar or a mailing list or whatever. I don't know what is going on, so the next step is to gather more information and ask for help. If I'm free from fear, it's entirely okay that I don't know what's going on. Friday, when I was feeling consumed by fear, the not-knowing part was a judgment against my competence as a developer.
I installed Thunderbird to confirm that it was an bug in Mail.app and not something wrong with my SSH tunnel. I had already confirmed this using telnet on Friday. The SSH tunnel was fine, but Mail.app couldn't use it for some opaque reason. But I wanted another example. In my experience, at least some of the local Geniuses don't know what to do with information when it comes from the command line. Thunderbird lets me show them that the competition works and their application doesn't. Hopefully that would motivate Apple to help me.
While I was waiting for Thunderbird to download I also googled for "mail.app debug". Did you know there's an AppleScript to turn on socket logging in Mail.app? It's here:
/Library/Scripts/Mail Scripts/Turn on Logging.scpt
And there's a wide array of other debugging options here:
Enable detailed Mail.app logging options
What I found out is that Mail.app was in fact talking to the mail server but was introducing itself to the server with an IPv6 address. Without the tunnel Mail.app introduces itself with the IPv4 address. Here was the debug output, first with the SSH tunnel (the addresses below have been changed to protect the innocent ;-):
EHLO [^T???^Nf???p? ^V??IPv6:::1]
Second, without the tunnel:
EHLO [10.10.1.25]
Stupid computer.
And that's the moral of this story. In the absense of fear I can clearly see and even document that it's the computer that's stupid, not me. That lets me get on with my day (by writing a long blog post ;-)
Thunderbird had finished downloading and worked fine with the SSH tunnel. I thought about switching to Thunderbird. But while putting a few more finishing touches on this post, I googled for "mail.app localhost ip v6". Didn't find anything useful, but google asked if I meant "mail.app localhost ipv6?" So I tried that and found this helpful comment by someone named Ashley Clark on a blog entry describing exactly the same problem I was having:
Specifying localhost in Mail resolves to the IPv6 localhost address, when connecting to the mail server then the EHLO/HELO commands pass in the IPv6 localhost address....When you specify 127.0.0.1 in your settings then Mail passes that address instead and everything works.
That comment exactly matched the debug output I had just read and sure enough, my problem was fixed by configuring my outgoing mail server in Mail.app using 127.0.0.1 instead of localhost.
The important lesson is about how fear clouds the mind. I was so close to identifying the problem on Friday. One of the other suggested answers in the comments on the above blog called for commenting out a line in /etc/hosts. I made other modifications to /etc/hosts in my troubleshooting on Friday. I asked myself "what is that ::1 in there?" (the line to comment out). In my fear-clouded mind on Friday I didn't think of googling for "mail.app debug", even though I was exactly asking myself how to get some kind of useful information about how Mail.app was trying to talk to the SSH tunnel. By contrast, today without the fear clouding my mind, that was my first search. My solution to this stupid problem this morning was about 15 minutes of searching and reading (and about four hours of writing about it. ;-) compared to a whole day wasted in anger and frustration. Had I noticed the fear on Friday and released it, I might have actually had time to do some billable work. Speaking of which, I've got some programming to catch up on.
[1] Most people would never guess that about me. A few people might remember some tantrums -- people from junior high and high school, and maybe my suite mates from Freshman year of college. The tantrums gradually stopped as I became less self-destructive.
Grieving: being a son and a father loosing a father and a son
Twenty-four weeks of gestation is such a short time and almost completely in the abstract, especially for a man. Nervous about providing for another hungry mouth. Nervous about Sarah's health. Distant anticipation for a new life. I've long hoped my kids would love each other as dearly as I love my brother. All of that emotional energy was focused on Sarah's growing belly.
Suddenly the conversation turned to death. And then more death.
Tears show the feelings that words cannot express
We learned of the fatal birth defects August fifteenth and faced questions no parent should ever have to ask. Is it more humane to have an abortion or to wait for the baby to die on its own? If no to abortion, would Sarah be able to endure conversations with acquaintances and strangers? Obviously pregnant and only becoming more so, people would ask about the due date and gender. Some can't resist touching a pregnant belly. All of which is weird enough alone without also provoking tears and the burden of sharing horrible news. If yes to abortion, what kind of abortion? I wasn't prepared for questions of method. Would it be better to choose dilation and extraction (aka. D&E -- disturbingly clinical term for a profoundly gruesome procedure)? Or better to induce the pregnancy knowing the baby would suffocate after cutting the umbilical cord?
I've long intellectually favored euthanasia, despite "thou shall not kill". I kept remembering Of Mice and Men. (spoiler?) Can one kill humanely, even lovingly? But thought experiments and intellectual banter are easy when hypothetical or fictional. Faced with real life and real death, nothing suggested direction. Abortion and euthanasia had always been balanced counterpoint. Never before were they the same thing. Is the lesser evil even measurable? With which choice could we live?
Real choices are difficult and painful because all the options are miserable.
On September forth we learned the baby's heart had stopped. Relieved of the choice and horrified to be relieved at the death of our unborn child.
In stillbirth the motions are Birth and the emotions are Death. Anticipation mingles with dread. He was literally beet red from head to toe. The Caucasian skin tones I expected don't develop until after twenty-four weeks. Amid that shock I still felt parental pride and a surprising sense of connection. Then I felt Dad's presence. It seemed exactly right that we name our little boy after Dad. Little Milton was stillborn on September fifth.
Grief for the baby has overshadowed grief for Dad -- I still keep waiting for the floor to drop out from under me. Dad survived brain cancer eighteen years ago, but between the tumor, surgery, chemotherapy, and lots of Dilantin (to control the seizures brought on by the tumor), he was never the same. He was left with a subtle mental disability and forced into retirement. My athletic, go-getter Dad became a couch potato. His death was a long time coming, despite always feeling a long way off. Dad called 911 around eleven p.m. on August sixteenth complaining of lower back and stomach pain. His heart stopped while undergoing a cat scan. Although they briefly revived him, his blood pressure never recovered. He was pronounced dead around two a.m. on the seventeenth. Better that he died quickly, but I wish I could have been by his side. His memorial service was held in Grand Junction on September fifteenth.
Little Milt at only twenty-four weeks (or is it negative twenty-four weeks?) has filled up the past five, while the nearly forty years I knew Dad are lost in the fog. Dad hugely influenced my character, for good and bad. I still keep waiting for the floor to drop out from under me.
On one hand, little Milt was a precious angel of death who came for my Dad. On the other hand, Dad left this Earth as a guardian angel for little Milt. I still imagine Dad and little Milt walking hand-in-hand in a park and it's still really hard to express how much that grounds things for me.
Rays of Light
Last Wednesday, Sarah had an ultrasound. We went in excited to learn the sex of our second child, though Sarah was apprehensive. She first felt Elliott move at 17 weeks. She was 21 weeks into this, our second pregnancy, and had not yet felt the baby move. I looked forward to confirming everything was fine. But our ultrasound technician was quiet.
Maybe a busy day, I thought.
Maybe just concentrating, I thought.
Then she had to leave the room for a minute.
Or two. Or five.
Sarah and I exchanged long silent glances: hers said "I told you" and mine failed to reply "everything will be fine". The technician came back in and scanned Sarah's belly again. What was she seeing as she looked increasingly uncomfortable? Silence revealed and concealed.
In Elliott's ultrasound three years ago, the technician was chatty, pointing to head and hands and stomach and heart. Did we want to know the sex? It had been fun and exciting. Now that memory contrasted starkly, sitting in silence guessing at a mash of unidentified images. Knowing nothing and yet something. The technician left again.
More silence. Sarah and I fought back fear of the unknown. The tech apologised. Forbidden to tell us. The perinatologist had to tell us. Awaited a phone call from the perinatologist. Still waiting. Gave up and called them.
On hold. On hold. On hold.
The technician's next client is was waiting. Still on old.
Finally an answer, but only to schedule an appointment in Denver. The sound at the end of the deafening tunnel was two hours away. The perinatologist was coming in on his day off.
To meet with us.
Still no idea why while we picked Elliott up. Poor kid had a horrible rash while we scrambled to find someone to watch him for another few hours.
No idea. No idea. What's the worst it could be? Something terminal? Something not terminal but debilitating? No idea. No idea. We sat mostly in stunned silence in the waiting room. The nurse who finally called us in acknowledged that we'd already had a very bad day. Still we awaited the details.
The perinatologist met us with another ultrasound. Higher resolution. "First I'm going to take a look around the fetus, then I'll explain everything I'm seeing in as much detail as you feel you need." More images swam over the monitor. "First, let me tell you this is very bad news."
Our unborn child has 1) a Dandy Walker malformation, and 2) severe hydrops fetalis. In English, that's 1) a malformation of the cerebellum, and 2) lots of fluid where it shouldn't be. Each condition is bad news, but the hydrops is easiest to explain. There's massive swelling in the skin, especially evident around the scull, chest, and abdomen. There's excess fluid in the brain around the malformation. There's fluid in the chest around the heart and lungs. There's especially large amounts of fluid around the intestines. The fluid around the heart and lungs will interfere with their development. The prognosis is miscarriage, most commonly in the second trimester, or if not that then in the third trimester. If the baby does survive to birth it will not have sufficiently developed heart and lungs and will die shortly after.
I talked to Dad about it on Thursday afternoon. "God never gives us anything we can't handle" he said. He died of a heart attack Friday morning around 2am. We found out around 5am. Passed the news on to my brother and drove out to Grand Junction. We spent the weekend visiting my aunts and uncles, making arrangements for Dad, and then sorting through his stuff.
A few rays of light
My relatives on the Western Slope were so incredibly supportive and kind. These are the folks I was talking about when I was wringing my hands about Colorado politics a few years ago. This weekend gave me a different glimpse into the "political divide" that's so very talked up in our media. For my family, the bonds that join us are much, much stronger than whatever political or ideological views divide us. I believe but cannot prove that to be the case for our country as a whole. We're essentially united, but that story doesn't move advertisements. We end up wringing our hands about mostly inconsequential divisions and worry unnecessarily that we might be torn apart by these conflicts of value.
On Friday morning as Sarah got Elliott up, he immediately squirmed out of her arms and ran to me in the living room. With his eyes gleaming and a broad smile he exclaimed "Your Daddy's here! Your Father's here!" I sat down on the floor right where I had been standing and laughed and cried and hugged my now-more-precious-than-ever little boy.
Early in the weekend I kept seeing an image of my Dad and a toddler walking hand-in-hand in a park. Later, as Greg and I went through Dad's stuff I kept imagining my Dad in the hours after our conversation on Thursday deciding it was his job to get started on making whatever arrangements were necessary for the baby. I heard Dad's take-charge voice saying "Somebody's gotta get up there to take care of that baby" ending almost twenty years of purposelessness.
Somehow grieving Dad and the coming loss of our baby at the same time seems easier than either would be alone. These deaths feel spiritually connected. It feels like Dad and his fourth grandchild will have each other to keep company and it's really hard to express how much that grounds things for me.
Photosynth: vision for the Map Room at St. Peter's Basilica
From January to May 1991 I was in Siena, Italy as an apprentice to Dr. Kim Veltman. My work involved creating three dimensional animations of significant drawings from the history of perspective. On weekends we took all kinds of trips around central Italy. I was incredibly lucky to be touring with the world expert on perspective. He was researching the medieval precursors to perspective and we found ourselves spending a lot of time looking at paintings of the lives of various saints in monasteries, especially Franciscan and Dominican.
We visited the Sistine Chapel at St. Peter's Basilica, but what was more memorable for me was our time waiting in the antechamber known as the Map Room. Here are a couple images to give a sense of the space:
Map room ceiling
Detail of one of the maps
Kim noticed there are some loose correlations between saints depicted on the ceiling and the maps of Italy on the walls. If we hadn't been immersed in details of the lives of various saints he might not have noticed the connections. Now consider the punchline from the demo of Photosynth: by virtue of spatial relationships between photographs, each user's "own photos are getting tagged with metadata that somebody else entered. If somebody bothered to tag all these saints to say who they all are then my photo of Notre Dame cathedral actually gets enriched with all that data and I can use it as an entry point to dive into that space. ... And of course a byproduct of all of that is immensely rich virtual models of every interesting part of the Earth."
Ever since I visited the Map Room I've wished I could go back over the various connections between the saints and the historical maps of Italy where those saints lived and worked. I had imagined a virtual reality application where one could click on links in the ceiling images and see highlights appear on the corresponding maps. I imagined following several different trails from there. In one I just explored a stream of images of historical maps of Italy to watch how geographic technology improved over time. In another I could explore other areas on the maps where events in that saint's life took place. In another trail I dipped back into my Dream Encyclopedia and watched how the borders of the Roman Empire changed over time.
Between wikipedia, flickr, photosynth, and sea dragon my dream encyclopedia may yet come to pass. It's an exciting time to be alive!
Photosynth: did someone hack my brain?
In my final year before graduating from University of Colorado (1993-4) I created a prototype software tool aiming to derive three-dimensional computer models from photographs. I received funding via two small grants from the Undergraduate Research Opportunity Program and submitted a paper for presentation at the 1994 conference of the Association for Computer Aided Design in Architecture . Though the paper was not accepted, I'm quite fond of that project even these many years later. It's the last real work I did in lisp. I very much enjoyed the geometry problems I had to solve in the process. I also enjoyed using the computer to help me visualize that geometry.
Many different things have been kicking up these memories in the past month, but one in particular compells me to write: Blaise Aguera y Arcas' Photosynth demo at TEDTalks
In fact, one image from that talk in particular compells me to write. (I'm showing two images here for context. The one displaying the cones of vision is my motivation for writing).


I would accuse someone of hacking my brain, except that what intrests me most about Notre Damme are the flying buttresses rather than the West facade and the rose window. It's a hauntingly beautiful model, even ghostly, made more sureal for me because it's a private memory from fourteen years ago which only escaped my own mind in verbal descriptions and quick sketches with close friends.
It's profoundly exciting to see the tool I envisioned so long ago to come into existance without the slightest effort from me and then neatly enhanced by resources at Flickr along with some certainly very cool developments in computer vision.
I've retyped the Introduction and Conclusion from my 1994 paper below. Tooting my own horn, I'm especially pleased to have this prediction of future automation in writing.
Introduction
Although three dimensional computer models serve many useful purposes their creation remains difficult especially when created from poorly documented existing objects or buildings. Generally, one must directly measure the objects to be modeled, then enter the measurements into a computer aided drafting (CAD) system with a mouse or digitizing tablet. Direct measurement is often difficult and inaccurate when the object is intricate, very small, or very large. Photogrammetry, a technique of obtaining measurements from photographs, offers an alternative to direct measurement for the generation of three dimensional models.
The purpose of this project is to create a suite of tools to derive three dimensional computer models from photographs.
Advantages of Photography
First, most contact with the object is unnecessary because on generates the model from photographs, very useful for particularly large, small, or delicate objects. Second, photography is very general. One can take pictures of buildings as easily as furniture. One could use the same tools for producing models of objects of dramatically different scales. Whereas in direct measurement, one must have different tools for different scale objects. Third, there is potential for photogrammetric techniques to be completely automated.
[snip]
Conclusion
Since its early devleopment, perspective has involved measurement. The techniques used here expand on this relationship to generate computer models from photographs. The current implementation is probably no more convenient than direct measurement, nor any less time consuming. It is also not particularly useful for organic objects. Nonetheless, it generates models entirely from photographs. No special cameras, drafting tablets, nor other specialized equipment are required, except a computer. It is equally useful for large and small scale objects. It also offers the possibility of completely automating photogrammetry, should artificial intelligence techniques become clever enough to recognize rectiliniar shapes in photographs.
Several forces working in Jython's favor -- PyCon 2007 notes
I participated in four days of sprinting on jython at PyCon and at two local sprints here in Boulder leading up to PyCon. There was a lot of interest in jython and I'm overdue in commenting on it. I met a number of people in the Python Software Foundation and jython seems to be one of their main priorities for the next year. I was surprised by the number of people who joined us at the PyCon sprints. I've just learned this week that there are several Google Summer of Code students who will be working on jython. Sun has made a serious committment to supporting dynamic languages on the JVM: they hired the two lead developers of JRuby. One of them, Charles Nutter, was quick to offer support to the jython community. He publically recruited developers to give jython a little love -- which is what inspired these sprints. Discussion of collaboration on the internals of dynamic language development on the JVM has begun. The core jython developers are closing in on a long awaited release of jython 2.2. With energy coming from the PSF, Google Summer of Code, and Sun, jython's future is looking quite optimistic.
A couple other points to mention. CPython developers will not be particularly impressed that the next release is only supporting version 2.2 language features. However, with CPython shifting attention to Python 3000, Jython has a chance to catch up. Also the biggest obstacle in keeping pace with CPython has been the challenge of supporting new-style classes. Lastly, there's a fair amount of interest among some of the newcomers to jython development to leap into 2.5 features. Long story short...
CONCORDE: Message for you, sir.
LANCELOT: Concorde! Concorde! Speak to me! 'To whoever finds this note: I have been imprisoned by my father, who wishes me to marry against my will. Please, please, please come and rescue me. I am in the Tall Tower of Swamp Castle.'
At last! A call! A cry of distress! This could be the sign that leads us to the Holy Grail! Brave, brave Concorde, you shall not have died in vain!
CONCORDE: Uh, I'm-- I'm not quite dead, sir.
LANCELOT: Well, you shall not have been mortally wounded in vain!
CONCORDE: I... I... I think I c-- I could pull through, sir.
Python, Scientific Computing, and NumPy -- PyCon 2007 notes
I gave the last lightening talk of the conference. I told a story there I want to re-tell here for posterity.
I spent two hours in a fascinating conversation with Brian Wilson as we were "on our way out" after SciPy 2006 last Summer. He's an atmospheric scientist at JPL who was there to present GENESIS SciFlo. He's a fascinating guy with broad interests who clearly loves programming languages. Although he seems quite happy with python, he was profoundly angry with language designers for universally ignoring the needs of scientists. Computer scientists have left the rest of the sciences stranded in FORTRAN and IDL because no one will make n-dimensional arrays a native data type of the language. Python is no exception -- someone else added the n-dimensional arrays to python. (There's some hope that Guy Steele will correct this problem with Fortress, but it's not here yet).
To illustrate the point in my lightning talk I asked the scientists in the room to raise their hands -- five or ten hands went up in a room of maybe one hundred. "How many of you could do your work without NumPy?" I asked. Every hand went down. The scientists at PyCon know that python offers better tools for scientific computing and I'm sure they try to persuade their colleagues accordingly. "But how many of you have colleagues who are stranded in FORTRAN or IDL?" I asked. Every hand went back up.
My call to action was for someone to chime in next time Travis Oliphant suggests adding n-dimensional arrays to the language because Travis can't do it on his own. There's a huge opportunity for python to invite the whole scientific community to the language: NumPy has ten years of maturity and ruby doesn't have anything like it. As with all things in perl there's more than one way to do it, but nothing seems to have captured the space in the way NumPy has for python.
I hope I made it clear in my lighting talk that without NumPy python would be irrelevant for scientists. It looks like Travis is getting a little more traction for his efforts. There's a revised PEP here if you care to comment: http://mail.python.org/pipermail/python-3000/attachments/20070320/c2800d0e/attachment-0001.txt