PuTTY or one of its forks is a standard tool for administering Unix and Linux machines from Windows. It provides SSH connectivity for command line access, as well as keypair management for compatible programs like WinSCP.
Unfortunately, PuTTY has some terrible defaults. For example, it limits itself to 200 lines of scrollback by default, which guarantees that you’ll lose some history in most SSH sessions.
There’s a way to fix this and other defaults.
First, load the “Default Settings” saved session: Then, configure the defaults as you like. For example, I’m increasing my lines of scrollback from 200 to 20,000:
Then, save the new default settings:
PuTTY will now have a sensible defaults whenever you’re connecting to a random server.
Sometimes when my VPN connection to work goes down, certain applications that rely on intranet servers (e.g. Lotus Notes, Lotus Sametime) become unable to reconnect to their servers even after I reconnect to VPN. This is due to the operating system’s DNS lookup cache reusing the failed hostname lookup from when VPN was down rather than doing a fresh hostname lookup now that there is a fresh VPN connection.
On Windows, you can fix the issue by opening up the Command Prompt as Administrator and running the following command:
I had an exciting tax year (lots of RRSPs, bought a house), so I picked up a copy of TurboTax 2012 to help file my Canada income taxes.
Unfortunately, TurboTax crashed on startup and running it as Administrator did not help. It turns out there is a known workaround involving copying some DLLs around.
I do some reporting in Excel. The reporting involves loading data via ODBC from a DB2 database. Excel is pretty zippy with its pivot tables once the data is loaded, but setting up the initial connection can be tricky.
Windows 7 is the first Microsoft operating system where the expectation is that the consumers would run the 64-bit version. However, Office hasn’t caught up yet, and 32-bit is the default for Office 2010.
32-bit Excel can’t see 64-bit ODBC data sources.
Windows comes with entirely separate 64-bit and 32-bit ODBC control panels. The 64-bit ODBC control panel is the default, and the 32-bit ODBC control panel is not even listed in the in the main control panel. You need to invoke it via Start > Run.
To invoke the 32-bit ODBC control panel, use the following command:
Once you have the control panel open, it should be straightforward to define a new System data source to your database.
I’m setting up a new primary system and I thought I’d jot down some notes.
Ninite is probably the quickest way to install all the necessary software (Chrome, 7-zip, Dropbox, iTunes, Picasa, etc). You click the checkboxes and it rolls you a custom, hands-off installer. They upsell to an auto-update service, but there are free alternatives like FileHippo Update Checker.
Speaking of Dropbox, it proved a lifesaver. If you aren’t familiar with it, it’s a service that automatically syncs (and backups) a folder between all your machines. My last hard drive failed, but because all my personal files are on Dropbox I didn’t lose any of them. They have a free 2GB account available, and if you join they’ll toss some extra free space my way as well.
I also set up a few Firefox extensions. With extensions, the goal is always is to have as few as possible, as there is a history of extensions slowing down Firefox performance. Here are the ones I chose:
HTTPS Everywhere is of course a great security boon. LastPass is a secure cross-browser way to manage the hundreds of passwords we all have. Xmarks is a bookmarks synchronizer which I prefer over Firefox Sync because it’s cross-browser.
I have a few goals with the new system:
- Keep the desktop empty of files
- Keep all personal files in a single location (e.g. \Dropbox)
- Keep all work files in a single location (e.g. \Projects)
The last one might be the trickiest, as all the different Eclipse-based IDEs I’ll need to install will all try to grab a workplace for themselves.
It’s fairly straightforward to diff or compare different revisions of an Office document on Windows. The approach below applies to Word, Excel, and PowerPoint files, as well as to ones created by Lotus Symphony, OpenOffice.org, or LibreOffice.
- Download and install WinMerge. This is a free, open source utility.
- Download the xdocdiff plugin. Unzip it somewhere.
- Copy xdoc2txt.exe and zlib.dll to C:\Program Files\WinMerge
- Copy amb_xdocdiffPlugin.dll to C:\Program Files\WinMerge\MergePlugins
- Start WinMerge.
- Go to Plugins > List and check [x] Enable plugins.
- Go to Plugins and set it to [x] Automatic unpacking
- Close or restart WinMerge
You should now be able to select any two documents that you want to compare, right-click on them, and choose WinMerge to get a meaningful comparison of the textual differences between them.
If you are seeing line noise in the comparison, you need to make sure you enable the settings mentioned in steps 6 and 7 above.
My team at IBM recently released DB2 Express-C 9.7.4, the latest and greatest version of our free database.
Raul wrote up a detailed article with the technical nitty-gritty of what’s new. There’s a bunch of different improvements, but one thing that’s caught my eye are the enhancements to triggers.
A trigger is something defined to fire automatically when you insert, update, or delete a row in a table. Starting with 9.7.4, you can basically inline a whole stored procedure in the trigger definition. This is nice because it lets you keep the code for all the different actions on a table together.
Let me quote Raul’s example:
CREATE TABLE COMPANY_STATS (NBEMP INTEGER)
CREATE TRIGGER HIRED
AFTER INSERT OR DELETE OR UPDATE OF SALARY ON EMPLOYEE
REFERENCING NEW AS N OLD AS O FOR EACH ROW
THEN UPDATE COMPANY_STATS SET NBEMP = NBEMP + 1;
THEN UPDATE COMPANY_STATS SET NBEMP = NBEMP - 1;
IF (UPDATING AND (N.SALARY > 1.1 * O.SALARY))
THEN SIGNAL SQLSTATE '75000' SET MESSAGE_TEXT='Salary increase>10%';
Ignore that last part. All salary increases should be > 10%.
The look up table goes in months.bat:
:: one record per line
:: = is the delimiter
Given a month number, you can then look up the month abbreviation as follows:
:: Enable numeric comparison in if statements (Windows NT or better)
:: Set the month number you want to look up
:: 8 is August
:: Look up the months abbreviation (e.g. 8 is aug, 9 is sep, 10 is oct)
@FOR /F "tokens=1,2 delims==" %%i IN ('months.bat') DO @IF %%i EQU %MN% SET MW=%%j
:: The month abbreviation is now the %MW% variable
@ECHO The month abbreviation corresponding to %MN% is %MW%.
- ‘months.bat’ executes that file and pipes the output to the FOR /F command
- delims== sets the delimiter to the equals sign
- tokens=1,2 means you want the first two tokens (e.g. 1 and aug for 1=aug=August)
- %%i means the first token will go in %%i, second in %%j, etc
Alternate solutions are welcome. I’m still a bit unclear on the difference between %%i, %i, and %i%.
CCleaner is one of my favourite utilities for Windows. It does several things very well.
One of them is removing the temporary files that various applications leave lying around. For example, the Windows temporary files directory gets filled up with various installers that have a tendency to never be removed as well as fragments of files left open during crashes. For another, Windows retains the option to let you uninstall every patch Microsoft issues. This may be useful in a mission-critical server situation, but on a regular machine it just wastes space.
I just had to clean up a very space-constrained virtual machine for work. CCleaner instantly freed up 1.4GB of space simply by removing crud left around by installers and other applications.
CCleaner also does a beautiful job of correcting Registry inconsistencies, finding dead Start Menu shortcuts, and various miscellaneous tasks like free space management and cleaning up the Add/Remove programs list.
On Windows, my music player of choice is musikCube. It’s fast, clean, elegant, and powerful. Oh, and it has an embedded SQL engine underlying its song library.
It has conventional playlists, but it also has dynamic playlists based on queries of the underlying SQL database. For example, this query gives the Top 10 Most Played songs:
timesplayed > 0 ORDER BY timesplayed DESC LIMIT 10
And this gives 50 songs with a rating of 4 stars or better in random order:
rating > 3 ORDER BY random() LIMIT 50
Once created, a dynamic playlist is only a mouseclick away.
The documentation is incomplete, but the database schema is easy to look up by saving a copy of the library and opening it up with a tool like sqliteman:
I wanted to subdivide my music into playlists, and then find any song not on a custom playlist. A query similar to this did the trick:
songid NOT IN (
WHERE std_playlist_id IN (
WHERE std_playlist_name IN ('Gnarly', 'Radical', 'Tubular')
It finds every song not added to the Gnarly, Radical, or Tubular static playlist. Using this, I finally got my music library sorted and organized.