Tips & tricks from my 4 months at Pythian

After working with Yanick Champoux on a few little Perl projects here and there, we finally met face-to-face at YAPC::NA last summer. A few months later, when I was looking for a co-op position, I immediately thought of Pythian.

They're a mid-sized company in Ottawa that does database services. They're the expert DBAs you hire if you don't have your own (or enough of your own). Their in-house development team works on 2 major pieces of software: Support Track, a ticket tracking web application, and Avail, a server monitoring tool. I was hired to do quality assurance on these two systems over the winter semester.

A lot of the testing was manual, and I learned a bunch of new techniques for testing and debugging web applications. Because I did a bunch of little things while I was there, I wanted to share a bunch of little tips & tricks you might find useful if you don't already know about them.

Testing/debugging tips & tricks

  • openssl s_server and s_client are a simple server and client included with the standard OpenSSL installation. If you need to see what your SSL server or client is doing, these provide the instrumentation you're looking for. I used this extensively in my testing for a project adding SSL support to an HTTP client library - see also SSL Security in HTTP::Tiny.
  • telnet, netcat make a nice server/client pair for plaintext protocols like HTTP or memcached.
  • mtr is the best of ping and traceroute rolled into a single package.
  • perldoc -l will tell you which module is being loaded. Module::Versions::Report is also very helpful.
  • Symlinks are often used to provide a kind of versioning for a directory. To switch the symlink to the new target atomically, do: ln -s new-thing link-tmp && mv -Tf link-tmp link - the mv makes is atomic.. If you try to give the symlink a new target with ln directly, it isn't atomic. Use strace if you don't believe me.
  • cp has a -s flag that makes symbolic links with a less confusing syntax than ln.
  • To follow a file being appended to while also being able to scroll back and forth, use less and press F to follow just like tail -f.
  • To make columnar data from various commands actually readable, pipe into column -t.
  • perltidy is your friend.
  • Just do echo 'alias fail="tail -f"' >> ~/.bash_alises already and be done with it!
Comments
Comment from garu - May 19, 2012 at 10:20 pm

Great tips, thanks for sharing!

Funny how you do 'alias fail="tail -f"'. I usually do 'alias duff="diff -u"' ;-)

Comment from Iñigo - May 20, 2012 at 7:06 pm

The 'cp -s' one is not very portable (not POSIX) as 'ln -s' is.

For example, it may not work in Solaris, FreeBSD, OpenBSD, etc.

Anyway, reading 'strace' in the previous paragraph, the context of the tips, is clear enough :-)

Nice tips.

Comment from Arup Nanda - May 22, 2012 at 1:57 pm

Very nice post. Thanks for sharing these. On the topic of aliases, I always use alias rm='rm -i'; so for mv and cp. Saved my behind more than once.

Pingback from Introducing File::Symlink::Atomic - May 26, 2012 at 12:39 am

[...] Tips & tricks from my 4 months at Pythian, I showed how to give a symlink a new target atomically. I wasn’t aware of any module to [...]