Sunday, 20 December 2009

What's In Your Toolbox?

This article started out as a simple list of the tools and applications on my work PC.  This was to be both an audit of the current state of the union on my PC, and a checklist for myself for when my PC gets upgraded or dies (note that there is no 'if' in the preceding statement).  I was interested in not just the full-blown applications that appear in the Start menu, but also the little scripts, batch files, and utilities that tend to accrete on our PCs, the small-but-useful stuff that doesn't get much mind share.

The main reason stuff is on my PC is to help me develop, maintain, or review code, but some other bits and pieces have snuck on too, for instance applications that help me write documentation, or prepare a presentation.  I try to keep my PC fluff-free, and any application that doesn't cut the mustard is ruthlessly excised.  If it's listed here, I use it, and find it useful.

Programmers are notoriously obsessive about their choice of tools, and love agonising over them in minute detail.  Just type 'best text editor' into Stack Overflow and watch your screen melt.  I suspect engineers are comparatively pragmatic, but there's no harm in taking a lead from our non-soldering brethren.

This list does not by any means constitute the best of breed.  It's just bits and pieces I've accumulated in my travels.  Sometimes I stumble upon gems through books, blogs, or magazines, sometimes I go looking for a particular functionality I'm sure somebody must have built, and sometimes people recommend programs.  Whatever.  If you see something here that looks interesting, but would like to see some alternatives, Scott Hanselman maintains an awesomely huge tools ├╝ber-list, and I highly recommend that you at least skim it.

One tip: learn to use your tools.  RTFM, and learn the keyboard shortcuts.  I've found over the years that many of the tools I've been using are more powerful than I realised, but you need to delve to find this out.  And using keyboard shortcuts is a no-brainer - even if they only save a couple of seconds over the equivalent operation with a mouse, the compound interest on this saving over the course of a year is enormous.  [Related pet peeve - I find it almost physically painful to watch somebody doing something like copying and pasting text between two documents using the mouse.  They carefully highlight the text of interest, then go to Edit|Copy, then press the toolbar icon for the destination document, carefully place the cursor at the appropriate point, and then select Edit|Paste.  And in my head I'm shouting "Double click!  Ctrl-C!  Alt-tab!  Ctrl-V!".  But maybe that's just me.]

Don't be afraid to splash your own cash.  Even if the department budget won't stretch to buying everybody a decent text editor, spending a few quid of your own hard-earned on decent tools is well worth the investment.  I've a friend who's a car mechanic, and has spent thousands of pounds on stocking a decent toolbox over the years - I don't see why supposedly professional engineers should shy away from investing in their own careers in like manner.  That said, many of the tools listed below are free.

Rules for inclusion: I'm interested in applications that may be of interest to the engineer on the Clapham omnibus, and so haven't listed project-specific tools like compilers and vendor IDEs.  If you need such tools, you'll have them.  I've also skipped over staples like Microsoft Office - such applications are likely to be on the default engineer PC install.  Again, if you need them, you'll have them.  Tools are listed in alphabetical order.  And lastly, these are all Windows applications, because that's where I live.  Some may have ports to other platforms, and there are almost certainly functional equivalents for Linux, OS X, etc.

7-zip: Everybody needs a compression tool.  This one is free, and handles all of the formats I've thrown at it over the years (including things like *nix tarballs).  It can also generate password-encrypted zip files, which is neat for sending confidential documents or source code to offsite contacts.

Absolute Uninstaller: The clue's in the name - this uninstalls programs.  But this free program lists installed programs much more quickly than control panel, removes programs more completely, and can export a list of all installed programs.  In truth this is my main use for this program - generating a weekly list of all installed programs as a snapshot for future reference.

Agent Ransack: This is just insanely useful.  It's a free search program allowing you to recursively search folders for files containing specified text.  Both the filenames and the search text can be regular expressions.  When installed, "Agent Ransack..." appears on the right-click context menu in Windows Explorer, allowing you to specify the root folder for your search.  I have this up and running pretty much all the time I'm developing or examining code.

Beyond Compare: Again, everybody needs a file differencing program.  This one lets you compare files or folders in text or binary mode.  Text comparisons can ignore whitespace-only differences, or 'trivial' changes such as source code comments.  Changes between two files or folders can be copied across in either direction.  Folders can be synchronised, FTP is supported, and there's a whole bunch of options I haven't even looked at.  Heeding my own advice above, I really need to revisit this and RTFM.  Again, the tool integrates with Windows Explorer, appearing on the right-click menu to let you choose the 'from' and 'to' files/folders for a comparison.

Bug Shooting: Before I installed this free screenshot utility, I wouldn't have believed how much I would use it.  It can be run by clicking on its icon in the system tray, or by pressing one of the hot key combinations.  It can capture either the whole screen, or just a specified section, and can do so immediately or after a timed interval.  Once captured, you can crop the image, highlight an area, write text on the image, and so on.  It was originally developed for posting screenshots to bug tracking systems, but I use it for writing documentation, FAQs on our in-house wiki, and a bunch of other stuff that wouldn't have occurred to me before I'd installed it.

CCCC: This one is fairly hard-core geeky.  It's an open source application based, I believe, on a doctoral thesis, that analyses C/C++ source code and spits out various metrics including line of code, line of comments, and McCabe complexity metric.  I use these as a general basis for comparison of bodies of source code - is this application inherently more complicated than this other one?  It also highlights complexity hotspots worth investigating in a bit more detail.

CCleaner: This free program removes unused files to free up space by clearing your recycle bin, Windows temporary and log files, browsing history, and so on.  It also contains a registry cleaner for removing unused and old entries.

Clean Sources Plus: This is a neat little freebie utility from Jeff Atwood.  It gives you a right-click menu item in Windows Explorer (yes, I'm a sucker for these) that lets you delete a user-specified set of files and folders in and under the clicked-on folder.  So, for instance, you can remove all object files in your development folder before checking your code into version control.  It also gives you the option to zip the folder - very handy when you want to upload or email some code.

Clipname: Another freebie that rapidly became indispensable.  Right-click on one or more files or folders, and you get the option to save their names to the clipboard for copying into other applications.  You can save just their names, or their full paths including all folder information, and can do so in the URL-encoded format needed for hyperlinks.  Very, very helpful.

CmdHere Powertoy: This time the freebie is from Microsoft itself.  Right-click on a folder (are you spotting a common theme here?) to get the option to open a command window pointing at the selected folder.  Very useful when you want to jump in and check the output from a batch file, or quickly run a program with particular command line options.

DebugView: The first but by no means the last appearance for the Sysinternals tools on this list.  This program captures debug output locally, or across a TCP/IP network.  In my case I've only ever used it to capture OutputDebugString() calls in my PC code, but apparently it also supports kernel mode debugging.

Editplus: a decent text editor is absolutely essential.  When developing you almost certainly spend a huge chunk of your working day in a text editor, and so should be using a tool that helps you as much as possible.  For me, the minimum requirements of a text editor include language-specific syntax highlighting, the ability to record and play back keystroke macros, and regular expression searching.  Failure to provide any of these results in me immediately losing interest.  For historical reasons my weapon of choice here is Editplus, which is small, cheap, and powerful.  BTW, one of my standard interview questions is to ask the candidate what their favourite editor is.  I'm not really interested in their answer, so much as in if they have one.  If not, they're not thinking about what they're doing.

EverNote: I realise that I'm only using a tiny percentage of the functionality of this application.  I basically use it as a journal/logbook, writing up notes as I work, and pasting in code snippets, scope shots, and photos as appropriate.  These are all then available for searching when, in six months, I want to quickly find all my notes on a given project.

Fences: This one is still in the stage I like to call "trying-it-out-to-see-if-I-like-it-and-or-find-it-useful".  It lets you create areas (that it calls 'fences') on your desktop, in which you can drop files or shortcuts.  I personally try to keep my desktop empty, and use a hotkey application launcher to start up most of my programs, but this has potential.  I've been using it to create project fences containing links to the datasheet for the chip I'm working with, the project demo software, and so on.  Fences feels stable and would certainly be worth looking at if you tend to use your desktop as a holding area.

Foxit Reader: Smaller, faster, and leaner than Adobe Reader.

Google Desktop Search: This brings the power of the mighty Google to your desktop.  Once installed it starts indexing all of the files on your PC.  I've got it running in the system tray, and by typing in, for instance, the name of a project I've worked on, it will find all files containing that name.  And that includes not just text files, but also Word, Excel, PDFs, emails, etc.

Janitor Script: I have a folder on my PC where I put all downloads, email attachments, and things I only want to deal with on a temporary basis.  This little script runs every lunch time and deletes everything older than a week from the folder.  Neat.

Keepass: Keep all your passwords in a single database with a single password to remember.  I use this for not only all of the web sites demanding I have a password to identify myself, but also for the passwords I've assigned to users on some of our internal tools.

Launchy: This is just mind-bogglingly, consciousness-expandingly useful.  It's a hotkey application launcher that has totally removed my need to use the Start menu, shortcuts, or just about any other method of running a program or opening a commonly accessed file.  I press ALT-space, type in the first few characters of the application I'm interested in, it auto-suggests the most likely candidate based on my previous invocations, and I hit enter to run the program or open the file.  Or, in many cases, I can supply further information.  For instance, to search for a book on Amazon, I type in 'am' to get Launchy to suggest 'Amazon', then hit tab, followed by the name of the book I'm interested in.  It then launches my browser and displays the Amazon search results.  I can also create emails, add items to my web-based to-do list, and append text to files on my PC.  If you haven't tried a hotkey launcher, give them a go, they'll change your life.

PDFCreator: Install this freebie to have a PDF output option appear in your print menu.  This lets you create PDFs straight from any Windows application that lets you print.  Neat.

Paint.NET: Free and increasingly-powerful image and photo editing software.  I tend to use it for really simple things like annotating photos, but there are a wealth of features in there.

PC-Lint: If you're writing C or C++, and don't have this, or a functional equivalent, go buy it.  Now.  Seriously.  This static analysis tool remorselessly examines all of your code, and pedantically flags every potential violation of the rules of the language.  You can also configure it to perform MISRA compliance checking, so consider it as two-for-the-price-of-one.  It's remarkably flexible (for which read 'difficult to configure to get it going'), but well worth the effort.  Hook it in to your development system so that it runs every time you build your application, and you'll never look back. 

Portmon: YASG (Yet Another Sysinternals Gem).  I stumbled across this when debugging a serial port application I'd written.  It lets you capture all reads and writes to/from specified serial and parallel ports.  Absolutely essential if you're playing with such items.  Also useful if you want to figure out the interface protocol for a bit of third-party kit.  There used to be similar applications for file activity (filemon) and registry activity (regmon), but these have now been superseded by a process monitor (procmon).

Process Explorer: YASG (see above).  Task Manager on steroids.  See unbelievably detailed information on what's going on in your PC.  I've no idea what a lot of the displayed data is, but what I have been able to do with this in the past is use it to check for memory leaks in my PC code.  Select a program, right click to select 'Properties...', and switch to the 'Performance Graph' tab to see the application memory usage - if it continually ramps up, you've got a problem.

RegexBuddy: OK, this is pretty geeky too, but in a good way.  I bought this following Jeff Atwood's enthusiastic endorsement, and find that it excels in its (admittedly rather narrow) sphere of application.  As previously mentioned, one of my main uses for script languages is searching for data in log files.  Well, with RegexBuddy, I can copy some of a log file into a 'test' window and try out regular expressions that are evaluated on the fly, highlighting matches as I type.  When I'm happy with my expression I can copy and paste it into a fully-fledged script and I'm good to go.  Similarly, I can copy sections of code into the test window, and develop regular expression searches to be pasted into the aforementioned Agent Ransack.

Source Code Spell Checker: As I’ve mentioned before, I have a fairly dogmatic approach to spelling and grammar in source code.  I run this tool on all of my own code, and on code I'm reviewing, and fix or flag all transgressions.  Cheap, and does what it says on the tin.

Source Navigator: This is an open source code analysis tool.  It can generate function call trees, variable cross reference tables, class hierarchies, etc.  Extremely handy in getting you up and running on a glob of code you haven't seen before.

SyncToy: Another freebie from Redmond.  This one lets you synchronise folders, which is very useful when, for instance, keeping a snapshot of your source code on a USB stick or network drive.

TreeSize: Right-click a folder to see a graphical representation of the size of it and all folders under it.  Great when trying to track down what's eating all of the space on your hard drive/USB stick.

ZoomIt: YASG (see above).  Lets you zoom in and scroll around on your PC screen, highlight areas, and scribble notes on it.  Invaluable during presentations or training sessions.