Orange Remotes

Remote controls should be easier to find.

Remote controls should be easier to find.

All remote controls should be blaze orange. It was never a problem until I began living with other people. Nobody puts the remotes back where they belong.


Kathy Canary's Obituary

My mother passed away last week.

My mother passed away last week.

Kathryn (Kathy) Carroll Canary
January 13, 1943 – December 13, 2024

Born Kathryn Ann Carroll on January 13, 1943, in Wilmington, North Carolina, to David Shields Carroll (1917–1992) and Mary Kathryn (McGuire) Carroll (1918–1960), Kathy Canary passed away on December 13, 2024, in Raleigh, North Carolina. Kathy grew up in Memphis, Tennessee, and moved several times, living in Virginia, Florida, and North Carolina. She held a bachelor's degree in Elementary Education from the University of Tennessee, Knoxville. She married Hal Winchester Canary (1943–2018) in 1966, they were married 52 happy years with their only child born in 1978.

Kathy will be remembered for the joy she found in teaching and volunteering. She was a talented artist and enjoyed painting landscapes, botanicals, and abstracts. She adored her son, granddaughter, and grandson.

Kathy is survived by her siblings David S. Carroll, Jr, of Memphis, Tennessee, and Elizabeth (Carroll) Busch of Burke, Virginia, as well as her son Hal W. Canary, III, of Durham, North Carolina, and grandchildren Margaret R. Canary and Thaddeus W. Canary.

A visitation followed by a burial service will be held at Memorial Park Cemetery (5667 Poplar Avenue, Memphis, Tennessee) on Saturday January 18, 2025, at 12:30 and 1:30 p.m. One may make a donation in Kathy's memory to Arts For Life of North Carolina (artsforlifenc).


Python Object JSON Encoder

How to JSON-encode any Python object.

How to JSON-encode any Python object.
#! /usr/bin/env python3

import json

class ObjectEncoder(json.JSONEncoder):
    def default(self, o):
        try:
            super().default(o)
        except:
            return vars(o)

class Example:
    def __init__(self, x, y):
        self.x = x
        self.y = y

print(ObjectEncoder(indent='  ').encode(Example(42, 24)))

This produces:

{
  "x": 42,
  "y": 24
}

Tariffs

devil's advocate

devil's advocate

One could make the case for high tariffs on trade goods.

  1. Some of our trading partners, such as China and Saudi Arabia, have terrible human rights policies. We could limit trade with these countries as a signal that we disapprove. To be effective, we would promise to reduce tariffs when their human rights situation improves. And we would need to apply the same rules with every nation.

  2. Global trade has some downsides. It is a major contributor to climate change. Regions of the world should be more self-sufficient. We should "buy local" to support local workers.

That said, any changes to tariffs will have a ton of bad consequences in the short term. The best approach is to schedule a slow increase of rates over decades, not to unilaterally impose large rates immediately. It took decades for the current global economy to form; I expect it would take a similar time to make major changes without disruption.


Missing Emoji

Someone should design an emoji that means "thank you". I generally use "👍︎", but I'm not sure that that is the most unambiguous possibility.


Golang Pitfall

Go does not have references.

Go does not have references.

In C++11 one might do the following:

struct Foo {
    int Value;
};

void f() {
    std::vector<Foo> foovec;
    //....
    for (auto& foo : foovec) {
        if (foo.Value > 10) {
            foo.Value = 10;
        }
    }
    //....
}

However, in Go, the following contains a bug:

type Foo struct {
    Value int
}   

func f() {
    var fooslice []Foo
    //....
    for _, foo := range fooslice {
        if foo.Value > 10 {
            foo.Value = 10
        }
    }
}

What I wanted to do was the following:

    for idx, foo := range fooslice {
        if foo.Value > 10 {
            foo.Value = 10
            fooslice[idx] = foo
        }
    }

Git Unstage

Unstaging is the only git action I can never remember.

Unstaging is the only git action I can never remember.

For reference, it is:

git restore --staged FILE[S]

Text-only skymap

Just a list of brightest objects in the sky.

Just a list of brightest objects in the sky.

Sometimes, when I want to quickly identify the planets I see in the early evening and before dawn, the planetarium/sky map app on my phone is sometimes harder to use than I want.

I would love to have an website that uses your location and the time to list the brightest dozen objects in the sky right now, along with current azimuth and altitude.

Living in the city, I can barely see few dozen stars anyway.


Using A Theorem Prover

I reccomend the Lean4 Natural Number Game.

I reccomend the Lean4 Natural Number Game.

I was playing around with the Lean4 Natural Number Game. (Via this discussion.) I really like this way of doing mathematics. Maybe in the future, all upper-level math classes will use this software for homework. And all math papers too (Professor Tao is working on formalizing his papers in Lean4!)


Building a Better House.

Houses should last for hundreds of years and be easy to inspect, maintain, and upgrade.

Houses should last for hundreds of years and be easy to inspect, maintain, and upgrade.

I think about this all too often.

"How to design a house to last 1000 years" by Brian Potter.

"The Perfect Wall" by Joseph Lstiburek.

Oh, and sofas too.