WTF Bites


  • SockDev

    @onyx re arrays, it isn't quite what you'd think. In the case of $array[5] = 'hello world', giving you the h into that position, this is cromulent and comes from a bad design choice a bit back.

    A string is really a byte array with some pretending that it isn't. You can address a string like an array to pull individual bytes, thus $array[5] is cromulent for the sixth item of an array and also the sixth byte of a string, as compared to the old syntax of $array{5} which IIRC (and I might not) was deprecated for raisins.

    It's only giving shit for type coercions that are fucktarded. I don't object to the 7.1 behaviours but I only a few times ever had to deal with code broken by this stuff, because I never worked on code that shitty to start with.



  • @arantor yeah, but using 0x20 bytes to fill in used-without-being-initialized memory locations, by default? That seems pretty... arbitrary...


  • BINNED

    @arantor said in WTF Bites:

    See for yourself what they dun fucked up.

    Ah. I always use the DateTime class so I never even considered that. Fair point.

    @arantor said in WTF Bites:

    @onyx this isn't new. call_user_func doesn't do references, call_user_func_array is given an array which can contain references. But ISTR the caller and receiver should both indicate reference passing.

    Yes, I have some call_user_func_array calls. That started throwing warnings. And then it didn't. I am confuse.

    @arantor said in WTF Bites:

    @onyx re arrays, it isn't quite what you'd think. In the case of $array[5] = 'hello world', giving you the h into that position, this is cromulent and comes from a bad design choice a bit back.

    Yeah, that bit's ok-ish. At least it makes sense. I don't like it, but it's relatively sane.

    The bit I raged about was the coercion where it turns it into an array and puts the value in with the key 0. If you have to coerce it like that (which I think you shouldn't), at least set the key to 5! Not like PHP arrays are normal arrays which have to have consecutive numeric indexes anyway.

    @arantor said in WTF Bites:

    It's only giving shit for type coercions that are fucktarded.

    Yes, please. The more code of that type that breaks the happier I will be. I'll buy the person who has to fix that legacy shit a drink to help them cope, but at least it'll be gone from existence.


  • Discourse touched me in a no-no place

    @dkf said in WTF Bites:

    This codebase keeps giving.

    do {} while (writingtofile==1);     // busy wait for file to finish being updated if in-flight
    

    Naturally, the writingtofile variable is not volatile, and is also actually a tri-state “boolean”…

    And here's a beaut that interacts with that. This function is called to process what happens when someone clicks on a menu; the value parameter is an integer specified when the menu entry was created (the GLUT API isn't too terrible in this regard).

    void myfilemenu (int value)
    {
       int menuitem=1;
       if (outputfileformat==0) {                    // no savefile open
          if (value==menuitem++) {
             outputfileformat=1;
             open_or_close_output_file();    // start saving data in <FORMAT-A>
          }
          if (value==menuitem++) {
             outputfileformat=2;
             open_or_close_output_file();    //  or <FORMAT-B> format
          }
       } else {                                    // savefile open
          if (writingtofile==2)    {
             if (value==menuitem++) {
                writingtofile=0;                                //   and paused
                printf("Recording resumed...  ");
             }
          } else {
             if (value==menuitem++) {
                writingtofile=2;                                //   or running
                printf("Recording paused...  ");
             }
          }
          if (value==menuitem++) open_or_close_output_file();                // closefile out
       }
       needtorebuildmenu=1;
       //rebuildmenu(); // rebuild menu with state modified by this work
    }
    

    Magic constants? Check. Computed values instead of constants? Check. Differing meanings of the same value on different paths? Check. Different numbers of increments on different paths so that some poor maintenance programmer adding something afterwards is really going to come unstuck? Check. This code is toxic, and its author is a Bad Person Who Should Feel Bad.



  • Dear Sonar developers: yes, in general "use a more general type if you don't use the functionality provided by the more derived type" is a fairly decent linting rule.

    No, void f(Expression<Func<TFrom, TTo>>) cannot just be readily replaced by void f(LambdaExpression). No points for figuring out why.



  • Dear Vivaldi developers: you can either have dragging a tab outside the window have it open a new window with that tab, or you can have the tab behave like a text selection that can be dropped into a text field. But don't do both.



  • @maciejasjmj additional :wtf:: using the fullscreen button on that video embed in Chrome causes jellypotato.


  • Discourse touched me in a no-no place

    @lb_ Whoa. Significant jellypotato at that!


  • Discourse touched me in a no-no place

    @lb_ WOMM (but OSX is funny that way).



  • @anotherusername said in WTF Bites:

    But I would like to see the type wrangling that took place in order for it to say that two DateTimes were equal...

    If it was C++, I'd say someone did something like

    bool operator==(DateTime const& rhs)
    {
        bool bIsEqual = true
        // ... bunch of stuff that sets isEqual instead
        return bIsEqual;
    }
    


  • Vendor's knowledge base article:

    Description:
    [...] There is no functional impact other than not being able to access the JDBC Pools page from Admin. Console.
    Resolution:
    The Integration Server Administration screen is served by services for retrieving JDBC configuration.
    These services have no impact on actual JDBC connections or runtime function.

    You forgot to mention the services for CHANGING configuration are on that screen. Such as the administrator's ability to change the database password.

    You retarded. fucks.


  • Impossible Mission Players - A

    @lb_ said in WTF Bites:

    @maciejasjmj additional :wtf:: using the fullscreen button on that video embed in Chrome causes jellypotato.

    It does that for all embeds. Welcome back!



  • @arantor Speaking of PHP and DateTime, there was a pretty strange bug where using offset-based timezones instead of named ones broke the time:

    I looked into the source when I was curious, and the fix was... to call getTimestamp() after assigning such a timezone.

    Because getTimestamp() recalculated some internal data and changed the object's externally visible state. It gets even better – PHP has separate DateTime and DateTimeImmutable classes, and the getter can mutate even the "immutable" one. Surprise!


  • Dupa

    @dkf said in WTF Bites:

    @lb_ WOMM (but OSX is funny that way).

    Then again, I can't play it on iOS.


  • Discourse touched me in a no-no place

    Hey there, little for-switch antipattern. I SEE YOU!



  • @maciejasjmj said in WTF Bites:

    Looks like your video went away. I'm glad I got to watch it first.



  • The one thing that continually infuriates me about Internet Explorer is its use of "Page cannot be displayed" instead of a more specific error when using HTTPS. I could have solved this problem with server configuration much more quickly if IE had said "The server did not accept our (lack of) client certificate" rather than "Page cannot be displayed" which implied to me that there was some sort of problem hitting the HTTPS port in the first place. I shouldn't need openssl s_client to figure out every HTTPS problem.

    Then again, Firefox and Chrome don't do much better so it may be a more complicated implementation issue than I might think.


  • Discourse touched me in a no-no place

    @heterodox said in WTF Bites:

    a more complicated implementation issue than I might think

    The only implementation issue is “Do we, a browser maker, want to tell users what is going wrong? No? Awesome! Info-free page, here we come!”


  • Grade A Premium Asshole

    This morning I had a conference call with ATT about a dedicated fiber connection for a client as their Comcast connection is super unreliable and drops out all the time. The reason for this is a :wtf: of its own, which I will not get in to right now.

    The sales and technical reps are on the line, my client is calling in from his office and I am calling in from my office and while on the call my Comcast connection went down. I had to rejoin the call from my cell phone.

    Just before that happened my client had gotten sticker shock when they started talking about ~$800/month for 50Mbps internet service. He just sent me an email that read:

    $800 a month?! Shit. I did not think there would be that much of a price difference. That is 4 times what we are paying now for half the speed.

    On our follow up call he is now willing to spend the money. Congratulations Comcast, you just made the sale for ATT.

    Filed under: You couldn't make this shit up.



  • @zecc said in WTF Bites:

    Looks like your video went away. I'm glad I got to watch it first.

    Still works for me.

    @Maciejasjmj you could just upload it here, though... it's what, 4.3 MB or so? I think the max attachment size here is something like 6 MB or higher now. (Increased from what it was previously, IIRC 2 MB?)

    You have to add the <video controls="" src="link goes here"></video> tag yourself, though, once the upload completes and it inserts the link.



  • @anotherusername Works for me too again. Last time I tried to access //s1.webmshare.com/zN3bw.webm it redirected to an HTML page.

    Looks like webmsearch.com likes to play tricks.



  • representative line

    await(86400*365); // one year should be enough
    

    in a test checking if a task created a folder. Guess what happens if the folder is not created.


  • SockDev

    @homobalkanus said in WTF Bites:

    await(86400*365); // one year should be enough
    

    Except in leap years, when a year less a day should be enough



  • Just stumbled upon this while looking for an unrelated answer on StackOverflow:

    I'm frankly amazed it lets you have anywhere near that amount to begin with...


  • Impossible Mission Players - A

    @heterodox said in WTF Bites:

    client certificate

    Ah. Nobody uses those! :trolleybus:


  • Impossible Mission Players - A

    @zecc said in WTF Bites:

    @anotherusername Works for me too again. Last time I tried to access //s1.webmshare.com/zN3bw.webm it redirected to an HTML page.

    Looks like webmsearch.com likes to play tricks.

    They're probably webscale and were moving it to a higher-availability cdn.



  • @cursorkeys said in WTF Bites:

    an SQL

    TRWTF spotted! :control_knobs:



  • @boomzilla said in WTF Bites:

    @cursorkeys said in WTF Bites:

    an SQL

    TRWTF spotted! :control_knobs:

    They warned us it wasn't web-scale but that dude didn't listen.

    I wonder what his query was:

    SELECT * From enterprisy_table_table WHERE serial <> '1' AND serial <> '2' AND serial <> '3'...


  • Discourse touched me in a no-no place

    @cursorkeys said in WTF Bites:

    I'm frankly amazed it lets you have anywhere near that amount to begin with...

    That query's going to be a minimum of around 200kB long. Probably quite a bit more (600kB would be unsurprising). That's one heck of a lot of query to be pushing around.



  • modules:composer.user_said_in, @anotherusername, WTF Bites

    You have to add the <video controls="" src="link goes here"></video> tag yourself, though, once the upload completes and it inserts the link.

    0_1502307770010_dab10754-73c7-47f6-b91c-6e4c6306ab83-image.png

    Well that went great... (Also, random broken localization, yay)

    EDIT: fixed. If you let the webm onebox it picks a sensible width and height, but if you use a video tag it just ignores the width and height you're setting.



  • @cursorkeys said in WTF Bites:

    I'm frankly amazed it lets you have anywhere near that amount to begin with...

    Be grateful you didn't see some of the SQL queries I came up with for potential badges on Discourse...



  • @dkf said in WTF Bites:

    @cursorkeys said in WTF Bites:

    I'm frankly amazed it lets you have anywhere near that amount to begin with...

    That query's going to be a minimum of around 200kB long. Probably quite a bit more (600kB would be unsurprising). That's one heck of a lot of query to be pushing around.

    Automatically generated?



  • @maciejasjmj said in WTF Bites:

    modules:composer.user_said_in, @anotherusername, WTF Bites

    Uh....



  • @anotherusername Remember when every template in the forum broke? Good times.


  • Discourse touched me in a no-no place

    @anotherusername said in WTF Bites:

    Automatically generated?

    Well, it's either that or farm it out to someone in Bangalore every time they need an alteration made to it…



  • @anonymous234 said in WTF Bites:

    @anotherusername Remember when every template in the forum broke? Good times.

    I remember when @RaceProUK broke every template in the forum, yes.


  • SockDev

    @anotherusername said in WTF Bites:

    @anonymous234 said in WTF Bites:

    @anotherusername Remember when every template in the forum broke? Good times.

    I remember when @RaceProUK broke every template in the forum, yes.

    I'm not gonna be allowed to forget that, am i?
    0_1502313826436_Amy (Sadder).png

    Thankfully, many saw the funny side.



  • @anonymous234 said in WTF Bites:

    @anotherusername Remember when every template in the forum broke? Good times.

    That means only the Lean and Green stylesheet loaded. You need to refresh for the other CSS files to load.


  • Impossible Mission Players - A

    @twelvebaud said in WTF Bites:

    Huh, something went wrong with the forum imports somewhere along the line...

    0_1502333586297_Screenshot_20170809-195218.png



  • String fooCode = String.valueOf( item.getBar().getFrobnicatingFoo().getId() );
    

    Of course, that id that's gotten is a String. Also, the code is something else entirely (a property of that frobnicatingFoo), so the variable name is misleading.

    If only we could figure out how to fire the person who wrote this.


  • Dupa

    @kt_ said in WTF Bites:

    @kt_ said in WTF Bites:

    @dreikin said in WTF Bites:

    @kt_ said in WTF Bites:

    Brace yourself, this is a good one.

    So I've got this laptop with a dead battery. It's old, but it's still capable of playing 1080p, so I keep it for that. Sometimes, though, I have this urge to take it a few feet farther and well… I can't. So I decided to buy a new battery for it.

    I know fuck all about batteries so I chose the one online store that sells a battery branded for this particular laptop model. Also, I've bought from them before. Because I don't like the VAT, I decided to buy it and get the invoice issued to my father's company. And here's where it started to get funny.

    1. There was no way to input address for the company, they just filled the delivery address as the company address. Had to email them to change it.
    2. When it finally got here, I wasn't home, so the postman brought it back to the post office. I went there and they told me… they wouldn't give the package to me. Because it's addressed to the company, with no name there. This means that only people that are on the board or people with authorization signed by someone from the board, can retrieve it.
    3. If I were there when the postman came, she'd give it to me, no questions asked.

    On Monday I'm gonna call them and be very unpleasant to them. Mostly because it's not the first time they screwed up.

    You see, this is the second battery replacement I ordered from them. The first time they managed to mail it to the address on the invoice, instead of the delivery address. Fortunately it was only a few blocks away, so I was able to retrieve it quite easily.

    The next time, though, they sent me an email saying that they sent the 1500 PLN worth of stuff to me. They even included the tracking number for the package.

    The issue there was:

    1. I didn't order anything. It was my father's company that did.
    2. And the address was wrong, because it was from my first order from them and don't live there anymore.

    Which means, someone from the company somehow got from their system my delivery address from the first order when the company I just wanted to be on the invoice made an order with them. And they sent the stuff to me, but not me, a stranger really, because I don't live there anymore. And knowing how delivery companies work around here, they'd probably leave the stuff with the wrong people anyway!

    Luckily for them, the courier company allowed them to change the delivery address, because it was only a few blocks away.

    Fuck, I made two orders with them and they managed to screw up 3 times. Losers.

    Today, after realizing what happened, I wanted to yell at them real hard. I went to the website, saw they had a line open 8 AM - 8 PM (it was 5.30), called them. All I got was "we're open 8 - 4, Monday thru Friday".

    They can't even get their own opening times right!

    So basically you tried to commit VAT fraud and got a lot of trouble for your efforts?

    Exactly! And the issue is, it never happened before. Usually they're extremely willing to cooperate!


    ETA Mind you, it wasn't VAT fraud, it was VAT optimization. And I didn't try to commit it, depending on how you look at it I already did or I'm gonna next week.

    VAT optimized. Mission accomplished.



  • 0_1502445928071_94c41eed-35e2-4f66-998a-8448e373691a-image.png

    The message is like 1k characters long. Why. Just... why. How fucking insane does your messaging system have to be that it breaks when the message is over ~1k characters.


  • SockDev

    @maciejasjmj Discord's limit is 2000 characters, and Slack's probably the same.

    Really, if you're sending a message that long, that's what email is for.



  • @raceprouk said in WTF Bites:

    @maciejasjmj Discord's limit is 2000 characters, and Slack's probably the same.

    Really, if you're sending a message that long, that's what email is for.

    Well, I assumed it's a technical limitation, because you'd have to be downright insane to arbitrarily limit how talkative people can be. And at the very least Slack allows you to paste long messages as code snippets or similar. No such luck in Skype.

    And really, e-mail? Sure, I'll save that snippet to a file and mail it instead of just pasting it in the context of the current conversation! Why not send a printout stapled to a wooden table by FedEx while we're at it.


  • SockDev

    @maciejasjmj I was thinking more it's designed around typical patterns of conversation, and IME at least, it's extremely rare to need over a thousand characters for a single message. Plus, it's not really a limit on how talkative you can be: there's no rate limit on message frequency, so there's nothing to stop you splitting the message into chunks.



  • @raceprouk said in WTF Bites:

    so there's nothing to stop you splitting the message into chunks.

    Even if that asinine solution was in any way acceptable for the end user, the message doesn't even tell you how big the chunks should be.


  • kills Dumbledore

    @maciejasjmj said in WTF Bites:

    in the context of the current conversation

    Which is immediately lost if you have to scroll up through screens worth of pasted stuff to see the last real message


  • SockDev

    @maciejasjmj That is a :wtf: for sure.

    At least Discord tells you:
    0_1502446703207_5ea7a5de-d7fc-4fc2-a53d-4a98f25a6376-image.png

    Slack's could do with a visibility improvement though:
    0_1502446795827_f57344fa-d959-494b-b62e-d392fa7d6aaf-image.png



  • @jaloopa said in WTF Bites:

    Which is immediately lost if you have to scroll up through screens worth of pasted stuff to see the last real message

    Slack's code snipped can be unrolled and rolled down, as far as I remember. So they take the same amount of screen estate as a shorter message unless you're actively looking at them. Skype for Business, on the other hand, just waves a middle finger in your face.


  • kills Dumbledore

    @maciejasjmj said in WTF Bites:

    Skype for Business, on the other hand, just waves a middle finger in your face

    Yeah, it does that a lot.

    I'm not defending SfB, it's a nasty piece of software


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.