Wednesday, October 12, 2011

Preserving a leading zero on a number in a text field in Excel

At work we're writing UPC codes to a TSV file. Often a UPC has a leading zero, which is automatically whacked when the file is opened in Excel. The trick is to write the UPC cell to the TSV file as

="027297909021"

This preserves the zero.


Friday, August 19, 2011

OMG, command line editing in mysql client

This is freaking awesome. To enable command line editing and searching in the mysql client, create ~/.inputrc and add the following lines...

set keymap vi
set editing-mode vi

Bam, vi commands in the shell. This is literally shaving hours off my work time.

Friday, March 25, 2011

Perl Module Tricks

To check the existence of a module, if the following completes with no errors, it's installed...

perl -MXML::Simple -e 1

To get the version of a module...

perl -MXML::Simple -e 'print "$XML::Simple::VERSION\n"'

Removing a CVS sticky tag

Yes, I'm sorry to say, I still have to use CVS for some tasks. We've talked about upgrading to SVN, at least, but I doubt it will happen soon. To remove a sticky tag and update a file to the latest revision (HEAD), use the following...

cvs update -A filename