• Forum
  • Lounge
  • Come and talk about your latest dumb mis

 
Come and talk about your latest dumb mistake!

So luckily I only wasted 30 minutes this time solving a bug where it turns out I did a - b instead of a + b (and fixed some other minor bugs while trying to find the root cause). Also note the repeated y's...
1
2
double x_rot = (x - p0.x)*cos_theta - (y - p0.y)*sin_theta + p0.x;
double y_rot = (y - p0.y)*sin_theta - (y - p0.y)*cos_theta + p0.y;

Definitely would fall under the realm of http://www.cplusplus.com/articles/Lz86b7Xj/

So, not sure how often a topic like this is made, but come and tell us your latest or most memorable/stupid programming (or anything logical) mistake!
Last edited on
I've made too many dumb mistakes to remember any individual one, I just vaguely recall many face palms in my past. A new habit I've formed, however, is leaving notes in the comments to my future self when I write potentially dubious code, usually saying something along the lines of "if this stopped working, it's most likely because of this line/function/etc." This has actually proven to be quite helpful as it has saved me good amounts of time on multiple occasions now.

I'm not sure how good of a practice it may be considered, but I'm not the only one that does it. Obligatory xkcd: http://xkcd.com/1421/
Hmm last big mistake..

Yesterday I was working on the back end for a ticket system I'm making for work, the tables get created by the php code, and some of them are populated automatically with some hard coded values- I have been creating and dropping the tables frequently because of the many changes I've made to the structure of the database recently.

Little did I realize every time I recreated those tables I was actually duplicating all of the default values so when I was working in the front end and made a bunch of new tickets, the associated programIDs were actually like 90 instead of 6! I fixed it by giving those program rows manual values, but now I have a bunch of orphaned tickets just floating around ^_^
Probably not the latest one, but:
const double cm_per_sec = SPEED_COEFF_M * 1e-1;
It is good that there are safety regulations in testing area.
Last edited on
Registered users can post here. Sign in or register to post.