WTF Bites



  • @PleegWat said in WTF Bites:

    @Arantor said in WTF Bites:

    @TimeBandit yes, they're called Zoom and Teams.

    Preferably with the camera disconnected, or the lens covered.

    And ideally the sound off too.


  • Java Dev

    @Arantor said in WTF Bites:

    @PleegWat said in WTF Bites:

    @Arantor said in WTF Bites:

    @TimeBandit yes, they're called Zoom and Teams.

    Preferably with the camera disconnected, or the lens covered.

    And ideally the sound off too.

    I've got one such weekly meeting. Though I generally keep the audio on low (keywords) and the mic off.



  • I open my laptop. Observe that Firefox is eating 50% of the CPU.

    Check Firefox's task manager.

    f7d853b5-7d8f-4120-a38c-ecf24002f7a6-image.png

    I wasn't aware I had a Loom tab open (I am familiar with Loom, the boss likes it at work), but it smells like it's an iframe somewhere which means I need to hunt down and murder whichever tab has it open.


  • 🚽 Regular

    @Arantor I'm Bobbin Threadbare. Are you my mother?



  • @Zecc said in WTF Bites:

    @Arantor I'm Bobbin Threadbare. Are you my mother?

    Sadly, wrong Loom.



  • How's this for a helpful API: The proposed media.canPlayType(type) JS function has the following return values:

    • '' if it knows it cannot play that type.
    • 'maybe' if it isn't sure one way or the other (this is the "normal" response)
    • 'probably' if it thinks it can.

    The canPlayType(type) method must return the empty string if type is a type that the user agent knows it cannot render or is the type "application/octet-stream"; it must return "probably" if the user agent is confident that the type represents a media resource that it can render if used in with this audio or video element; and it must return "maybe" otherwise. Implementers are encouraged to return "maybe" unless the type can be confidently established as being supported or not. Generally, a user agent should never return "probably" for a type that allows the codecs parameter if that parameter is not present.


  • Banned

    @Benjamin-Hall considering what a mess media playback is in general, it's either this or something even less useful.



  • @Gustav said in WTF Bites:

    @Benjamin-Hall considering what a mess media playback is in general, it's either this or something even less useful.

    I'm just amused by the choices. You get nothing (for false, which kinda makes sense because '' is falsey), maybe, or probably. The later two are near-synonyms. And probably is only to be used where the User Agent is near-certain that it can.



  • It's one example I like to use when asked what's my opinion of web dev.


  • Banned

    @Benjamin-Hall said in WTF Bites:

    @Gustav said in WTF Bites:

    @Benjamin-Hall considering what a mess media playback is in general, it's either this or something even less useful.

    I'm just amused by the choices. You get nothing (for false, which kinda makes sense because '' is falsey), maybe, or probably. The later two are near-synonyms. And probably is only to be used where the User Agent is near-certain that it can.

    It's about setting the right expectations (or rather, avoiding wrong ones). What if it was a simple true/false/FILE_NOT_FOUND? What if the browser returned true for the given MIME type and codec, but it turns out the video uses a weird encoding mode that only one implementation is legally allowed to support due to patents? Instead of "it says probably, but actually it works basically every time", we'd have "it says true, but actually it doesn't always work".


  • BINNED

    @Benjamin-Hall said in WTF Bites:

    which kinda makes sense because '' is falsey

    I mean, sure, that makes sense if you want to encourage comparisons that pretend the value is boolean when you know it's not. Or they could just be one teeny bit less retarded and return 'no' when they mean no. :mlp_shrug:


  • Banned

    @topspin especially since if (media.canPlayType(type)) is the wrong thing to ask with this API. "We are definitely sure we don't support it" is virtually never the case you care about.



  • @Gustav What is the intended use case anyway?

    var c = media.canPlayType(someType);
    if (c === 'probably') {
      tryPlayingIt(); //either plays it or doesn't
    } else if (c === 'maybe') {
      tryPlayingIt(); //either plays it or doesn't
    } else {
      console.log('¯\_(ツ)_/¯');
    }
    

  • I survived the hour long Uno hand

    @hungrier said in WTF Bites:

    @Gustav What is the intended use case anyway?

    var c = media.canPlayType(someType);
    if (c === 'probably') {
      tryPlayingIt(); //either plays it or doesn't
    } else if (c === 'maybe') {
      playLightAdBlockingAdmonishment();
      tryPlayingIt(); //either plays it or doesn't
    } else {
      playAdBlockingBlakeyrage();
    }
    

    🔧


  • Banned

    @hungrier there was one, until someone (correctly) pointed out the use case is impossible to implement reliably. What followed, I imagine, is the "we absolutely need this feature" camp and "this feature cannot possibly work" camp meeting in the middle and designing an API that satisfies both groups' main goals (existence, and admitting uselessness).


  • BINNED

    @Gustav the most depressing part is how likely that's true. :picard-facepalm:



  • Seen in a PR for the QA automation project (using Webdriver to do automated regression tests on our web product) as a selector for a particular element:

    `//div[@id="background"]/div/div/div[3]//span[@t-id="${tId}"]/../../../following-sibling::div[1]//input`
    

    Hmm...maybe we need to actually put good stable unique ids on things...:thonking:

    FYI, that tId parameter is actually a placeholder for a translation id used by our (💩) localization package. It's the best way they have of identifying this element over that element.

    Note--I'm not blaming the QA team. They do the best with the crap that we've given them.



  • @Benjamin-Hall The eternal fight between the testers, who want all important widgets to have ids, and the devs, who never understand why, and in case they do, they don't give a shit anyway. Most projects are like that.



  • @Bulb solution: make the devs write the first round of basic tests.





  • @Bulb in this particular case, this was written well before we had any tests. Including non production environments or a QA department in general.

    We've gotten slowly better on new stuff, and now have a policy that QA runs the automation on tickets before they're merged. Failing tests that have stupid selectors like this get subdefects to go add proper IDs.



  • @Bulb said in WTF Bites:

    @Arantor :laugh-harder:

    You say that but there are projects I've worked on where I as developer of record also write the tests in Behat+Selenium...


  • Fake News

    @Benjamin-Hall said in WTF Bites:

    @Gustav said in WTF Bites:

    @Benjamin-Hall considering what a mess media playback is in general, it's either this or something even less useful.

    I'm just amused by the choices. You get nothing (for false, which kinda makes sense because '' is falsey), maybe, or probably. The later two are near-synonyms. And probably is only to be used where the User Agent is near-certain that it can.

    60% of the time, it works every time would be a lot to type, though.


  • Notification Spam Recipient

    @Arantor said in WTF Bites:

    @Bulb solution: make the devs write the first round of basic tests.

    That's how you get duplicate IDs for every component.



  • @Tsaukpaetra said in WTF Bites:

    @Arantor said in WTF Bites:

    @Bulb solution: make the devs write the first round of basic tests.

    That's how you get duplicate IDs for every component.

    No, I just spent my time tripping over the test runner selector-matching the wrong 'add' button all the damn time because despite me telling it 'the "add xyz" button' it would inevitably find whichever button had text that started with 'add' whether it was my button or not, usually not.


  • 🚽 Regular

    @Gustav said in WTF Bites:

    It's about setting the right expectations (or rather, avoiding wrong ones). What if it was a simple true/false/FILE_NOT_FOUND? What if the browser returned true for the given MIME type and codec, but it turns out the video uses a weird encoding mode that only one implementation is legally allowed to support due to patents? Instead of "it says probably, but actually it works basically every time", we'd have "it says true, but actually it doesn't always work".

    What if it returned symbols or an object with is properties instead of being stringly typed?



  • @Zecc that sounds far too cromulent for web dev specifications.



  • Now I have a MS SQL Server in the cloudz. Installed the current Management Studio on my virtual Win 11 machine, connected to the server, created a database, added some data, and took a look at them with a view. For convenience, I added an Order By section. And SSMS barked:
    ViewOrderBy.png
    So what? It works anyways, I thought. At least it does on my old computer at home with a vintage version of SQL Server and SMSS (2008?).

    But with the modern version it fails.
    :wtf_owl:
    One moment... There was a thing...
    Ah yes: the TOP part of SQL statement for the view:
    SELECT TOP(100) PERCENT
    fails.
    You have to use instead
    SELECT TOP(999999)
    That works.
    🐃 :wtf-whistling:



  • @BernieTheBernie Why even include the TOP restriction if you are not actually restricting the result?


  • Banned

    @BernieTheBernie said in WTF Bites:

    So what? It works anyways, I thought.

    It's this kind of thinking that made IT industry into the hell we know it as.



  • @Bulb said in WTF Bites:

    @Benjamin-Hall The eternal fight between the testers, who want all important widgets to have ids, and the devs, who never understand why, and in case they do, they don't give a shit anyway. Most projects are like that.

    Also frameworks that purposefully make it difficult to assign predictable, unique ids to things


  • Discourse touched me in a no-no place

    @Gustav It's a matter of balance. We need to not just bang out crap, but we also need to actually get on with it and get stuff done. Taking 6 months to produce something that ought to take a few hours isn't a win, even if the few hours includes more CPU time...


  • Banned

    @dkf yeah but expecting an SQL view to automagically keep everything in strict order for all queries forever after is anything but balanced. Imagine the horror if it actually worked like that! 99% of Windows codebase - and 99% of the reason why Windows is so unstable - is due to accomodating this kind of asinine requests.

    It even tells you exactly what to do to get your query ordered. But nooooo, that's not good enough. I must have the order stored permanently in the database itself, because fuck you that's why!



  • @Gustav it's not clear if this is a materialised view or not. If not, it's basically just a shorthand SELECT where baking the order in makes sense.



  • @Bulb said in WTF Bites:

    @BernieTheBernie Why even include the TOP restriction if you are not actually restricting the result?

    :um-actually: Have you ever created a view with SMSS? That TOP(100) PERCENT is there automagically.
    :um-pendant: I am not even sure if I have tried to remove that clause at all - CRS... - or if I failed when I tried that with the vintage version...
    :um-nevermind:



  • @Gustav said in WTF Bites:

    because fuck you that's why!

    Exactly. I just want to click on "select first 1000 results" and that's it. Why should I want to write a query, or load a query every time I want to see the dataz in SMSS?
    Because :fu:


  • Banned

    @BernieTheBernie we used to make fun of people who just want to see the grumpy cat and don't care about anything else. For example, that "first 1000 results" you want to do doesn't make semantical sense unless the query you're making has an ORDER BY clause, regardless of how the view was defined. You don't like that the button doesn't add ORDER BY to the query? Be mad that the button doesn't add ORDER BY to the query, not that there's no inherent order of rows in an SQL view.



  • @Gustav said in WTF Bites:

    @BernieTheBernie we used to make fun of people who just want to see the grumpy cat and don't care about anything else. For example, that "first 1000 results" you want to do doesn't make semantical sense unless the query you're making has an ORDER BY clause, regardless of how the view was defined. You don't like that the button doesn't add ORDER BY to the query? Be mad that the button doesn't add ORDER BY to the query, not that there's no inherent order of rows in an SQL view.

    Uh, the problem isn't about having to add an ORDER BY clause, it's about SQL SERVER slapping a TOP clause onto the view definition. Because why would you ever want all the records? And that TOP went on to break a later ORDER BY in a query on the view - because ordering after limiting via top doesn't make sense.


  • Discourse touched me in a no-no place

    @Watson said in WTF Bites:

    Uh, the problem isn't about having to add an ORDER BY clause, it's about SQL SERVER slapping a TOP clause onto the view definition. Because why would you ever want all the records? And that TOP went on to break a later ORDER BY in a query on the view - because ordering after limiting via top doesn't make sense.

    TBF, if the view was materialised, the secondary ORDER BY would make sense. "I want the 100 invoices with greatest amounts outstanding, ordered by time since when the invoice was raised." Makes definite sense for some reporting queries.

    The annoying part is that you end up needing (temporary?) subsidiary indices, but hopefully the view will have few enough elements that that's not horribly expensive.


  • Banned

    @Watson I think you read a different post. The one I was replying to had a screenshot of a warning that view's ORDER BY isn't the same as the query's ORDER BY, promptly ignored everything it says because the undocumented behavior in a version 15 years ago randomly happened to be as if they were the same, and whined that this isn't true in the new version as well.



  • @Gustav But who added the TOP clause?


  • Notification Spam Recipient

    @BernieTheBernie said in WTF Bites:

    SELECT TOP(100) PERCENT

    This smells horribly of a hack to trick the sensibilities of the optimizer...


  • Notification Spam Recipient

    @BernieTheBernie said in WTF Bites:

    @Bulb said in WTF Bites:

    @BernieTheBernie Why even include the TOP restriction if you are not actually restricting the result?

    :um-actually: Have you ever created a view with SMSS? That TOP(100) PERCENT is there automagically.
    :um-pendant: I am not even sure if I have tried to remove that clause at all - CRS... - or if I failed when I tried that with the vintage version...
    :um-nevermind:

    c235ad6b-f0f3-4148-9503-4ab139c83c61-image.png

    Yeah, it 100 percent was NOT there, but maybe you're using a 👶 🤝 version.


  • Notification Spam Recipient

    @Gustav said in WTF Bites:

    there's no inherent order of rows in an SQL view.

    I remememeber a programming language that explicitly randomized list ordering to enforce the idea that an unordered list was in fact not ordered. :thinking-ahead:



  • @Tsaukpaetra said in WTF Bites:

    @BernieTheBernie said in WTF Bites:

    @Bulb said in WTF Bites:

    @BernieTheBernie Why even include the TOP restriction if you are not actually restricting the result?

    :um-actually: Have you ever created a view with SMSS? That TOP(100) PERCENT is there automagically.
    :um-pendant: I am not even sure if I have tried to remove that clause at all - CRS... - or if I failed when I tried that with the vintage version...
    :um-nevermind:

    c235ad6b-f0f3-4148-9503-4ab139c83c61-image.png

    Yeah, it 100 percent was NOT there, but maybe you're using a 👶 🤝 version.

    I do not know whic version you are using. I use SSMS v19.2.
    And just tried to remove the TOP clause.
    Guess what happens?
    :surprised-pikachu:
    SSMS slaps in a TOP (100) PERCENT the moment when I try to save the view.
    :trwtf:


  • Discourse touched me in a no-no place

    @Tsaukpaetra said in WTF Bites:

    @Gustav said in WTF Bites:

    there's no inherent order of rows in an SQL view.

    I remememeber a programming language that explicitly randomized list ordering to enforce the idea that an unordered list was in fact not ordered. :thinking-ahead:

    There is an option to SQLite (maybe a pragma?) to reverse the order it internally iterates over things without an ORDER BY, just to make it easier to hunt down such user code problems.



  • @dkf said in WTF Bites:

    (maybe a pragma?)

    reverse_unordered_selects



  • @BernieTheBernie said in WTF Bites:

    @Bulb said in WTF Bites:

    @BernieTheBernie Why even include the TOP restriction if you are not actually restricting the result?

    :um-actually: Have you ever created a view with SMSS? That TOP(100) PERCENT is there automagically.

    No.

    :um-pendant: I am not even sure if I have tried to remove that clause at all - CRS... - or if I failed when I tried that with the vintage version...

    🤔 The warning said that the order by only defines which are the top n rows, not the final order, which means without the top, the order by might be invalid altogether.

    @BernieTheBernie said in WTF Bites:

    Exactly. I just want to click on "select first 1000 results" and that's it. Why should I want to write a query, or load a query every time I want to see the dataz in SMSS?
    Because :fu:

    So it's a workaround for the SMSS not being very user friendly…

    … and thinking about it a bit more, the adding of top into the view to make order by “work”, for suitable values of “work”, seems to me like it is actually a supported workaround, because otherwise top (100) percent makes no effing sense, and is pointless except allowing to include that order by clause that nominally does jack shit in a view definition.


    @BernieTheBernie said in WTF Bites:

    Ah yes: the TOP part of SQL statement for the view:
    SELECT TOP(100) PERCENT
    fails.
    You have to use instead
    SELECT TOP(999999)
    That works.
    🐃 :wtf-whistling:

    The “Azure SQL Database”, “Azure SQL Managed Instance” and “SQL Server” each have slightly different features and behaviour and their internals probably differ quite a lot. The SMSS may or may not know about all the differences and it would have to be a new one.


  • Trolleybus Mechanic

    I have a video with SAR so small that it makes 16:9 into 9:16. The browser plays this correctly, even though it shows 'NaN x NaN pixels' in page info. They filed a bug, because the thumbnail generator produced something like this.
    By the way, this type of content is what an ad agency worth nine figures produces. According to the metadata they use a free program called 'HandBrake'. The underlaying video is blurry, so they certainly stretched it (16/9)^2 times and then squeezed it back by setting the SAR. No idea why would they do this.

    It took me a while to actually find out what is wrong with this video, but I managed to fix the thumbnail generator by adding so many switches to ffmpeg that they don't fit on the screen. Good luck with any automated scaling and re-encoding of this crap though.



  • Sometimes, I'm the :wtf:.

    Upgrading Vim is always a PIA on Windows because I've changed a number of file extensions to use c:\vim\vim90\gvim.exe. The vim installer always installs into a "vimver" directory (my VIM variable is c:\vim)

    WhyTF did I never think of using junctions before... Now an upgrade is simple:

    • junction -d c:\vim\vim
    • junction c:\vim\vim c:\vim\vim91
    • install vim91 (could do this before fixing junctions).

    And no other changes (changing PATH and using regedit to find all the damn vim90 entries - and I'm sure there's a couple config files laying around somewhere I've forgotten about)


Log in to reply