Funny (and noobish) things you've accidentally done

In my C++ class, I wrote a program. I debugged it and everything worked fine. I was about to submit it but had the bright idea of testing it. It didn't run. I checked the code, compiled it again, debugged it again, and basicly did everything I could think of to get it to work. Nothing helped. The problem would only show up when I ran the exe file. After a week I found the problem: The exe file refered to a xml file. I had the folder with the assignment, inside of that was a folder and the exe file. Inside of the folder was everything else (cpp files, xml file, etc). The reason it would work in the debugger was the xml file was in that folder but I failed to realize that I would also need to have the xml file in the same folder as the exe file for it to work.

Dude, shouldn't you have added some error handling to your program? Maybe a message about a missing xml file? ;)
 
My first database ever, dBase III, and I could not get the colour commands to work. I checked, double-checked, they seemed fine but would not work. I eventually realised that I needed to spell it color...

I had that issue with HTML too.
 
That's why C/C++ is the best ;)

#define COLOUR COLOR
 
Dude, shouldn't you have added some error handling to your program? Maybe a message about a missing xml file? ;)

Dude, key word "C++ class"
I literally had less than 2 months of programming experience in a class with so little information that we should have been able to cover all the information in the class in 2 weeks. How am I going to think of that?:mischief:
 
Well, you ask yourself: "What happens if I try this?"

Sure there's the standard caveats: santitizing input, making sure your memory is being freed, but a lot of the times the bugs I catch while coding are more so an "okay, so if I enter this or this...wait, thats not right...."
 
You should always check for errors when opening text files.

I normally use the C API for file I/O, fopen returns NULL (0) if something goes wrong.
 
On one of my old test machines (its fairly old) I remember having to use the screwdriver to unplug the computer. Im not sure why it was screwed in but I remembered this...

In last week's hardware lab I did the same thing when I wasnt supposed to and the errant PSU began hissing and smoking and shooting sparks at me. If I had been thinking I would've unplugged the other end first...
 
On one of my old test machines (its fairly old) I remember having to use the screwdriver to unplug the computer. Im not sure why it was screwed in but I remembered this...

In last week's hardware lab I did the same thing when I wasnt supposed to and the errant PSU began hissing and smoking and shooting sparks at me. If I had been thinking I would've unplugged the other end first...

You connected the neutral and hot wires of the cable while it was live. Good Job.
 
I'm surprised I didnt get burned too badly... a small one on my hand but I oddly didnt feel it (and didnt notice until later) and its nicely healed up now.
 
Well, on the plus side, the injury wasn't too bad and you'll probably remember not to do that the next time. Reminds me of when I touched a bunsen burner in chemistry class right after turning off the flame, forgetting that it took awhile to cool down. I was pretty tired that day, but I never forgot that again, even when I was exhausted.

Earlier this week I nearly did a format C: in my host machine instead of the virtual machine I meant to do it on. The hazards of having cmd.exe windows open when you also have DOS virtual machines open.
 
Back
Top Bottom