WTF Bites


  • area_can

    Redis, Memcached, and Elasticsearch are software products that many rely on. What you might not know, is that these locally running services are accessible by any website you visit, making it possible for bad guys to steal the data you have locally!

    TIL.



  • There was a webservice that returned data about vehicles. It was a paid service, so a company created a middle-man service to cache it's queires, as this data was requested several times for the same vehicle.

    When the vehicle isn't in the cache, it returned the exact answer returned from the provider, that was a XML. When it's on cache, it reads the data from the database in an ADO.NET dataset and returns whatever DataSet.GetXml created.

    The cache only saved a small subset of the fields, and some had differente names. The provider also changed the structure of their XML once or twice. There was no way for you to know if you got the original or cached version of the text without looking at known differences in the format. The error codes and messages were different between the cache and provider too.


  • Winner of the 2016 Presidential Election

    @bb36e said in WTF Bites:

    Redis, Memcached, and Elasticsearch are software products that many rely on. What you might not know, is that these locally running services are accessible by any website you visit, making it possible for bad guys to steal the data you have locally!

    TIL.

    :wtf: is up with that font? Is it just me?

    0_1472859418231_upload-32ca37c5-a57e-4c0b-a5ad-81e769bc637c
    0_1472859446219_upload-f389d1d2-00f8-46d8-a422-9cb88f564df0
    0_1472859471083_upload-302eeec8-9a34-4123-b46c-29a9ea777b1a
    0_1472859519343_upload-b0f2b665-5e5a-461b-8776-cc383f4a3621

    One of these letters is not like the others..


  • BINNED

    @Medinoc said in WTF Bites:

    @dse said in WTF Bites:

    @dkf said in WTF Bites:

    I loathe start; useful functionality ruined by utter stupidity by some MS underling back in the day and now we're stuck with that shit.

    What the actual :wtf: !! This is Windows 10 and still the stupid CON filename problem exists. Now you may say, it is your damn problem for creating a special file name, and it does not matter if ~/desktop/con.json does not look at all suspicious. Ok, I did not try to create the file. If your user passes that path to your program to read, the fucking ifstream happily opens the non-existent file and you have no way of knowing such file did not exist to return an error. Now, when you try to read all of that file to parse, hehe you have to wait forever! To fucking reaD A NON-EXISTENT filE!!!1111!!!

    The fact that they're special despite having an extension was a feature back in the day. Now it's a boat anchor but hey, maybe some obscure mission-critical production software still uses it...

    There is absolutely no excuse why this crap still exists, I mean look at that 4 letter extension! DOS extensions were 3 letters, it is just Windows team's suckiness for not fixing this scenario.



  • @Dreikin said in WTF Bites:

    @bb36e said in WTF Bites:

    Redis, Memcached, and Elasticsearch are software products that many rely on. What you might not know, is that these locally running services are accessible by any website you visit, making it possible for bad guys to steal the data you have locally!

    TIL.

    :wtf: is up with that font? Is it just me?

    0_1472859418231_upload-32ca37c5-a57e-4c0b-a5ad-81e769bc637c
    0_1472859446219_upload-f389d1d2-00f8-46d8-a422-9cb88f564df0
    0_1472859471083_upload-302eeec8-9a34-4123-b46c-29a9ea777b1a
    0_1472859519343_upload-b0f2b665-5e5a-461b-8776-cc383f4a3621

    One of these letters is not like the others..

    They had to replace one of the typeheads!


  • Dupa

    Is it, really?

    0_1472914771334_image.jpeg


    INB4 It used to say dishwasher safe



  • @kt_ said in WTF Bites:

    Is it, really?

    0_1472914771334_image.jpeg


    INB4 It used to say dishwasher safe

    "on the top rack only" appears to have been completely obliterated. ;)

    On a tangential note: Pro-tip #328: Do not use citrus-based or citrus-scented dishwashing detergent with gold-plated dishes or silverware. It will eat away at the gold.


  • Dupa

    @djls45 said in WTF Bites:

    @kt_ said in WTF Bites:

    Is it, really?

    0_1472914771334_image.jpeg


    INB4 It used to say dishwasher safe

    "on the top rack only" appears to have been completely obliterated. ;)

    It's a bowl, I never put it on the lower rack. ;)



  • @kt_ said in WTF Bites:

    Is it, really?

    0_1472914771334_image.jpeg


    INB4 It used to say dishwasher safe

    Except for the text, probably yes. The glaze does not seem to be damaged and the text does not affect use.


  • Dupa

    @Bulb said in WTF Bites:

    @kt_ said in WTF Bites:

    Is it, really?

    0_1472914771334_image.jpeg


    INB4 It used to say dishwasher safe

    Except for the text, probably yes. The glaze does not seem to be damaged and the text does not affect use.

    Oh you :pendant:s, take that sticks out of your butts.



  • 0_1473013540920_upload-bb0b6627-2b24-4b7a-ade9-ad3f7f3883ca

    That feeling when you want to learn more about a web technology, but the website that's supposed to teach is itself broken by that same technology...

    https://imgur.com/a/N8VRC


  • area_can

    Google play store on android:

    "Oh, you want to read the entire review? Just tap to see more!"

    0_1473031665523_Screenshot_20160904-192424.png

    "Haha fuck you have fun scrolling for miles"

    0_1473031719934_Screenshot_20160904-192435.png

    How is this useable for anyone??


  • Notification Spam Recipient

    @bb36e said in WTF Bites:

    Google play store on android:

    "Oh, you want to read the entire review? Just tap to see more!"

    0_1473031665523_Screenshot_20160904-192424.png

    "Haha fuck you have fun scrolling for miles"

    0_1473031719934_Screenshot_20160904-192435.png

    How is this useable for anyone??

    Yeah, that part of the store isn't paid attention to the DPI-modder devs....



  • @djls45 said in WTF Bites:

    Pro-tip #328: Do not use citrus-based or citrus-scented dishwashing detergent with gold-plated dishes or silverware. It will eat away at the gold.

    rich people problems?



  • @Bulb said in WTF Bites:

    @kt_ said in WTF Bites:

    Is it, really?

    0_1472914771334_image.jpeg


    INB4 It used to say dishwasher safe

    Except for the text, probably yes. The glaze does not seem to be damaged and the text does not affect use.

    the text was a self-unfullfilling prophecy


  • area_can

    @Tsaukpaetra I didn't even do anything super obscure, I just changed an option in settings > display (android N lets you modify the DPI)


  • Notification Spam Recipient

    @bb36e said in WTF Bites:

    @Tsaukpaetra I didn't even do anything super obscure, I just changed an option in settings > display (android N lets you modify the DPI)

    We may need your help with @aliceif ....



  • @djls45 said in WTF Bites:

    On a tangential note: Pro-tip #328: Do not use citrus-based or citrus-scented dishwashing detergent with gold-plated dishes or silverware. It will eat away at the gold.

    I ordered my servants to use only the mildest of all-natural detergents and a toothbrush when cleaning my silverware.



  • @cartman82 something as coarse as a toothbrush? My god, man, what level of savage are you?! Surely you use strands of only the softest and finest silk to make a polishing rag that you only use once!


  • kills Dumbledore

    @Arantor said in WTF Bites:

    Surely you use strands of only the softest and finest silksaffron to make a polishing rag that you only use once!


  • Discourse touched me in a no-no place

    @Jaloopa Saffron stains a lot, so you wouldn't use it for anything to do with cleaning.

    The other Saffron just irritates us all. ;)


  • 🚽 Regular

    @dkf said in WTF Bites:

    The other Saffron just irritates us all.

    0_1473072722343_url30-320x240.jpg



  • 0_1473086060870_upload-afed131e-7550-4c95-8831-42c73526aa8e

    Who the fuck decided to put array AFTER the mapper function in PHP's array_map?

    0_1473086053891_upload-80936764-398e-4684-90a1-5df5232524b9


  • Discourse touched me in a no-no place

    @cartman82 Make another function, map_array, that puts the arguments the other way round. It's the PHP way!


  • Java Dev

    @cartman82 Well, I think that function predates lambda support, so originally you'd write:

    $report = array_map( "mapper", $results );
    
    ...
    
    function mapper ($result) {
    }
    

  • 🚽 Regular

    @cartman82 At least it's consistent with Python's map.



  • @cartman82 the people who decided that array_map would accept an arbitrary number of arguments for the callback.


  • area_can

    @cartman82 at least it's consistent with array_filter—oh…



  • @cartman82 said in WTF Bites:

    Who the fuck decided to put array AFTER the mapper function in PHP's array_map?

    In vast majority of languages, the map function has the operator as the first argument. Lisp does, Scheme does, Perl does, Python does, so of course, PHP does too.

    C++ is a notable exception, but the functional operators in C++ are a design disaster, so that does not count. And languages where map is a method of array (like JavaScript or Ruby) somewhat obviously are another exception. But PHP is not one of them. So it follows the convention.



  • Noticed in the Mr Robot pilot they managed to spell the name of their own company wrong for the firewall.


  • Winner of the 2016 Presidential Election

    @Bulb said in WTF Bites:

    @cartman82 said in WTF Bites:

    Who the fuck decided to put array AFTER the mapper function in PHP's array_map?

    In vast majority of languages, the map function has the operator as the first argument. Lisp does, Scheme does, Perl does, Python does, so of course, PHP does too.

    C++ is a notable exception, but the functional operators in C++ are a design disaster, so that does not count. And languages where map is a method of array (like JavaScript or Ruby) somewhat obviously are another exception. But PHP is not one of them. So it follows the convention.

    All those languages either use map<thing> or map, so if PHP used map_array, that'd be just fine. But it uses array_map, which would seem to hint that the arguments would be in the other order.


  • Winner of the 2016 Presidential Election

    @coldandtired said in WTF Bites:

    Noticed in the Mr Robot pilot they managed to spell the name of their own company wrong for the firewall.

    Seems more like "truth in television" than a wtf, if the articles side of this site is to be believed.


  • BINNED

    @Zecc said in WTF Bites:

    Python's map

    Should be obsolete. Use list comprehension and let map die in 🔥



  • @Yamikuronue said in WTF Bites:

    @dkf

    Or as one episode of "Doctor Who" put it:

    "Biting's excellent! It's like kissing, only there's a winner."



  • @Dreikin it's not like this is the only example in PHP...

    strpos is (haystack, needle)
    in_array is (needle, haystack)


  • BINNED

    @Arantor said in WTF Bites:

    strpos

    TRIGGERED!

    if(strpos($foo, 'bar') < 0) { ...

    PHP folk who also know C will understand...



  • @Onyx not === false assuming you're going for "does not exist"?


  • BINNED

    @Arantor yup, that's correct in PHP. They made a function that can return either an int or a bool (which pisses me off as it is), but not only that, they made them look the same as their C namesakes where "not found" returns -1. Trips me up almost every fucking time.


  • 🚽 Regular

    @dse said in WTF Bites:

    @Zecc said in WTF Bites:

    Python's map

    Should be obsolete. Use list comprehension and let map die in 🔥

    So I checked and map doesn't return a list in Python 3. It did in Python 2.
    Instead it returns an iterable map object.

    # One way to skin a cat. Though perhaps a bit of an overreaction.
    # I don't like this big expression. :P
    [launch(nuke, launch_code) for nuke, launch_code in zip(nukes, launch_codes)]
    
    # Better. But it doesn't do what you think! m is only iterated on demand.
    m = map(launch, nukes, launch_codes)
    
    # *Now* it does what you expect.
    list(map(launch, nukes, launch_codes))
    
    # What's this? A reasonable way of writing? Preposterous!
    for i, nuke in enumerate(nukes):
        launch(nuke, launch_codes[i])
    

    I'm slightly inclined to agree with you, even if not entirely.


  • 🚽 Regular

    Btw, I've just found out this builtin is headquartered in Ohio:

    0_1473161008393_Capture.PNG

    (searching for "python ohio" or "python east sparta" does not trigger the map)


  • Considered Harmful

    I'm looking through my course syllabus, and all the indention is done with &νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;. OK, non-breaking spaces encoded incorrectly, not really WTF-worthy...

    Wait... What was that?

    Zoom! Enhance!

    &νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;&νβσπ;

    :wtf: How did they get replaced with Greek letters?

    Edit: Apparently this is not the first time this has happened.



  • @Onyx said in WTF Bites:

    PHP folk who also know C will understand...

    People who know C doesn't want to see anything like C "string" functions anywhere out of it, they want them to die an horrible death.


  • Considered Harmful

    @groo said in WTF Bites:

    People who know C doesn't want to see anything like C "string" functions anywhere out of it, they want them to die an horrible death.

    Reminds me of this article.

    Remember the way strings work in C: they consist of a bunch of bytes followed by a null character, which has the value 0. This has two obvious implications:

    1. There is no way to know where the string ends (that is, the string length) without moving through it, looking for the null character at the end.
    2. Your string can't have any zeros in it. So you can't store an arbitrary binary blob like a JPEG picture in a C string.

    Why do C strings work this way? It's because the PDP-7 microprocessor, on which UNIX and the C programming language were invented, had an ASCIZ string type. ASCIZ meant "ASCII with a Z (zero) at the end."

    Is this the only way to store strings? No, in fact, it's one of the worst ways to store strings. For non-trivial programs, APIs, operating systems, class libraries, you should avoid ASCIZ strings like the plague. Why?

    Let's start by writing a version of the code for strcat, the function which appends one string to another.

    void strcat( char* dest, char* src )
    {
         while (*dest) dest++;
         while (*dest++ = *src++);
    }
    

    Study the code a bit and see what we're doing here. First, we're walking through the first string looking for its null-terminator. When we find it, we walk through the second string, copying one character at a time onto the first string.

    This kind of string handling and string concatenation was good enough for Kernighan and Ritchie, but it has its problems. Here's a problem. Suppose you have a bunch of names that you want to append together in one big string:

    char bigString[1000];     /* I never know how much to allocate... */
    bigString[0] = '\0';
    strcat(bigString,"John, ");
    strcat(bigString,"Paul, ");
    strcat(bigString,"George, ");
    strcat(bigString,"Joel ");
    

    This works, right? Yes. And it looks nice and clean.

    What is its performance characteristic? Is it as fast as it could be? Does it scale well? If we had a million strings to append, would this be a good way to do it?

    No. This code uses the Shlemiel the painter's algorithm. Who is Shlemiel? He's the guy in this joke:

    Shlemiel gets a job as a street painter, painting the dotted lines down the middle of the road. On the first day he takes a can of paint out to the road and finishes 300 yards of the road. "That's pretty good!" says his boss, "you're a fast worker!" and pays him a kopeck.

    The next day Shlemiel only gets 150 yards done. "Well, that's not nearly as good as yesterday, but you're still a fast worker. 150 yards is respectable," and pays him a kopeck.

    The next day Shlemiel paints 30 yards of the road. "Only 30!" shouts his boss. "That's unacceptable! On the first day you did ten times that much work! What's going on?"

    "I can't help it," says Shlemiel. "Every day I get farther and farther away from the paint can!"



  • @error said in WTF Bites:

    Remember the way strings work in C: they consist of a bunch of bytes followed by a null character, which has the value 0.

    It's worse in the wild. Some old code I have around here have mixed null terminated strings with fixed length strings where a null character would cause some functions to crash.



  • @error When you store strings as length+content, you have to choose how to store the length. For example, Pascal stores the length as a single byte, so its strings can have at most 255 characters. Or you can store it as int, but then even short strings would have the sizeof(int) (which used to be 2 at those ancient times when it mattered, but anyway) overhead, plus there could be endian issues. Or you can store it as some kind of variable length code, but then it gets Complicated™. On the other hand ASCIIZ strings have exactly 1 byte overhead no matter how long they are. Also, the implementations of the string functions are simpler for the C strings then those with length, which was all hype when C was designed.



  • @Bulb Obviously the right way is to have the size of the size before it. Like: "\x01\x04Groo" would mean:

    • the first byte is a 01 that say the string lenght is represented in one byte
    • the second byte is 04, the actual lenght of the string
    • And finally the string, "Groo"

    I also use a special case, if the first byte is 0xFF it means the size of the string require more than 255 bytes, so the size of the size will be represented by the following two bytes. If the following bytes are both 0xFF you double the size's size again, repeating it until you are able to represent the total size.


    Filed Under: Complicator's string



  • @groo Congratulations, you just reinvented tumblers, but without the actual mathematical proofs and other conceptual scaffolding behind them.



  • @groo Or, alternatively, you could use a variable length integer encoding that doesn't suck.



  • Thankfully, the days where meeting space requirements were more important than meeting speed requirements are mostly over in a majority of places (except networking). Yet much of new(!?) C software is still using the old technique even when no networking is involved - for compatibility, it seems.


  • BINNED

    :wtf: It is now more than a week that visual studio debugging is slow as fuck! After much digging it seems to be a server problem after anniversary update. What I do not get is why out of the sudden my cache needed update.

    Filed Under: ERROR: ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR


Log in to reply