Tuesday
Apr102012

Revision history of a file in SVN

One of these days I'm probably moving to Git, but for now I'm on subversion.

Today I was trying to trace why some camera software had stopped working.  To skip ahead, the answer was that inexplicably one of the binary parameter files on disk had become corrupted.  Curse you cosmic rays.  Thank you backups.  But, along the way it seemed reasonable I might have introduced a bug into the code.  I didn't think it likely as I hadn't touched this code recently, but I had been cleaning up an old svn checkout recently on a retiring computer and it was believable I'd committed something dumb in haste.

As far as I can tell SVN has no simple built-in method to list a full history of revisions to a file.  But somebody else has figured out a nice simple bash script that does this.  Thank you stackoverflow.

Monday
Apr092012

Consolidate Web Receipts on to Dropbox

I use the "Save PDF to Web Receipts Folder" option all the time from the print dialog box.  It's annoyed me for a while that this then means that my receipts aren't all in one place, but instead scattered across the few machines I use regularly.

Today I fixed that using Hazel:

I created a folder called "Web Receipts blah" inside Dropbox.  (Replace "blah" with your own favorite short random sequence of characters to give a little extra protection if/when Dropbox has a security hole to make guessing the name harder.1)

Then, create a Hazel rule:

Note: that last blue bubble of the rename field is "extension".  So, I'm just prepending YYYYMMDD_ to the filename before moving it.

One additional critical point is to select "If file exists:  rename" in order to add a "-1" to the end of the filename if you end up with duplicate receipt names:

Works nicely!

1 Yeah, security through obscurity is dumb, but in this case I'm not relying on it, just triple knotting my shoe laces instead of only double knotting them.

Thursday
Mar082012

Deleting a bunch of files from a DOS prompt - when all else fails

I can't believe I needed this, but I made a hash of a cygwin installation on a Windows XP virtual machine, but didn't want to start over and didn't have a recent enough backup of that particular machine.

So, I needed to uninstall cygwin.

But, first I needed to delete C:\cygwin

At a DOS prompt:

rmdir /S /Q C:\cygwin

Use this power very carefully....

Wednesday
Mar072012

Turn off the Firewall from the Command Line

I dumbly managed to lock myself out from a remote Mac OS X Server install this evening by activating the firewall without carefully checking which rules were enabled.  Dumb, dumb, dumb.  Apple Remote Desktop couldn't get me in.  But, thankfully I could still SSH in and turn off the Firewall with:

 sudo ipfw -f flush 

(Yes, there's probably some better/safer/more-elegant way of doing this, but it worked to get me back in and do a more careful raising of the firewall shields.)

Monday
Feb272012

So, how are your backups?

Uh oh. Reboot.

"Bong"...oh good it's booting.

Umm. Err. Why does the progress bar advance a little way twice and then the computer just shuts itself off?

Ok, no panic, let's reset the SMC.

Well, that didn't work.

Time to dig out those Snow Leopard disks that came with the computer when I bought it just before Lion came out. Oh, did I mention this is my main laptop?

Ok, it's probably just some permissions thing on the disk, easily fixed by launching Disk Utility from the Snow Leopard install disk and Repairing Permissions. At worst, maybe I'll have to do a Repair Disk. Right?

Wrong.

Time to pull out that second Snow Leopard disk and launch the Apple Hardware Test by holding down the D key while booting.

Hmmm.... So, the memory is bad. Why did disk utility have a problem?

Swap out the memory chips from MacSales and re-install the original Apple memory. Proves right my decision to hold on to the original memory versus sending it back in to MacSales for a few bucks. The other reason to hold on to original memory is if you ever have to send the laptop to Apple it's best to reinstall the original memory.

Phew, OK, Hardware test says no problems with the original Apple memory installed.

Wait. I still can't boot???

Hmmm, guess the bad memory managed to hose my drive before it totally failed. Let's hope it's a software thing not a hardware thing.

First, let's go check out that SuperDuper backup that completed OK just an hour before everything went haywire.

Ummmm....errrr..... Ok, time to switch into cautious, conservative, don't-make-things-worse-than-they-already-are mode if you weren't there already.

Close and turn off the laptop. Set it aside. Priority is now understanding the status of all backup drives and getting multiple copies made before doing anything else to the laptop.

First, make sure the next older backup is OK. It is. Phew. Next, clone the corrupted backup. The clone is corrupted too and gives the same message. Take the clone and use rsync to pull all files out directory-by-directory. (Thank goodness for scripting.)

It now appears that the original laptop drive has nothing further to offer us for this recovery beyond what exists in the backups. So, re-format the drive and install Snow Leopard fresh. That worked and confirms my theory that the memory went bad in such a way as to corrupt the drive before it bombed the computer. Wow, while I've had my share of bad memory chips I've never had things go this wrong. Take this as an opportunity to do a nuke-and-pave. And, no, I'm still not upgrading to Lion.

Confirm that the MacSales memory chips were bad (yup) and initiate a return under their lifetime warranty. (This is the reason to buy memory from them and not from fly-by-night auction vendors.)

How was your weekend? And, more importantly, how are your backups?

This episode illustrates the importance of backups and the value of having multiple Macs around to help when your primary machine goes wonky.

Finally, what exactly would I have done if this had been on Lion? Would that recovery partition really have saved me? Maybe? Probably? I still feel better having separate bootable recovery disks with Hardware Test and Disk Utility.