Ask HN: What's your biggest programming mistake?
About 5 years ago I created my first startup, it was my first time building a application for users and didn't expect it to gain any traction. After the first month it received about 5,000 users. Naturally, I decided to focus on security a bit more and convert all user's passwords to a encrypted version in the database. As I was re-building one of the components (reset password page) I was preparing all the needed queries when I accidentally wrote a MySQL UPDATE query and forgot to put a 'LIMIT 1' at the end. =x Yep, I reset all 5k passwords to the same thing. I remember having a panic attack shortly after as I struggled to think of a remedy. It was a pretty low point in my career as a programmer but I learned quite a few lessons that day (like the importance of backups for starters). In the end, I ended up emailing all our users asking them to update their password via secure link to their email and no harm was done.
What was your biggest mistake as a programmer?
10 comments
[ 4.7 ms ] story [ 26.7 ms ] threadI was checking the deployment to the shadow system, repeatedly running over the check-list to ensure that the deployment went smoothly, and then running a comparison between the shadow system and the live system to check that the update took place properly.
Between each test I took down the shadow system and brought it back up in a clean duplicate of the live system. Except on this one occasion when I had a brain-fart and killed the live system.
It all came back as designed within 30 seconds, re-initialised and restarted without loss of data, but it was a scary moment.
An entire month to fix.
rm * .png
Back to where I started from now; a combination of version control and things going much faster when you've already figured out the answer made things go faster than I thought
I wrote something like:
BACKUP_DIR=/home/bmelton/backups $LOG_DIR=/opt/alui/portal/logs mv $LOG_DIR/* $BACKUP_DIR tar -czf `date`.tar.gz $BACKUP_DIR/*
Anybody who's awake has probably already spotted that I tried to SET $LOG_DIR instead of LOG_DIR, and hence, ended up moving the entire operating system into my home folder.
It was a virtual instance, using Sun's zone virtualization, so fixing it proved to be trivial, but it was on a production system serving a federal agency, and that wasn't the only thing on the server.
Oddly enough though, after the script ran, the Access Manager (having loaded everything into memory, I assume) still worked like a champ, though everything else failed completely.