• (disco) in reply to Tsaukpaetra
    Tsaukpaetra:
    On 5 1/4" floppy disks, right?

    i was thinking of putting the file on a 8mm DAT tape.

    or a DVD-DL, but that's sacrificing a bit of the point to make it more accessible.

    Tsaukpaetra:
    Fox screams are kinda creepy though...
    I think @raceprouk would disagree
  • (disco) in reply to accalia
    accalia:
    /me also is briefly curious before self defense circuits cut in and excise the curiosity
    I however have no such self-defence mechanism… and that search turned up **exactly one** NSFW image.

    But I did find this: [image] Which is weirdly appropriate to the search terms, when you think about it…

  • (disco) in reply to accalia
    accalia:
    Tsaukpaetra:
    Fox screams are kinda creepy though...
    I think @raceprouk would disagree
    Once you get used to them, they're alright ;)
  • (disco) in reply to RaceProUK

    Conversation complete. :giggity: entry logged for future conversations.

  • (disco)

    The code copies every received byte into a Byte object and then copies it again into a byte array before writing everything into the file-system! Hence this tiny little code snippet requires about 9-10 times the file-size in memory for downloading and saving the file.

    This analysis seems quite misleading. Byte.valueOf(x) does not create a copy for every value input, it uses a cache internal to the Byte class for recycling values, so at most 256 Byte objects get created, regardless of file size. In a 32-bit JVM, addresses cost 4 bytes so, so the memory required by the vector to store the Byte pointers is about 4fileSizeBytes (which isn't really mentioned), and the final byte[] array would be just fileSizeBytes, so only ~5fileSizeBytes is needed in memory, discounting constant factors. I wonder how this 9-10 number was computed.

  • (disco) in reply to isthisunique
    isthisunique:
    But as usual there's no way to create it from an InputStream except something ugly like a cast.

    Won't work. The PipedInputStream and PipedOutputStream classes are a matched pair; you can't cast in and out in any useful way. That's because the two classes poke around in each others' implementations, so there's no point in trying shenanigans to work around it; you just need to hold your nose and spawn a thread to copy stuff. (A thread! To copy I/O buffers! In 2015! :confounded:)

    Java's IO is chock full of miserable stupidity and lack of vision, and they've not yet managed to unfuck it. Nor has any of the third-party libraries really done any better either. I can't even do trivial things like selecting on subprocess pipelines! That's trivial and they fail at it.

  • (disco) in reply to Bananafish
    Bananafish:
    This is called using whatever we learned in class today.

    This was actually called "I am going to modify working production code which I have not been asked to work on because I do not understand the Dunning-Krueger effect."

  • (disco) in reply to accalia
    accalia:
    if i get another fucking whoosh badger for that i am going to scream, record myself screaming and send you the uncompressed 88.4khz 32bit PCM .wav of that scream.

    I am so tempted to :fa_flag: now!

    Because there's no way I'd play the file.

  • (disco) in reply to FrostCat

    you, you i will email 500 copies of that file.... yep.

  • (disco) in reply to accalia
    accalia:
    email 500 copies

    You and what botnet?

    Oh, wait...

  • (disco) in reply to accalia
    accalia:
    you, you i will email 500 copies of that file.... yep.

    I like that you think you have a valid email address for me that has a quota large enough. :smile:

  • (disco) in reply to FrostCat

    ther are ways, and ways,

    as for the quota, that is rather the point, no?

  • (disco)

    And we have had lecturers keep telling us since memory is so cheap, writing memory efficient code is no longer important.

    :facepalm:

  • (disco) in reply to accalia
    accalia:
    as for the quota, that is rather the point, no?

    Well, it's more Microsoft's problem than mine, especially as I have other email accounts. :smile:

  • (disco) in reply to FrostCat

    /me makes a point to multi send the payload to @frostcat's other email addresses too.

    /me makes a point to find out what they are first.

    /me decides it's simpler just to send the files to everyone in the world... that will guarantee delivery and make sure that everyone else that gave her flags gets what's comming to them too

    /me decided it given such an email job would bring the internet to its knees it would probably be just as legal and effective to override the launch codes for a couple dozen nukes and detonate the warheads in the ionosphere causing a massive EMP that wipes out most of the electricity grid world wide.

    /me hiccouchs

    /me takes another sip of her third rum and coke

    /me giggles at the thought of global destruction/domination

  • (disco) in reply to accalia

    /me is slightly worried by the sound of a fox cackling manically


    /me is at least comforted by the thought that she will be protected while @accalia executes her plan

  • (disco) in reply to accalia
    accalia:
    gleemonk:
    Err i uM my shift keys have considerable lag at the relativistic speeds i'm tyPing things
    /me makes a note to remember that excuse when she gets called out on her tyops next time
    That'll only be of limited use. Relativity (simplifying a little) doesn't change the order of causally-connected events, so you can't explain transposition typos this way.
  • (disco) in reply to isthisunique
    isthisunique:
    I haven't used Java for a long time but I swear you can just hook streams together to pipe them.

    Perhaps it was this:

    http://docs.oracle.com/javase/7/docs/api/java/io/PipedInputStream.html

    But as usual there's no way to create it from an InputStream except something ugly like a cast. Thanks java.

    PipedInputStream and PipedOutputStream don't do what you think they do: You create them and pass them to APIs that expect streams. Data written to the PipedOutputStream comes out the PipedInputStream. They are analogous to the pipe() call in C.

    To hook streams together you need to read from one and write to the other. You might need to do this from another thread (have Now problems. two you) because blocking IO. It's not fun.

  • (disco) in reply to Scarlet_Manuka
    Scarlet_Manuka:
    Relativity (simplifying a little) doesn't change the order of causally-connected events, so you can't explain transposition typos this way.

    That won't stop her :P

  • (disco) in reply to RaceProUK

    But surely if the keyboard and typist are in moving reference frames, (and the keys have their own), then there'll sometimes be disagreement about which key made contact first?

  • (disco) in reply to Scarlet_Manuka
    Scarlet_Manuka:
    Relativity (simplifying a little) doesn't change the order of causally-connected events, so you can't explain transposition typos this way.

    With relativistic speeds I meant that once you type sufficiently fast, the key hits race the propagation delay in the copper medium. It's all about variance in the distance between key and decoder chip. If we take the tyops example, you have to wait out the 50ps, otherwise it depends on circuit layout which key will be registered first. Of course once you get used to your keyboard model, you can adjust your habits.

    Why'd you think ZXC were chosen for copy-cut-paste? That's right, because the keyboards of the time had their decoder chip top-left, which meant that CTRL and ZXC are approximately equidistant from it. That's why people want their IBM Model M and nothing else.

    The shift keys are particularly hard because there are two of them and you have to adjust your timing just right so they don't catch a letter before or after. It's a failure of education really, because we are taught to use the opposing shift-key when learning to touch-type. I'm currently switching to same-hand shifting and you wouldn't believe the improvement in typing speed. Unfortunately changing habits takes its time, so sometimes I fall back to the other hand when shifting, but with incorrect delay. Still I'm almost back at the 108.605WPM I had before switching.

  • (disco) in reply to accalia

    Beats me...is TRWTF that I can't post an acronym in the forum? :-P

  • (disco) in reply to gleemonk
    gleemonk:
    Why'd you think ZXC were chosen for copy-cut-paste?

    I thought it was because on early Macintoshes F1 was for Undo, F2 for Cut, F3 for Copy, and F4 for Paste, and the simple keyboards didn't have function keys, so they mapped that functionality to the leftmost letters on the bottom keyboard row.

    (Not that I'm really sure, but I definitively noticed when Windows 95 adapted the behavior I was used from MacOS for years.)

  • (disco) in reply to PWolff
    PWolff:
    I thought it was because on early Macintoshes F1 was for Undo, F2 for Cut, F3 for Copy, and F4 for Paste, and the simple keyboards didn't have function keys, so they mapped that functionality to the leftmost letters on the bottom keyboard row.

    It's all lies spread by people wanting to sell us shitty slow keyboards. Why, they're even using low-grade copper nowadays, so the delays are worse!

  • (disco) in reply to RFoxmich

    EBCDIC?

    <Like this?

  • (disco) in reply to RFoxmich
    RFoxmich:
    Beats me...is TRWTF that I can't post an acronym in the forum?

    THE FORUM DOESN'T ALLOW ALL CAP POSTS.

    Edit: That went thru cause punctuation. And there are other :evil_laugh: ways...

  • (disco) in reply to dcon
    dcon:
    Edit: That went thru cause punctuation.

    NOT SO

    THAT WENT THROUGH BECAUSE QUOTE

  • (disco) in reply to accalia

    As I said...

  • (disco) in reply to dcon

    DISCOURSISTENCY...

    <!-- HTML comments do count -->
  • (disco) in reply to dcon

    The original post was:

    EBCDIC.

    with a trailing perod.

  • (disco) in reply to RFoxmich
    RFoxmich:
    The original post was:

    EBCDIC.

    with a trailing perod.

    PWolff:
    DISCOURSISTENCY...

    You'll get used to it...

  • (disco) in reply to RFoxmich

    It depends on the punctuation you pick. I find an ellipsis character works just fine, and a non-standard type of whitespace (Unicode's got all sorts of evilness!) might work too, but I've never got around to testing it. Failing that, some FauxTML (e.g., <discotoaster denied!>) does perfectly as it will be sanitised out after the shoutiness check.

  • (disco) in reply to gleemonk
    gleemonk:
    Wouldn't the cast fail?

    Someone practicing magic without a license again? [image]

  • (disco)

    As bad as the code looks, with its cast from byte to Byte, the JIT will see right through the dumb cast and skip it entirely. If the code is not run enough to be JITed, then there isn't a performance problem anyway. So...eventually this won't be a problem, or the code isn't called enough to be a problem.

  • (disco) in reply to gleemonk
    gleemonk:
    your plumber to cast the pipes herself

    I wonder if there are any statistics on gender ratio in plumbing profession that would warrant feminine pronoun use in a generic case.

  • (disco) in reply to HardwareGeek
    HardwareGeek:
    accalia:
    fucking whoosh badger

    Briefly — very briefly — tempted to see if GIS turned up anything amusing for that. But then I recovered what little sanity I have left, and decided *NO*!!!!!

    You didn't miss much, it was pretty disappointing. Well, maybe apart from this:

    (NSFW) http://i.eprci.net/badger-meatspin

  • (disco) in reply to obeselymorbid

    Maybe @gleemonk chose to use the opposite of the expected gender.

  • (disco) in reply to obeselymorbid

    I'm not much of a plumber and I'm mostly male. Working from this knowledge I deduce that plumbers are statistically more likely to be female. The one plumber I met once was quite male by my standards, but I'm not gonna rely on anecdotal evidence.

  • (disco) in reply to gleemonk
    gleemonk:
    I'm not much of a plumber and I'm mostly male. Working from this knowledge I deduce that plumbers are statistically more likely to be female. The one plumber I met once was quite male by my standards, but I'm not gonna rely on anecdotal evidence.

    seems logical to me.

  • (disco) in reply to obeselymorbid

    http://phe.rockefeller.edu/barcode/blog/wp-content/uploads/2008/09/red-herring-final.gif

  • (disco)

    this code is indeed stupid, but the analysis isn't quite right; there are only 256 possible Byte objects, and so on Android, all 256 are created at system-initalization time, kept around forever, and re-used as appropriate. an array of Byte objects is still less memory-efficient than a byte[], and there are plenty of other stupid things about the code, as mentioned in the article.

  • (disco) in reply to mlc
    mlc:
    there are only 256 possible Byte objects

    No, you can always call new Byte(…) yourself because the constructor is public, and the general contract of new guarantees an identity-distinct object in that case. You'd be idiotic to do it (and the code in the article doesn't) but you can if you insist.

  • (disco) in reply to dkf

    I think he is talking about the coder should have used Byte.valueOf() instead of new Byte() if he really need to use Byte as object, so the cached Byte objects of the runtime will be used all the time.

  • (disco) in reply to RaceProUK

    http://pbs.twimg.com/media/CBEZLg1VAAAU9Um.jpg

  • (disco) in reply to Tsaukpaetra
    Tsaukpaetra:
    On 5 1/4" floppy disks, right?
    Those 1/4" floppy disks don't store very much; 5 might not be enough for a whole scream even using lossy compression.
  • (disco) in reply to mlc

    So... instead of allocating an 8-bit byte location, it allocates a 32-bit (?) pointer to one of the 256 static 8-bit byte locations?

    Why not replace the pointer with an 8-bit offset and add it to a fixed base address? If the bytes are stored in binary order, this'll result in the 8-bit offset conveniently being equal to the 8-bit byte it's pointing to...

  • (disco) in reply to anotherusername

    It's not a pointer, it's a pointer-divided-by-word-size. All Java objects are aligned on the heap so it can have a heap larger than 32 bits.

  • (disco) in reply to Quite
    Quite:
    the word wasn't "bother" it was something NSFW which started and finished the same

    Belgiumer?

  • (disco) in reply to redwizard
    redwizard:

    YOU SHALL NOT CAST!

Leave a comment on “Byte me”

Log In or post as a guest

Replying to comment #:

« Return to Article