WTF Bites



  • @gleemonk this is like the one time i accidentally uncovered a hidden storage for reportable content in a search engine by typing in %%[IMG="xyzlinkgoeshere"] into a search engine due to the surfaced meta content surfacing from the source archive; much like the spanish inquisition, no one expects to have to report their funny html hack's src feedback to the fbi


  • BINNED

    @topspin said in WTF Bites:

    It’d probably be faster if I told you the available disk space than wait for whatever the fuck you’re doing.

    I found this code on an obscure internet forum from ages past:¹

    int CheckSpace(FILE *fp, int game_size)
    {
        fp = fopen("allocationbuffer", "w");
        while(ftell(fp) < game_size)
        {
            int status = putc('\0', fp);
            if(status == EOF)
                return FILE_NOT_FOUND;
            fflush(fp);
        }
        return TRUE;
    }
    


  • @kazitor what, uhhh; :} what language is this? it's like ajax and python are awkwardly chatting at the cafe.

    "w".


  • Notification Spam Recipient

    @_deathcollege said in WTF Bites:

    @kazitor what, uhhh; :} what language is this? it's like ajax and python are awkwardly chatting at the cafe.

    "w".

    It looks like C.



  • @Tsaukpaetra it does, a bit, actually, but it's missing something.

    that's actually really bothering me-- where are the bin calls?



  • @_deathcollege said in WTF Bites:

    @Tsaukpaetra it does, a bit, actually, but it's missing something.

    that's actually really bothering me-- where are the bin calls?

    -- thiiis might be c#


  • BINNED

    @_deathcollege said in WTF Bites:

    @kazitor what, uhhh; :} what language is this? it's like ajax and python are awkwardly chatting at the cafe.

    "w".

    Seems 🇳🇴🇩🇪🇧🇧 doesn’t know either.

    Screenshot_20231210_102949.png


  • Java Dev

    @kazitor said in WTF Bites:

    @topspin said in WTF Bites:

    It’d probably be faster if I told you the available disk space than wait for whatever the fuck you’re doing.

    I found this code on an obscure internet forum from ages past:¹

    int CheckSpace(FILE *fp, int game_size)
    {
        fp = fopen("allocationbuffer", "w");
        while(ftell(fp) < game_size)
        {
            int status = putc('\0', fp);
            if(status == EOF)
                return FILE_NOT_FOUND;
            fflush(fp);
        }
        return TRUE;
    }
    

    Seems legit. Might be missing some details but they're probably not important.


  • Grade A Premium Asshole

    @Polygeekery said in WTF Bites:

    If you have Google Fi as your wireless provider and you go to order new phones you have to order each one individually.

    • Choose phone
    • Add to cart
    • Pay
    • Checkout

    For each individual phone.

    I have 9 lines of service. That means 9 checkout processes. 9 individual charges to my account for the exact same dollar amount in the span of a few minutes. Honestly, I am surprised that it did not trip some fraud alert algorithm.

    Absolutely retarded. A company of their size cannot figure out "buying multiple items in one transaction".

    It does not even require you to assign a purchased phone to a line of service or anything that would complicate matters. You're buying phones that you could run through a shredder after you get them and it would not make any difference to their systems.

    Screenshot_20231209-183925.png

    But you can transfer an eSIM between Android and iOS or between iOS devices. But transferring eSIMs between Android devices doesn't work.

    That's fucking idiotic.



  • @_deathcollege said in WTF Bites:

    @kazitor what, uhhh; :} what language is this? it's like ajax and python are awkwardly chatting at the cafe.

    C

    @_deathcollege said in WTF Bites:

    @Tsaukpaetra it does, a bit, actually, but it's missing something.

    No, it's not missing anything. Well, except the #includes that I don't expect to see when just one function is quoted. It also seems to be using the FALSE/TRUE/FILE_NOT_FOUND “boolean” logic, but :thats_the_joke:.

    that's actually really bothering me-- where are the bin calls?

    What do you mean by bin calls? It is a fully valid C function provided the top of the file does the obvious #include <stdio.h> and some other #include that defines the project-specific FILE_NOT_FOUND and TRUE constants.



  • @Bulb said in WTF Bites:

    @_deathcollege said in WTF Bites:

    @kazitor what, uhhh; :} what language is this? it's like ajax and python are awkwardly chatting at the cafe.

    C

    @_deathcollege said in WTF Bites:

    @Tsaukpaetra it does, a bit, actually, but it's missing something.

    No, it's not missing anything. Well, except the #includes that I don't expect to see when just one function is quoted. It also seems to be using the FALSE/TRUE/FILE_NOT_FOUND “boolean” logic, but :thats_the_joke:.

    that's actually really bothering me-- where are the bin calls?

    What do you mean by bin calls? It is a fully valid C function provided the top of the file does the obvious #include <stdio.h> and some other #include that defines the project-specific FILE_NOT_FOUND and TRUE constants.

    #includes, sryyeah. those .h files are mostly found in either the bin or dev folders, i think; android might have a /dev variant name for their filepaths via cli, though



  • @_deathcollege said in WTF Bites:

    either the bin or dev folders

    The kurwa was? Headers are almost always found in include directories. Or sometimes alongside the sources, but that's a C++ habit and we don't want no C++ habits in our nice pristine C.

    They are also no calls. They are, well, includes, duh. The header is textually included in the compilation unit—often multiple times as the headers tend to include each other, that's what the #ifndef BFLMPSVZ_H/#define BFLMPSVZ_H/#endif wrappers are about. See, it is an ancient technology. Comes from more civilized age when engineers still knew how to keep things simple.



  • @Bulb . _ . uhhya, cooltx


  • Notification Spam Recipient

    @_deathcollege said in WTF Bites:

    those .h files are mostly found in either the bin or dev folders, i think;


    https://imgur.com/POWxyez




  • Considered Harmful

    @PleegWat said in WTF Bites:

    Try time find . -printf "%s\n" | wc -l. That will force it to fetch the file size on each file. Otherwise find uses an optimization which lets it avoid the stat() if it knows there are no subdirectories.

    23s instead of 20 for the same ~2M files. On an old ext2fs it would probably have made a significant difference but not on ext4.


  • Considered Harmful

    @topspin said in WTF Bites:

    @LaoC said in WTF Bites:

    @sebastian-galczynski said in WTF Bites:

    @cvi said in WTF Bites:

    notcopying.png

    Dear Windows, I asked you to copy files, not discover them.

    Windows "discovering" the files took about as long as scp took to copy them to the network share in the first place. Windows is currently copying files at a rather leisurely pace.

    Note to self: next time, just use cygwin+scp on Windows.

    Any program would have to list the files, unless you just dump the whole partition image. scp would be just as slow, unless you tar all these files into one, which i'd recommend. Don't gzip them though, use scp -C instead.

    tar and scp would have to discover files all the same. Although this should never take significant time for a few 10k files at least on local file systems. This is worst-case after dropping all caches:

    [root@c2d1gg0 ~]# time find 2>/dev/null /home | wc -l
    2037066
    
    real    0m20.103s
    user    0m0.638s
    sys     0m3.174s
    

    tar+scp costs twice the I/O bandwidth. Unless you have a 10Gbps network and a lot of data where using nc may make sense, tar -zcf - /blah | ssh foo@bar "tar -zxf -" is fastest.

    Not sure I understand. Can you elaborate how tar+scp is different from tar+ssh?

    scp can only copy files, not stream, so you have to read everything from disk, tar it up, write it back to disk and then have scp read it again (OK, three times ackshually). tar|ssh reads just once at the source and writes once at the destination.



  • Re: Windows and file slowness, at one point we found that the Windows version of our desktop publishing program was tremendously slower than the Mac version when scanning through directories, looking for files that could be placed in the document.

    I poked around and saw that the slowdown was in a routine in the cross-platform code that was trying to figure out what kind of file a file was. Part of doing this was reading the first few bytes of the file to do magic numbering; this was done by a utility function that would make sure that the file had enough bytes to meet the request by getting the file's size. It did that by opening the file and advancing to the end of it, counting bytes but ignoring the data. Apparently on the Mac this was fast but on Windows it was slow, especially over the network.

    So I made a couple of changes. First, I made the relevant part of the "check the file type" routine just open the stupid file and read however many bytes out of it and fail if it couldn't. Second, I split the "get file size for random purposes" routine between platforms and made the Windows version ask the file system for the file size, which is much faster but in theory could be wrong. I think it was recalculated the slow way if we wound up needing the entire file.


  • BINNED

    @kazitor said in WTF Bites:

    @topspin said in WTF Bites:

    It’d probably be faster if I told you the available disk space than wait for whatever the fuck you’re doing.

    I found this code on an obscure internet forum from ages past:¹

    Sue me. I’ll stop complaining about it when idiotic programs stop doing it. :mlp_smug:


  • BINNED

    @LaoC I see, makes sense. Thanks.



  • @Parody said in WTF Bites:

    ask the file system for the file size, which is much faster but in theory could be wrong.

    Uh? Unless the filesystem is extremely broken, I don't see how that could happen.



  • @Zerosquare said in WTF Bites:

    @Parody said in WTF Bites:

    ask the file system for the file size, which is much faster but in theory could be wrong.

    Uh? Unless the filesystem is extremely broken, I don't see how that could happen.

    ...and similar unlikely-but-possible things. I think there were also potential issues with NTFS symbolic links (you'd get the size of the link, not the target) and network resources (because you're beholden to the server's filesystem and network sharing implementation; Mac folks accessing non-Mac servers got hit all the time by the file IDs changing when the server is rebooted).

    I don't remember any issues being reported along these lines, though, at least not on Windows. The Mac folks eventually implemented a preference to "Use the file path instead of the Mac file ID for files from a network share", losing the Mac ability to move files around the filesystem and still find them but working around the server's poor implementation of Mac file sharing.



  • @Tsaukpaetra said in WTF Bites:

    @Gurth said in WTF Bites:

    especially if you know there won’t be any conflicts

    I wish there's was a "turn off safety checks I know what I'm doing" option.

    Yes, that always ends well.



  • @PleegWat said in WTF Bites:

    @sebastian-galczynski said in WTF Bites:

    @cvi said in WTF Bites:

    notcopying.png

    Dear Windows, I asked you to copy files, not discover them.

    Windows "discovering" the files took about as long as scp took to copy them to the network share in the first place. Windows is currently copying files at a rather leisurely pace.

    Note to self: next time, just use cygwin+scp on Windows.

    Any program would have to list the files, unless you just dump the whole partition image. scp would be just as slow, unless you tar all these files into one, which i'd recommend. Don't gzip them though, use scp -C instead.

    Modern windows versions actually materialize the list, reading which source files exist, and whether any conflicting files already exist in the destination. Then if there are any conflicts it asks for confirmation. And only then it starts copying.

    Modern Windows (10 and 11, maybe the 8s as well) defers asking about file conflicts until after copying everything else first. This may require you to have folder conflicts turned off, which I believe is the default in those versions.



  • @Gurth said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    @Gurth said in WTF Bites:

    especially if you know there won’t be any conflicts

    I wish there's was a "turn off safety checks I know what I'm doing" option.

    Yes, that always ends well.

    If only there were a way to tie that option to some proof that you really do know what you're doing.


  • Grade A Premium Asshole

    @Polygeekery said in WTF Bites:

    @Polygeekery said in WTF Bites:

    If you have Google Fi as your wireless provider and you go to order new phones you have to order each one individually.

    • Choose phone
    • Add to cart
    • Pay
    • Checkout

    For each individual phone.

    I have 9 lines of service. That means 9 checkout processes. 9 individual charges to my account for the exact same dollar amount in the span of a few minutes. Honestly, I am surprised that it did not trip some fraud alert algorithm.

    Absolutely retarded. A company of their size cannot figure out "buying multiple items in one transaction".

    It does not even require you to assign a purchased phone to a line of service or anything that would complicate matters. You're buying phones that you could run through a shredder after you get them and it would not make any difference to their systems.

    Screenshot_20231209-183925.png

    But you can transfer an eSIM between Android and iOS or between iOS devices. But transferring eSIMs between Android devices doesn't work.

    That's fucking idiotic.

    9 phones ordered at the same time, 4 were delivered yesterday, they were routed through 3 different local FedEx hubs, 2 of the remaining phones are supposed to be delivered Monday and 3 no longer have an estimated delivery date even though they are at the FedEx hub that is closest to our house.


  • BINNED

    @HardwareGeek said in WTF Bites:

    @Gurth said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    @Gurth said in WTF Bites:

    especially if you know there won’t be any conflicts

    I wish there's was a "turn off safety checks I know what I'm doing" option.

    Yes, that always ends well.

    If only there were a way to tie that option to some proof that you really do know what you're doing.

    How would that work, considering the people who programmed that shit don’t know what they’re doing?



  • @topspin can any of us, truly, say that we know what we’re doing, to the exclusion of all possible failure states?



  • @HardwareGeek said in WTF Bites:

    If only there were a way to tie that option to some proof that you really do know what you're doing.

    Hmm … How about this: introduce an option to link your local computer account to your StackOverflow account, and if your reputation there is high enough, the “turn off safety checks I know what I'm doing” button in every dialog is no longer greyed out for you.

    Yep, that’ll end well.


  • Notification Spam Recipient

    @Arantor said in WTF Bites:

    @topspin can any of us, truly, say that we know what we’re doing, to the exclusion of all possible failure states?

    The person knows what he is doing by virtue of knowing what he is not doing....



  • @Polygeekery said in WTF Bites:

    9 phones ordered at the same time, 4 were delivered yesterday, they were routed through 3 different local FedEx hubs, 2 of the remaining phones are supposed to be delivered Monday and 3 no longer have an estimated delivery date even though they are at the FedEx hub that is closest to our house.

    Welcome to the TwilightDelivery Distortion Zone.


  • Trolleybus Mechanic

    @LaoC said in WTF Bites:

    tar and scp would have to discover files all the same.

    Yes, but there would be no additional round-trip for every small file while transfering. Which matters a lot if you try to transfer something like node_modules to a physically remote server.


  • Considered Harmful

    @HardwareGeek said in WTF Bites:

    @Gurth said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    @Gurth said in WTF Bites:

    especially if you know there won’t be any conflicts

    I wish there's was a "turn off safety checks I know what I'm doing" option.

    Yes, that always ends well.

    If only there were a way to tie that option to some proof that you really do know what you're doing.

    I wonder where all the proponents of this thing called "personal responsibility" went 🍹


  • Discourse touched me in a no-no place


  • Considered Harmful

    @sebastian-galczynski said in WTF Bites:

    @LaoC said in WTF Bites:

    tar and scp would have to discover files all the same.

    Yes, but there would be no additional round-trip for every small file while transfering. Which matters a lot if you try to transfer something like node_modules to a physically remote server.

    Sure, it's faster, just not due to the local file listing because tar does the same work in the end.


  • Discourse touched me in a no-no place

    @LaoC In particular it is because tar is intended to work with streaming media (magnetic tapes being rather slow to seek to a specific point). Absolutely everything about the format is about going forwards only in a single pass.



  • @Polygeekery said in WTF Bites:

    @Polygeekery said in WTF Bites:

    If you have Google Fi as your wireless provider and you go to order new phones you have to order each one individually.

    • Choose phone
    • Add to cart
    • Pay
    • Checkout

    For each individual phone.

    I have 9 lines of service. That means 9 checkout processes. 9 individual charges to my account for the exact same dollar amount in the span of a few minutes. Honestly, I am surprised that it did not trip some fraud alert algorithm.

    Absolutely retarded. A company of their size cannot figure out "buying multiple items in one transaction".

    It does not even require you to assign a purchased phone to a line of service or anything that would complicate matters. You're buying phones that you could run through a shredder after you get them and it would not make any difference to their systems.

    Screenshot_20231209-183925.png

    But you can transfer an eSIM between Android and iOS or between iOS devices. But transferring eSIMs between Android devices doesn't work.

    That's fucking idiotic.

    Does the Android/iOS transfer work both ways?
    If so, you can transfer Android -> iOS -> Android, so it actually can be used to transfer between Androids :technically-correct:



  • @Polygeekery said in WTF Bites:

    Screenshot_20231209-183925.png

    But you can transfer an eSIM between Android and iOS or between iOS devices. But transferring eSIMs between Android devices doesn't work.

    FWIW, the Google Fi Android app will prompt you to move the number over if you activate a different device with the same account. It's the usual product team vs. product team petty battle: "We had a different system set up before the Pixel/Android team got around to it. Some year we'll get around to adding compatibility. Maybe."

    Also, as far as I can Google, they didn't actually release the OS-level eSIM transfer feature in Android 14 anyway.


  • Grade A Premium Asshole

    @LaoC said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    @Gurth said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    @Gurth said in WTF Bites:

    especially if you know there won’t be any conflicts

    I wish there's was a "turn off safety checks I know what I'm doing" option.

    Yes, that always ends well.

    If only there were a way to tie that option to some proof that you really do know what you're doing.

    I wonder where all the proponents of this thing called "personal responsibility" went 🍹

    Things like that can only be discussed in the garage.


  • ♿ (Parody)

    @LaoC said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    @Gurth said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    @Gurth said in WTF Bites:

    especially if you know there won’t be any conflicts

    I wish there's was a "turn off safety checks I know what I'm doing" option.

    Yes, that always ends well.

    If only there were a way to tie that option to some proof that you really do know what you're doing.

    I wonder where all the proponents of this thing called "personal responsibility" went 🍹

    Personal experience suggests away from using Windows.



  • @dkf said in WTF Bites:

    @LaoC
    fff8668b-01cb-49d6-a1cd-e835d1654387-image.png

    "Things that remind you..." threads are :arrows:.



  • @HardwareGeek And this is how you remind me of who I really am.



  • For just the cost of one maxed-out Genshin character, you can have better (and slower) network audio!


  • I survived the hour long Uno hand

    @Parody said in WTF Bites:

    For just the cost of one maxed-out Genshin character, you can have better (and slower) network audio!

    Should switch to Star Rail, you can max out two characters for $4000 there :mlp_smug:



  • @izzion said in WTF Bites:

    @Parody said in WTF Bites:
    Should switch to Star Rail, you can max out two characters for $4000 there :mlp_smug:

    Yeah, well, sunk time fallacy and all. ⏰ 💸 :laugh-harder:


  • Notification Spam Recipient

    @Arantor said in WTF Bites:

    @HardwareGeek And this is how you remind me of who I really am.

    Don’t think I didn’t see that. 😠


  • Java Dev

    The logger I'm required to use here only supports warning, info, and debug, but not the error level. Who makes up this stuff.



  • @DogsB said in WTF Bites:

    @Arantor said in WTF Bites:

    @HardwareGeek And this is how you remind me of who I really am.

    Don’t think I didn’t see that. 😠

    I was rather counting on it.



  • @PleegWat said in WTF Bites:

    The logger I'm required to use here only supports warning, info, and debug, but not the error level. Who makes up this stuff.

    Someone whose code never produces errors, obviously.


  • Discourse touched me in a no-no place

    @PleegWat said in WTF Bites:

    The logger I'm required to use here only supports warning, info, and debug, but not the error level. Who makes up this stuff.

    Oh well, abort() it is then.


Log in to reply