News for hackers. Stuff that matters.
Re:The Norway Problem by azernik on Saturday April 03, 2021 @04:22AM (#26679229)
YAML had a worse example, once.

For the ease of entering time units YAML 1.1 parsed any set of two digits, separated by colons, as a number in sexagesimal (base 60). So 1:11:00 would parse to the integer 4260, as in 1 hour and 11 minutes equals 4260 seconds.

Now try plugging MAC addresses into that parser.

The most annoying part is that the MAC addresses would only be mis-parsed if there were no hex digits in the string. Like the bug in this post, it could only be reproduced with specific values.

Generally, if you're doing implicit typing, you need to keep the number of cases as low as possible, and preferably error out in case of ambiguity.

Re:The Norway Problem by adwn on Saturday April 03, 2021 @07:01AM (#26679983)
> For the ease of entering time units YAML 1.1 parsed any set of two digits, separated by colons, as a number in sexagesimal (base 60).

This is a mind-boggling level of idiocy. Even leaving aside the MAC address problem, this conversion treats "11:15" (= 675) different from "11:15:00" (= 40500), even though those denote the same time, while treating "00:15:00" (15 minutes past midnight) and "15:00" (3 in the afternoon) the same.

Re:The Norway Problem by azernik on Sunday April 04, 2021 @02:46AM (#26687424)
You know you've fucked up when you have to remove features from the spec (which they did in YAML 1.2).
Re:The Norway Problem by imtringued on Sunday April 04, 2021 @01:36PM (#26691349)
On the other hand, you know that you did well, when a direct competitor would look exactly the same minus some undesired features.
Re:The Norway Problem by dragonwriter on Saturday April 03, 2021 @06:08AM (#26679728)
> YAML had a worse example, once.

It had it literally at the same time as it had the problem in the article (the article refers to YAML 2.O, a nonexistent spec, and to PyYAML, a real parser which supports only YAML 1.1.)

Both the unquoted-YES/NO-as-boolean and sexagesimal literals were removed in YAML 1.2. (As was the 0-prefixed-number-as-octal mentioned in a sibling comment.)

Re:The Norway Problem by whytookay on Saturday April 03, 2021 @05:54AM (#26679657)
One that really surprised/confused me was that pyaml (and the yaml spec) attempts to interpret any 0-prefixed string into an octal number.

There was a list of AWS Account IDs that parsed just fine until someone added one that started with a 0 and had no numbers greater than 7 in it, after which our parser started spitting out decidedly different values than we were expecting. Fixing it was easy, but figuring out what in the heck was going on took some digging.

Re:The Norway Problem by lainga on Saturday April 03, 2021 @10:58AM (#26681548)
We had a Grafana dashboard where one of the columns was a short Git hash. One day, a commit got the hash `89e2520`, which Grafana's frontend helpfully decided to display as "+infinity". Presumably it was parsing 89E+2520.
Re:The Norway Problem by rootusrootus on Saturday April 03, 2021 @11:40AM (#26681893)
Ha, that reminds me of some work I was doing just yesterday, implementing a custom dictionary for a postgres full text search index. Postgres has a number of mappings that you can specify, and it picks which one based on a guess of what the data represents. I got bit by a string token in this same format, because it got interpreted as an exponential number.
Re:The Norway Problem by BlueTemplar on Sunday April 04, 2021 @09:45AM (#26689328)
Sounds like the core issue is that an hexadecimal number was encoded as a string ?
Re:The Norway Problem by m463 on Saturday April 03, 2021 @04:54AM (#26679385)
slightly related, on my microwave 99 > 100, even 61 > 100
Re:The Norway Problem by roland35 on Saturday April 03, 2021 @11:16AM (#26681700)
I try to optimize my microwave button pushing too. I also have a +30 seconds button, so for 1:30 I can hit "1,3,0,Start" or "+30" three times and save a press!
Re:The Norway Problem by bonzini on Saturday April 03, 2021 @05:02AM (#26679415)
Why does your microwave compare numbers?
Re:The Norway Problem by sokoloff on Saturday April 03, 2021 @09:28AM (#26680874)
It doesn’t compare them, it just counts down.

If I enter 1-3-0-start, I get 90 seconds of cooking. If I enter 9-9-start, I get 99 seconds of cooking, so in that sense, 99 > 130.

If I want about 90 seconds, I’ll use 88 as it’s faster to enter (fewer finger movements).

Re:The Norway Problem by JoeAltmaier on Saturday April 03, 2021 @09:29AM (#26680883)
I've done the same thing for decades! Soul mates?
Re:The Norway Problem by sokoloff on Saturday April 03, 2021 @09:31AM (#26680899)
You might like this one as well.

Load soap into the dishwasher after emptying rather than after loading. If the soap dispenser is closed, the dishes are dirty.

Re:The Norway Problem by sneak on Saturday April 03, 2021 @10:28AM (#26681346)
My rule is that loading the dishwasher means that one loads all the available dishes, and runs it, even if it's only x% full. We use the (large) sink as an input buffer.

If the dishwasher has dishes in it and it's not running, they're clean.

Re:The Norway Problem by rootusrootus on Saturday April 03, 2021 @11:44AM (#26681923)
This is exactly our algorithm as all. I can't really imagine flipping it the other way, since leaving dirty dishes in a dishwasher will just let them completely dry out, making it more likely they won't get fully clean when the cycle is eventually run.
Re:The Norway Problem by medstrom on Saturday April 03, 2021 @04:41PM (#26684538)
Rinse until visually clean, then put in dishwasher.
Re:The Norway Problem by sneak on Sunday April 04, 2021 @03:36AM (#26687604)
This doubles the time required to do the dishes, defeating much of the purpose of the dishwasher.
Re:The Norway Problem by medstrom on Sunday April 04, 2021 @02:24PM (#26691678)
Idk, to me it's not about time but effort. Rinsing is just pleasant.
Re:The Norway Problem by teddyh on Saturday April 03, 2021 @12:25PM (#26682290)
That’s not a zero-copy algorithm. The algorithm with using the soap dispenser being closed as a flag is zero-copy.
Re:The Norway Problem by corpMaverick on Saturday April 03, 2021 @12:12PM (#26682168)
I want to have two dishwashers. One with the dirty dishes and one with the clean dishes. So you never have to put the dishes away. They go from the clean dishwasher to the table to the dirty one. And then flip them.
Re:The Norway Problem by tjalfi on Saturday April 03, 2021 @04:34PM (#26684488)
This idea comes up periodically on Reddit. [0] has a few posts from people who have installed them, mostly for bachelors.

[0] https://www.reddit.com/r/self/comments/ayr9c/when_im_rich_im...

Re:The Norway Problem by sokoloff on Saturday April 03, 2021 @02:53PM (#26683650)
There’s a community near here with a high fraction of Orthodox Jews. One condo I toured in my 20s had two dishwashers and without thinking about why they did it, I commented how I thought that was awesome that you’d never need to put dishes away. (They of course installed two dishwashers for orthodox separation of dishes from each other.)
Re:The Norway Problem by LilBytes on Saturday April 03, 2021 @10:13AM (#26681214)
Blasphemy! I do the inverse. You're wrong. /s

insert code flame war here

Re:The Norway Problem by pdkl95 on Saturday April 03, 2021 @11:42AM (#26681909)
Vi Hart - "How to Microwave Gracefully"

https://www.youtube.com/watch?v=T9E0zSpULFY

Re:The Norway Problem by pdpi on Saturday April 03, 2021 @07:31AM (#26680135)
Not the OP, but I have the same problem. For some reason that escapes me, pressing the “10 sec” button 7 times produces 00 70 instead of 01 10. If you then press the “1 min” button you get 01 70
Re:The Norway Problem by nerdponx on Saturday April 03, 2021 @08:17AM (#26680443)
Most microwaves (in the USA) do this, at least in my experience.

They treat the ":" like a sum of two sexagesimal numbers, rather than a sexagesimal digit separator.

Re:The Norway Problem by mckirk on Saturday April 03, 2021 @05:11AM (#26679456)
How else would you prove it's turing complete and can run Doom?