Category Archives: Coding

Using ant to exec mysql .sql files via a fileset

In trying to automate our DB development, we decided to use ant and Jenkins to run our SQL scripts for a deploy. We had a hard time getting ant to work and after much trial and error (and cussing and fussing) we finally got it to work. The key really was the addsourcefile=”false” attribute and the redirector. Since mysql can run sql from a file using redirection (< ) you have to use a redirector (which is poorly documented).

The ant apply task can apply an executable to every file in a fileset, so this will use the mysql executable to exec every *.sql file it finds.
Continue reading

Upgrading Perl in Linux Mint

WARNING: don’t do this – it could hose your system like it did mine… details to follow once i figure out how to undo it.

Figured I’d share this since it was a PITA to figure out. Linux Mint 11 ships with Perl 5.10. I was trying to install icinga and it needs Perl 5.12.4 or greater.

To make it happen I had to:

  • add this line to /etc/apt/sources.list: deb wheezy main
  • install/upgrade with this: apt-get install gcc perl -o APT::Immediate-Configure=0 (from linux mint forums)

and Bob’s your uncle.

AND…. to put 5.10 back in place…

  • remove the entry you put in /etc/apt/sources.list and replace it with deb squeeze main
  • sudo apt-get install perl=5.10.1-17ubuntu4 perl-base=5.10.1-17ubuntu4 perl-modules=5.10.1-17ubuntu4

upgrading to 5.12 caused lots of problems – Pidgin wouldn’t work and most importantly, my VPN stopped working – it would disconnect after about 30 seconds.

Twitter search archiver

With Teenormous, we started giving away free tees to people that tweet a link to us. Problem is, we couldn’t find an easy solution to archiving/looking back on tweets for the month. Twitter keeps the tweets seachable for a very short time. We found a few web apps/services that did some similar things but not exactly what we wanted. We even tried Google Reader by putting the search RSS feed into it. (That worked, but trying to scroll and count to #57 is a royal pain and that method just doesn’t scale.) So, some poking around led me to the excellent Ruby library for Twitter by John Nunemaker which uses the Twitter APIs.

It’s so easy to use it’s laughable. A few hours later and I have an app/script written that stores the results of any twitter query (like the one we care about) into a static HTML file with them in order from oldest to newest and each tweet numbered for easy random picking of winners. It also automatically creates a new file each month. I used the Twitter CSS so it looks nice and clean. Slap it in a cron job and we have auto-archiving twitter searches. Plus – it’s in HTML format in case we want to put them online for some reason.

It’s nice sometimes to do a little coding project that’s not exactly what you typically do. Oh – and Ruby rocks.