- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Ahh the wonderful days of Type 1 guids and the "OMG Security"...
Admin
Shouldn't the ID just be the row number the data is inserted at?
Admin
Do end-users (a) follow instructions like that and, more to the point (b) even read instructions?
Admin
Depends on whether rows ever get deleted, I guess.
Admin
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.
Admin
Never trust end users to follow instructions. Especially, never trust them to follow instructions when the integrity of data is up for grabs.
Admin
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 the0.
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 return0
,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.Admin
Since this looks like js, the param passed to toString (36) is the radix, not the string length.
Admin
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
Admin
Nem toda a gente é muito boa com o inglês, sabia? :-P
Admin
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.
Admin
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.
Admin
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.
Admin
If you don't know English, how do you support this:
''' return Math.random().toString(36).substring(2, 6); '''
Admin
I guess with Portuguese there won't be many problems, but in languages with lots of usage of diacritics it won't work well.
Admin
Something like
const hämmërtïmë = 42;
is valid JS.Admin
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.
Admin
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
Admin
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
Admin
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.
Admin
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.
Admin
You end up with a code base, that is technically in English, but only makes sense if you know the native language.
All time favorite: We're working on it hardly! :)
Admin
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.
Admin
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 !!!"
Admin
" 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