I will start with an old haiku which seems painfully appropriate for the moment:
Three things are certain:
Death, taxes, and lost data.
Guess which has occurred.
It all happened so quickly. I have created a new project in Eclipse to add some minor library to the prototype application I have been writing for three days. Since my projects sit outside the workspace, I had to uncheck this little checkbox suggesting me to put a new project in default location and type the new location (a directory not far from there) by myself.
For some strange reason, when you uncheck this box, the text field with the directory path becomes empty so despite the fact that the directory I needed was just beside the one that is already written there by default I had to switch to explorer, copy and paste the path manually into the field.
This is where I erred. After pasting the directory, I forgot that this was the path of the directory where all my projects resided, the parent directory - not the directory of the new project I wanted to create. Before I realized that I hit OK, and there it was - my new project created in the projects parent directory instead of a nice little directory of its own.
Well, I suppose these things happen, said I when I realized my mistake, I will just delete that project and create a new one in the correct directory. So I said, and pressed the "delete" button.
But this story is not about me, it's about Eclipse. After I pressed that button, Eclipse inconspicuously asked me whether I wanted to remove the project from the workspace only or delete its contents as well, all that with straight, poker face, calm as a frozen lake. I thought "why would I need to keep contents of an empty, just created, project in the wrong location" so I hit "delete contents" - and that was exactly what Eclipse did.
He deleted the contents of the entire directory, all three meaningless files that were created with the new plugin project and ALL SUBDIRECTORIES WITH ALL MY OTHER PROJECTS as well.
It was almost too easy. BOOM - everything was gone.
I know what you are thinking so NO - I did not have a backup, NO - it was not in a source control and NO - I did not have anyone to blame. Three days of work, were gone. Eclipse does not have any Recycle Bin and I did not have a good recovery software installed, and I only have one logical drive - so if I would install one I would risk accidentally overwriting the very data I was trying to rescue. The irony tends to get thick in situations like these.
It looked hopeless, but I know you are waiting for the happy ending, so here it comes.
Once, in one obscure Eclipse conference, I heard that there is such a thing called "local history" in Eclipse 3.2, and that in that history they save all the files you work on so you can go back and undo some changes that you have done and compare previous versions. Lucky for me, this history is saved in the workspace .metadata directory that was not deleted during the accident. After a few minutes I have found it, a bunch of tiny little files with long meaningless names, just lying there happily, each holding a class full of my precious code.
It only took three hours of scraping around to restore 90 percent of the code I have written, and I filled in the rest - so in almost no time I had all my stuff back in good working condition, even better, as in some cases I found bugs while reviewing the code and looking for the changes.
Now for the moral.
First, do backup, do use source control and don't be an idiot.
Second, be extra careful with what you DELETE with Eclipse. Eclipse has it's own file system underneath, so everything it deletes does not go to the Windows recycle bin, or any other place you can salvage it from. This is just plain barbaric. Even my browser has a trash can, in case I accidentally close a tab I did not yet bookmark.
Third, just for the sake of emergencies. Find, try and buy a good piece of software that restores deleted files and keep it installed on your computer at all times. It might save you some nerves one day or another.
And last, listen carefully in conferences, you never know what might save your day next time :)
The paradox of insular language
1 year ago
4 comments:
Hi.
I recommend this tool, it works great:
http://www.r-studio.com/
Recovered some precious staff countless number of times.
So were able to recover the non-project files that got wiped out? The post is unclear...
it's also entirely possible for eclipse to erase the entire contents of a drive... which incidentally has just happened to someone here... any suggestions?
Post a Comment