WTF Bites
-
Any examples?
The big problem is that timezone short names are non-unique. (Case in point: BST can be British Summer Time and Brazilian Standard Time.) The fixes that most people use for that are either to use offsets (usually in timestamps) or
Continent/Largest_City_in_Zone
in the zone names themselves. But Windows instead went with spelling the stupid things out in full. Good thing Windows isn't running out of disk space!
-
A strict "no magic values" policy means I see shit like this daily:
final int FOUR = 4;
That's terrible. Replace with
final int MAGIC = 4;
-
@Bulb You call that a magic number? This is a magic number!
i = * ( long * ) &y; // evil floating point bit level hacking i = 0x5f3759df - ( i >> 1 ); // what the fuck? y = * ( float * ) &i;
Free internet points to whoever identifies the relatively-well-known publicly available snippet I got this from.
-
@PleegWat without googling (that would be cheating) I'm placing bets on Quake's fast inverse square root.
-
-
Free internet points to whoever identifies the relatively-well-known publicly available snippet I got this from.
Free internet points to whoever remembers who's always bitching about a suboptimal choice of a constant whenever this snippet is posted.
-
who's always bitching about a suboptimal choice of a constant
It's certainly not Blakey, I'll tell you that.
-
Short version: that magic number is used to calculate a not-entirely-terrible first approximation to the inverse square root, as it gets pretty close to the right order of magnitude straight off (by sheer fucking magic). The overall algorithm then uses a round of Newton-Raphson to home in on the correct mantissa; only one round, but the algorithm converges fast for that polynomial and it isn't a high-accuracy application anyway.
-
@dkf Talk about taking the fun out of posting a link to an article which has twice the number of pages compared to the number of lines of code the article analyzes.
But, yes.
-
-
A strict "no magic values" policy means I see shit like this daily:
final int FOUR = 4;
Anybody who thinks
4
is a magic value butFOUR
is not is an idiot. Unfortunately this kind of idiocy seems to be fairly widespread.That reminds me. There's one guy at my work who likes to check in new files with the comment, "initial check in."
-
@boomzilla I'd be soooo tempted to start each code review of his stuff with
initial comment
…
-
@boomzilla said in WTF Bites:
A strict "no magic values" policy means I see shit like this daily:
final int FOUR = 4;
Anybody who thinks
4
is a magic value butFOUR
is not is an idiot. Unfortunately this kind of idiocy seems to be fairly widespread.That reminds me. There's one guy at my work who likes to check in new files with the comment, "initial check in."
I do that on topic branches but it usually gets quashed into "JIRA-666 : short bugfix description". when merged into the PR branch. I pushed a topic branch for a colleague once for a prove of concept and he later just merged it to develop. It had commits like "O_o", "woking" and "okay, actually woking now". I've lived with the shame of it every since.
-
@DogsB if you're going to push topics for POC, best to make them conflict horribly then.
-
@boomzilla said in WTF Bites:
There's one guy at my work who likes to check in new files with the comment, "initial check in."
If I had a penny for every one of those I've seen, I could ... well, I could probably get a cup of coffee, at least. I wouldn't do that, but I could.
-
As usual, I am .
Debugging some integration tests. Wondering why it's failing, saying that there are duplicate entities (which is against a business rule). Checked (test) database--yup, there are duplicate entities. Can't find anything wrong.
...
Then actually read the test's setup phase. Turns out that if you copy-paste things and forget to alter it, you do, in fact, get duplicates. Note: having a
unique
column wouldn't help, because the thing it's duplicating can be duplicate...just not in combination with a couple other keys which can't be easily summed up in a database constraint (that I know of). No, this is just me being derp.
-
@Benjamin-Hall you could set up some fake generators, maybe even stateful at least insofar as a private random seed, to reduce the boilerplate.
Well, not you personally, but one could.
-
@boomzilla said in WTF Bites:
That reminds me. There's one guy at my work who likes to check in new files with the comment, "initial check in."
Honest question, because I
would probably dohave done the same: why is that bad, and what should it say instead?
-
@boomzilla said in WTF Bites:
That reminds me. There's one guy at my work who likes to check in new files with the comment, "initial check in."
Honest question, because I
would probably dohave done the same: why is that bad, and what should it say instead?Holy shit. Do you also do, "Second checkin?" "Final solution?"
Briefly say what it is or what it does!
-
why is that bad, and what should it say instead?
It's entirely redundant in context, so anything more informative would be better. If it's an empty commit, the reason for having initial empty would be more useful, for the minimum limit.
-
@boomzilla it serves as the initial commit, is what's it's is doing.
-
-
-
what should it say instead?
If it's a new file added to a project, what does it do, and why did you add it? Answer those questions. "Added new test for X feature." "Implemented Y."
If it's a wholesale check-in of a new project, it's probably a good idea to at least say "Initial check-in of project Z", maybe with some notes as to what is implemented so far. Those comments may sometimes be viewed out of context.
-
Today I couldn't log into my VPN for work, which meant I couldn't do most of my job. There's actually very little I can do without it. So I messaged my supervisor on Teams, and he submitted a ServiceNow ticket for IT to help me out.
As it turns out, I am : I figured out (before IT got around to contacting me, so there's that) that my password had expired. I half-remembered an email several days ago saying that it would expire in three days, but I couldn't find it in a cursory scroll-scan-search through Outlook, so I had to submit an actual search†.
Once I had the URL for the password web portal, I was able to reset my password, which "magically" then let me log in to the VPN (with my new password) without any error messages.
† Email searches in Outlook are dumb, because if you want to search in all email folders,
you first have to submit a search in the current folder, and then modify it from the search modifiers dropdown that appears.Again, I am the dumb, because there's a little down arrow on the right end of the search box that shows the search modifier panel.
-
@boomzilla said in WTF Bites:
@boomzilla said in WTF Bites:
That reminds me. There's one guy at my work who likes to check in new files with the comment, "initial check in."
Honest question, because I
would probably dohave done the same: why is that bad, and what should it say instead?Holy shit. Do you also do, "Second checkin?" "Final solution?"
No, I'm not (quite) that stupid. :P
Briefly say what it is or what it does!
↓↓↓
@Gribnit said in WTF Bites:@boomzilla it serves as the initial commit, is what's it's is doing.
↑↑↑
@HardwareGeek said in WTF Bites:
what should it say instead?
If it's a new file added to a project, what does it do, and why did you add it? Answer those questions. "Added new test for X feature." "Implemented Y."
If it's a wholesale check-in of a new project, it's probably a good idea to at least say "Initial check-in of project Z", maybe with some notes as to what is implemented so far. Those comments may sometimes be viewed out of context.
If the name of the file(s) for the commit already indicates what is being added (e.g. "CreateNewAccountForm.cs"), doesn't something like "initial commit" or "added <file>" sufficiently indicate why? And such verbiage would clearly communicate to someone looking at the commit(s) that this file doesn't exist in any previous commits. How often do people look at only commit messages without also looking at the filenames in the commit?
-
@djls45 never go full gribnit.
-
How often do people look at only commit messages without also looking at the filenames in the commit?
I look through logs a lot.
-
@PleegWat Here's a long explanation.
Thanks, very interesting! I was familiar with that hack, but had never seen an explanation of why that initial guess for the newton step makes any sense at all, or why the magic constant has that specific value.
-
@boomzilla said in WTF Bites:
I look through logs a lot.
... and I hate it when the log viewers don't have an easy way to see the list of files changed. But that's a problem of the log viewer / generator, not the commit messages.
-
@boomzilla said in WTF Bites:
@boomzilla said in WTF Bites:
That reminds me. There's one guy at my work who likes to check in new files with the comment, "initial check in."
Honest question, because I
would probably dohave done the same: why is that bad, and what should it say instead?Holy shit. Do you also do, "Second checkin?" "Final solution?"
No, I'm not (quite) that stupid. :P
Briefly say what it is or what it does!
↓↓↓
@Gribnit said in WTF Bites:@boomzilla it serves as the initial commit, is what's it's is doing.
↑↑↑
@HardwareGeek said in WTF Bites:
what should it say instead?
If it's a new file added to a project, what does it do, and why did you add it? Answer those questions. "Added new test for X feature." "Implemented Y."
If it's a wholesale check-in of a new project, it's probably a good idea to at least say "Initial check-in of project Z", maybe with some notes as to what is implemented so far. Those comments may sometimes be viewed out of context.
If the name of the file(s) for the commit already indicates what is being added (e.g. "CreateNewAccountForm.cs"), doesn't something like "initial commit" or "added <file>" sufficiently indicate why? And such verbiage would clearly communicate to someone looking at the commit(s) that this file doesn't exist in any previous commits. How often do people look at only commit messages without also looking at the filenames in the commit?
Even if it's the first time a certain file shows up I would expect that there is some way to find out why this file was added, like a ticket number or a summary description of the feature being implemented.
What change request documents the need for the file? What can the user do with the file (it might not always be obvious from just the filename)? Who signed off on the design? And so on...
Of course, a whole lot depends on what version control system you use, how often you commit and how descriptive file names are. But in general I take about as much care of the commit message as I do for the code being committed (and to : it's not for both, there's actual work going on).
-
"okay, actually woking now". I've lived with the shame of it every since
Shameful indeed.
-
@Benjamin-Hall said in WTF Bites:
just not in combination with a couple other keys which can't be easily summed up in a database constraint
Not even in a unique multicolumn index? Those exist for exactly that sort of purpose.
-
If the name of the file(s) for the commit already indicates what is being added (e.g. "CreateNewAccountForm.cs"), doesn't something like "initial commit" or "added <file>" sufficiently indicate why?
Sometimes yes. Sometimes no. It's often a good idea to get a link to the issue in there somewhere. (Links go stale, but they're a whole lot better than nothing.) Also, the message is more visible in your VCS history viewer than what was changed; you typically read the log message to determine whether to drill in further (assuming you're not bisecting, etc.)…
-
-
relatively-well-known publicly available snippet I got this from.
Isn't that the fast inverse square something or another thing?Nevermind. I'm having trouble thinking.
-
how often you commit
Yeah, my commit history at the moment is a shitshow because I'm just doing so much in so little time I've just thrown up fingers and fucked it at the end of the day.
When I get around to cleanup after initial MVP I'll be a bit more studious....
-
As it turns out, I am : I figured out (before IT got around to contacting me, so there's that) that my password had expired.
Yeah it works like that for us but the password self-service portal is only internal. Thankfully it is accessible via my work phone which has a special browser with connectivity into our corporate network, otherwise it'd be very difficult to sort remotely.
-
@Tsaukpaetra said in WTF Bites:
I'm having trouble thinking.
I'm not sure rebooting will help that, but I suppose it can't hurt. @Zerosquare, you know what you need to do.
-
*reboots @Tsaukpaetra*
Maybe I'll unlock an achievement if do it enough times...
-
@Zerosquare said in WTF Bites:
*reboots @Tsaukpaetra*
Maybe I'll unlock an achievement if do it enough times...
Achievement get! RoboKicker 1080G
-
I think something is wrong with these air dates
-
@Zerosquare said in WTF Bites:
Maybe I'll unlock a
n achievementif do it enough times...
-
merged into the PR branch
There is a Public Relations branch in your code?
-
@HardwareGeek said in WTF Bites:
what should it say instead?
If it's a new file added to a project, what does it do, and why did you add it? Answer those questions. "Added new test for X feature." "Implemented Y."
If it's a wholesale check-in of a new project, it's probably a good idea to at least say "Initial check-in of project Z", maybe with some notes as to what is implemented so far. Those comments may sometimes be viewed out of context.
C'mon. Kevin's comments are always:
PsX update
. Very informative.
-
@ixvedeusi said in WTF Bites:
see the list of files changed
Another specialty of Kevin: an empty line at the end of the file got added or deleted. That's all, nothing else changed in that file.
-
"okay, actually woking now". I've lived with the shame of it every since
Shameful indeed.
And there's also
Woking ham
. What aboutWoking bacon
?
-
@BernieTheBernie Code review issue: Are there supposed to be changes in this file? Otherwise, please unbranch.
-
-
@BernieTheBernie said in WTF Bites:
Code review
What's that?
That's when people complain about trivial crap and ignore the real problems.