This is a brief extract of a conversation I had with myself today. My sincere wish is that you'll never have this kind of conversation with yourself. I was playing around with ActiveMQ's persistence (see http://activemq.apache.org) after getting basic queuing working...
Me: "How do I get persistence to work properly?" (I start googling and get some pointers...)
Me: "Oh, this is easy.." (sounds of typing)
KahaPersistenceAdaptor adapter = new KahaPersistenceAdaptor();
Me: "Hmmm... ah, just dump the database in my home directory for now..."
adaptor.setDirectory("~");
...
Me: "Ok, now I just need to set it up... cool."
(Some more typing and thoughts of leaving early...)
Me: "Okay, let's see what happens..." (clicks run).
Me: "Cool! Yes! It works... let's see how the database looks."
$ cd ~
$ ls -la
<Home directory listing here, without the database file(s) I expected...>
Me: "That's funny... what does the project directory look like?"
$ cd ~/workspace/activemq-test
$ ls -la
total 12
drw-r--r-- 1 jaco 4096 Jan 24 06:58 ~
-rw-r--r-- 1 jaco 1924 Jan 24 06:58 pom.xml
<some other files>
Me: "Hmmm... What the hell? What is that ~ doing there..."
$ rm ~
rm: cannot remove `~': It is a directory
Me: "Ag... dammit... just delete the damn thing!"
(At this point reason and intellect was replaced by the primordial aggressive hunter/gatherer)
$ rm -rf ~
(Reason and intellect reasserts itself in my recently installed cerebral cortex...albeit, just briefly.)
Me: "...."
$ cd ~
$ ls -la
total 0
(I felt the hair in my neck stand on-end, that eery sensation and that metal taste... At this point I experienced a complete take-over of the medulla & cerebellum part of the brain, rendering me completely and utterly speechless...)
Me: "..."
Me: "..."
(sounds of soft crying...)
After a few hours of trying to get my system in a semi-working state (and realising that the program was never checked in anywhere), I vow never to use rm again.
I had a similar experience at varsity when I wiped my home-directory and lost a weekend's worth of work for one of my COS projects that needed to be handed in that week (as far as I remember I also did a "rm -r ~" and I hit enter to early without specifying the directory that I wanted to delete in my home directory). I also wiped my system at one point as well when I did a "rm -r /" (as root). The best strategy for me (to protect me from myself) that I adopted is to user the "./" prefix to remind me that I'm referring to directories in the current directory.
ReplyDeletelol @ "Some more typing and thoughts of leaving early..." because we all know it is a myth.
ReplyDeleteAnd if it was me I would've substituted "sounds of soft crying..." with "sounds of head banging against the wall".
Haha, that's brilliant! Sorry man... hope your komper is fixed now :)
ReplyDelete"Brilliant" is not really the adjective that I would use here (but since this is a family-friendly website, let's leave it there)...
ReplyDeleteAnyway, yes, the computer is fixed, but I did lose some "sandpit" projects that was only checked into my local repo (I was not really prepared for my own stupidity. :-))