This feed omits posts by jwz. Just 'cause.

US citizens: call on Lula and Brazil to be the world's climate leaders in COP 30 next year.

Posted Sat Dec 21 10:38:11 2024 Tags:

I'm looking for speaking invitations for a trip in January and February that will include some part of Europe, then India, then some other part of Europe.

The first visit to Europe will be roughly Jan 16 to 22. The visit to India will start Jan 22 and can continue into February. The second visit to Europe will be after that. Those dates are flexible.

One advantage of this period for you is that the intercontinental flights are already covered, so you won't need to pay for that.

If you are interested in inviting me, and you have a venue to use and a public to invite, please email me soon with "speaking invitation" in the Subject field, using the name rms and the host gnu dot org.

Posted Sat Dec 21 10:38:11 2024 Tags:

* A strain now circulating in dairy cows appears to carry little risk for humans at present, but we need to develop an effective strategy before it mutates*

In particular, we will need vaccine for whatever strain becomes a threat. Now the US faces the danger that crazy politicians might forbid this.

Posted Sat Dec 21 10:38:10 2024 Tags:

Mangione's political views are a mixture of right-wing and left-wing, and he has crystallized hatred of US medical deinsurance companies among both sides. Right-wing leaders are trying to attach that to "wokism", but it doesn't stick.

In fact, most Deinsurance in Congress and most Republicans in Congress are plutocratists, and that goes double for the wrecker. If you want to find an official, or candidate who seeks to put an end to medical deinsurance, you'll find that progressive Democrats stand for this.

I've said that Biden is 1/3 progressive. He has a history of trying to reduce medical deinsurance, but he did not push to go all the way by instituting a universal medical system.

Posted Sat Dec 21 10:38:10 2024 Tags:

* Rainfall patterns are changing, crops are ripening earlier, and the normal rhythms of farming have fallen off — exactly as climate scientists warned.*

We are already encountering the next step, which is shortages of some foods. That can lead, some years later, to mass hunger and eventually to mass death and breakdown of society. My addition to this forecast is the end of globalized manufacturing and the loss of all high technology. You and the hundred people in your fortified farming village won't be able to make ICs or solar cells, thus soon no computers and no electricity.

You won't even be able to keep the local all-devouring weeb from taking the land away from you. Sure, you could cut it and uproot it in any particular small area. However, doing that in a large area will take too much work, especially when the only power available is muscle power.

Posted Sat Dec 21 10:38:10 2024 Tags:

US citizens: call on the Senate: don't allow the wrecker to make recess appointments. Don't abdicate your duty to vet the wrecker's nominees.

Posted Sat Dec 21 10:38:10 2024 Tags:

US citizens: call on Congress to oppose any cuts to, and any efforts to privatize, Social Security and Medicare.

Posted Sat Dec 21 10:38:10 2024 Tags:

US citizens: call on Biden to Pardon Edward Snowden and Julian Assange.

Posted Sat Dec 21 10:38:10 2024 Tags:

The bully is trying to bully the judge who refused to dismiss civil claims against him.

Posted Sat Dec 21 10:38:09 2024 Tags:

The Signal client's own code is free/libre, but it farms out some activities to Google services. Depending on what Signal uses each of those services to do, using it might be SaaSS, which is as subjugating to the user as locally running a nonfree program.

I don't use Signal, because it is almost impossible to make a Signal account without having a cellular phone, so I can't. Since I can't use Signal, I don't try to learn anything else about it. I know almost as little about the specific Google services named in the article — I don't have a Google account, and most of its services require the user to run nonfree client software.

As a result, I don't know whether it is possible to get some real use out of Signal without using the Google services listed in the article, or whether the job each one does constitutes SaaSS.

I can correct two errors made in comments in that page: (1) free software is a matter of freedom, not price and (2) Android is contains nonfree components, and has contained them since almost the beginning.

Posted Sat Dec 21 10:38:09 2024 Tags:

Different sports have different attitudes to rules changes. Most competitive sports get constant rules tweaks (except for baseball, which seems dead set on achieving cultural irrelevance). Track and field tries to keep consistent rules over time so performances in different years are comparable. Poker has a history of lots of experimentation but has mostly been a few main variants the last few decades. Go never changes the rules at all (except for tweaking the scoring system out of necessity but still not admitting it. That’s a story for another day). Chess hasn’t changed the rules for a long time and it’s a problem.

I’m writing this right after a new world chess champion has been crowned. While the result was better than previous championships in that it succeeded in crowning an unambiguous world champion, it failed at two bigger goals: Being exciting and selecting a winner who’s widely viewed as demonstrating that they’re the strongest among all the competitors.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

The source of the lack of excitement is no secret: Most of the games were draws. Out of the 14 games, 5 were decisive. This also creates a problem for the accuracy of the result. In a less drawish game a match with 6 games of which only one was drawn would have equal statistical significance (assuming it wasn’t overly partisan). In fact it’s even worse than that appears on its face. The candidates tournament, which selected the challenger, was a 7 person double round robin where the winner scored 9/14 and three other competitors scored 8.5/14. Picking a winner based on such a close result has hardly any significance at all, and that format means that unless one of the competitors was ludicrously better than the others such a close result was expected. If the format were instead that the top four finishers from the candidates tournament played single elimination matches against each other then the eventual result would be viewed with far more authority. Partially the problem here is that this is just a badly designed tournament but some of the reasoning behind this format is because of the drawishness. Such matches would be long and arduous and not much fun, as they were in the past. Some previous FIDE title tournaments were far worse, following a very misguided idea that making the results random would lead to more excitement. That makes sense in sports like Soccer where there are few teams and it’s important that all of them have a shot, but the ethos of Chess is that the better player should consistently win, and adding randomness can easily lead to never seeing the same player win twice.

This leads to the question of how the rules of chess could be modified to not have so many draws. Most proposed variations suffer from being far too alien to chess players to be taken seriously, but there are two approaches which are, or should be, taken seriously which I’d like to highlight: Fischer random and the variants explored by Kramnik. In Fischer random a starting position with the pieces in the back rank scrambled randomly is selected. In the latter Kramnik, a former world champion, suggested game variants, and the Deepmind team trained an AI on them and measured the draw rate and partisanship of all of them based on how that engine did in self-play games. (Partisanship is the degree to which the game favors one player over the other). I love this methodology. Of the variants tried I’d like to highlight two of the best ones. One is ‘torpedo’, in which pawns can move two squares at once from any position, not just the starting one. The other is no-castle, which is exactly what it sounds like. No castle has the benefit that it gets rid of the most complex and confusing chess rules and that it’s just changing the opening position, in fact it’s a position reachable from the standard Chess opening position. (For some reason people don’t do no-castle Fischer Random tournaments, which seems ridiculous. Might as well combine the best ideas.)

Both no castle and torpedo have about the same level of partisanship as regular chess, which may be a good thing for reasons I really ought to do a separate blog post about. They also both do a good job of making the game less drawish. The reason for this is, in my opinion, basically the same, or at least two sides of the same coin. Torpedo makes the pawns stronger, so they’re more likely to promote and decide the game. No castle nerfs the king so it’s more likely to get captured. Of these two approaches torpedo feels far more alien to regular chess than no castle does. My proposal to make Chess even more non-drawish is to nerf the king even more: Make it so the king can’t move diagonally. Notably this would cause even king versus king endgames to be decisive. It would also result in a lot more exciting attacks because the king would be so poorly defended. This needs extensive play testing to be taken seriously, but repeating the Deepmind experiment is vastly easier now that AI has come so far, and it would be great if Chess or at least a very Chess-like game could have a world championship which was much more exciting and meaningful.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

Posted Fri Dec 13 06:21:54 2024 Tags:

Before I get into the meat of this rant, I’d like to say that my main point is not that giving monthly numbers is incompetent, but I will get that out of the way now. There’s this ongoing deep mystery of the universe: “Why does our monthly revenue always drop in February?” It’s because it has less days in it, ya dumbass. What you should be doing is average daily numbers with months as the time intervals of measurement, and longer term stats being weighted by lengths of months. That’s still subject to some artifacts but they’re vastly smaller and hard to avoid. (Whoever decided to make days and years not line up properly should be fired.)

Even if you aren’t engaged in that bit of gross incompetence, it’s still that case that not only year over year but any fixed time interval delta is something you should never, ever use. This includes measuring historical inflation, the performance of a stock, and the price of tea in China. You may find this surprising because the vast majority of graphs you ever see present data in exactly this way, but it’s true and is a huge problem.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

Let’s consider the criteria we want out of a smoothing algorithm:

  1. There shouldn’t be any weird artifacts in how the data is presented

  2. There should be minimal parameterization/options for p-hacking

  3. Only the data from a fixed window should be considered

  4. Data from the future should not be considered

So what’s wrong with straightforwardly applying even weighting across the entire time interval? The issue is that it grants a special and extreme cutoff status to two very specific points in time: Right now and the beginning of the interval. While right now is hard to do anything about (but more on that later) granting special status to an arbitrary point in the past is just wrong. For example, here’s a year over year weighted average in a scenario where there was a big spike one month, which is the most artifact-laden scenario:

What happened exactly a year after the spike? Absolutely nothing, it’s an artifact of the smoothing algorithm used. You could argue that by picking a standard interval to use the amount of possible p-hacking is mitigated and it’s true. But the effects are still there and people can always decide to show the data at all only when the artifact goes the way they want and it’s extremely hard to standardize enough to avoid trivial p-hacks. For example it’s viewed as acceptable to show year to date, and that may hit a different convenient cutoff date.

(The graphs in this post all use weighted geometric means and for simplicity assume that all months are the same length. As I said at the top you should take into account month lengths with real world data but it’s beside the point here.)

What you should be using is linear weighted moving average, which instead of applying an even weighting to every data point has the weighting go down linearly as things go into the past, hitting zero at the beginning of the window. Because the early stuff is weighted less the size of the window is sort of narrower than with constant weighting. To get roughly apples to apples you can set it so that the amount of weight coming from the last half year is the same in either case, which corresponds to the time interval of the linear weighting being multiplied by the square root of 2, which is roughly 17 months instead of 12. Here’s what it looks like with linear weighted averages:

As you can see the LWMA doesn’t have a sudden crash at the end and much more closely models how you would experience the spike as you lived through it. There’s still some p-hacking which can be done, for example you can average over a month or a ten years instead of one year if that tells a story you prefer, but the effects of changing the time interval used are vastly less dramatic. Changing by a single month will rarely have any noticeable effect at all, while doing the same with a strict cutoff will matter fairly often.

Stock values in particular are usually shown as deviations from a single point at the beginning of a time period, which is all kinds of wrong. Much more appropriate would be to display it in the same way as inflation: annual rate of return smoothed out using LWMA over a set window. That view is much less exciting but much more informative.

In defense of the future

Now I’m going to go out on a limb and advocate for something more speculative. What I said above should be the default, what I’m about to say should be done at least sometimes, but for now it’s done hardly ever.

Of the four criteria at the top the dodgyest one by far is that you shouldn’t use data from the future. When you’re talking about the current time you don’t have much choice in the matter because you don’t know what will happen in the future, but when looking at past data it makes sense to retroactively take what happened later into account when evaluating what happened at a particular time. This is especially true of things which have measurement error, both from noise in measurement and noise in arrival time of effect. Using both before and after data simply gives better information. What it sacrifices is the criterion that you don’t retroactively change how you view past data after you give information at the time. While there’s some benefit to revisiting the drama as you experienced it at the time, that shouldn’t always be more important than accuracy.

Here’s a comparison of how a rolling linearly weighted average which uses data from the future would show things in real time versus in retrospect:

(This assumes a window of 17 months centered around the current time and data from the future elided, so the current value is across a window of 9 months.)

The after the fact smoothing is much more reasonable. It’s utilizing 20/20 hindsight, which is both its strength and weakness. The point is sometimes that’s what you want.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

Posted Mon Dec 2 17:25:59 2024 Tags:

The book ‘Manchild in the Promised Land’ is a classic of American literature which traumatized me when I was assigned to read it in middle school. It is a literarily important work, using a style of hyperrealism which was innovative at the time and eventually lead to reality television and youtube channels which have full staffs but go out of their way to make it appear that the whole thing was produced by a single person. In parallel it also was part of the rise of the blaxsploitation genre. The author and most of the books ardent followers claim that it proves that black people in the US are that way due to the oppression of white people. It’s also been claimed to be oppression porn, and to glorify drug use and criminality. I’ll get to whether those things are true, but first there are some things I need to explain.

The book is an autobiography about the author’s growing up in Harlem, how he was a involved in all manner of criminality when he was younger, and eventually managed to get out of it, go to law school, and have a respectable career. What struck me when I was younger was that it was the first depiction of the interactions between men and women I’d ever seen which wasn’t propaganda bullshit. Back in the 80s the depictions of dating in sitcoms and movies were stagey and dumb, but worse than that they’d alternate between christian moralizing and juvenile fantasizing of the writers. Even back then I could see transparently through them. This book was different. It depicted people in actually uncomfortable situations, doing things you weren’t supposed to talk about, and having normal human reactions. The thing which caused damage to my impressionable young mind was that most of these interactions involved pimps and hos and present a very dark side of humanity.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

There’s something I now need to admit. I haven’t, and most likely won’t, be able to force myself to finish re-reading this book. I know that’s a bit hypocritical when writing a review, but there’s something I realized early on re-reading it which recontextualized everything in it and made not able to cope with reading it any more. And that is that it’s all made up.

It was the homophobia which gave it away. All the gay people are presented as aggressive creepazoids, with not much motivation other than to fulfill the role of creepazoid in this literary universe of general oppression. Such people do exist in real life, but they tend to have the good sense to not openly go after people they don’t know and have no reason to think will be receptive, especially back when homosexuality was downright illegal and getting beating someone up for being gay wouldn’t land you in any trouble at all (The story is set in the 1940s). The logical conclusion is that the author didn’t know any real out gay people and was making them up as characters in a story using a common trope of the time. Looking into the author more, everything falls apart. He comes across as a dweeb in interviews, not someone anyone would take seriously as a pimp. None of the characters other than him mention seem to ever have been mentioned. He conveniently claims to have been a lawyer but then stopped practicing because he could make more money giving talks, but there doesn’t seem to be evidence that he ever practiced or passed the bar, attended law school, or got into law school in the first place. (I’m guessing he did some but not all of those.) Most ridiculously the timing doesn’t work. Either he was hustling soldiers on leave from WWII when he was eight years old, or that was somebody else’s story. In an interview with NPR they said it was a novel but written as an autobiography, which is surprising given that nearly everything referencing it claims unambiguously that it’s simply an autobiography. My guess is that they did some actual journalism and politely let him fall back on ‘it’s a novel’ when they called him out on his lies.

One may ask whether this matters. Does a work of art’s meaning or import depend on the artist who created it? In general I lean towards saying no, that the truth of even a claimed personal experience is less important than whether that experience is prototypical of that of many others. But in this case the context and meaning are so completely changed based on whether it’s real that I have to go the other way. If it’s a real story it’s about someone who was once a pimp, came to the realization that hos are real people too, changed his life around and is bringing a laudable message of inclusion. If it’s made up then it’s a loser fantasizing about having been a pimp. That doesn’t mean that this isn’t an important and influential book, but it does man that if you’re going to teach it you should include the context that it’s a seminal work of incel literature.

All that said, being a work of fiction doesn’t mean that there’s nothing about reality which can be gleaned from a work. I truly believe that the stories in this book were ones told to or observed by the author involving older, cooler boys and were either true or at least demonstrations that such stories could win you social status. A lot of it jives with things which I personally witnessed in the 80s and 90s growing up in walking distance of where the book is set. So now let’s get to critiques of the book and whether they’re true or not. The first question at hand is: Does it show that black americans are kept where they are via oppression from white americans? Well… not really. It’s complicated. A lot of the white people in it are very personally charitable to the author, helping him get through school and better himself. That’s the opposite of oppression. Where it does show a lot of oppression is from the police, both in the form of under- and over- policing. Police brutality is commonplace, but the cops won’t show up when you call for them and actually need them. This is definitely a real problem, thankfully less so now than the better part of a century ago, but there’s still a default assumption in the US that when the cops show up they’ll make the situation worse. Maybe over the course of my lifetime that’s been downgraded from an assumption to a fear, but it’s still a very real hangover and the war on drugs isn’t done yet. What the book most definitely shows is the black community oppressing itself. People in the ghetto are mostly interacting with other people in the ghetto, so it’s to be expected that crimes which happen there also have victims from there. The depictions of drug dealers intentionally getting potential customers addicted and of men forcing women into prostitution are particularly disturbing, but are things which actually happen.

That leads to the other big question, which is whether this book glorifies criminality. Yes it glorifies criminality! Half of it is the author fantasizing about being a badass pimp! He claims cocaine isn’t addictive! Gang rape is portrayed as a rite of passage! (The one thing which the author seems to really not like is heroin. This was before crack.) What’s puzzling is how this book is held up as a paragon of showing greatness of black culture. Saying ‘There’s a lot of glorification of criminality and misogyny in black culture and that’s a bad thing’ is something one isn’t allowed to say in polite company, or can only be said by black academics who obfuscate it with layers of jargon. While I understand getting defensive about that, it might behoove people who want to avoid the issue to not outright promote works which are emblematic of those trends (by, say, making them assigned reading in school). It doesn’t help to fall back on ‘this has a deep meaning which only black people can understand’ when the obvious problems are pointed out, as the author had a penchant for doing in interviews.

This brings me to the most central and currently culturally relevant aspect of what’s real in this book. The (very different, not at all bullshit) book ‘We Have Never Been Woke’ by Musa al-Gharbi makes a compelling case for the claim that woke worldview is a largely self-serving one of intellectual elites who claim to speak for underprivileged people but don’t. That book is from the point of view of someone who is himself cringily woke and can point out the hypocrisy and disconnect from that end. The other side of it is that when underprivileged people who woke claims to speak for say they are not you should believe them. This book is an example of that. So is all of gangsta rap. It is not productive to pretend a culture is something it is not just because you think it should be different. And there I think Manchild gets some amount of redemption: It claims to be a work which shines a light on cold, hard, unpleasant reality, and for all its faults it does, only not with the meaning the author intended.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

Posted Tue Nov 26 21:04:24 2024 Tags:

A while ago I was looking at Rust-based parsing of HID reports but, surprisingly, outside of C wrappers and the usual cratesquatting I couldn't find anything ready to use. So I figured, why not write my own, NIH style. Yay! Gave me a good excuse to learn API design for Rust and whatnot. Anyway, the result of this effort is the hidutils collection of repositories which includes commandline tools like hid-recorder and hid-replay but, more importantly, the hidreport (documentation) and hut (documentation) crates. Let's have a look at the latter two.

Both crates were intentionally written with minimal dependencies, they currently only depend on thiserror and arguably even that dependency can be removed.

HID Usage Tables (HUT)

As you know, HID Fields have a so-called "Usage" which is divided into a Usage Page (like a chapter) and a Usage ID. The HID Usage tells us what a sequence of bits in a HID Report represents, e.g. "this is the X axis" or "this is button number 5". These usages are specified in the HID Usage Tables (HUT) (currently at version 1.5 (PDF)). The hut crate is generated from the official HUT json file and contains all current HID Usages together with the various conversions you will need to get from a numeric value in a report descriptor to the named usage and vice versa. Which means you can do things like this:

  let gd_x = GenericDesktop::X;
  let usage_page = gd_x.usage_page();
  assert!(matches!(usage_page, UsagePage::GenericDesktop));
  
Or the more likely need: convert from a numeric page/id tuple to a named usage.
  let usage = Usage::new_from_page_and_id(0x1, 0x30); // GenericDesktop / X
  println!("Usage is {}", usage.name());
  
90% of this crate are the various conversions from a named usage to the numeric value and vice versa. It's a huge crate in that there are lots of enum values but the actual functionality is relatively simple.

hidreport - Report Descriptor parsing

The hidreport crate is the one that can take a set of HID Report Descriptor bytes obtained from a device and parse the contents. Or extract the value of a HID Field from a HID Report, given the HID Report Descriptor. So let's assume we have a bunch of bytes that are HID report descriptor read from the device (or sysfs) we can do this:

  let rdesc: ReportDescriptor = ReportDescriptor::try_from(bytes).unwrap();
  
I'm not going to copy/paste the code to run through this report descriptor but suffice to day it will give us access to the input, output and feature reports on the device together with every field inside those reports. Now let's read from the device and parse the data for whatever the first field is in the report (this is obviously device-specific, could be a button, a coordinate, anything):
   let input_report_bytes = read_from_device();
   let report = rdesc.find_input_report(&input_report_bytes).unwrap();
   let field = report.fields().first().unwrap();
   match field {
       Field::Variable(var) => {
          let val: u32 = var.extract(&input_report_bytes).unwrap().into();
          println!("Field {:?} is of value {}", field, val);
       },
       _ => {}
   }
  
The full documentation is of course on docs.rs and I'd be happy to take suggestions on how to improve the API and/or add features not currently present.

hid-recorder

The hidreport and hut crates are still quite new but we have an existing test bed that we use regularly. The venerable hid-recorder tool has been rewritten twice already. Benjamin Tissoires' first version was in C, then a Python version of it became part of hid-tools and now we have the third version written in Rust. Which has a few nice features over the Python version and we're using it heavily for e.g. udev-hid-bpf debugging and development. An examle output of that is below and it shows that you can get all the information out of the device via the hidreport and hut crates.

$ sudo hid-recorder /dev/hidraw1
# Microsoft Microsoft® 2.4GHz Transceiver v9.0
# Report descriptor length: 223 bytes
# 0x05, 0x01,                    // Usage Page (Generic Desktop)              0
# 0x09, 0x02,                    // Usage (Mouse)                             2
# 0xa1, 0x01,                    // Collection (Application)                  4
# 0x05, 0x01,                    //   Usage Page (Generic Desktop)            6
# 0x09, 0x02,                    //   Usage (Mouse)                           8
# 0xa1, 0x02,                    //   Collection (Logical)                    10
# 0x85, 0x1a,                    //     Report ID (26)                        12
# 0x09, 0x01,                    //     Usage (Pointer)                       14
# 0xa1, 0x00,                    //     Collection (Physical)                 16
# 0x05, 0x09,                    //       Usage Page (Button)                 18
# 0x19, 0x01,                    //       UsageMinimum (1)                    20
# 0x29, 0x05,                    //       UsageMaximum (5)                    22
# 0x95, 0x05,                    //       Report Count (5)                    24
# 0x75, 0x01,                    //       Report Size (1)                     26
... omitted for brevity
# 0x75, 0x01,                    //     Report Size (1)                       213
# 0xb1, 0x02,                    //     Feature (Data,Var,Abs)                215
# 0x75, 0x03,                    //     Report Size (3)                       217
# 0xb1, 0x01,                    //     Feature (Cnst,Arr,Abs)                219
# 0xc0,                          //   End Collection                          221
# 0xc0,                          // End Collection                            222
R: 223 05 01 09 02 a1 01 05 01 09 02 a1 02 85 1a 09 ... omitted for previty
N: Microsoft Microsoft® 2.4GHz Transceiver v9.0
I: 3 45e 7a5
# Report descriptor:
# ------- Input Report -------
# Report ID: 26
#    Report size: 80 bits
#  |   Bit:    8       | Usage: 0009/0001: Button / Button 1                          | Logical Range:     0..=1     |
#  |   Bit:    9       | Usage: 0009/0002: Button / Button 2                          | Logical Range:     0..=1     |
#  |   Bit:   10       | Usage: 0009/0003: Button / Button 3                          | Logical Range:     0..=1     |
#  |   Bit:   11       | Usage: 0009/0004: Button / Button 4                          | Logical Range:     0..=1     |
#  |   Bit:   12       | Usage: 0009/0005: Button / Button 5                          | Logical Range:     0..=1     |
#  |   Bits:  13..=15  | ######### Padding                                            |
#  |   Bits:  16..=31  | Usage: 0001/0030: Generic Desktop / X                        | Logical Range: -32767..=32767 |
#  |   Bits:  32..=47  | Usage: 0001/0031: Generic Desktop / Y                        | Logical Range: -32767..=32767 |
#  |   Bits:  48..=63  | Usage: 0001/0038: Generic Desktop / Wheel                    | Logical Range: -32767..=32767 | Physical Range:     0..=0     |
#  |   Bits:  64..=79  | Usage: 000c/0238: Consumer / AC Pan                          | Logical Range: -32767..=32767 | Physical Range:     0..=0     |
# ------- Input Report -------
# Report ID: 31
#    Report size: 24 bits
#  |   Bits:   8..=23  | Usage: 000c/0238: Consumer / AC Pan                          | Logical Range: -32767..=32767 | Physical Range:     0..=0     |
# ------- Feature Report -------
# Report ID: 18
#    Report size: 16 bits
#  |   Bits:   8..=9   | Usage: 0001/0048: Generic Desktop / Resolution Multiplier    | Logical Range:     0..=1     | Physical Range:     1..=12    |
#  |   Bits:  10..=11  | Usage: 0001/0048: Generic Desktop / Resolution Multiplier    | Logical Range:     0..=1     | Physical Range:     1..=12    |
#  |   Bits:  12..=15  | ######### Padding                                            |
# ------- Feature Report -------
# Report ID: 23
#    Report size: 16 bits
#  |   Bits:   8..=9   | Usage: ff00/ff06: Vendor Defined Page 0xFF00 / Vendor Usage 0xff06 | Logical Range:     0..=1     | Physical Range:     1..=12    |
#  |   Bits:  10..=11  | Usage: ff00/ff0f: Vendor Defined Page 0xFF00 / Vendor Usage 0xff0f | Logical Range:     0..=1     | Physical Range:     1..=12    |
#  |   Bit:   12       | Usage: ff00/ff04: Vendor Defined Page 0xFF00 / Vendor Usage 0xff04 | Logical Range:     0..=1     | Physical Range:     0..=0     |
#  |   Bits:  13..=15  | ######### Padding                                            |
##############################################################################
# Recorded events below in format:
# E: .  [bytes ...]
#
# Current time: 11:31:20
# Report ID: 26 /
#                Button 1:     0 | Button 2:     0 | Button 3:     0 | Button 4:     0 | Button 5:     0 | X:     5 | Y:     0 |
#                Wheel:     0 |
#                AC Pan:     0 |
E: 000000.000124 10 1a 00 05 00 00 00 00 00 00 00
  
Posted Tue Nov 19 01:54:00 2024 Tags:

In this weekend’s edition of ‘Bram gets nerd sniped by something ridiculous so makes a blog post about it to make it somebody else’s problem’ Mark Rober said something about ‘A Lava Lamp made out of real lava’. Unfortunately he just poured lava on a regular lava lamp to destroy it but this does raise the question of whether you could have a real lava lamp which uses a molten salt instead of water.

First the requirements. The lamp is made of three substances: the lamp itself, the ‘liquid’ inside, and the ‘solid’ inside. The lamp must be transparent and remain solid across the range of temperatures used. The ‘liquid’ must be solid at room temperature, become liquid at a high but not too high temperature, and be transparent in its liquid phase. It should also be opaque in its solid phase to give a cool reveal of what the thing does as it heats up but but that’s hard to avoid. The ‘solid’ should have a melting point higher than the ‘liquid’ but not so high that it softens the lamp and be opaque. The density of the ‘solid’ should be just barely below that of the ‘liquid’ in its melted form and just barely above in its solid form to give it that distinctive lava lamp buoyancy effect. The ‘solid’ and ‘liquid’ should not react with each other or stick to the lamp or decompose over time.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

That was a lot of requirements, but it does seem to be possible to meet them. The choice for the lamp is obvious: Borosilicate glass. That’s physically strong, transparent, can withstand big temperature changes (due to low thermal expansion) and is chemically inert. All the same reasons why it’s ideal for cookware. It doesn’t get soft until over 800C, so the melting points of the other materials should be well below that.

For the ‘liquid’ there also turns out to only be one real option: Zinc Chloride. That’s transparent and has a melting point of 290C and a density of 2.9 (it’s also opaque at room temperature). The other transparent salts aren’t dense enough.

For the ‘solid’ there once again only seems to be one option: Boron Trioxide. That has a melting point of 450C and a density of 2.46. Every other oxide has a density which is way too high, but this one overshoots it a bit. It’s much easier to get get the densities closer together by making mixing the Boron Trioxide with something heavy than the Zinc Chloride with something light, so some Lead(II) oxide can be mixed in. That has a density of 9.53 so not much of it is needed and a melting point of 888C so the combined melting point will still be completely reasonable. (Due to eutectic-type effects it might be barely higher at all.) It should also add some color, possibly multiple ones because the colors formed depend on how it cools. Bismuth(III) oxide should also work and may be a bit more colorful.

I’m crossing my fingers a bit on these things not reacting but given that they’re glasses and salts it seems reasonable. The glasses may have a bit of a tendency to stick to each other. Hopefully not so much because one is a solid at these temperatures and the other is a liquid, but it’s probably a good idea to coat the top and bottom of the insides of the lamp with Silicon and to use an overall shape where the pieces inside never come close to the walls, in particular having an inverted cone shape at the bottom and a similar tapering at the top. The whole lamp should also be sealed because oxygen and water might react at the high temperatures reached, and there should be an argon bubble at the top because there is some expansion and contraction going on. Those same concerns apply to regular lava lamps which explains a lot about how they’re shaped.

Anyone who wants to feel free to try this build. You don’t need any more permission from me. I’d like to see it happen and don’t have the time to spend on building it myself.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

Posted Sun Nov 17 04:53:55 2024 Tags:

Let’s say you happen to need a color code something and want RGB values corresponding to all the common color names. Let’s further say that you’re an obsessive maniac and would like to avoid losing your sanity studying color theory just for the sake of this one silly task. How do you do it? Easy, leverage the work I already did for you. Here’s the chart, followed by caveats and methodology:

First the caveats: The level of saturation of these colors varies a lot mostly because sRGB sucks and your monitor can only display faded versions of some of them. (For colorblind accessibility it might be a good idea to use slightly lower saturation.) A luminance high enough to make yellow have decent saturation washes out other things so this was set to a consistent level which is a reasonable compromise. (This isn’t the fault of sRGB, it’s a limitation of human eyes.) Purple hues at angles 300 and 320 are both things which my eyes accept as the single ideal of Purple and don’t realize are two different things until I see them next to each other. The value given is midway between. Reasonable descriptions of them are ‘Royal Purple’ and ‘Common Purple’. They have an analogous relationship to the one between Blue and Cyan.

The methodology behind this first has to answer the question ‘What is a color?’ For the purposes of this exercise we’ll just pretend that hues are colors. The next question is why particular positions in the hue continuum count as colors. Hues are a twisting road. In particular places the road bends, making a gradient crossing over it look not like a straight line. The places where those bends happen we call colors. Which bends get a name is dependent on where you set the threshold and cultural factors. The exact point where the bend happens is also hard to define exactly. I located them by the highly scientific process of picking them out with my own two eyes.

There’s a standard statement of what the common color words are in English to which I’m adding Cyan and Pink. Cyan is a proper name for what’s usually called ‘Light Blue’, a name which makes no sense because both Cyan and Blue can appear at any amount of luminance. It may be that Cyan is denied a proper common name because our displays can barely show it. The biggest limitation of sRGB by far is that it can only display Cyan with poor saturation. Pink I put in both because it’s a primary color (as is Cyan) and because it’s a very common color word in English, mostly denied its proper place out of an absurd bit of misogyny and homophobia. It’s especially funny that in printing Pink is euphemized as ‘Magenta’ even though the shade which is used is a light one and the common usage of ‘Magenta’ is to refer to a darker shade.

One important thing to note is that the primary colors, which have sRGB values set to 00 and FF, are NOT on ideal color hues. Those colors correspond to the most saturated things your display can show, which is important, but the positioning of RGB was selected first and foremost for them to be 120 degrees from each other to maximize how much color display could be done with only three phosphores. They happen to be very close to the true ideals but not exactly.

To pick out exact shades I used an OKHSL color picker with saturation 100% and light and dark luminance at 65% and 43%. There are still a few artifacts of OKHSL, in particular its hues bend a tiny bit in the darker shades. To compensate I picked out color angles which are good at both high and low luminance, mostly resulting in Cyan being shifted over because in darker shades Teal is elbowing it out of the way. One thing OKHSL does NOT do is maintain the property that two colors which are opposite each other in space are true opposites, which is annoying because oppositeness is one of the most objective things you can say about colors. (That could probably be improved by having brightness correction be done by cubing a single value instead of three values separately but I personally am not going to put together such a proposal.)

Annoyingly the human perceptual system doesn’t see fit to put color angles with canonical names opposite each other, instead placing them roughly evenly but with seemingly random noise added. This of course creates problems for color wheels, which want both to show what colors are opposites and what the color names are.

Posted Sun Nov 10 07:07:22 2024 Tags:
Questioning a puzzling claim about mass surveillance. #attackers #governments #corporations #surveillance #cryptowars
Posted Mon Oct 28 14:25:09 2024 Tags:

If you want to know how bad your computer display is, go here, select sRGB for the gamut, OKLab for the geometric color coordinate space, and Color for the spectral colors, and rotate it around. You’ll get a much better sense of what’s going on rotating it in 3D yourself, but I’ll do some explaining. Here’s a screenshot showing just how much of the color space your monitor is missing:

The colored shape shows the extremes of what your color can display. It’s warped to reflect the cognitive distance between colors, so the distances in space reflect the apparent distance between the colors in your brain. Ideally that shape would fill the entire basket, which represents all the colors your eyes can perceive. You might notice that it comes nowhere close. It’s a stick going from black at the bottom to white at the top, with just enough around it that you can get colors but the saturation is poor.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

The biggest chunks missing from this are that there’s very little bright blue and dark cyan. This may be why people mischaracterize cyan as ‘light blue’. Our display technologies are literally incapable of displaying a highly saturated light blue or a highly saturated dark cyan. It’s likely that most of the paintings from Picasso’s blue period can’t be displayed properly on a monitor, and that he was going with blues not as a gimmick but because it’s literally half the human cognitive space. If you have the ability to make a display or physical object without the standard restrictions go with bright blue or dark cyan. Even better contrast them with each other and break everybody’s brains.

Sadly this situation is basically unfixable. The Rec2020 standard covers much more of the color space, but you can’t simply display sRGB values as Rec2020 values. That will result in more intense colors, but because the original inputs weren’t designed for it the effect will be cartoony and weird. You can simply display the correct values specified by sRGB, but that will waste the potential of the display . If there was content recored for sRGB which specified that in its format it would display very well, but that’s has a chicken and egg problem, and the displaying input recorded for Rec2020 on a legacy sRGB display is even worse than going the other way around. Maybe about the best you can do is have a Rec2020 display which applies a superlinear saturation filter to sRGB input so low saturations are true but ‘fully saturated’ values look more intense.

This is an example of how modern televisions do a huge amount of processing of their input before displaying it and it’s extremely difficult to disentangle how good the physical display is from the quality of the processing software. Another example of that is in the display of gradients. A 10 bit color display will naturally display gradients much better than an 8 bit color display, but an 8 bit color display can dither the errors well enough to be nearly imperceptible. The problem then is that causes flicker due to the dithering changing between frames. There are ways of fixing this by keeping information between frames but I don’t think there’s an open source implementation of this for televisions to use. One has to assume that many if not nearly all of the proprietary ones do it.

Speaking of which, this is a problem how software in general handles color precision. It’s true that 8 bits is plenty for display, but like with audio you should keep all intermediate representations with much greater precision and only smash them down when making the final output. Ideally operating systems would pretend that final display had 16 bit color and fix it on final display, or even in the monitor. Lossy video compression in particular inexplicably gives 8 bit color output resulting in truly awful dark gradients. The standard Python image libraries don’t even have an option for higher color precision resulting in them producing terrible gradients. This should be completely fixable.

Popping back up the stack I’d like to fantasize about a data format for display technology which supports the entire range of human perceptible colors. This would encode color as three values: x, y, and luma. x would go between 0 and 2 with y between 0 and 1. It’s a little hard to describe what exactly these values mean, but (0, 0) would be red, (1, 0) yellow, (2, 0) green, (2, 1) cyan, (1, 1) blue, and (0, 1) pink. The outer edge goes around the color wheel keeping opposite colors opposite and doing an okay job of corresponding with cognitive space even in raw form. You could make an approximate rendering of this in sRGB as a smushed color wheel but by definition the outer edge of that would be horrendously faded compared to how it should look. Luminance should work as it implicitly does in RGB: Luminance 0 is exactly black and x and y have no effect. As it goes up the cognitive width which x and y represent increases up until the midway point, then it shrinks again until it gets to luminance 1 which is exactly white and x and y again have no effect. This shrinking at the top is to reflect how real displays work. If you want to get much better bright colors you can use the luminance of 1/2 as white at the expense of everything being darker. Many movies do this, which makes them look great when covering a whole display but dark when open in a window next to true white on a monitor.

Deep diving on color theory of course has given me multiple ideas for hobby software projects, most of which I’ll probably never get around to because many things don’t pan out but mostly because I have limited hobby coding time so things get triaged heavily. If anybody wants to beat me to the punch on these please go ahead:

  • A color cycling utility which instead of rotating the color space reflects it. Usually when color cycling there’s one position which is true, then it rotates until all hues are changed to their opposite, then it rotates back around the other way. This would instead at all times have two opposite hues which are true and two opposite colors which are flipped and cycle which those are. Ideally this would be implemented by converting to okHSL, changing H to (d-H) % 1 and converting back again. As you change d it will cycle. You could trivially change it to a very nice traditional color cycler using (d+H) % 1.

  • A color cycling utility which allows user controlled real time three dimensional color rotation. If you take an input image, convert it into the okLab color space and shrink its color space to fit in a sphere centered at (0.76, 0, 0) with radius 0.125 then this can be done without hitting any values which are unreachable in sRGB. The interface for rotating it should be similar to this one. In the past when I’ve tried doing these sorts of three dimensional color rotations they’ve looked horrible when white-black gets off axis. Hopefully that’s because the cognitive distance in that direction is so much greater than in the color directions and keeping everything uniform will fix it, but it may be that getting white and black inverted at all fundamentally looks weird.

Thanks for reading Bram’s Thoughts! Subscribe for free to receive new posts and support my work.

Posted Sun Oct 27 23:46:43 2024 Tags: