• TheCPUWizard (unregistered)

    Ahh the wonderful days of Type 1 guids and the "OMG Security"...

  • Tinkle (unregistered)

    Shouldn't the ID just be the row number the data is inserted at?

  • (nodebb)

    it probably should have just been a Google Sheet and just some instructions for how to use it correctly

    Do end-users (a) follow instructions like that and, more to the point (b) even read instructions?

  • (nodebb) in reply to Tinkle

    Depends on whether rows ever get deleted, I guess.

  • (nodebb)

    Yes. Let's do that. Let's just use a speadsheet. And the whizkid over at accounts payable can write some VBA code when we need something extra.

    ... a few years pass ...

    and now the spreadsheet is featured here on TDWTF.

  • Ssieth (unregistered) in reply to Steve_The_Cynic

    Never trust end users to follow instructions. Especially, never trust them to follow instructions when the integrity of data is up for grabs.

  • Scragar (unregistered)

    The 36 in the two string call is the base. Number.to string(2) returns binary, Number.toString(16) is hexadecimal.

    The wording "36 character string" feels like you're expecting it to return a string that's 36 characters long, which it doesn't. Instead it returns 0. followed by random characters 0-9|a-z. The substr is skipping the 0. portion so it only grabs the first 6 random characters. Not the cleanest way to generate a random string, but it works most of the time(it's possible for the random number to return 0, 0.5, 0.25, etc which would not have 6+ characters on the end, it should be padded to ensure if this happens it works as expected.

  • Weretaco (unregistered)

    Since this looks like js, the param passed to toString (36) is the radix, not the string length.

  • (nodebb)

    The real WTF is writing variable names in languages other than English. You're using code that still uses english keywords, just write in English for fuck's sake

  • Dave Aronson (github) in reply to DocMonster

    Nem toda a gente é muito boa com o inglês, sabia? :-P

  • (nodebb) in reply to Scragar

    I did a test, and if this is JavaScript that's being used, the substring only gets 4 characters because the second parameter is an index, not a length.

  • Argle (unregistered) in reply to DocMonster

    Sorry, DocMonster, but we 'mericans may have imposed English on the rest of the world when it comes to our keywords, but I'm not about to foist English on anyone who reached adulthood without speaking it. I speak Spanish, but using Spanish variable names in a mostly English environment would be about as offensive as using English in a Portuguese environment.

    Hm... probably been done before, but maybe I'll invent a language without keywords. Or stick with toki pona.

  • (nodebb) in reply to DocMonster

    I dunno. If your first language is Portuguese, all of your team speaks Portuguese and your manager speaks Portuguese, I'd rather your variables are correctly named in your own language than wrongly named in English.

  • (nodebb) in reply to jeremypnet

    If you don't know English, how do you support this:

    ''' return Math.random().toString(36).substring(2, 6); '''

  • Klimax (unregistered) in reply to jeremypnet

    I guess with Portuguese there won't be many problems, but in languages with lots of usage of diacritics it won't work well.

  • Sokrates (unregistered) in reply to Klimax

    Something like const hämmërtïmë = 42; is valid JS.

  • (nodebb)

    The code to construct dataFormatada could have been a lot worse - at least they didn't make the mistake of calling new Date() multiple times during the creation.

    And it's not like they're then converting dataFormatada back to a date later on in the code (or at least not in this snippet).

    So, while not exactly stylish, that bit is not too much of a WTF.

  • (nodebb)

    TBH, googling this out of curiosity tells me the solution provided here is an excellent one compared to idiocies like using row numbers (oops I sorted it, all IDs have been reassigned) or random numbers (oops, I recalculated the sheet, all IDs have been reassigned).

    But sure, it could have been better... I get the impression it started with the randomness and in some inexplicable way they either had or feared duplicates and added the while loop to be safe...

    If only they'd known to search for UUIDs: https://stackoverflow.com/questions/51245218/how-to-generate-an-uuid-in-google-sheet

  • (nodebb)

    TBH, googling this out of curiosity tells me the solution provided here is an excellent one compared to idiocies like using row numbers (oops I sorted it, all IDs have been reassigned) or random numbers (oops, I recalculated the sheet, all IDs have been reassigned).

    But sure, it could have been better... I get the impression it started with the randomness and in some inexplicable way they either had or feared duplicates and added the while loop to be safe...

    If only they'd known to search for UUIDs: https://stackoverflow.com/questions/51245218/how-to-generate-an-uuid-in-google-sheet

  • (nodebb) in reply to Steve_The_Cynic

    The answer is no! A very emphatic NO!

    I emailed instructions yesterday about a new change to my system for work, it was a small email, succint, no fancy lingo or anything.

    This morning when I implemented the change, I still ended up with an email and a phone call about it, because naturally, they didn't read the email, probably just deleted it.

  • Aitkiar (unregistered) in reply to DocMonster

    With an english codebase, your job can get outsourced to any place of the world. With a codebase written in the native language of the applications target, you only compete with people who speak that native tongue. So i'd say that is rather smart not coding in english for a local development.

  • (nodebb) in reply to jeremypnet

    I dunno. If your first language is Portuguese, all of your team speaks Portuguese and your manager speaks Portuguese, I'd rather your variables are correctly named in your own language than wrongly named in English.

    You end up with a code base, that is technically in English, but only makes sense if you know the native language.

    actualizeData()
    => English: Makes no sense in the context.
    => German: "Aktualisieren" means "update" => they meant "updateData"
    

    All time favorite: We're working on it hardly! :)

  • see sharp (unregistered)

    The problem with "some instructions for how to use it correctly" is that most likely, noone will ever read them, anyone who might read them will misunderstand them, and if there is ever a need to revise the instructions, the original instructions will always prevail in the minds of most, if not all, users.

  • Officer Johnny Holzkopf (unregistered) in reply to R3D3

    German PHB: "I hope, thatt you are recieving this Em@ail ! Include arteficiel intelegence in the acounting process and call me on my handy its urgend !!!"

  • Graculus (unregistered) in reply to Jaime

    " return Math.random().toString(36).substring(2, 6); ".... spot the Xenophobe! ... lots of languages borrow from other languages (including borrowing from English). Your argument is beyond belief. That's like saying how can not you understand JavaScript, Typescript, C, C#, VBA, BASIC, GoLang and a million other langauges.... because they are all different languages. Need to get out more and smell the roses.. and there aren't just roses out there

Leave a comment on “Uniquely Enough Identifiers”

Log In or post as a guest

Replying to comment #:

« Return to Article