Forehead-slapping moments

Soldato
Joined
18 Oct 2002
Posts
5,464
Location
London Town
Just experienced a perfectly executed forehead-slapping moment.

I've been working on some fairly confusing code all day, having to manually update a database in lieu of a backend system being built at the same time. Reaching the end of the working day, the caffeine's wearing off and I'm starting to lose focus. So, I knock up a quick database schema update to reflect the latest changes and at the same time, as always, exporting the complete structure-only schema for our main database to CVS. A simple few clicks to update the live DB with the updates script, and I should be done and on the home strait.

For no particular reason I glance across the office to ask a colleague if the live DB was being regularly updated while flicking through the 'Import' options on phpMyAdmin I'm so familiar with. Don't know why, just a thought that popped into my head.

Yeah, so there I was selecting the full schema script for import rather than the script for the minor update. The script that contains a whole slew of DROP TABLE, followed by CREATE TABLE statements, rather than a few harmless ALTER TABLEs. Just as I refocus my eyes on the screen I click the 'Go' button, and one of those beautiful moments occured where the world slows down and you can almost hear the pops and clicks as the whole database disappears on a merry jaunt into the digital ether.

Whoops.

Fortunately the answer to my question was 'yes', and a few minutes later the DB was back up and running with just a little bit of non-essential data loss and the latest changes, this time, successfully applied. Oh, and the schema no longer contains any DROP TABLEs :D. I think it's one of my finest moments so far.

So, what's the stupidest thing you've done in those moments when you really should have been paying more attention?
 
Do really basic errors count? I jus spent 10 minutes troubleshooting why a variable was always being set to 0.

Then I saw.

Code:
	if($id = 0) {
 
Beansprout said:
Do really basic errors count? I jus spent 10 minutes troubleshooting why a variable was always being set to 0.

Then I saw.

Code:
	if($id = 0) {

That's why you put variables on the right :)

Code:
if ( 0 == $id ) {

Which throws an error if you accidentally put one = in.
 
The most annoying ones are mostly certainly the times when you have a minor problem with the CSS in a page, and you spend hours and hours trying to work it out. It starts to frustrate you, you get tired, you lose focus of the project and then it hits you.

Backgruond is actually supposed to be background.

That's a real D'oh moment.
 
Hmm, background colour needs to be white I think.

Code:
background-color: #ffffff;

Strange. Looks at code again.

Re-writes.

Code:
background-color: #ffffff;

Must be getting overwritten later in the sheet.

*Ctrl-F* No? Bizarre..

**** it, I'll solve it after a coffee.

*Brews... Sips*

For godsake, try actually uploading it to the server you fraggle. :rolleyes:


:D
 
Few days ago I ran the following on a well-known fuel-suppliers database...

UPDATE dbo.Signalman
SET currentLevel=0

Come a split-second realisation of what I'd done before seeing "7218 records updated" when I only was wanting one! :o
 
I had one of those today...

*Open* -> *20 Minutes coding* -> *Click Save*

err hang on.... did I just overwrite our live version of our invoice handling system with untested code.......

oh dear...

akakjs
 
robmiller said:
How does a strongly typed language prevent you from doing this :confused:

Code:
int foo = SomeFunctionThatReturnsAnInt();

if ( foo = 20 ) {
Because the condition must return a boolean, whereas the assignment operator returns whatever value was assigned.

Granted, it won't pick up the mistake in all situations, but it certainly makes things easier ;)
 
This is why I like to get other people to code :D

Im probably the worst person in *** world for making terrible silly small pathetic errors. I hate programming.
 
iCraig said:
Hmm, background colour needs to be white I think.

Code:
background-color: #ffffff;

Strange. Looks at code again.

Re-writes.

Code:
background-color: #ffffff;

Must be getting overwritten later in the sheet.

*Ctrl-F* No? Bizarre..

**** it, I'll solve it after a coffee.

*Brews... Sips*

For godsake, try actually uploading it to the server you fraggle. :rolleyes:

A slap head moment would be realising that rather than writing that, you could have saved time writing:

Code:
background: #fff;
 
toosepin said:
A slap head moment would be realising that rather than writing that, you could have saved time writing:

Code:
background: #fff;

Says the guy with !important in the wrong place in his sig and what should probably be content:url() not url: :p
 
toosepin said:
A slap head moment would be realising that rather than writing that, you could have saved time writing:

Code:
background: #fff;
But that's down to preference. I prefer to use full hexadecimal notation for colours in CSS for consistency. Anyway, It's only an extra three bytes, which isn't going to make an enormous difference to bandwidth consumption unless you're running an ultra high-traffic site.
 
robmiller said:
Says the guy with !important in the wrong place in his sig and what should probably be content:url() not url: :p

Indeed I did say that. It's one of my pet hates, writing out CSS in long hand just to keep my colleagues with poor understandings of CSS on the right track. :)
 
Last edited:
Inquisitor said:
But that's down to preference. I prefer to use full hexadecimal notation for colours in CSS for consistency. Anyway, It's only an extra three bytes, which isn't going to make an enormous difference to bandwidth consumption unless you're running an ultra high-traffic site.

I totally agree. Actually, for some reason, I hate seeing it with only half.
 
Hehe, yes, editing the wrong version of a file is one of those annoying gotchas. Bashing F5 in frustration for a few minutes until it finally dawns on you :D.
 
toosepin said:
Indeed I did say that. It's one of my pet hates, writing out CSS in long hand just to keep my colleagues with poor understandings of CSS on the right track. :)

Urm, writing it out in "long hand" doesn't mean they have a poor understanding of CSS.

They, like me, might simply prefer the full version. It keeps my CSS colours consistent across all stylesheets.
 
Running a cfgsp_emptydatatables on our development database and not the local one on my machine, after my thought process was interrupted by a customer (I had two copies of Management Studio open, one looking locally and one looking at the development SQL Server).

My local copies of the database are now postfixed TW, and I make sure I type use DBNAME before the SP!

Also doing i++; instead of i--; and wondering why my While loop wouldn't stop :rolleyes:
 
Back
Top Bottom