Thursday, July 26, 2007

Tip: Poor man's text bookmarking

Many IDEs and text editors support a “bookmarking” feature, which will let you set a bookmark at a particular line of code or location in a document (generally through a menu pick or a shortcut key, which will bring up a prompt to enter a name for the bookmark), and then return there later (generally either through a dialog which allows you to pick a bookmark that you set previously, or though a Go To Next Bookmark / Go To Previous Bookmark shortcut key).

However, there currently isn’t any standard convention among Windows applications for the shortcut keys and menu options that are used to set and navigate to bookmarks. Visual Studio 2005, Eclipse 3.2.1, and Word 2003 (to name three applications that support mid-document bookmarking) all use completely different methods for setting and accessing bookmarks.

I’ve come up with my own trick for setting temporary bookmarks in a document. When I’m at a place at a document that I want to easily be able to return to a little bit later, I enter the string $$$ in the document. (If I’m writing code, I’ll enter it as a comment so that the code will still compile.) Then, later, I just use the editor’s Find feature to search for the $$$ to return that spot. When I’m done working with that area of the document, I delete the $$$. It’s also easy to do a multi-file search for “$$$” to find and remove any bookmarks that I might have set and then forgotten to clean up (prior to checking in a set of code changes, for example).

I chose the string “$$$” because it doesn’t tend to appear anywhere else in the types of documents that I work with, so when I go back and search for "$$$" later, my bookmark is the only match. It's also easy to type and easy to remember.

This technique is nice because it can be used in any text editor, regardless of the particular editor’s own convention for accessing bookmarks. As a sort of poor man's bookmark, it can be used even in editors that do not support bookmarking at all.

Wednesday, July 11, 2007

Thinkpad Rescue & Recovery, and free disk space

While researching a "Rescue and Recovery does not have enough disk space to perform the requested operation" error message that has been unexpectedly popping up on my Lenovo Thinkpad T60 from time to time, I found that on at least some Thinkpad laptops, 20 GB or more of “unaccounted for” of hard disk space – space that is reported as “in use” by the Windows, but which apparently no files are actually using -- can be reclaimed by deleting backups made by the Thinkpad “Rescue & Recovery” utility, or by uninstalling the utility altogether. Information on this is available in a post on Charles J. Keeme's blog (which incidentally, as of this morning, was somewhat surprisingly the only Google result for that error message).

Disclaimer: Make sure you have a sound alternative backup strategy in place before you fiddle with the Rescue & Recovery utility! You may also first want to make a set of OS recovery CDs if you haven’t already and you don’t have other means to restore your machine to its factory default state, as the restore data for some Thinkpads is apparently stored as part of the Rescue & Recovery backup data, not on CDs that came with the machine.

The ability to reclaim this disk space that was being used by Rescue & Recovery was a pretty big deal to me, as my current work machine is a Thinkpad T60 that came with only a 50.7 GB hard drive. This morning, despite having relatively few applications installed and very little in the way of multimedia files (music/photos) on the machine, I had only 9.57GB of free space. After uninstalling the Rescue & Recovery utility, I’m up to 29.9 GB of space – Rescue & Recovery was consuming fully 40% of the capacity of my limited hard disk storage!

(In my case, my Thinkpad is my work machine, and my setup is such that my code and work data are backed up on the corporate LAN, and I can rely on the corporate IT department to help me out should the machine experience some kind of hardware failure that would require me to need to reinstall Windows, so I was happy make the tradeoff of tripling my available free disk space in exchange for the (for me) mostly-redundant backup capability that Rescue & Recovery afforded.)