I was trying to back track on some coding I did, by hitting command-z a bunch of times. After a bunch of times, everything (all my code) disappeared. I couldn’t get it back, as when it all disappeared, I accidentally hit z alone, without command, thus making it so the computer couldn’t redo. Is there any way to get my code back? I worked on it for weeks and was hoping to find someplace where it was saved, but I can’t. Can anyone help?
Sorry, Iggy. If Command-Shift-Z does not “undo the undo” (i.e. redo), then it really is lost :’(
Your only hope would then be to find a copy that you made along the way and restart there. The more copies that you made along the way, the less work you’d end up losing.
If you made no copies along the way, you really will have to start from scratch. That would really stink, but maybe it’s not quite as bad as it sounds. You learned more along the way that you probably realize. It will still take time to redo your work, but you’ll find that much of it goes quicker the second time around. And you’ll also find that much of the code will just be better. In fact, some programmers intentionally delete their first version of the program for just this reason—once you’ve written it once, it’s going to be better then next time.
I know that this is absolutely zero consolation, but every programmer out there has done exactly this. Multiple times. Something goes wrong (weird editor action, disk crashes, etc) and hours, days, weeks of work is lost. If you’re like me, you’ll do this again and again. If you’re better than me, you’ll makes copies at least daily.
Sorry I don’t have more help to offer. Good luck!
hello could you please give me the code up to chapter seven for the avatar. i reset my browser and lost it. thanks -nathan
If you have the ebook, there is an appendix at the end of the book with the complete code for each chapter. You can just copy & paste directly from there.
The entire source code for the book is located at: http://pragprog.com/titles/csjava/source_code.