Had I Known ...

Earlier today I was asked to take a look at a piece of code that was written a couple years ago to solve a very specific problem at a European branch of the day job. It was just a simple Python script that called a series of SQL queries to correct some information that was missed by a sync mechanism between three applications. There was no documentation for how the code was supposed to work, nor was there any specification document providing the gist of the tool. However, being the organization's predictable fool, I agreed to take a look in an effort to discover and fix the reported problem.

Some Python Code

When the .zip file came through I was quick to get started on the debug process. The problem was that, after running well for two years, the code would throw errors galore and quit. In with the source files were some log files, so I started with those and quickly found the cause of the problem. The next challenge would be to resolve the problem, which naturally involves looking at the source code. I fired up a text editor and started digging into the Python, but something seemed a little off with what I was looking at. The coding style and terse comment blocks looked incredibly familiar.

It was my code. The attribution block at the top of the page had been completely removed, and any reference to specific GitHub issues to explain why certain code blocks did what they did were scrubbed, but the code was most certainly from a project that I had written in 2015 to work as an "interim solution" to a problem here in Japan. Locally, the Python project was certainly a short-lived fix. However, it seems that someone shared it with the German team in 2016 to solve a similar problem they were having and this temporary solution became a permanent one.

Less than 20 minutes after receiving the code from my European colleagues, I fired off and email outlining the proper fix to their problem, which would make this malfunctioning code completely irrelevant1. Had I known this fix would have been shared outside of the country, I would have written the tool a little more intelligently. There would be better error checking and more links in the code pointing to the GitHub wiki page where the software was most certainly documented. Then again, had I known this fix would have been shared outside the country, I would have likely followed up with international teams to make sure they did not use the sync hack after a proper resolution to the problem was found.

This does make me wonder just how much of my code has been handed out to the various international teams without my knowledge2. A lot of it was designed for a very specific internal purpose, so I doubt much of it would work elsewhere without a bit of effort.


  1. The problem turned out to be the code was moved to a new server running an incompatible version of Python. I had written the code for Python 3, but the server Germany set up was running an older version.

  2. and my name. Why delete the name of the developer? Why remove GitHub issue numbers from comments? I have a feeling I know who did this, but it doesn't make the unnecessary editing of comments any more understandable.

Babanusa

Working from home means that the boy and I get to spend quite a bit of time together. Today, while I was doing some research on local kindergartens he might attend, he jumped on my lap and started playing with the tablet, which had the maps application open. He understands that "things happen" when you run your finger over the glass, so that's just what he did for several minutes until he stumbled across a city in souther South Sudan that has almost zero information on Wikipedia: Babanusa.

Babanusa, South Sudan

The town appears to be located in the middle of a desert. Its roads are covered in sand. The fences surrounding all of the homes have accumulations of sand on the eastern sides. There doesn't appear to be any source of fresh water within walking distance, but we did manage to find 12 large tanks that are likely used to store the life-giving liquid. According to Google Maps, there are two mosques servicing the community and three small grocers. A handful of small cafes can be found just south of the massive railway junction that dominates the area.

While looking around the town, I started asking questions. Where are the signs of agriculture? Can food be grown here, or is it all imported from communities closer to the river 9km to the east? Are the haphazard-fenced homes outside the main community where the poorer people live? Aside from the railway junction, what are the main industries that keep people busy? There appear to be at least 1,000 homes in the area, so are there more than two mosques? There does not seem to be any signs of high-voltage electrical lines bringing power to the community, so where does everyone's electricity come from?

Following the main road west, there's a whole lot of nothing stretching on for kilometre after kilometre. And then … what looked like a scorched piece of earth where people clearly live — or used to live. There are all the signs of homes, a market, a place of worship, and even a school next door. Yet this place has no name on any map.

Scorched Earth, South Sudan

In my quest to find a name for this place, I zoomed out a bit to get some context for where it's located. When I saw the region, things started to make sense.

This is in Darfur, an area that's roughly the size of Spain and almost completely arid plateau. Whatever this land had once offered to the people living here has been stripped away by the ravages of war. This is why there does not appear to be any developed infrastructure, or agriculture, or even large farms of roaming livestock. It's a part of the world that is so foreign and alien to me that I wouldn't last a week. If one of the various militias didn't kidnap me in an attempt to collect a ransom, the lack of fresh water and food would do me in. The people who live here pay much more attention and are much more resourceful than I will ever need to be.

A lot of this information was kept from the boy, of course. He was just happy to play with the tablet. But while he gleefully tapped and scrolled around the map of a faraway land, I couldn't help but think about the blackened soil around the unnamed communities and wondered whether this was evidence of industry or the consequences of war.

The Time I Almost Died in Lake Erie

Some of the many things that I like about Randall Munroe's XKCD comic is the honesty and intelligence that goes into every strip. His strips can make a person feel sadness for a robot on Mars, make people laugh, change a person's perceptions, and remind you of people you've known (and probably worked with). Today's comic was unique as it instantly reminded me of the time I almost drowned in Lake Erie, the shallowest and filthiest of the North American Great Lakes.

XKCD - Swimming

In the summer of 1992, when Sir Mix-a-Lot's Baby Got Back and Whitney Houston's I Will Always Love You seemed to repeat endlessly on every FM radio station in the area, my step-father's family was having a rather large get-together at Rock Point Provincial Park, which is not too far from the small town of Dunnville, Ontario. The exact number of people in attendance slips my mind but, as my step father came from a rather large family that multiplied to create many more large families, there were several dozen of us playing around on the beach and in the lake. As one of the older kids present, I was expected to be the "life guard" and keep an eye on the people swimming nearby. No problem. Then we started to play a game involving throwing a ball as far as we could ….

The rest of the story can be pretty much worked out from that one line alone.

The ball was thrown too far for any of the younger kids to get it, as they would have been no more than 10. So I swam out to retrieve the object. Getting to the ball was no problem but, when I turned and tried to make my way back, I couldn't make any progress back to shore. I would swim towards land, but see it recede with every wave. In my mind, I needed to push against something to get a little boost. This meant going down to the lake bed and pushing. I didn't think I had gone too far out, so the bottom of the lake shouldn't have been more than two or three metres from the surface.

I was quite wrong.

When I went under, I didn't find the bottom. I didn't find anything but colder water. Lake Erie is said to be a "fresh water" lake, but the green liquid is anything but drinkable. Visibility is less than 50cm on a good day. The light from the sun was completely gone and I was in a world of darkness. I panicked. There were no signs as to which direction was up1 and air was in short supply. My uncle Ron must have seen me go out to get the ball because before the situation got much worse, he grabbed my arm and pulled me to the surface. I didn't even know he was that close.

Someone told me that I must have drank half the lake given how much water was coughed up afterwards. I don't remember the coughing, but I do remember being carried to the beach and put in a plastic lawn chair.

Just like in the comic, I still get a little shiver of panic when I don't realize how deep the water is beneath me. This won't stop me from swimming, but it is a good reminder to pay attention and keep my wits.


  1. I hadn't yet learned about "following the bubbles"; releasing a bit of air and seeing which direction the gas rises. An uncle suggested that later.

Longevity

In January of 2013, one of Sharp's last flip phones became available on SoftBank and my employer snapped up dozens of these for the sales team as well as some members of HQ. When I moved to the IT department in 2015, I was also given one of these in order to be available should any of my systems go down. At first I didn't like having "yet another device" but I've come to appreciate what this simple device offers. Despite its age, the battery still provides enough charge to go 7 days if calls are kept to a minimum. As an added bonus, the sound quality is decent and the physical number pad pushes back when pressed. One final compliment; the phone is "unapologetically plastic". I can't tell you how many times this device has been dropped on concrete, tile, down stairs, and out a window1 without once losing power or cracking somewhere.

So it's probably no surprise that SoftBank has been emailing people who still use this phone to say it's nearing EOL.

Sharp 202SH

SoftBank has said that support for the phone will end on September 30th, 2021 for business accounts, which gives people a little under 30 months to change their phone to something else. Being a flip phone with no data plan, the monthly cost of using this phone comes out to a little under $8 after tax. SoftBank, like the other two major carriers in the country, will not have any new phones lacking a data plan requirement before the end of this year. Even the more modern flip phones from Panasonic, Kyocera, and NEC all run Android. To make matters worse, anyone who buys an older 3G phone with the intention of running it on the network will find their phones inoperable come January 1, 2022. The older technology is being locked out of the network. It's unfortunate, but not at all unexpected.

2G arrived in Japan during the mid-90s bubble, when pagers2 were all the rage, and was phased out of the country in 2010. 3G arrived a decade later and wasn't widely deployed until 2010, when people started buying iPhones and Android devices. In both cases the technology had an operational lifespan of about 15 years. Will 4G and the upcoming 5G technologies see the same timespan?

There's little chance that my next phone will survive the entire operational period of a cellular technology. Devices that use the newer network capabilities will need powerful processors, large amounts of memory, and a bigger battery. For the moment, this means a smart phone. These slabs of glass and silicon can certainly last a long time when treated well, but there's little chance that the software written today will be compatible with very much in the 2030s.

We can hope, though.


  1. Okay, it's only been tossed out the window once. But it was an open window and the phone only flew maybe five meters before hitting the dirt. 10 seconds with a damp tissue and everything was good as new.

  2. These were called "pocket bells" in Japan.

Five Things

The original plan for today’s list was to look at five things I wish I didn’t know, as having the knowledge has generally resulted in a great deal of frustration. The list was mostly written, aside from the fifth item, which I couldn’t really think of. On the list two of the items could have been rolled into a single entry as one only exists because of the other, and the others were poorly justified. Reading through the piece, the post could really have been titled Mountains from Mole Hills, as not knowing these things would not result in a happier, more fulfilling life. If anything, just the opposite would happen very quickly. So why not turn the frown upside-down and look at five things I wish I did know?

Buddhism

From my mid-teens to late 20s I studied and was very much a part of religious communities. First it was with the Roman Catholic Church, until “something happened”. Then it was with the Christian Reformed church. Finally it was Islam, where I had some of the most intelligent discussions in my life with people who have invested decades into understanding not only their own sacred books, but those of other faiths. I learned more about the importance of Genesis, Exodus, and Leviticus while talking to Muslim scholars than from anyone else.

Buddhism, however, is something of a mystery. I’ve read some books on the religion and it’s precepts, but my knowledge is still very shallow. By learning more about this religion, I might gain a better appreciation for some of the historical buildings in Japan as well as the role the belief system had in shaping much of Asia.

The Art of Conversation

There are a couple dozen or so rules of thumb that I try to follow when talking to someone new but, more often than not, I leave a conversation wondering how badly I engaged with the other person. This isn’t for a lack of trying, either. I’m just generally not very good at conversing without a set topic. Perhaps with better verbal and interpersonal skills, I can develop and maintain lasting friendships.

Carpentry

If someone were to present either of my grandfathers with a piece of wood and (nicely) ask that they make something, a beautiful and unique piece of art would be created. Regardless of what it was, be it a birdhouse, a shelf, an old-timey crystal radio, what you would get back would look like something from a luxury store in Ginza1. With this skill, I could take a more proactive role in customizing my house and maybe even help some neighbours with their own projects

Canine Care

There is just one place in a 10km radius that a person can bring their dog to get a proper trim, and they’re not accepting new customers because there isn’t enough hours in the day to take care of everyone. If I want Nozomi to get her claws or fur trimmed, I need to take her 12km to the place she’s gone since the age of 2. If I could do this, then Nozomi wouldn’t have to go so long between visits and I could maybe help other dogs in the neighbourhood when they need a little bit of care, attention, and pampering.

Rocket Science

Who doesn’t want to know rocket science? With a better understanding of the conventional technologies that are in use or active development today, it becomes possible to seriously examine some of the less-conventional — or downright unconventional — means of propulsion in space.


  1. This is generally seen as “where the wealthy shop in Tokyo”

Thrum

Snoring tends to be a problem for everyone but the snorer, which is why I generally sleep in a separate room from Reiko and the boy. All in all, this setup works quite well. On the days when I work well past midnight there is little chance of me waking people as I enter the room and climb into bed. Also, by not subjecting people to the sound of my snoring, the family can wake up in a much better mood than if I’ve been disturbing their sleep for much of the night. As there are three bedrooms in the house, I’ve decided to sleep in the “spare” that exists in the event Reiko and I have another child or invite someone to stay with us for a while. Also in this room are the servers and hard drives that power 10Centuries and the robust home network infrastructure. This means that every night I am lulled go sleep by the thrum of spinning hard dives and the occasional whine of a processor fan.

It’s like music to my ears.

In the late 90’s I was renting a basement on the east side of Hamilton1 and, as one would expect, I had a trio of computers running 24-hours every day. This was at a time well before the average person could afford solid state storage, so there was always the sound of multiple hard drives powering up and down depending on what was happening, power supply fans, processor fans, and large case fans. An endless cacophony of noise that would drive my parents to complain. However, I had always found the sound to be incredibly soothing.

Read/write heads inside a hard drive are mounted on the end of actuator arms that make a high-pitched sound as they moved from place to place across the disk. The 80mm case fans in the 90s could be made variable depending on the ambient temperature inside the box, so these would occasionally spin up or slowdown. If I were listening to a CD, the drive would spin up every time it finished the last track. These sounds, as ridiculous as it may seem, calm me in ways that meditation CDs simply cannot.

Laying alone in the spare room less than three meters from two servers, a 72TB NAS, a UPS, and some networking equipment is the perfect finish to any day of the week. The responsibilities and expectations from family2 near and far, as well as those from colleagues and clients, completely slip away when I’m in the room, laying on my bed, and just listening to the thrum of spinning hardware. I worry that this luxury will not be possible in the future if all storage is flash-based but, until that happens, I’ll enjoy every moment of this modern rhythmic hum.


  1. Not too far from where my father and I lived for seven years before he remarried, as chance had it.

  2. I include Nozomi as family. Her canine genetics do not bother me in the least.

APIs as a Service

Over the last couple of months I've been investing a good amount of time into research and planning for my upcoming push into self-employment. Some common concerns involve questions like "How much money needs to be earned every month?" and "What are the expected monthly operational costs?", but the biggest question has always been "What can I offer that people actually want?". A couple of projects have been outlined on this site in the past, however it seems that one of the most common solutions that I am providing to clients has been absent from consideration: APIs.

Modern C++

When I sit and think about it, I build an awful lot of APIs. Here are some of the more interesting solutions that I've built at the day job or for clients in the last two years:

  • library management
  • pedagogy and digital textbooks
  • online skills training
  • Proprietary CMS ⇢ Salesforce sync middleware
  • Proprietary LMS ⇢ Moodle sync middleware
  • Weather station data collection (for IoT devices distributed across forests in Japan and Thailand)
  • ISBN book catalogue (with an emphasis on textbooks and other learning materials)
  • Email ⇢ Evernote sync middleware
  • restaurant inventory management
  • and many tiny, single-function resources

This seems to be where I'm investing a great deal of my time, building tools that interact with systems, but are generally not seen1. Is this not the area that I should be looking into developing and expanding?

One of the reasons I make these APIs is because the reasonably-priced options that already exist in the world have glaring issues with consistency, or completeness, or are simply far too complicated to be used within the imposed request limitations. As for the unreasonably-priced APIs … I don't get to play with those very often as they're generally cost prohibitive, even for larger corporations.

There are two APIs that I've been thinking about building to solve some of the data organization problems around podcasts and RSS feeds, which are very similar in many respects. Thinking through the sorts of tools that people might actually want, this would make more sense than creating yet another MySQL client.

This is something I need to seriously consider this weekend.


  1. I do occasionally build things that have a web interface, but these UIs are more functional than beautiful. Fortunately there is always ThemeForest to help meet a design deadline for under $20.

Tired of Friction

This week has seen a couple of changes to my digital tools as I try to get back to basics, reducing the friction that gets in the way of productivity. macOS has been reinstalled on my personal notebook. Evernote has been re-installed and is receiving some documents to keep track of and index. The Lenovo X1 Carbon notebook, like the W541 upstairs, has been turned into a server. For the last couple of months there has just been too much friction involved with the day-to-day, and I've spent far too much of my time working around problems that shouldn't exist rather than focusing on the work in front of me.

The Workspace

So for the next little bit, I'm going to try this setup again. Closed software that I can generally trust to do the job its hired to do, with the cross-platform compatibility that I generally rely on to meet deadlines and deliver results.

If I later regret the decision, it will not take very long for me to restore the Lenovo notebook back to a development machine thanks to the backups that were made1.


  1. and tested. You do test your backups, don't you?

Mario's Castle

There's a park not too far from my home that the boy and I enjoy going to once or twice a week. This particular play area has a lot of the standard equipment that one would expect to see in a place designed for children, such as swings, slides, and see-saws. What makes this place unique, though, is its "Mario Castle".

Hill Park

At the top of a hill is a castle with red bricks. There are tunnels underneath, ladders that take you to the top, and a 30-metre slide that will bring a person down to the walking path below. Whether this glorious fort is actually called Mario's Castle is up for debate, but this is the name that I call it given that it reminds me a lot of the castle in Super Mario Brothers for the NES.

Another Look at Mario's Castle

In front of the castle is an elaborate play area that includes a number of slides, tubes, rope bridges, and even a zip-line. All the things that I would have absolutely loved had there been something like this around my home when growing up. Fortunately I can take advantage of my role as a parent to act like a kid. The boy and I are often the only people under 50 in the park when we visit, as most kids would be in school at the time. This gives us free reign on all of the equipment.

Slides and Tubes

One of the many things that I find interesting about being 40 is that I don't feel 40. My muscles and joints do not ache nearly as much as my parents said theirs ached at my age. I can still run and jog for several minutes before breaking a sweat. Climbing isn't an issue, nor is lifting my body up onto a rope bridge from below … which is something that would probably result in a broken leg if I didn't do it right. Generally I believe my body to be healthier and in better shape today then it was when I was in my 20s1, which makes it easier to keep up with the boy as he runs from place to place, packing as much fun into every 60-second block of time as possible.

This year in our adventures, the boy and I have visited 17 parks around the neighbourhood (and surrounding neighbourhoods). This one here, with Mario's Castle, is by far our favourite. One day we'll need to drag Reiko along and have a nice picnic under one of the lush trees.


  1. There are a lot of differences between my body today and my body 20 years ago, such as the amount and type of food that I can consume in one sitting. For the most part, though, it's better.

Magic and Math

Earlier today a number of updates to 10C rolled out to fix a handful of bugs and introduce new functionality in both the API and the Social site. While the features are certainly nice, one of the most rewarding aspects to today's release is seeing the average CPU load on the web server drop from a pretty steady 1.1 to just 0.28. Memory usage is down as are response times. Today's update saw the next push to use the system's MySQL database engine more like I would SQL Server.

I've been on record to say that SQL Server is the best relational database engine on the planet and I stand by this assessment. It's incredibly fast, powerful, and comes with a slew of excellent tools that I find to be incredibly reliable. Licensing and other aspects can be quite complex at times, but the technology itself is rock solid. For a while, I actually had 10Cv5 running completely off a SQL Server on Linux installation during the year-long alpha period, but opted to change the database engine to something a little more common in the open source world.

MySQL is an interesting tool in that it powers a lot of the Internet, is relatively easy to set up, and doesn't cost a dime. I've been using this database engine for 15 years and seen it develop quite a lot over this period of time. One area where it has seriously lagged behind SQL Server is with the performance of stored procedures and triggers. These programmable objects were just slow and easy to break in the MySQL 5.x versions, which meant that a lot of people — myself included — would write their web applications to use a series of ad hoc queries that are created in the API layer and passed to the database when needed. The more recent 8.0 release of MySQL has completely changed this paradigm. The database engine is faster. Memory is better used. Indexes remain in memory longer. All in all, I feel that 8.0 is the best release of MySQL there has ever been.

Since the beginning of v5's planning, I wanted to make more use of the features and functions that are found in a traditional relational database management system. Objects like triggers, views, and stored procedures are excellent tools to enforce consistency in a database at the database layer, freeing up the API layer to be more of a communications bus than anything else. Triggers were relatively easy to set up on the tables and they're providing some of the much-needed functionality to keep people's data safe and organized.

One area that I've stayed away from until recently has been stored procedures. In SQL Server these are wonderfully powerful objects that allow for a series of complex operations to take place completely in the database before a set of data is returned. In the MySQL 5.x versions, a stored procedure could be used for a complex task but was often slower than simply sending an ad hoc query and processing the results in the API middle layer. With version 8.0, this resistance is no longer necessary. Stored procedures in MySQL 8 rock. They're incredibly fast, reliable, and require less memory and fewer disk reads on average than sending a raw query string to the database. The change has been night and day, and it's reflected in the load times across the myriad of sites and services powered by 10C.

Being able to use stored procedures with 10C and not battle with a performance hit is going to completely change how I write this application and how people who choose to self-host administer the software. If MySQL continues to see the sort of improvements witnessed between 5.7 and 8.0, then other relational database engines will need to see similar changes in order to keep up.