Hey, there.

  • 0 Posts
  • 6 Comments
Joined 1 year ago
cake
Cake day: June 30th, 2023

help-circle

  • For a serious reoly, I think the expression “If they have eggs, buy two” is redundant. If they didn’t have eggs, the kid just can’t and won’t buy any eggs.

    I think the proper command would be, “Please buy 1 bottle of milk and two eggs.” That way, the kid won’t be confused and it’s still a proper valid command.

    Unfortunately though, the sentence is ambiguous even to non-programmers. It is unknown whether the if condition applies to

    • buying two eggs (buy two eggs)
    • buying two bottles of milk (buy two bottles instead)
    • or buying a bottle of milk (buy another bottle)

    Simply because they didn’t specify which to buy.

    For a non-serious reply,

    cart.add(supermarket.takeProduct(ProductType.milk, 1));
    
    if (supermarket.getProduct(type: ProductType.eggs).length > 0) {
        cart.add(supermarket.takeProduct(Product type.milk, 2));
    }
    
    cart.checkout();
    

    The kid should have bought a total of 3 bottles.




  • Unfortunately, it seems you have a really bad misconception as well.

    Sorry, no, files (be it MP3 or FLAC or MP4 or whatever) do not degrade over time. Not one bit. Yes, storage devices do degrade and ultimately break down, but that does not result in MP3 files “losing 7 to 15 kbps per year”. Digital files are like that—digital. They don’t suffer the same degradation like vinyl where each playback damages the grooves and looses definition. Digital files are a bunch of zeros and ones (be it MP3 or FLAC or whatever) and it’s either those bunch of numbers makes sense to the player (as in, it plays) or not (as in, the player shows an error saying it can’t play the file).

    What you have experienced as “degradation” probably isn’t the result of files degrading over the years. See, when MP3 was invented, the early encoders produced relatively bad sound quality for a given bitrate. They just can’t pack that much information into 128kbps without affecting the sound quality. Over the years, many countless improvements were made to MP3 compression technology, and modern software like LAME can produce really good sound quality even at relatively low bitrates. That makes old files encoded using old encoders sound worse than new files encoded using new encoders at the same bitrate.

    MP3 doesn’t even support 16kbps, so I can’t imagine your storage device delicately removing bits from your MP3 files to reduce the bitrate without corrupting them, since storage devices can’t even see the boundary between files—it only sees all the files as one huge string of numbers without any sense. Also, I can imagine your MP3 file shrinking in size every year if they do lose bits over time. Many filesystems also offer integrity checks on files, so your computer will alert you if something unintentional changes on your storage. Even some Linux filesystems will show an error if a single bit unexpectedly changes on one of your files.

    Wherever you read that misconception, please don’t believe it. Digital files are not affected by quality degradation, and it’s either they play, or they don’t play.

    Hopefully you take this as a friendly message, and if this has been a joke and I’ve been whooshed, then you had me very well.


  • Unless the disc is burned as a data CD containing MP3 files, then they are supposed to be audio CDs containing lossless PCM data (almost literally WAV). This is definitely the case unless the MP3 is converted to WAV then burned as an audio CD.

    If you want to store the audio from an audio CD losslessly, then there are no benefits in choosing WAV over FLAC. That is just wasting storage, since a FLAC will store the WAV without any loss.

    If you don’t mind changing some bits resulting in a lossy but virtually indistinguishable-from-the-original quality, then use a modern lossy codec like Opus (or even AAC or even Vorbis). That way, you save a ton of space without affecting the sound quality, assuming you chose a high enough bitrate setting.