in reply to Re^13: Renaming an image file
in thread Renaming an image file

If the OPs system allows users to "edit" their images, then when the image has been edited, the new image will hash to a different value. No data loss.
Really? What did the OP write that makes you assume this? All he describes is renaming existing files. I'd say that's another assumption.
Whenever we reply to an OP, we inevitably make some assumptions.
Sure. State them in your reply. Knowingly assuming things, and keeping them hidden from your reply is very, very bad. This was your answer: Rather than a random number, I'd suggest using a digest of the files contents. Digest::MD5 for example. Whilst not guaranteed to be unique, the chance of collision is remote. All the assumptions you made here, you kept for yourself.

But, again, I'd like to point out, I did not have a problem with your original suggestion. I had problems with the replies following morgons observation there's a problem if there are two files with the same content.

But it is still superior to the solution that you offered.
I did not offer a solution because by the time I read the thread, good suggestions were already made. There's little value in repeating suggestions.

Replies are listed 'Best First'.
Re^15: Renaming an image file
by BrowserUk (Patriarch) on Nov 29, 2010 at 18:35 UTC
    What did the OP write that makes you assume this?

    The OP doesn't enter the equation. You invented the "editing" scenario.

    I took it to the logical conclusion, should the "hash the contents" be adopted.

    So that's a strawman.

    All the assumptions you made here, you kept for yourself.

    Oh my! Do you really credit me with prescient foresight that I can instantly foresee every possible scenario that the OP might encounter?

    Sir! You do me much too much credit.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Oh my! Do you really credit me with prescient foresight that I can instantly foresee every possible scenario that the OP might encounter?
      So, what is it? Did you make unstated assumptions, or did you not realize the scenario that morgon described? You can have either, but not both.
        So, what is it?

        When I made the original suggestion, I was aware that in some scenarios the potential to eliminate duplicate files was beneficial; and that in others it could be compensated for by the necessary re-mapping of links to files.

        I was also aware that in some scenarios, eliminating the user name entirely might lead to even greater disk-space savings, provided the link re-mapping mechanism was sufficiently robust to compensate.

        I was also aware that there could be some scenarios where hashing the contents alone would be insufficient.

        But mostly, I was aware that it was impossible for me to consider all possible scenarios.

        And that it would be stupid to think I could possibly describe and address all those possibilities; detail all the assumptions that would be need to be considered in each of them; and cover off every one of them with either a full guarentee or an iron-clad disclaimer.

        So, as is the norm with forums such as this, I didn't attempt to do any of that. Just as no one else here does!

        OPs ask questions; some monks(*) offer solutions. The OP takes--or not--from those offered suggestions what best fits their--usually, most undescribed--situations.

        Are you suggesting that I should given cast-iron guarantees with my suggestions?

        (*)Of course, then there are the other monks who don't offer solutions, but just ...


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.