Working With AI

It’s been impossible to not have been bombarded with all the hype about AI ever since ChatGPT. There are now several powerful LLM tools available, and one of the claims is that they can write software better than human programmers. As a software developer myself, and one who’s been doing this kind of thing for longer than many of my colleagues have been alive, you might understand my skepticism.

Before I retired, NVIDIA gave all of its employees access to Perplexity Pro, so that’s the LLM I have the most experience with, but I have tried several others. At first I would ask it to write some Python code to replicate a problem I had already solved, to get a feel for how well it did. Most of the time the solution it provided worked, but just didn’t feel “elegant” – it was much more like a beginner would create. But it did work in most cases.

You may have heard the term “vibe coding” used to describe a non-developer using AI to write code. I have tried that, and the results were spotty at best. I decided to write an app for my iPhone that would be useful when practicing disc golf by measuring the distance of a throw. I had no experience with writing Swift or developing with SwiftUI, so it was about as close to vibe coding as I could imagine.

The process was surprisingly quick: it gave me the basics I would need to set up the app, get the mapping tools working, and implementing buttons. It wasn’t smooth sailing, though, as Perplexity would suggest code that was for different versions of Swift, and they would throw errors. I could then copy those errors and paste them back into the “conversation” with Perplexity, and it would respond with a correction (usually preceded by an apology – nice touch!). I did get something working in a couple of days, so I would say it was a success. Adding additional features, such as voice interaction, proved to be a much tougher endeavor; there were just too many incompatibilities that were hit as it tried to write the more complex interactions.

So based on my meager experimental sample of 1, I would say that vibe coding works, but only for the simplest of cases. It felt like asking a machine to design a house: sure, it could probably come up with something boxy that would work, but once you tried to add some style, it would probably mix things up. It’s a language processor, after all, and doesn’t actually understand anything.

Where I’ve found AI to be helpful is when I need to write some code in a language or environment that I don’t work in often, or solve a strange bug. Let me give you an example from yesterday.

I’ve hosted technical email lists on my servers for over 25 years, and I maintain an archive of every message. It’s all automated and generally works well. Each month it analyzes the previous month’s traffic, and posts a summary.

The June summary for the ProFox list came out on July 1, and it was missing most of the messages for that month. I investigated, and found a problem with the archive software that was pretty straightforward to correct. The problem was that I no longer had the original messages to add back to the archive. Some subscribers did, so I was able to add them back – except for one.

The error was clear enough: the text had a smiley emoji, and the MariaDB database column that holds the text of the message was defined with utf8 encoding. Emojis require multibyte (utf8mb4) encoding, so I ran the ALTER TABLE command to change the encoding. This took almost an hour, as the table has over a half-million records that needed to be re-encoded, but when it completed, I confidently re-ran the command to add the message, but once again it failed – with the exact same error! So I turned to Perplexity, fed it the table structure and the error, and it quickly came back with a solution: not only did the column need to be utf8mb4, the entire table has to be defined with that encoding. So once again I ran ALTER TABLE, but it took over 2 hours this time.

When it finally finished, I re-ran the command, and once again it failed, with the exact same message! I read Perplexity’s answer once again, and noticed that I had missed one part of it: defining the connection in pymysql. I needed to also tell the connection to use the correct charset:

    conn = pymysql.connect(
        host=HOST,
        user=creds["DB_USERNAME"],
        passwd=creds["DB_PWD"],
        db=db,
        cursorclass=cls,
        charset="utf8mb4",     <========
        use_unicode=True,      <========
    )Code language: PHP (php)

I had never added those parameters before, as they were never needed – it worked fine with the defaults. But once I added them, the command to add the message worked flawlessly! So in this case, Perplexity saved the day. I’m sure I would have figured it out eventually, but this was so much faster, as Perplexity runs multiple searches on the web and analyzes the responses in order to come up with its answer to your question.

And that’s what machines will always be better at than humans: doing multiple things at once. I could have run those searches, but going through the results to see which matched what I needed would have taken a whole lot longer than what Perplexity could do. That’s the sweet spot for coding with AI: not having it design your application or its interface, but solving those edge case bugs that would take you a much longer time to figure out.

Letting Go

In my early 20s I got interested in working with my hands building things. I read everything I could find (remember, this is long before YouTube existed; you had to get actual books!) This led to a career of renovating houses that lasted over a decade.

When I first got some tools I wanted to start on something, but like a blank screen staring back at you when you try to write, the problem was where to start. Then one day I was driving along and saw an old, beat-up desk by the curb. It just so happened that I needed a desk for working on my brand-new Apple IIc, so I managed to get it into the trunk of my Mercury Capri, which needed lots of rope to keep it from falling out.

When I got it home I began stripping it down to the wood, as well as fixing some loose parts. I sanded it smooth, gave it a couple of coats of polyurethane, and fitted it with new hardware. It looked great, if I do say so myself.

Over the years that little desk has been used one way or another in every house I lived in—but not any more. There simply isn’t space for it in our new house. Not that the house is small, but it’s very old and the room shapes simply don’t leave room for it. So today when Goodwill Home Pickup came to clear out the furniture we couldn’t take with us, it was among the items they took.

My old desk being loaded into a truck
Goodbye, old friend!

I would say that 40 years of service after being tossed to the curb is quite impressive. It’s still in great shape, so I hope whoever gets it next can make use of it for many more years to come.

Lasts

Today we move from the house we’ve lived in for the last 9 years into a new house that we feel will be better for us in the long run. We’re both looking forward to the change, even though it’s a lot of work.

One thing that keeps popping into my head over the past 24 hours is that this will be the last time…

…that I go to sleep in this room.

…that I carry out my morning coffee making routine.

…that I bake sourdough in this oven.

…that I lock the house up for the night.

You get it. None of these are traumatic at all; instead, they are kind of bittersweet. If we hadn’t been happy in this house, I would be feeling the opposite: so glad that this is the last time…!

Start Anywhere

Breaking the ice. Blank page syndrome.

I haven’t written in this blog for some time now, and I’ve been wanting to get back into it, but I didn’t want to approach it as strictly some sort of diary. Instead, something more akin to stream-of-consciousness: whatever is on my mind at the time. I still struggle with perfectionism, as mentioned before, but I think I’m getting better at that.

Why now? I think because I retired a month ago, and that’s a fairly big life event. Not only do I have more time on my hands, I also have a lot of thoughts that have perked up in the past that once again spring to mind. My hope is to be able to write about them instead of just letting them fade away once more.

There probably won’t be too much technical content, as I’m not engaged in the world of tech as I had been when employed. I still like coding, though, and have started working on updating a very old project: Dabo. It was first developed in 2003, but has been stagnant for at least the last decade. It’s an amusing enough of an endeavor to hold my attention, and I have no expectations for it. Just something to keep the brain sharp.

Blood and Lava

We visited Bend, Oregon last week. For those of you not familiar with this area, it’s largely defined by the Cascade Mountain Range, which are relatively young and actively volcanic. Just south of Bend is Lava Butte, a cinder cone created from an eruption about 7,000 years ago. The lava flowed out and eventually covered over 9 square miles. Much of that is still largely free from vegetation today. Here is the view on Google Maps, showing just how extensive the lava flow was: you can see the Butte near the bottom, and the black area from the lava covering several miles to the north. Another way of looking at how big this is:

The volume of rock in the Lava Butte Flow is 380,000,000 cubic yards. Assuming a paved road 24 feet wide and six inches thick, there is enough rock in the flow to pave 160,000 miles of road, equivalent to a paved road circling the earth six and a half times.

from a National Forest Service brochure on Lava Butte
The fields of lava from Lava Butte, whose cinder cone is visible on the right side of the photo.

The important thing to take away from this is just how hard and durable this rock that formed from the cooled lava is. Even after thousands of years, its sharp edges remain.

In the fields of cooled lava surrounding the cinder cone, the Parks Service created several paved trails so you can walk safely though the area, and see the lava rocks and its sparse vegetation up close. When I first visited the park in 2014, I took this photo:

Lava Field Tree
Lone tree in a lava field

In order to get the angle I wanted, with the tree lining up with the clouds like that, I had to leave the paved path and step onto the lava rocks. Interestingly enough, my wife Linda took a photo of me just as I was taking this photo:

A photograph of me creating the original Lava Tree photo in 2014
Standing on the lava rocks to get the right angle

So when we went back to Lava Butte last week, I wanted to find that tree to see how it had changed over the past 7 years. Linda and the rest of our party followed one path, while I went up the hill to where I remembered the tree was. Sure enough, I found it, and it looked pretty much the same. I wanted to try to re-create the photo, but there were two issues: one, there wasn’t a cloud in the sky, and two, I had a much longer lens than I did when I took the original. In order to frame the photo properly, I had to leave the path and climb onto the rocks further away from the tree. I got what I think is a pretty good re-creation of the image, given the different conditions:

Re-creation of the lone tree in lava fields
The re-created lava tree shot

After taking the photo, I began walking along the rocks to get back to the path. Bear in mind that these rocks are fairly loose, so you have to be very careful as you step. More than once I tested a rock only to have it slide away, requiring adjusting my route. I was about 8 feet from the path when I stepped on a rock with my right foot. It seemed sturdy enough, so I lifted my left foot for the next step. Just as I did, the rock under my right foot gave way, twisting in a way that threw my weight forward. I tried to regain my balance, but it was impossible on such an uneven surface, and I hit the ground. My right hand and arm took the brunt of the impact, and I felt my head strike a rock. Not a straight-on impact, but more in a glancing manner. I wasn’t sure if I had done any serious damage, but as soon as I started to lift myself back up, there was a generous flow of blood, so I knew it was not just a scratch. I had actually opened a fairly large laceration on my forehead.

The next few photos are graphic, as they show lots of blood and wounds. So I’m going to insert a few pleasant photos first so that if you are bothered by the sight of blood, you can close this post now.

Sample lava rock
A sample of the rock take from Lava Butte, on display in the High Desert Museum.
Photo of me by Linda as I went to find the tree, about 10 minutes before my fall.

OK, if you’re still here, let’s continue the story.

I knew that I would need to get help and likely need stitches, so I gathered up the things I dropped, including my camera, which had survived the fall better than I did! Linda and the others were far away, so I tried calling them. I had no luck at first, but soon they finally heard me. They couldn’t tell that anything was wrong, being so far away. I walked back down toward them, but of course there were other people on the trails, and they were pretty alarmed. One group had a couple of kids, and I didn’t want to give them nightmares, so I tried to laugh and joke about my clumsiness with them so that they would see I wasn’t hurt that badly.

Finally Linda reached me and saw what my condition was. She still had the disinfectant wipes the airlines had given out in her backpack, so she gave me one to use to press against the wound as we made our way back down to the visitor’s center. There was a ranger there, and he immediately realized what had happened – apparently I wasn’t the first to suffer such a fall. He left to get another ranger who is a retired doctor, and while we waited Linda took this shot of me:

At the visitor center nursing my head wound
At the Visitor’s Center, 10 minutes after my fall, all smiles!

When the rangers came back they took me inside and checked me out. She confirmed that the gash was deep enough to require suturing, so she gave us the name of a hospital in Bend that would be able to patch me up.

Attended to by the ranger
Being examined by the park ranger

So we got in the car and drove 30 minutes to the hospital. I do remember the odd feeling of having to sit in the car applying pressure to the wound, and how tired my hands were getting. But we got there eventually, and waited to be seen. The ER was very busy, and I’m assuming that since my injury wasn’t life-threatening, I could afford to wait. So while we were waiting, I asked Linda to take some photos to document just what I had done to myself.

Abrasions on my right arm
Several deep abrasions on my right arm.
Head wound
Close-up of my laceration before they stitched it up

They had someone who introduced himself as the “wound-cleaning guy” who would be getting off all the dried blood and bits of lava from the wounds. Before he got to work they injected some lidocaine around the head wound to numb it, since he needed to be a little rough. He was very thorough, and already I was looking better without all that blood. Now to get stitched up and go home!

Well, not so fast. During that time a couple of ambulances arrived, and the doctors were busy with those patients, so we waited. In fact, we waited so long that by the time they finally came back, the lidocaine had worn off, and I had to get more before they could finish suturing. But when they were done, I looked much better!

Freshly-stitched forehead
My newly-sutured forehead!

Finally we headed home! Once there I was able to very carefully shower to wash all the “pink streaks” out of my hair, and get the remaining bits of dried blood out of my beard. I put on some clean clothes, and threw the bloody garments away – not only were they caked with dried blood, they also suffered many “abrasions” like I did.

While all the hospital drama had been going on, Linda had let our kids know what had happened to me. Afterwards I wanted to reassure them that I was ok, so I took this selfie once I was cleaned up. We were staying at a gorgeous house that had a deck overlooking the Deschutes River, so why not include that view in the photo!

Selfie in front of the Deschutes River
Selfie from the deck of our place on the Deschutes River

If there’s a lesson to take away from all this, it’s this: Lava rocks are hard – don’t mess with ’em! And stay on the paths!!