Human error creeps into the simplest tasks. Always test
everything. Learned when a division sales manager handed my boss a stack of reports with math errors on a business trip. I'd been in a hurry to finish them, it was 3am when I finished them, and I thought they were too simple for me to make a mistake on. I was wrong.
Backup before you work. You will eventually trash something important. If it's backed up, you won't feel the pain. Learned one night when I dropped a table before I unloaded it.
Never try to outguess the customer. Ask questions. Show them work in progress. Make sure your delivering what they want. Learned when my deliverable did not deliver.
Document while you work. I know that people have differing opinions on the value of comments and documentation. I have had to re-visit documented 5 year old code and undocumented 5 year old code. The documented code was easier to work with. Do it now. You probably won't have time to document it later.
Keep an open mind. In 2000, I bought a copy of Learning Perl. A colleague of mine saw it on my desk and asked me, "Why do want to learn that? It's a dead language!" I don't think he's in the industry anymore.
Re: Greatest programming mistakes and what to learn from