23 November 2006

Windows CMD Redirect Error And Standard Stream To File

To redirect error and standard stream of a program to a file, use the following in Windows cmd shell: prog args > file.log 2>&1.

20 November 2006

Java IDEs Jgrasp Eclipse

I had a play with two Java IDEs recently: Jgrasp and Eclipse. For a developer, Jgrasp was small and worked reasonably well. Since I was trying to fix someone else's code, I wished Jgrasp had more features and shortcut keys for debugging. Eclipse is huge but I like the way it automatically parsed my source code to find errors and warnings.

19 November 2006

New Blogger Interface

I migrated my blog to the new Blogger interface. Since I had a Google account, now I have one less username-password combination to remember. One nice new feature: labels. Now I don't have to put keywords in the title of each blog entry just for categorising blog entries. It's a Google-ish feature and works like labels in Google Mail.

Misc: Saving A Minute A Day

We used to have a slow login start script that would take a minute or more to map remote drives and printers to our workstations. The script was over-complicated and no longer maintained, so I asked our IT person to write us a much a shorter and simpler one. The resulting script now takes one or two seconds to run. For 10 staff, saving that one minute a day is worth up to one man-week a year (1 minute * 10 * 240 working days)!

13 November 2006

Software: Oracle SQL Loader NL_DATE_FORMAT

I had to load some data into our Oracle test database server. The data was created in Excel, exported as CSV files, then read into Oracle using sqlldr.exe (SQL Loader). Pretty straightforward, but sqlldr.exe complained about the date format of some entries and some constraints being broken. It turns out that the date field in the CSV files were "dd/mon/YY" while sqlldr.exe expected "DD-MON-YY" by default. Also, Excel was writing two digit year values, so some start dates were occurring after end dates. For example, if the start and end dates were "1-Jan-2006" and "31-Dec-9999", then they were being written as "1-Jan-06" and "31-Dec-99". Solution was to set the NL_DATE_FORMAT environment variable to YYYY/MM/DD and ensure that the date fields in Excel match them.

I had to be a little careful with setting NL_DATE_FORMAT. In Windows shell, double quotes are treated literally in statements, so use SET NL_DATE_FORMAT=YYYY/MM/DD instead of SET NL_DATE_FORMAT="YYYY/MM/DD" to define the environment variable's value. I guess this will bite you if you come from a Unix environment where the shell treats double-quotes as a string delimiter.

03 November 2006

Misc: Firefox 2.0

Just installed latest Firefox 2.0 on my Windows box. It works as expected. Can't see a technical reason why the release number was bumped to "2.0" when there are just a lot of minor changes and fixes.

Having a close button on the right hand side of each tab is more intuitive. Previously, there was only one close button on the right hand side of the Firefox window for closing the currently active tab. I had no problem with that but I noticed my son didn't realise he could close tabs by pressing that button. Score an extra point for usability.

Update: Firefox 2.0 can spell-check text fields. Now I know what rubbish I've been writing.

Misc: Vim No Backup

I got a new workstation at work and reinstalled Vim. Then vim started creating backup files with the tilde (~) and .bak extensions. Right-O, no problem. I edited my _vimrc file and added set nobackup and set nowritebackup but that didn't work. Puzzled about this problem off-and-on for a couple of weeks. It turns out that I added my settings before source $VIMRUNTIME/vimrc_example.vim and source $VIMRUNTIME/mswin.vim. Duh! My configuration settings were being overrode by the default settings. I moved my configuration settings below those two lines and vim behaved as expected.

02 November 2006

Misc: Disable Windows Autoplay

Windows' Autoplay feature annoys me whenever I put a CD into my CD-ROM drive. Copy Controlled CDs are especially annoying because a dialogue pops up asking me to install a proprietary player. My solution is to disable running software on a CD-ROM by changing this registry value: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\CDRom\Autorun = 0. Extra: As usual, once I start looking, I find out more than I need to know in this site.