WTF Bites


  • Discourse touched me in a no-no place

    @Arantor said in WTF Bites:

    YAML seems intuitive but the indentation kills you until you learn by having it beaten into you how much it matters

    I've used Python. YAML's rules aren't a big problem in practice for me.



  • @Arantor said in WTF Bites:

    JSON seems intuitive until you get some numpty throw a large blob at you that’s minified and missing a quote somewhere.

    … because JSON was meant to be readable and somewhat writable by humans for debugging purposes only, but should be written by programs in the normal course of operation.



  • @dkf said in WTF Bites:

    @Arantor said in WTF Bites:

    YAML seems intuitive but the indentation kills you until you learn by having it beaten into you how much it matters

    I've used Python. YAML's rules aren't a big problem in practice for me.

    The indentation rules are not usually a problem. Except for the option to not indent lists—I somewhat commonly need to merge that ßtupid .kube/config format, and recently the two specimens I had differed in whether they indented lists. So one was like

    clusters:
    - name: this
      cluster:
        server: https://10.11.12.13:6443/
        certificate-authority: …
    

    and the other like

    clusters:
      - name: that
        cluster:
          server: https://10.69.18.22:6443/
          certificate-authority: …
    

    … of course I missed the fact the sections that are nominally at the same depth don't have the same level of indentation the first time around.



  • @Arantor said in WTF Bites:

    Also, fuck JSON’s dislike of trailing commas.

    Javascript: :whistling:



  • @Bulb I’ve written YAML. I didn’t realise that you could skip that indent and it still read the same way to the parser… and that is why I hate YAML.


  • Considered Harmful

    @Arantor INI files encourage namespace flattening.

    There, I said it.



  • @Bulb said in WTF Bites:

    I have a string that's very long. I want to keep this within the 80-column (or so) view of my editor

    Get a better editor!

    Our company has a coding style with max 80 char lines. :wtf:❓ We're on big 4K monitors and you want to stay at 80 chars???



  • Soft keyboards are a fixture on modern slab-phones. So you'd think that Android and iOS would have bullet-proof keyboard-handling-and-detection APIs. Or would automagically handle the basic cases. And most of all, that those routines would be stable (not having changed since v1.0 or so.

    But no. Android 11 introduced new keyboard stuff, which means that previous stuff resizes properly...but only when the keyboard opens. When it closes, the app isn't notified (the same way) and so nothing resizes, leaving a gaping hole where the keyboard was. The solution? Add manual resizing. :headdesk: And once you do that, you have to handle both directions yourself--you lose any automatic resizing.

    What's more, the reported size of the keyboard isn't even right--it lies and says it's about 50 pixels taller than it really is. So if you just resize it to the stated margins, you get a white bar above the keyboard and below the content.

    iOS is more stable, but way more of a pain to set up in the first place.


  • Trolleybus Mechanic

    @Arantor said in WTF Bites:

    @sebastian-galczynski depends_on is still present but it doesn't check a healthcheck, it just ensures the container has started. For my uses that's enough but I can see how in your it might not be.

    Yes, but apparently you can (again) nest "condition: healthy" under depends_on. This will check the status determined by the healthcheck in the target container.



  • @Benjamin-Hall And I bet there's still no arrow keys for when you need more precise movement than having to zoom waaaay in and try to click precisely with your finger?


  • BINNED

    @dcon said in WTF Bites:

    @Bulb said in WTF Bites:

    I have a string that's very long. I want to keep this within the 80-column (or so) view of my editor

    Get a better editor!

    Our company has a coding style with max 80 char lines. :wtf:❓ We're on big 4K monitors and you want to stay at 80 chars???

    Yes. Maybe not necessarily 80, but surely not more than 100 or 120.
    I use the widescreen monitor to have multiple files or multiple views of files open horizontally next to each other. I don't want to have to read 400 character long lines just because that fits on the monitor in ultra wide. Also super long lines have a high correlation to WTF density and code that is extremely shitty to read even after line wrapping.


  • Discourse touched me in a no-no place

    @dcon said in WTF Bites:

    We're on big 4K monitors and you want to stay at 80 chars?

    Yes. You can see more files at once.



  • @Medinoc said in WTF Bites:

    @Benjamin-Hall And I bet there's still no arrow keys for when you need more precise movement than having to zoom waaaay in and try to click precisely with your finger?

    There are workarounds (precise scrubbing), but yeah. That's not so much a thing.

    I saw a guy the other day who was doing programming on his phone. Like actually writing serious code. Nope. Do not want.



  • @topspin said in WTF Bites:

    Yes. Maybe not necessarily 80, but surely not more than 100 or 120.

    Personally, I've got my .clang-format file set to 120.


  • Discourse touched me in a no-no place

    @Benjamin-Hall said in WTF Bites:

    There are workarounds (precise scrubbing), but yeah. That's not so much a thing.

    It depends on the keyboard implementation. Some provide honest arrow keys. Others provide ways to let you see more precisely where you are fat-finger pointing. Yet others... don't.


  • Considered Harmful

    @dcon said in WTF Bites:

    We're on big 4K monitors and you want to stay at 80 chars???

    You should press for 132.



  • @Benjamin-Hall said in WTF Bites:

    What's more, the reported size of the keyboard isn't even right--it lies and says it's about 50 pixels taller than it really is. So if you just resize it to the stated margins, you get a white bar above the keyboard and below the content.

    Is that with or without the supplementary band (autofill, autocomplete, autocarrot, paste, etc)?



  • @TwelveBaud said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    What's more, the reported size of the keyboard isn't even right--it lies and says it's about 50 pixels taller than it really is. So if you just resize it to the stated margins, you get a white bar above the keyboard and below the content.

    Is that with or without the supplementary band (autofill, autocomplete, autocarrot, paste, etc)?

    Including that band. It's even worse if the band isn't there.



  • @Medinoc said in WTF Bites:

    @Benjamin-Hall And I bet there's still no arrow keys for when you need more precise movement than having to zoom waaaay in and try to click precisely with your finger?

    That depends on your keyboard and/or settings. I know SwiftKey has them, but IIRC they're disabled by default.


  • BINNED

    What is going on here?

    pulseaudio.png



  • @topspin Firefox is using less memory than usual?


  • Java Dev

    @dcon I don't know. We don't really have a point of reference.


  • BINNED

    @dcon pulseaudio has 10 hours of CPU time.


  • Java Dev

    @topspin said in WTF Bites:

    @dcon pulseaudio has 10 hours of CPU time.

    What's the uptime of the system?



  • @topspin said in WTF Bites:

    @dcon pulseaudio has 10 hours of CPU time.

    Well, turn off that streaming tab in FF! (Oh wait, are you one of those with 500 tabs open so there's no hope of finding it?) :trollface:


  • BINNED

    @PleegWat 21 days.



  • @dcon said in WTF Bites:

    @Bulb said in WTF Bites:

    I have a string that's very long. I want to keep this within the 80-column (or so) view of my editor

    Get a better editor!

    Our company has a coding style with max 80 char lines. :wtf:❓ We're on big 4K monitors and you want to stay at 80 chars???

    Yes. Besides the simple fact that long lines are difficult to read simply due to the range of eye motion necessary, there are good uses to have two pieces of code open side-by-side. So you want the code only so wide that you can fit two files side-by-side plus the IDE sidebar. Account for developers with poorer sight who have big font and 80 is fairly reasonable.



  • @topspin said in WTF Bites:

    What is going on here?

    pulseaudio.png

    systemd-audio-trojan working as intended?


  • Considered Harmful

    @dkf said in WTF Bites:

    @Arantor said in WTF Bites:

    I’d go for TOML.

    I don't mind YAML for configs, but my IDE supports editing it so it's non-painful. Only a total madman would use YAML for serialization though; JSON is much better for that.

    🖐
    In my defence, this was before JSON was anything like popular and way before it was ECMA'd; YAML was pretty much a Perl thing. The two or three other serialization formats we tried were slower, opaque, or both. And when the serialization code is in C and you compress the result, it's not that bad.



  • Status Javascript sucks. Hot take, I know.

    In this case, the mutability of the function parameters and the lack of any (native) deep clone (until very recently, which can't be counted on in all clients and only works for some objects).



  • wasNull.png

    The real question is if "null" is a better price than English-€3.


  • Considered Harmful

    grim.png

    Metal äf!



  • WTF of my day: User complained that duplicating a course in Moodle never completes and is stuck at 100%. Looked in the task log and saw this:

    9154332a-d617-4fc9-96b9-4aa68ebc6ab4-image.png

    "Ergebnis: Erfolgreich" translates to "Result: Successful".

    :wtf_owl:



  • I want to talk for a minute about postal codes.

    In the UK we define postal codes as approximate geographic regions, as a letter or pair of letters that refers to the sorting office, a number (or a number then a letter) for which subregion and then three characters for which street inside that.

    So you get B1 XYZ for the first region in Birmingham, or BN2 as the second region in Brighton. Or EC1A as region 1A in East Central (London).

    Anyway, you can assign an approximate geographic location to this region and use it as a “find the nearest x to me” within a reasonable level of accuracy. Like, “my nearest x is roughly 10 miles away” I don’t need it perfectly. It just has to be good enough.

    Now I am expanding this to Ireland - all of it. Northern Ireland behaves consistently to this with BT prefixes, e.g. BT2 through BT17 being Belfast itself for example.

    But the rest of Ireland? Fuuuuuuck.

    So they decided in 2015 they’d introduce actual postal codes that align to buildings. Fine. These take the form of A11 BC23 where the first half is the region, the second half the identifier for the building. Fine.

    Dublin gets D01 through D18 plus D20, D22, D24 and D6W (west). Fiiiine.

    The rest are “randomly allocated”. Some of these randomly allocated identifiers are, of course duplicated. There’s no reason for them to be duplicated whatsoever. Some of them aren’t bad, e.g. A75 covers two different towns a quarter of an hour’s drive apart.

    :wtf_owl: there are enough spare fucking allocations you lot could have given out more without duplication! Like in the R group, there is R21, R32, R35, R45, R51, R56, R93, R95… and then R42 that has two towns in it that Google tells me are at least an hour’s drive apart.

    And for a simple enough “the nearest x to me” widget this shouldn’t be this fucking complicated. Sort it out Ireland.


  • Discourse touched me in a no-no place

    @Arantor said in WTF Bites:

    Anyway, you can assign an approximate geographic location to this region and use it as a “find the nearest x to me” within a reasonable level of accuracy. Like, “my nearest x is roughly 10 miles away” I don’t need it perfectly. It just has to be good enough.

    We had a form for registering attendance at an internal event recently.
    It took the first 3 characters of your postcode to work out roughly how long it would take you to travel to the event as that determined if the company would cover a hotel for the night.

    It's fine if you live in B62, but if you live somewhere like NG33 it'd treat it as NG3 and there's at least an hour travel time difference.



  • @Arantor Germany has similar fun. So, we have the usual differentiation - you have the state, the districts and then the cities and villages belonging to this district, with one town usually being the nominal main town for the district.

    Sometime back someone very clever at the post office decided that if you want to send something to a smaller village in a district, you instead have to use the district's main town instead.

    So, instead of sending something to "Elm Street 1, Village Name" you now have to send it to "Elm Sstreet 1, Main Town".

    Now, my own home town is such a main town and it, along with several villages in the district, is located around a forest called Elm. As a result, nearly every village and my town has a street leading to this forest called the Elm Street.

    With the obvious result. Bonus points if two families in two different villages on such a street have the same last name.

    Bonus: A friend of mine lived on one of those Elm Streets. His last name was "Krüger" ("Krueger" for all of you Umlaut-challenged deplorables). And his parents named him "Frederic". I'm still not sure whether they knew of the movies...



  • @Rhywden said in WTF Bites:

    WTF of my day: User complained that duplicating a course in Moodle never completes and is stuck at 100%. Looked in the task log and saw this:

    9154332a-d617-4fc9-96b9-4aa68ebc6ab4-image.png

    "Ergebnis: Erfolgreich" translates to "Result: Successful".

    :wtf_owl:

    :um-actually: Reminds me of the backup utility of a Hospital Information System.
    It was a script which contained many commands.
    When the script was able to run all the commands, it reported "success".
    Even when some of the commands had returned an error: because that did not prevent it from running all the commands.
    You had to investigate its log file to see these errors. Actually, all of the commands could have returned an error, and the script still reported "success".
    Health Care IT....



  • This post is deleted!


  • @Rhywden yes, that seems about right for Moodle. 5344 queries to duplicate a course is typical in my experience.



  • @LaoC said in WTF Bites:

    grim.png

    Metal äf!

    "Dö nöt remöve this band" is, obviously a Spotify-playlist-optimized heavy metal band. It should not be confused with "Do not remove this band" (country) and "Yo no remova dis band mothefucka" (gansta wrap).



  • @Arantor said in WTF Bites:

    In the UK we define postal codes as approximate geographic regions, as a letter or pair of letters that refers to the sorting office, a number (or a number then a letter) for which subregion and then three characters for which street inside that.

    UK is rather special in the regard that people tend to use postal codes for general purposes. In most countries people use just city (+ quarter if needed) + street + number and only bother with postal codes, where they even exists, when actually sending stuff via post.


    @Rhywden said in WTF Bites:

    Sometime back someone very clever at the post office decided that if you want to send something to a smaller village in a district, you instead have to use the district's main town instead.

    So, instead of sending something to "Elm Street 1, Village Name" you now have to send it to "Elm Sstreet 1, Main Town".

    Around here that kind of address has always been written like “Elm Street 1, Village Name, last post Main Town”. No ambiguity then.



  • @Arantor said in WTF Bites:

    @Rhywden yes, that seems about right for Moodle. 5344 queries to duplicate a course is typical in my experience.

    That's the problem with database schemas which grow organically over time and where you never deprecate anything due to backwards compatibility.



  • @Rhywden no, no, they do do deprecate things, and migrate schemas where necessary - I know, I’ve been involved in some of this stuff. At one point Moodle’s founder called me a gorilla to my face and I upstaged him a little at the 2018 UK/IE Moodle conference. I am sadly more familiar with Moodle than I would like to be.

    I’ve certainly managed the changes of their work over multiple major versions for some of the UK’s larger unis…



  • @Arantor But you probably have no idea what this means? Because the error message is veering off a bit towards the ":wtf: am I supposed to make of this?"



  • @Rhywden means that one of the course modules inside the course didn’t properly declare itself as done… if memory serves that’s during the restore step. Basically each step of the journey has a status code and it’s gotten stuck at a state it shouldn’t have.

    Adhoc copy is really “let’s make a serialisation of the entire course (IIRC without user data like student submissions) and immediately restore it” but this was just being worked by the core team as I was getting ready to leave that company.

    Each course module is responsible for its own backup/restore, so you “should” be able to rule out which modules aren’t relevant because IIRC all of the modules shipped with Moodle behave correctly (and have a full suite of tests to verify this)



  • @Arantor Thanks, that's very helpful and now I have something actionable :)



  • @Rhywden no one likes writing the backup/restore code, it’s flaky, it’s fragile and it’s utter hell to actually debug.

    And then you have people like me who write crazy shit like “let’s make a block that can contain other blocks and display them in different ways” which involves modifying the backup process in-situ to rearrange the order things get serialised/deserialised.

    It would help if the debug information were any use - but it isn’t.



  • @Arantor said in WTF Bites:

    But the rest of Ireland?
    ...
    The rest are “randomly allocated”. Some of these randomly allocated identifiers are, of course duplicated.

    Ireland. Whoever did the allocation was undoubtedly drunk at the time. :tro-pop:


  • Discourse touched me in a no-no place

    @BernieTheBernie said in WTF Bites:

    It was a script which contained many commands.
    When the script was able to run all the commands, it reported "success".

    I remember dealing with a "script" produced by a senior scientist. It was a grab bag of all the little tricks he'd worked out over the years, and he used it by copy-and-pasting stuff from there into his interactive Fortran session, in whatever order he felt was suitable for what he was doing. I'm not sure he ever understood why the rest of the team thought this was deplorable.



  • @dkf said in WTF Bites:

    copy-and-pasting stuff

    Fortran

    not sure he ever understood why the rest of the team thought this was deplorable.

    So, your standard scientist, then :half-trolling:


Log in to reply