Thursday, September 01, 2022

A Surprising Source of Programmer's Inspiration: A Weekend with Pablo Picasso

A few months back I listened to Herbert Sigüenza's A Weekend With Pablo Picasso, a one man play that as the title suggests gives you a view into Pablo Picasso's life and work. I enjoyed the production, but what really surprised me was how I related to Mr. Picasso. Surprisingly, I saw him less as eccentric genius artist, and more as a peer.

In the show, Picasso had a short deadline to use his creative talents to make something amazing; and I often find myself in the same scenario. What's more is that nobody is going to save us. If he doesn't paint, it's not getting painted. If I don't code, it's not getting coded.

I'm not claiming to be in the same league as Picasso, of course. Just that I found our pursuits have surprising symmetry. I'm sure we could have sat down and swapped war stories with one another, both of us nodding in understanding.

As a programmer, borrowing another profession's mindset and practice is common. A quintessential example is from the field of architecture, where programmers were so inspired by Christopher Alexander's text A Pattern Language, that it launched a revolution in how programmers think and build systems. Alexander has become massively successful in the world of programming without ever writing a line of code.

But we aren't just architects.

When I'm dealing with an especially thorny bug, I'll often don my virtual lab coat and behave like a scientist. I'll form hypothesis and run experiments with the goal of untangling a mystery.

And sometimes I play the role of plumber, using well understood technology and practices to piece together a system. I'm less interested in breaking new ground here, and more interested in doing precise and high quality work.

And sometimes I'm an artist. I'm Looking for clever and unique ways to tell my story to the computer, end-users and fellow programmers. This is where borrowing from the artist's playbook helps, and focusing on being creative and taking risks pays off.

Listening to A Weekend with Pablo Picasso nurtured this last mindset.

In the world of programming, there's often a push to remove or at least constrain the level of creativity programmers practice. And there's good reason for this: having programmers throw out the playbook may feel empowering, but it also sets them up to re-experience all the problems that our industry best practices have been designed to address.

Still, there are countless challenges in my industry we have yet to conquer. Attacking these with the same fearless energy and creativity of a Picasso may be exactly what we need to overcome them.

Sunday, July 31, 2022

A Perfect Yes Day at Burke Lake

So what should we do with G today? We could go fishing, geocaching, ride a train, ride a carousel, hit the playground or get ice cream?

Yes. Yes to it all.

And to Burke Lake's credit, we were able to do just that.

Burke Lake was perfect because we could scale all these activities so they were sized for G. The geocache we found was an easy grab with a fun toy inside. The train, carousel and ice cream were a natural win for everyone.

Fishing could easily require a bit too much patience for any little kid. Fortunately, we had my Dad with us. We picked a random spot along the shoreline and in four casts he caught four fish. Sure, they were tiny, but for what we were after they were perfect.

'Fishing' went down like this: my Dad would cast the line and catch a little fish. G would reel the line in and then I'd take the fish off the hook and show G his catch. It was a thing of beauty. My Dad's fishing skills certainly made the adventure work.

Overall, what a perfect day to spend with the fam! I can't wait to tackle more adventures with G!

Friday, July 29, 2022

Your Code is Safely Stored In The Cloud. Right?

One of my disaster recovery strategies is to switch my primary work computer every week. I've got a Mac Mini, Intel Nuc and Lenovo Laptop in the current rotation. Come Monday morning, I switch off to a new device for the week. When one of these devices inevitably fails, I can effortlessly switch to a new device and continue my work day.

This strategy has worked well for years, but has one primary annoyance. Back in the day, when most of my projects were Subversion based, I'd occasionally forget to commit files. Mid-week I'd discover the missing changes and I'd have to scramble to find them on another device. It was always a pain. Git exacerbated the problem by adding a new dimension: it's now possible to not only forget to commit files, you can commit them and forget to push them to a remote server.

A few weeks ago it finally occurred to me that I could program my way out of this annoyance. Right before I switch away from a device for the week (typically Friday afternoon, or first thing Monday morning), I now run these commands:

$ cd ~/dt/i2x/
$ svnassist repo-statuses .
M ./src
$ gitassist -a repo-statuses -n .
S ./i2x-website/src/master
M ./project-notes/src/main

Source code for my projects live in ~/dt/i2x so I use this as the top level directory to search from.

svnassist looks for subdirectories that contain the directory .svn. When it finds one, it runs an svn status on that directory. If changes are found, it prints out an 'M' next to the repo root to show that it has pending modifications.

# root=$HOME/dt/i2x -- my project directory
find  -L $root -name '.svn' -type d -prune -exec echo {} \; | while read sdir ; do
  root=$(dirname $sdir)
  modified=$(cd $root ; svn status)
  if [ -n "$modified" ] ; then
    echo "M $root"
  fi
done

gitassist works in a similar fashion, but accounts for the fact that a git repo can either have local changes that need to be committed, or committed changes that need to be pushed.

# name=$HOME/dt/i2x -- my project directory
find  -L $name -name '.git' -type d -prune -exec echo {} \; | while read gdir ; do
  status="_"
  root=$(dirname $gdir)
  modified=$(cd $root ; git status -s)
  if [ -n "$modified" ] ; then
    status="M"
  fi

  if [ -z "$modified" ] ; then
    branch=$(cd $root ; git branch --show-current)
    stalled=$(cd $root ; git cherry -v origin/$branch 2>&1)
    if [ -n "$stalled" ] ; then
      status="S"
    fi
  fi

  echo "$status $root"
done

git cherry was the best way I found to see if there were changes to the local repository that need to be pushed to the remote.

After running these commands, I've found that it takes just a minute or two to either discard the local changes or make them permanent.

Man, is this an improvement over discovering a missing set of changes and having to scramble to find them.

Tuesday, July 26, 2022

Rocky Mountain National Park - Day 3 - Adventure and Homecoming

Shira surprised me last night by convincing me to cut our trip short to avoid getting Covid symptoms 1,600 miles from home. And she surprised me again at 4:30am when she suggested we hit up the Bear Lake area for a sunrise hike. Naturally, I was in.

We got to the Bear Lake parking lot at around 5:00am and the place was already pretty parked up. The advice is to get to this parking lot early if you want to start one of the area's iconic hikes, and that advice is no joke.

By 6:00am, we had made it to our destination: Dream Lake. The pre-sunrise hiking was refreshing and had an air of excitement to it. I'm really glad I had brought along a head lamp this trip for Shira, 'just in case.' The 'just in case' I imagined was that we were going to be out hiking past sundown, not that we'd have to cut short our trip due to a Covid-19 exposure and so we wanted to log some early morning hiking. But still, it was a good grab on my part.

Dream Lake was gorgeous and there were a heap of photographers waiting in one corner for the sun to light up one of the rock faces in the distance. We took tons of photos in the pre-dawn light and then started our walk back to the car. We caught sunrise on the way back and it was absolutely gorgeous.

This bonus hike was definitely a highlight and I'm glad Shira suggested it at 4:00am.

On the way out of the park we caught sight of some wild turkeys and deer. I also saw a couple of exotic looking blue birds. They seemed to have the shape of magpie's I'd seen in Australia. And sure enough, that's what they were: A Black-billed magpie. I wish I'd been able to grab a pic. Apparently they are super common and hardly anything to get excited about.

The rest of the day passed uneventfully: we packed up, headed to the airport and our flight home was easy. As we headed home I struggled to wrap my head around the flurry of emotions that have accompanied this adventure. The utter disappointment of not being able to bring the kids. The joy and excitement of exploring a gorgeous landscape and seeing unique flora and fauna. The frustration of having to make the adult decision of leaving early. The appreciation that our trip could have been totally canceled but wasn't. The relief that these problems are of a temporary nature and that exciting travel is still in our future.

One thing that made me feel better was the act of writing down lessons learned. This let me add some additional value to the whole experience. So here they are, my top lessons learned:

  • Be mentally prepared for the idea that Covid may derail your plans at the last minute.
  • Throw all the snacks in the back of the car before heading out for the day. The extra trip or two to load the car will be worth it. Leaving the snacks on your Airbnb's counter does you no good.
  • We learned that the temperature lowers 5 degrees for every 1,000 feet in dry conditions and 3 degrees for every 1,000 feet in wet conditions. This doesn't sound like a lot, but it means that the 60° F in Estes Park at 7,000 feet is going to be 40° F at the 11,000 foot trail head. This is no joke, and we should have brought gloves and hand-warmers for the higher elevations. Not grabbing the trekking poles from our car was just dumb.
  • The Nuun tablets were smart to bring to stay hydrated. But bringing Tail Wind or drinking more calorically dense Gatorade would have been smarter.
  • Always bring a headlamp on hiking trips. This move paid off in an unexpected way.
  • I need to reconsider my threshold for what needs to be packed in my carry-on luggage when I travel. I'm all for the convenience of checking bags, and I thought I was OK with having the checked items never arrive. This time some of my checked items really never did arrive and it was an eye opener. Sure, USB cables and toothpaste are easy to replace. But my DSLR battery charger and prescription eye drops should never be flying in my checked luggage. Can I live without these? Technically, yes. But they're way hard to replace, so better to keep them at my side.
  • Always bring the DSLR, regardless of how heavy it is, to National Parks.
  • Only operate on one airline reservation at a time on airline websites. Do not attempt to open a new tab and try to cancel another reservation while in the middle of completing one.
  • Backcountry Navigator was a real win because the general purpose maps let us improvise hikes on the fly.
  • Always check to make sure Backcountry Navigator has downloaded offline maps for the area by switching to Airplane mode and testing this out. Sorry babe, I so thought I downloaded maps to your device.

Monday, July 25, 2022

Rocky Mountain National Park - Day 2 - Night

I mentioned that one of the reasons I was glad we'd purchased a curated itinerary for Rocky Mountain National Park were the little extras that we learned from it.

One example of this was what inspired our last hike for the day. We'd made our way through the park on Trail Ridge Road and now found ourselves at the trail head for Adam's Falls. We did the short hike into the falls, and we were impressed. The itinerary, however, suggested that there was a unique vista to be seen if we pushed on a bit further on the trail. We did and found ourselves at the alpine meadow that the guide had promised us. The whole scene was just beyond gorgeous and that was after a full day of seeing nothing but unbelievable views.

Once we were done chilling at the meadow we effectively retraced our steps for the day: first returning back to Adams Falls, then getting in the car and driving back along Trail Ridge Road. Pro tip: the Kawuneeche Visitor's Center, located at the entrance to the park near Grand Lake has great bathrooms, if you find yourself in need like we did.

The drive along Trail Ridge Road was still amazing the second time, and we caught a glimpse of more Elk and Deer.

By 7pm, we were back at our Airbnb and having a debate about what we should do the next day. I wanted to stick to the plan and enjoy exploring the park. Shira thought we should catch a flight home. Her logic wasn't wrong: we'd clearly been exposed to a case of Covid. If we left tomorrow, we'd have seen a bit of the park and will have avoided developing symptoms. Once we started developing symptoms, it would be wrong to get on an airplane. My counter argument of: c'mon, live a little! wasn't swaying her.

I finally came around to her line of thinking when I realized that if we ended up sick in Colorado it would not have been a surprise, it would have been the direct result of an avoidable situation. So reluctantly, I agreed with Shira and we booked our flight home for the following afternoon. At least we'd had one epic day in the park, which was a real thrill.