WTF Bites


  • Discourse touched me in a no-no place

    @LB_ said in WTF Bites:

    everyone suggests JavaScript instead

    Douglas Adams was wrong. The answer to the ultimate question is not 42, but is actually Javascript.

    INB4: jQuery.


  • 🚽 Regular

    A fairly significant percentage of the bug reports we receive, actually have very little to do with our code. Vivaldi is frequently blocked, shown alternate (incorrect) versions of a website or spurious warnings are displayed, based solely on the User Agent.

    Business as usual, but I can't help going :wtf: whenever I see corporations pull stupid bullshit like this:

    • On Google.com if you present a Vivaldi user agent and arrive via a redirect, the search text box will be misaligned
    • On Google Docs if you present a Vivaldi user agent you will receive a warning
    • On Facebook’s WhatsApp web interface if you present a Vivaldi user agent, you cannot enter the site and are advised to switch to one of our competitors
    • On Microsoft Teams (chat and collaboration website), presenting a Vivaldi user agent will stop you from being able to use the website
    • On Netflix, presenting a Vivaldi user agent results in a suggestion to install Silverlight to play videos… yes… really… Silverlight!


  • @Zecc They also link https://github.com/WICG/ua-client-hints, but it's far from radical enough. Like I surely already said, User-Agent should be fixed to Open Eyes, for all browsers, without replacement.


  • 🚽 Regular

    Or just character U+1F595 (🖕).


  • Considered Harmful

    @Zecc said in WTF Bites:

    corporations pull stupid bullshit like this

    If Vivaldi weren't based in Norway, I suppose they could summon The Knitting Lady. Any monies would surely go in EC coffers (after several appeals), but... you know, fight the good fight, for the better webs and all.



  • This is glorious! C++20 finally gives us mutable constexpr's:

        constexpr auto c = unconstexpr::meta_value{};
        static_assert(++c == 1);
        static_assert(++c == 2);
        c << []{ return "hello"sv; };
        static_assert(*c == "hello"sv);
        static_assert(std::is_same_v<decltype(*c), std::string_view>);
    

    Source: r/cpp



  • @cvi said in WTF Bites:

    This is glorious! C++20 finally gives us mutable constexpr's:

    :wtf_owl:



  • @Benjamin-Hall Exactly! I did say "glorious", right?

    Spoilers Not actually an intended language feature. More like accidental emergent behaviour. After all,

    32f09448-2591-43a3-a711-0d0fcbc90372-image.png



  • @Benjamin-Hall It's kind of global variable that is passed between all the compile-time-evaluated blocks.



  • @Bulb said in WTF Bites:

    @Benjamin-Hall It's kind of global variable that is passed between all the compile-time-evaluated blocks.

    That's not making my :wtf_owl: reaction any better. In fact, due to a threading error it's now worse: :wtf_owl:^2



  • @Benjamin-Hall said in WTF Bites:

    threading error

    Unless the dependency analysis is wrong, the compilation isn't likely to make a threading error in this. And the variable is only mutable at compile time, not at runtime. You can get different results in different compilation units quite easily though.



  • @Bulb said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    threading error

    Unless the dependency analysis is wrong, the compilation isn't likely to make a threading error in this. And the variable is only mutable at compile time, not at runtime. You can get different results in different compilation units quite easily though.

    I see my joke fell flat. Probably error'd out due to some arcane template error, this being C++.


  • Banned

    @Bulb said in WTF Bites:

    @Benjamin-Hall It's kind of global variable that is passed between all the compile-time-evaluated blocks.

    Wait, what? It looks like all they do is weird template trickery, shouldn't that be entirely contained within a single compilation unit?



  • @Gąska Yes, it is. Except if you put it in a header—and the point of constexprs is often that you do—you might get different result in each compilation unit due to different order of includes or some includes being or not being present and such.



  • @Bulb said in WTF Bites:

    @Gąska Yes, it is. Except if you put it in a header—and the point of constexprs is often that you do—you might get different result in each compilation unit due to different order of includes or some includes being or not being present and such.

    So not just weirdness, but quantum (apologies to all the real physicists out there) weirdness.


  • Banned

    @Benjamin-Hall at least the same code compiles to the same output each time. No worse than the previous hacks that work in C++14, except the syntax is nicer.



  • @LB_ max() and min() are in Chrome, and allegedly coming to Firefox Soon™.



  • I've got Eclipse content assist set to sort by relevance (as opposed to alphabetically, the only other choice), and I type the name of a method that I use all the time. Does it
    a) auto-complete the method that I wanted, or
    b) default to an unrelated method that I've never used

    93e382fb-bc07-4a9a-a0ce-51b70922cf39-image.png



  • @hungrier said in WTF Bites:

    Does it
    a) auto-complete the method that I wanted, or
    b) default to an unrelated method that I've never used

    c) Randomly pick a method name that may or may not exist in the project, and is almost certainly not actually valid on the object you are invoking it on. Except that rarely it does the right thing, because you'd uninstall it if it messed up all the time.



  • WTF of my day: So, last year we bought one of those Epson EcoTank printers because we needed at least one printer to do colour and the low price for ink (original even!) looked attractive. For those who don't know those printers: Instead of replacing cartridges with or without the printer head, this one has four separate tanks and you simply fill those tanks with ink.

    Now, after 9,000 pages, that printer developed a blank line in the cyan. The "printer head maintenance" and "intensive maintenance" did nothing.

    So I called Epson support which went through their script, making me do another two maintenance cycles (surprise: They did nothing) after which I sent in the printer for repairs.

    Today we received it back. So, I opened up the case (which included all my printouts I had to include - but nowhere was something like a "We did foo and fixed bar" statement to be seen), setup the printer, turned it on ... and the prints looked worse than ever. Blank lines everywhere.
    After one maintenance cycle, it cleared up, though.

    Save for one blank line in the cyan.

    When I put an old printout and a new one side by side I could easily see that it was the same one. The fuckers fixed nothing!

    Off to support I went, only to be greeted by a drone who, being told about my misfortune, did not acknowledge this in the slightest (Normal humans, when being told that their company didn't fix what they said they'd fix usually react with something akin to: "Oh, I'm sorry about that!" or similar). Naw, he immediately launched into his script which consisted of the same things as before.

    When I asked him what he expected to go differently this time, he replied that he could not deviate from his script. There's also no escalation or anything. Nope, just send the whole thing in again and pray for the best.

    We have Epson hardware approaching six figures in my school. I think we'll consider other options in the future.



  • @loopback0 said in WTF Bites:

    @LB_ said in WTF Bites:

    everyone suggests JavaScript instead

    Douglas Adams was wrong. The answer to the ultimate question is not 42, but is actually Javascript.

    If JS is the answer, I don't want to know the question.

    Edit: Don't close your tags; I delete your joke from the quote.



  • @Rhywden: the "printers are evil" thread is :arrows:

    But yeah, Epson printers. They work great... until you commit the sin of not printing anything for a week or so, or just looking at them the wrong way. Then you get sent straight to hell.



  • @HardwareGeek said in WTF Bites:

    If JS is the answer, I don't want to know the question.

    Maybe SO got the whole thing with closing other people's questions right?

    Filed under: CLOSED_DONOTASK or perhaps CLOSED_DONTEVEN.



  • @error said in WTF Bites:

    The OCR of this handwritten check I deposited with my phone gypped me 2 cents.

    I obviously don't care enough to fight it but.

    It kept insisting I entered the amount wrong, and eventually just "fixed" it for me.

    Careful. You have just exposed the new grand larceny scheme. Screw the fractions of cents - we're going full cents! The assassins will be round in the mornin to clean things up...



  • @Zerosquare said in WTF Bites:

    Epson printers. They work great...

    but they're inket printers and thereforfe made of 523.35% evil.



  • @cvi said in WTF Bites:

    Exactly! I did say "glorious", right?

    No. You said

    glorious

    "glorious" is definitely more appropriate.


  • Discourse touched me in a no-no place

    @cvi said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    If JS is the answer, I don't want to know the question.

    Maybe SO got the whole thing with closing other people's questions right?

    : What is the ultimate question?
    : Closed as Not Constructive, Duplicate.


  • Notification Spam Recipient

    @levicki said in WTF Bites:

    Why I cannot

    : You don't really want to know. One second, adding you to the gaslight list...


  • Java Dev

    @HardwareGeek said in WTF Bites:

    @loopback0 said in WTF Bites:

    @LB_ said in WTF Bites:

    everyone suggests JavaScript instead

    Douglas Adams was wrong. The answer to the ultimate question is not 42, but is actually Javascript.

    If JS is the answer, I don't want to know the question.

    But knowing the question would cause both the question and the answer to disappear! Did you really mean to say you want javascript to stick around?



  • Guess the source:
    b66ccc52-0da7-440f-9de6-aa8ebcc389a4-image.png

    Answer

    USB HID Usage Tables

    I'm not sure which is more amazing. The fact that the USB HID considers magic carpets important, or that we apparently have a standard control scheme for them.



  • I know this one. It's the USB HID spec. I remember reading it and going :wtf:



  • @Zerosquare There are a few other good ones in there. Bicycle crank is pretty neat (crank turns per minute) for whoever wants to create a better bicycle simulator.



  • If you set aside the usual design-by-committee that plagues USB, the HID spec has actually a few good ideas in it. The ability to support all kinds of different controllers (even future ones) with a single driver is pretty nice. On the other hand, it also includes some :facepalm: like limiting how many keys can be pressed together on keyboards, while the older PS/2 protocol handled it just fine.


  • Notification Spam Recipient

    @Zerosquare said in WTF Bites:

    limiting how many keys can be pressed together on keyboards,

    Wait, there's literally a rollover cap in the spec? Goddam...



  • @Tsaukpaetra said in WTF Bites:

    Wait, there's literally a rollover cap in the spec? Goddam...

    As far as I understood, there's the boot keyboard mode, which uses a standardized 8-byte format, where it reserves space for 6 scan codes. So, with the boot keyboard, you're limited to 6 concurrent keys + modifier keys (L/R shift/ctrl/alt/"gui", which are encoded separately). As annoying that might be, (a) this is literally the legacy support mode for stuff like old BIOSes, and (b) the decisions that led to this design kinda make sense.

    For non-boot keyboards, the HID spec apparently allows for all sorts of weird configurations, and apparently even ones that are full NKRO. I've not quite figured out all the details for that, but there are/were problems with incomplete/incorrect implementations on various sides of the fence, so people had to resort to various workarounds. These seem to live on, especially since people apparently want to have NKRO even when connected to their 15 year old toasters. (For modern devices, I would guess that the situation looks a lot better.)


  • Fake News

    @Zerosquare said in WTF Bites:

    it also includes some like limiting how many keys can be pressed together on keyboards, while the older PS/2 protocol handled it just fine.

    But then the PS/2 keyboard bus was a relatively simple thing with only a few functions like button on, button off. The USB HID spec is an entirely different beast where one might be sharing the bus with several devices, several different kinds of messages, and send e.g. analog values of controllers.

    The legacy keyboard mode is thus a decent compromise. It's just a pity that standard keyboard drivers would not support the full functionality of the USB HID descriptors, though that's also not surprising when a lot of cheap keyboards would simply implement the legacy keyboard mode and nothing more.



  • @Tsaukpaetra said in WTF Bites:

    @LB_ said in WTF Bites:

    if you want both at the same time you are just screwed.

    I thought I remember some hack that involved three layers of divs with three different classes, but I can't find it at the moment...

    I am using a three-nested-element workaround but it's dumb and doesn't work properly with :hover since the left and right sides act as hover zone.

    @TwelveBaud said in WTF Bites:

    @LB_ max() and min() are in Chrome, and allegedly coming to Firefox Soon™.

    Yeah, that seems to be about the only way to get close to a sane implementation of what I want. I'm going to hold off on using it until it has more browser support though.

    @levicki said in WTF Bites:

    @LB_ If the idea is to tie the aspect ratio to screen aspect ration you could use JS to just read screen width and height and set CSS variables on page load, then calculate element dimensions as needed in CSS itself.

    Ah no, my apologies for the confusion - the aspect ratio is arbitrary, and the div just needs to resize to fit within its container (varying width/height combinations due to other content on the page giving more or less space) but also not get larger than a known size, remaining centered after that. I have tried a lot of approaches with calc and var and such, but the issue that always stops me is that you cannot have a unit value on the right hand side of division, the right hand side of division always has to be a plain unadorned number. That basically makes most potentially useful things totally impossible.

    @levicki said in WTF Bites:

    Why default Chrome must be blindingly white? It's like I am staring at a 1000 W incadescent lightbulb.

    If you set your system app theme to Dark theme, Chrome changes its UI to match (and even some webpages change their theming too, like Microsoft's documentation). I think there's also a command line option to force dark theme in Chrome.


  • Banned

    @LB_ said in WTF Bites:

    I have tried a lot of approaches with calc and var and such, but the issue that always stops me is that you cannot have a unit value on the right hand side of division, the right hand side of division always has to be a plain unadorned number. That basically makes most potentially useful things totally impossible.

    As a total noob who doesn't know CSS at all: have you tried using dimensionless numbers for everything and saving them to variables, then using that "* 1px" hack @levicki mentioned?



  • @Gąska Yes, in fact that's part of my current solution, and it's not a hack either since it mirrors real world actual math that multiplying a unitless number with a united number gives it a unit. My current solution uses the vertical padding wrapper hack, e.g. padding-top: calc(calc(var(--height) / var(--width)) * 100%);, but I want to limit it to a max-height of 90vh so that the user can scroll it all into view at once if it's a tall box. That's easy enough to do with another wrapper element, but the issue is that all these divs take up the full width of the page, and I also want to remove the 90vh restriction on :hover, but since the div that has that restriction takes up the full width of the page, it makes the empty blank spaces on either side act as hover zones. So, you might think I can just limit the width of the divs, right? It's just not possible as far as I can tell. There's nothing I can enter as a formula into width or max-width that will work. One of my solutions involved dividing by 90vh but since you can't divide by united values, it just doesn't work. The padding-top thing really is an ugly hack since it abuses a weird gimmick whereby percentage values for vertical padding are a percent of the width instead of the height. There is no equivalent for horizontal padding to be based on the height instead of the width. It's just a hack that people have been using for years and only this year is there any real movement on trying to get something better.

    Also, there's no element queries in the same way there's media queries. The supposed reason being to prevent looping/flickering size computations. But while working on this project, regular old ordinary CSS already started having seizures anyway, so it's not exactly a new problem...

    EDIT: I may be getting myself mixed up with when/where I need the 90vh max-height, I stayed up too late trying to figure it out and I've sort of lost the plot.



  • @cvi: I admit I haven't looked at it in detail. All I knew is that USB keyboards that support full NKRO use ugly hacks to do so. It may well be because of buggy implementations. That wouldn't be the first time ; IIRC, there's at least one place where the USB spec was changed after the fact because Windows' implementation had a bug.

    @JBert: HID does a lot more stuff than PS/2, true, but that's not incompatible with reporting "key press/release" instead of reporting "key down". In fact it would have been easier for everyone, since existing devices and drivers worked that way.


  • Discourse touched me in a no-no place

    @LB_ said in WTF Bites:

    The thing really is an ugly hack since it abuses a weird gimmick

    That is what you get for using CSS.

    I stayed up too late trying to figure it out and I've sort of lost the plot.

    😆


  • BINNED

    @levicki said in WTF Bites:

    Why I cannot keep

    Because MS Defender is missing


  • BINNED

    @cvi said in WTF Bites:

    bicycle simulator.

    Big business this one.

    Current state of the art stuff adjust your angle to climb/descent, the up front fan to your speed and registers steering. All is projected inside a virtual world where you can ride against other users.

    No, I don't get the appeal either.


  • Notification Spam Recipient

    @Luhmann which is funny, because as far as I can tell, the VirZoom doesn't use that spec at all...


  • Fake News

    @Luhmann said in WTF Bites:

    @cvi said in WTF Bites:

    bicycle simulator.

    Big business this one.

    Current state of the art stuff adjust your angle to climb/descent, the up front fan to your speed and registers steering. All is projected inside a virtual world where you can ride against other users.

    No, I don't get the appeal either.

    Well, if it doesn't simulate rain, sleet, or black ice then you actually do have an advantage over biking outside during the winter...


  • Banned

    @topspin but is there any advantage over watching Netflix on a regular stationary bike?


  • BINNED

    @Gąska
    It's supposed to be less static and more stimulating.


  • BINNED

    @JBert
    Advantage? You are taking away all the fun!


  • BINNED

    @cvi said in WTF Bites:

    This is glorious! C++20 finally gives us mutable constexpr's:

        constexpr auto c = unconstexpr::meta_value{};
        static_assert(++c == 1);
        static_assert(++c == 2);
        c << []{ return "hello"sv; };
        static_assert(*c == "hello"sv);
        static_assert(std::is_same_v<decltype(*c), std::string_view>);
    

    Source: r/cpp

    Without actually looking into it how that works, this isn't new. I've seen something like that before:

    As far as I know, this is definitely an implementation artifact and not supposed to work. Even for C++'s usual level of craziness, the committee has decided that this is not compliant even if compilers support it.
    IMO, it's basically a sort of ODR violation.

    @Bulb said in WTF Bites:

    @Gąska Yes, it is. Except if you put it in a header—and the point of constexprs is often that you do—you might get different result in each compilation unit due to different order of includes or some includes being or not being present and such.

    Definitely sounds like an ODR violation.

    Fake edit: Just after typing this up I found an acknowledgement link from the github page back to the blog posts I mentioned. So I guess it's based on the same idea.

    Real edit: I guess all of this has already been covered, but only if you actually follow the links more than one level deep. I only saw the godbolt page originally.


  • BINNED

    @Gąska said in WTF Bites:

    @topspin but is there any advantage over watching Netflix on a regular stationary bike?

    Que? I have no idea.


Log in to reply