Posts

Showing posts from April, 2010

subversion and revision tags, first pass

Always being a wanna-be programmer, I'm only now learning development tools. Subversion is cool in itself, but when I was just starting with it a few months ago I wasn't googling tags correctly and only found parts about how cvs tags didn't work. Inspired today, I decided to search again and found the right information this time. For me a compressed tag with date, rev #, and id are good enough.  So all I had to do to get this working was to add a line in my PERL script under a comment: $Id$ and then change the svn property for the affected files with: svn propset svn:keywords Id lib/* now when I commit files, they automatically get updated with the latest tag. There are other more useful settings but this was my little discovery for today.  Since I'm forced to work under winblows and that means I have to use Cygwin to be productive at all, I haven't explored how to make this the default yet.

Decoding a bad attachment -- base64

The team captain for one of my hockey teams sent out the playoff schedule.  Unfortunately whatever method he used to forward the message, attached the original message in a raw mbox format.  Because it contained an attached m$ word document, it arrived at my Gmail inbox in base64 MIME format and Goggle didn't parse the attachment. Luckily, openssl has base64 encoding built in and with a little massaging I was able to decode the playoff schedule. First, save the raw attachment.  Delete all the lines before the actual base64 code.  Delete all of the lines after the base64 code.  Hint: don't even save the base64 header information. Next, tell openssl to decode that file: openssl base64 -d -in srcfile -out sched.doc

syslog-ng on cygwin

I am developing some PERL scripts for OMNIbus/Netcool at work.  Because my company restricts freedom and discourages innovation, we are stuck on Microsoft.  Luckily they haven't locked us down to the point where we can not install new software.   So I've become a big fan of Cygwin.  I've never used heroin, but I suspect my use of Cygwin is much like an addict's use of Methadone.  It keeps me alive, just barely. Anyway, this piece of knowledge was not the most straightforward piece to find, or I'm just an idiot (not that those are mutually exclusive.)  However on the winblows box, syslong-ng runs under Cygwin and even sets itself up as a service which is cool. Side Note:  if you want to upgrade Cygwin and are getting file in use problems and are running syslog-ng, you probably need to shutdown the service during upgrades. Anyway, marking and statistics in /var/log/messages on winblows are pointless and just consume disk space.   Normal google searching didn't

Fonts in M$ Outlook

I always have a heck of a time getting M$ to do what I want.   I guess because I am not a "defaults" kind of person.  Black text on a white background is gross.   Anyway Word has always had a wordperfect setting where I can get white text on a blue background.  Not as nice as a black background, but better than white. Unfortunately, many people send HTML emails and when replying I have to edit in HTML mode to preserve any kind of useful chain.  Up until today I've had a problem that eluded me.  Many times my initial typing would all be hidden because (I assume) the text color matched the background color.  Now this only happened with HTML replies.  I had to highlight my text, and click the Text Color (Auto) button to correct. The solution was not straightforward to me, but I found it today: (in Outlook) Tools->Options->Mail Format->Fonts These fonts are used and override (or interfere) with the blue background/ white text global option. Also, changed the "

xargs always confuses me

I have always had the hardest time working with xargs.  I usually end up with a bash foreach loop and some backticks instead.  But it really is cleaner to be able to specify a pipe from the generating command. I had a situation recently where I had added some code to a PERL script that I was trying to understand.  I added some File::Temp code to dump incoming variables and the current environment.  I just used /tmp as my template directory since it was always guaranteed to be there and I didn't want to have even more code to create and maintain a new sub-directory.  Wow, that is lazy.  Anyway, I ended up with a bunch of /tmp/?????????? files, so I needed a quick way to grab all my files from temp and move them to a sub-directory for review.  xargs was the perfect solution here, AND (drum roll) I actually got it to do what I needed it to do: cd /tmp/1 mkdir /tmp/1 fgrep -l dudeatwork.cgi ?????????? | xargs -I {} mv {} 1 which looks at all the files with 10 character names, look