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.


Can the US House of Representatives function without a speaker or with a speaker with limited power?

A way to let the house pass any bill that gets enough votes, without leadership involement.

A way to let the house pass any bill that gets enough votes, without leadership involement.

Can the US House of Representatives function without a speaker or with a speaker with limited power?

Expanding on a previous thought.

The house should adopt a new method of passing laws & resolutions:

  • There will be a server that anyone can read from and any member of the house can upload a proposed law to.

  • Any bill that passes the Senate is immediately uploaded to the server without modification.

  • The text of the bill will then be hashed to produce a cryptographic checksum used to identify a law.

  • Any member can amend (modify) a bill, which produces a new identifier.

  • Any member can vote in favor of any bill (identified by checksum) electronicly via secure methods. That vote is public.

  • Any member may un-vote for a bill they have already voted for via the same procedure. This action also goes into the public record.

  • If a bill gets 218 (=floor(N/2)+1) votes in favor (at the same time), it is passed the house and sent to the Senate.

  • Bills are deprecated at the end of the term. There may be other ways of deprecating a bill.


“Rule number one, never carry anything you don’t control.”

On using networked computers you don't understand.

On using networked computers you don't understand.

“Rule number one, never carry anything you don’t control.” (See Andor.)

How would one follow this advice in this world?

One would need only computers with a 100% open source stack. Including hardware.

Imagine starting with a mass-produced phone-sized touchscreen and battery that contained zero processors. You would then build a computer that plugs into that and screws onto the back. That would be your smartphone. You control all processors.

Imagine a RaspberryPi-Zero-style RISC-V computer that was 100% open on every integrated circuit. you could use that as the core of your fully-secure smartphone.

You would need to reverse-engineer a bunch of currently-opaque hardware that's hidden in special-purpose chips. E.g. cell network antenna drivers.

I would also build the hardware such that a led lights up whenever a camera or microphone is enabled, without the ability to change that in software.

And the software stack would need to be controlled by a non-profit with a long history of respecting users. Maybe Debian? I'd love just to have a phone that runs Debian!

It looks like there are several raspberryPi-based phone designs out there. My main problem with that is that it uses processors made by Broadcom Inc. These system-on-a-chip processors are wonderful technology, but the hardware is closed-source, and has closed-source firmware and graphics drivers.

Discuss: https://mastodon.sdf.org/@hal_canary/109710865869979581


Tears of The Kingdom

Zelda's new game is all right!

Zelda's new game is all right!

Lindsay and I are enjoying playing Tears of The Kingdom. (I do wish I could find a multiplayer game we could play at the same time instead od passing the controller back and forth.) She sent me this funny comic about it: https://artsekey.tumblr.com/post/719772231676444672.


Happy 15th birthday, Lulu!

Lulu on a walk. Old 20-lbs dog


Simple Command-Line Mastodon Status Poster!

I wrote a thing. Link to gist.

I wrote a thing. Link to gist.

MastodonStatusPoster.go

Discuss