Rubik’s Cube

I taught my daughter how to visualize and calculate volume using one of my Rubrik’s Cubes tonight.

Since school ended I June, she and I have covered most of the fifth grade math curriculum and some of the sixth grade math curriculum, too. We are just starting volume calculations, and still need to cover measurement unit conversions and graphing on a coordinate plane. Geometry is where things get tricky.

She told me tonight she wants to get 100 on all her test so she could move up to the highest math level at the end of the year. I think she can do it, as long as the school will let her.

JSON with my son

To my surprise, my son1 asked me to teach him how to use JSON in Python today. His grandfather showed him JSON files from his website earlier today, and now my son is mad for reading and writing JSON himself.

We graduated from Turtle graphics to data structures and file I/O. I introduced to him Python dictionary and the list, showed him how to converted both to JSON, and then showed him how to write the JSON to a file. In Python, it is very easy.

My wife is looking for computer science courses for him now.


  1. Who is 5. ↩︎

Impulse purchase: Kobo Clara HD e-reader

I just impulse-purchased a Kobo Clara HD. I hope it wasn’t a bad decision.

I need an e-book reader only for a few weeks each year, during my summer vacation, which is coming up soon. I have an old Kindle, which I trot out annually to read outside with during my vacation, but its lack of a backlight and its low resolution make it hard to read in way too many places—not just indoors, but outside in the shade as well. It is disappointing in every way.

I probably should have purchased a Kindle Paperwhite during Prime Day instead, but I don’t want another Kindle. I want something that handles ePubs natively, can side-load fonts, and can interface with my local library. The Kobo fits all these criteria.

It will be delivered as soon as tomorrow. I’m excited to take it for a spin.

🎧 An update on the Sony WH-1000M4

A little while ago, I bemoaned that the Sony WH-1000M4 headphones were disappointing to me. I’m happy to report they have been working pretty well as my gym headphones. The fit is pretty good (they don’t fall off unless I’m practically upside down) and the sound plus noise cancellation are more than adequate. The creakiness I observed when they were brand new seems to have gone away. My only complaint is that, when I bring my iPad with me to watch TV shows while doing cardio, it can be a pain to get the headphones to connect to it. They seem to want to connect only to my phone.

My gym almost never plays music, which is great because everybody wears some kind of wireless headphones there. I mostly see AirPods Pro around the gym, but a few people have the AirPods Max, and I wish I did, too. Their tighter fit and punchier sound, compared to the Sony WH-1000M4, would be welcome. A handful of other people at my gym use the same headphones I do, so I don’t feel crazy for not using purpose-built workout headphones there.

🎵 Today’s listen, Stop the Clocks by Oasis. It is a greatest hits album that is supposedly curated by the band to resemble on of their live show setlists. It is all the Oasis I need, and maybe a bit more.

I am excited to teach my daughter division by unit fractions this evening. I have been telling her that multiplication and division, much like addition and subtraction, are inverse functions. Now I get to show it in action, and it may blow her mind.

📺 I very much enjoyed Stranger Things season 4. After I finished it, I re-watched seasons 1 and 2 (so far), which I have not seen since they debuted. I think they hold up well and I liked them even better than the first time I watched them.

I don’t use Drafts anymore even though it used to be my all-time favorite iOS app. It became way more than I need it to be. Ulysses and Apple Notes have completely overtaken it for writing, and I don’t bother using it any more to create calendar events or execute searches.

Learning with VS Code on Chromebooks

My son needs a Chromebook for school and a computer to run Visual Studio Code in. I kind of want to get him a MacBook Air (which can run Chrome), but one is too expensive. I kind of want to get him a Linux laptop (which can also run Chrome), but that is likely not going to work 100% right. Why not get him a Chromebook and install Visual Studio Code on it? That might be the best and cheapest solution.

🎮 Today’s listen: The London Suede and Similar Artists Station on Apple Music. This is probably a personalized BritPop playlist. I’m discovering a lot of album cuts I didn’t know about or bother listening to in the 1990s. Also, I now think Blur holds up far better than Oasis.

Pilcrows and silcrows

I have been writing and editing documentation all week—so much so that I have been dreaming about applying styles to text in Microsoft Word.

Today I really got deep into the minutiae of Microsoft Word and legal citations. I was delighted to find an online guide called Typography for Lawyers, which not only has lots of useful tips about typography, but also tells you how to do it in Word, Mac OS Word, and WordPerfect. Its pages helped me get a handle on things like inserting pilcrows (¶) and silcrows (§) correctly, which (as I suspected) includes entering nonbreaking spaces after them.

I now know the Word keyboard shortcut to insert nonbreaking spaces (Control+Shift+Space in Word). I doubt any of my coworkers even know what nonbreaking spaces are.

PeaZip

At work, I rely on compression to keep my hard drive from filling up with huge data files that I need to work with and keep for the duration of a project. Because I mainly care about saving storage space, when it comes to file compression, I care mostly about compression ratio and only secondarily about compression and decompression speed.

Over the years I have become somewhat of a file compression nerd. To that end, on a whim today, I uninstalled my longtime favorite archive manager, 7-zip, from the Windows machine I use for work and installed PeaZip in its place.

PeaZip is a front-end to a host of open-source file compression methods, including old stalwarts like Zip and 7Z, and also newer entrants such as ZPAQ, Zstandard, and Brotli. These newer methods offer higher compression ratios, greater speeds, and differing trade-offs between the two.

PeaZip’s main benefit over 7-zip is its far-nicer file manager interface than 7-zip. Its nicer UI has never been enough to entice me to switch from 7-zip, but I made the switch to try out Zstandard (primarily) and ZPAQ. With the data I have on hand, which is mainly data files in text format, I found that ZPAQ offered the best compression ratio (which is the most important thing to me), but that 7Z offered almost the same compression ratio while being the non-Zip format I am already used to using1.

This surprised me, but it is good to know because my usage of PeaZip may be limited. While PeaZip has a nicer interface and more features, it is slower to launch (even to create an archive), and it lacks 7-zip’s integration with the Windows File Explorer right-click-and-drag handler. If I am going to use it primarily to make 7Z archives, and rarely use its file manager interface because I use its the Windows File Explorer right-click-and-drag handler, PeaZip does not offer me any features I really care about.

I am still curious about Zstandard, and will continue to explore how I can use it to compress my data files more quickly, but with better compression ratios, than 7-zip and Zip do.


  1. This observation is likely not true with other types of data. I would not extrapolate it to other situations. ↩︎

🎵 Today’s listen: I Miss Britpop. Because I do.

Everything takes longer to do than I expect

A miser knows the price of everything and the value of nothing. I feel that way sometimes about the people tracking my time at work. The thing is, they don’t bother me about how long it takes me to do my work. I bother me about it.1

A constant source of frustration for me is that everything I do takes longer than I expect it to. This is true whether I am doing something for the first time or the hundredth. I try to build it into my time estimates, but it is often impossible to guess how much time may be wasted on overcoming a technical setback. Most of my coworkers don’t have technical setbacks, per se. They are working primarily in Excel and Word rather than creating databases queries and analytical scripts. Consequently, they don’t understand how difficult it is for me to make time estimates. I can’t possibly create an accurate estimate of how much time I could lose to a bug I created, some analytical framework not working as promised, or the speed of a database or a network share being far slower than expected.

It also bothers me that it takes me the same amount of time to do a lot of my work as it did ten years ago. It isn’t because I haven’t gotten better at my work; the quality of my work is better, but adding that level of quality takes more time than doing the work in a slapdash, non-repeatable, non-controlled way. This kind of thing is true in my hobbies, as well. I can’t solve Sudoku puzzles or crosswords must faster than I could years ago. While solving quickly isn’t necessarily the point of doing puzzles, it makes me feel that I have plateaued in my abilities and possible cannot get any better.

I suppose, as I have gotten older, I have learned to be considerate and to care about quality over speed. Unfortunately, the world, I am afraid, still values the glib and quick over the thoughtful and slow.


  1. The calls are coming from inside the house. ↩︎

The beautiful, overwhelming vastness of the universe

The first public image from the James Webb telescope was made public today, and it is amazing. From the article:

Thousands of galaxies – including the faintest objects ever observed in the infrared – have appeared in Webb’s view for the first time. This slice of the vast universe covers a patch of sky approximately the size of a grain of sand held at arm’s length by someone on the ground.

Wow.

Common Table Expressions

Early in my career, I ended up working on Microsoft SQL Server projects as a software developer and a business analyst. Over several years, I became an expert1 in data modeling, performance tuning, ETL, numerous database connection options, numerous database programming libraries. Even after I left my software development job behind, I wrote queries and developed metadata layers for analytical reporting. Over that time, I wrote a ton of SQL queries, and I had a very opinionated way of structuring them, which was essentially clean ANSI SQL.

When I moved to audit, I had no use for SQL for years. Consequently, I did not keep up with Microsoft SQL Server for years. When my job became more technically oriented again, I was surprised to learn that SQL—or at least Microsoft SQL Server’s support T-SQL language—had evolved. One of my favorite features, which premiered in SQL Server 2005, but I was late to learn about, is common table expressions, or CTEs. Learning CTEs changed the way I write queries entirely.

Conceptually, a CTE is a temporary table based on a SQL query. Practically, CTEs let you break up a complex query into several simpler ones. I like to consider each CTE to be a step in a multi-step process that builds the dataset I need.

CTEs are very useful when you want to create a calculation and then group on the calculated value. Without CTEs, you have to copy/paste the entire calculation into the GROUP BY clause, which is error-prone and confusing to read. With CTEs, you can filter the data in one step, then make your calculations in another step, then group by the calculated values in the next step, then sort and select the top 10 calculated values in the final step.

From a performance standpoint, SQL Server optimizes the query you type in. Behind the scenes, it doesn’t actually create a temporary table for every CTE you create. That means that there is usually no, or negligible, impact to using CTEs in your queries.

Now, all but the simplest queries I wrote are a collection of common table expressions. Once you understand what they are, they make complex SQL queries a lot easier to reason through when writing them, and a lot easier to understand when reading them. In my field, audit, understanding the query and being able to reason about its correctness is often the most important consideration.


  1. A local expert, at least. ↩︎

Azure Data Studio

One thing I learned today is that Microsoft essentially made a fork of Visual Studio Code and customized it for database work. The app is called Azure Data Studio. Out of the box it supports Microsoft SQL Server, including non-Azure-hosted versions, despite its name. With an extension, it supports Postgres, too.

Oh, Schiit

My Schiit Magni 3 amplifier is acting up again. Tonight it is ground loop hum. Before tonight, it has been annoyingly sensitive (that is, it pops loudly) to the tiny amount of static electricity generated by my feet scuffing the low-pile carpet when I rise from my chair. When I stand up while wearing my headphones, it pops very loudly, which is painful to my ears, and then it will hum angrily the rest of the day.

When the Magni 3 works it is sublime. Unfortunately, I can’t always use it due to electrical issues, and I wonder if the popping problem could blow out my headphones someday. Early in its life it got fried and I had to RMA it. I’m not sure it is worth spending $80 or more for a power conditioner to try to fix it. I think it may be more trouble than it is worth.

I was delighted to learn this evening that I could install the excellent, open-source database Postgres on my Mac by downloading a simple app bundle—Postgres.app—and copying it to my Applications folder. In contrast, installing SQL Server on my Windows machine at work was a big deal.

🎮 Ori and the Will of the Wisps

Over this past week I played through Ori and the Will of the Wisps on the Nintendo Switch. It is a challenging Metroidvania with beautiful graphics and a moving story. I highly recommend it—especially if you enjoy platforming challenges. The way that Ori moves, jumps, bashes off enemies, and launches into the air is pure delight.

I had purchased the game almost two years ago when it first came out, and abandoned my save file because the game kept crashing. I had hoped the game would be patched so it no longer crashed, but that did not happen. On this play-through, the game crashed five or six times. Fortunately, I didn’t lose any progress when it did.

ETL with Python

I have been experimenting with writing ETL (extract, transform, load) scripts in Python for work. The scripts were mostly fun and easy to write, but the outcomes have been disappointing: unacceptably slow load times.

I usually work with an instance of SQL Server that runs locally on my computer. I use it for data collection, analysis, and reporting, and have never needed a shared server. In the local environment, I have always loaded .csv files to staging tables via BCP or the BULK INSERT command in T-SQL scripts; then I use T-SQL queries or stored procedures to load the data into the destination tables. This approach is very fast, but it only does “L” part of ETL (load). It also doesn’t work for remote databases, unless I have access to a filesystem that database server can read.

A Python script using a library such as PETL or Pandas, on the other hand, can do the whole thing: read a file in from just about any file format, transform the rows and columns in various ways, then load it into the database.

Lately I have been working with various databases that are stored somewhere in the cloud. They are the slowest databases I have ever worked with, and I don’t have access to the filesystem they can BULK INSERT from. Writing an ETL script lets me work around that problem easily. By far the hardest part of writing my first ETL scripts with Python was getting working SQL connection string. (I think that part would have been a cinch if our database was something open source like PostGRES.)

Unfortunately, my simple ETL script could load a table at the rate of 5 records per second, which is comically slow. At that rate, our data will take days or weeks to load. I’m not sure what the bottleneck is. It is probably slow network transfer time on top of a hugely sub-optimal data insertion method on the database side. I think that, in the end, it may not be worth figuring out. I should probably try a better tool for the job.

Dependence Day

On Independence Day, we Americans celebrate throwing off the yoke of tyranny of the British Crown and declaring that we, and all people, have certain inalienable rights under natural law.

The Supreme Court has made a mockery of this idea in its recent decision Dobbs v. Jackson. Now we are being led to believe that our natural rights are not natural at all. Instead, they depend on national tradition—specifically what the Supreme Court majority deems to be national tradition.

I refuse to believe that our rights should depend on the whims of a small group of unelected officials. It’s not much better than living under a monarchy.

📺 Stranger Things season 4 really clicked for me. Sure, it has some clumsy bits and didn’t serve half its characters with a real story, but overall I was hooked from the start and loved every minute of it.

Summer computer science

I started teaching my son Python turtle graphics this week. He’s only 5, but he is absolutely mad for computers and is thrilled to get to use them to do something.

I first learned to program using turtle graphics in Logo when I was in third grade. It was back in the 1980s, when computers were too expensive for my family to own, so it was also the first time I ever used a computer. My mom signed me up for a class at the local community college. We all used Apple IIs in the computer lab, which were probably old even then. Most of those machines had green monochrome monitors, and all of them had two 5.25” floppy drives. Now, of course, he is using my old MacBook Pro on my couch, and coding with Python in Visual Studio Code.

We have been working through some simple exercises, like finding different ways to draw a square. He understands looping already, and asked how to create an infinite loop to draw the square (and watch the turtle move) endlessly.

He and I are progressing very slowly, mostly because he asks lots and lots of questions, and partially because he is interested in doing things with turtle graphics that I was not prepared to teach him. (I had planned to teach him to draw lines and shapes. He is more interested in turning the turtle into a rocketship and moving it all around the screen.)

He is getting it. I installed Pythonista on his iPad last night, and this morning he used it to write a Python program all on his own, starting with:

from turtle import *

It’s pretty cool.

Summer math

It took a few days of cajoling, but I somehow convinced my daughter to study math with me over the summer—at least until we go on vacation in about a month. We are going through a “step up to fifth grade” packet that her math teacher gave us. I am making up my own problems based on the material and challenging her to think mathematically, too. She is an A+ student in the middle level of math in her grade, but she has been unable to pass the school’s rigorous, though largely arbitrary, criteria to gain entry into the highest level. I am hoping to be able to help her break through whatever glass ceiling the school is imposing on her. Our math studies have been a very rewarding part of our day.