What's the stupidest mistake you ever made?

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
User avatar
Dio
Sheepie Whore
Sheepie Whore
Posts: 18887
Joined: Mon May 31, 2004 1:08 pm 0
Location: Newcastle UK

What's the stupidest mistake you ever made?

Post by Dio »

After making a balls-up in the other thread with the powers of 2 thing, it reminds me I have a blind spot there obviously. Here's my greatest ever piece of coding stupidity.

Code: Select all

maxaxis = log2y > log2y ? log2y : log2y;
Yes, there should have been a couple of x's in there.

Anyone else? :D
User avatar
Ahchay
Baaaaaaa!
Baaaaaaa!
Posts: 6125
Joined: Tue Apr 23, 2002 10:23 am 0
Location: Londinium
Contact:

Post by Ahchay »

I once spent a good couple of hours writing a nicely elegant program that calculated the last day of the month. It had lookup tables, it had leap year calculations, running to about 40 lines of code including declarations.

And then someone pointed out that I could have just subtracted one from the first day of the next month.

Cheers
Chris
the bizzarre ratings of an ignorant, deluded old fool
matt
Sheepie Whore
Sheepie Whore
Posts: 14826
Joined: Mon Apr 22, 2002 4:07 pm 0
XBL Gamertag: gingerbeardman
PSN: wirehang
Location: here && there
Contact:

Post by matt »

I walked into a patio door once. No programming involved!

matt
User avatar
Ely
Baaaaaaa!
Baaaaaaa!
Posts: 7404
Joined: Tue May 28, 2002 6:32 pm 0
Yahoo Messenger: ely_uw2000
Location: The other place....
Contact:

Post by Ely »

I spent most of an afternoon once trying to work out why code changes I was making were not affecting the program when I re-ran it. Turns out I'd been forgetting to compile the source after changing anything :oops:
User avatar
Dvorak
Baaaaaa!
Baaaaaa!
Posts: 4560
Joined: Wed May 08, 2002 7:37 am 0
Yahoo Messenger: d3dxquaternion
Location: Germany

Post by Dvorak »

Ahchay wrote:And then someone pointed out that I could have just subtracted one from the first day of the next month.
8O

Until now I wouldn't have considered it a stupid mistake. Now I do.
>take off sunglasses
Seamen and fishermen alike swear to have heard voices in the rising tide. Inhuman screams, some of them say.
User avatar
TMR
Baaa!
Baaa!
Posts: 311
Joined: Thu Jan 01, 2004 4:44 pm 0
Location: Leeds, UK
Contact:

Post by TMR »

Most recent since i have a history of doing things like this was whilst messing around with PHP; using a while loop with a counter and echoing the word "Fnerk" to the page (don't ask) and i forgot to add one to the counter so the exit condition was never met...

Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk [Web server crash!!]
http://www.Oldschool-Gaming.com - 8bit reviews and resources
http://www.Cosine.org.uk - 8bit games, demos and tools
http://www.Cosine.org.uk/TMR - slightly scary stuff...!
User avatar
jrc313
Baaaaa!
Baaaaa!
Posts: 1824
Joined: Mon Aug 02, 2004 12:48 pm 0
PSN: jrc313
Location: Near Manchester
Contact:

Post by jrc313 »

TMR wrote:Most recent since i have a history of doing things like this was whilst messing around with PHP; using a while loop with a counter and echoing the word "Fnerk" to the page (don't ask) and i forgot to add one to the counter so the exit condition was never met...

Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk Fnerk [Web server crash!!]
I'm forever doing that.



Not usually outputing Fnerk though.
User avatar
Kon-Tiki
Baaaaaaa!
Baaaaaaa!
Posts: 5594
Joined: Fri Jan 07, 2005 9:54 pm 0
Location: Inside my BO
Contact:

Post by Kon-Tiki »

Got that often, when I'm starting to get tired, but usually in applications. Got to do Ctrl-Alt-Del to get it to stop sometimes.

Worst two things I've done, was when I was fiddling around with putting graphics up in Dos-based C/C++ programs, when closing the program, forgetting to get out of Screen 16. Nice way to crash a comp. The other one's not keeping a backup of my toilet simulator on a diskette. It's lost now, unless somebody still got it around somewhere. Actually completely forgot 'bout that, too, until it was brought up again a few days ago.
User avatar
the2bears
Baaaaaa!
Baaaaaa!
Posts: 3686
Joined: Wed Oct 27, 2004 9:30 pm 0
Location: The City by the Bay
Contact:

Post by the2bears »

if (foo != null) return foo
else return null

--------------

How's that?

Bill
User avatar
princec
Baaaa!
Baaaa!
Posts: 590
Joined: Thu May 09, 2002 3:20 pm 0
Location: Basingstoke
Contact:

Post by princec »

rmdir("")

A brilliant instruction which as part of its undocumented behaviour, recursively deletes the current working directory when "" is passed to it. Especially great when the current working directory is the root of the development server drive.

Cas :)
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

Well, I was attempting to delete all the .jpg files from a directory, so I type in

Code: Select all

rm *>jpg
and without looking, hit enter... Spot my mistake? BLoody SHift key :?

Totally obliterated someone's server's accounts partition by using 'mke2fs' instead of 'tune2fs' too. 'mke2fs' formats partitions, 'tune2fs' merely alters settings about them. I had to go outside and have a wander about in mild panic afterwards :oops: All hail working backups though :!:

Programming wise? I spent an hour going insane trying to debug a program. For some reason one section of code just wouldn't run. I loaded it into the debugger, set a breakpoint and it was ignored! The code in question looked like this:

Code: Select all

int foo (int x)
{
  int i, j;
  return 0;
  /* This function does xyz to abc and thingymajig wotsit */
...
}
Too me absolutely bloody ages to work it out!

I'm quite good at not writing error handling in my code. The few times I do bother, I get most confused when random error messages appear on the console, or functions don't return the value they should do. Usually takes a while for me to realise it's my error message or that '-5' isn't junk data, it means "file does not exist" :?
return (0);
User avatar
tufty
Sheepie Whore
Sheepie Whore
Posts: 12525
Joined: Fri Jan 07, 2005 4:52 pm 0
Location: French Alps

Post by tufty »

That has to be `rm -rf bin`, carried out in the wrong terminal window. which happened to be running root, and in /. On a production box. As oppposed to the development part of my home directory. Took quite a bit of explaining, that one.

For a good bit of schadenfreude, one can always head over to http://thedailywtf.com

simon
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

Oh yeah... Linux people...

You've installed a kernel before and forgotten to re-run LILO, right? Bit of a pisser, eh?

We used to have a colocated server in Birmingham. My sole connection to it was over the internet.

More than once the procedure for upgrading the kernel went:

Code: Select all

cp arch/i386/boot/bzImage /boot
shutdown -r now
ssh: Connection to host lost
*swear loudly*
*pick up phone, dial support line*
"Hello, it's so-and-so here, Just buggered my server, could you reboot it and choose 'emergency' in LILO's bootmenu please?. Yes I did, how did you guess?"
return (0);
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

tufty wrote:That has to be `rm -rf bin`, carried out in the wrong terminal window. which happened to be running root, and in /. On a production box. As oppposed to the development part of my home directory. Took quite a bit of explaining, that one.
I ssh into my webhost's server to fiddle with my website. Quite frequently I'll try to install a piece of software on their server or wonder why my root password doesn't work :roll:

And I'm forever picking up the keyboard for my own server and trying to use it to control my laptop. No matter how hard I bash the keys in frustration the words don't appear on its screen ;)
return (0);
User avatar
bloid
Baaaaaa!
Baaaaaa!
Posts: 4082
Joined: Wed Dec 17, 2003 3:12 pm 0
Location: Mancuniana

Post by bloid »

tufty wrote:That has to be `rm -rf bin`, carried out in the wrong terminal window. which happened to be running root, and in /. On a production box. As oppposed to the development part of my home directory. Took quite a bit of explaining, that one.
Yay! I've done that too ;)

:oops:
"What's there to lose?" said the general, selling our dead meat by the pound...
Post Reply