Recently I've been cleaning up some Perl code for release. I've been using perltidy as part of that process. Here's what I came up with for perltidy flags, a minor variation on those suggested by Perl Best Practices.

January 13, 2010

Apologies in advance for the Ubuntu-centricity of this post title. I haven't had a chance to try this out on Debian, so I can't be sure that it works quite as smoothly, although I assume it does. All of this was done on Ubuntu 9.10 (Karmic Koala).

First, install python, the python development headers and libraries, and python's setuptools (setuptools includes easy_install). easy_install allows you to install python libraries that are not available via the Ubuntu package system.

Second, use easy_install to install pip, which is superior to easy_install for package and library management. We use easy_install to get the latest version of pip, which is not available in the Ubuntu packages. Since it's not installed with aptitude, pip will end up under /usr/local as it should.

sudo easy_install pip

Finally, use pip to install virtualenv, which allows you to build out environments containing specific versions of python libraries for specific applications and development environments.

sudo pip install virtualenv

At this point I don't have hard and fast rules for which method I use to install python dependencies, but roughly it's:

Use aptitude and the Ubuntu sources for stable packages and tools, or packages and tools which are linked to other functionality and libraries better handled with the system package management. e.g. I'd install MySQL database support for python with the python-mysqldb package.

Use pip to install to /usr/local for tools which are useful system wide and are either out of date or not available in the Ubuntu sources. e.g. pep8.

Use pip to install to a specific virtualenv for a specific application development. e.g. if I started a Django project which had some specific dependencies I'd set up a virtualenv for that project and install the libraries it depended on there.

For more on why you might want to use these tools for python development:

December 19, 2009

Before upgrading to Snow Leopard I used Deja Vu Sans Mono (a variant of Bitstream Vera Sans Mono) as my Terminal font. I now prefer Menlo, Apple's own variant of Vera Sans Mono, which ships with Mac OS X 10.6. I use 12 pt. Menlo in Terminal and when programming and editing code. A comparison of Menlo and Deja Vu Sans Mono is below (via Jesse Burgheimer on Typophile).

Background:Fixing colors in Terminal.app on 10.6 contains all the relevant information on getting SIMBL and TerminalColors installed for Terminal.app, but only if you read the entire post and the entire comment thread which tracks the various updates to SIMBL itself and the 32-bit/64-bit enabled versions of the relevant applications and bundles.

Solution: SIMBL now works on Snow Leopard with both 32-bit and 64-bit applications. The Visor bundle (“a system-wide terminal accessible via a hot-key” which started its life at blacktree.com) now contains both TerminalColors and CopyOnSelect and is under active development. And it's handy to have a shell quickly accessible when I need one.

Download SIMBL (the latest 0.9.x version) and run the package installer.

If you just want to tweak colors sans Visor, try the version of TerminalColours timmfin released. (The download link is in the README on that page.) It includes Snow Leopard fixes, 32-bit and 64-bit support, and works with SIMBL 0.9.x.

Another option is Yoshimasa Niwa's TerminalColoreopard. The 0.2.5 beta works with Snow Leopard, 64-bit, and SIMBL 0.9.x.

July 10, 2009

In the modern version of gnome-terminal, there is a hidden gconf setting that controls this if you don't want to turn off the Gnome-wide setting. Fire up gconf-editor, navigate to apps/gnome-terminal/profiles/Default, and set the cursor_blink_mode key to have the value of 'off'. If you have any other profiles, you will have to create and set this key in them as well.

-q This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out. (Reference.)

--single-transaction This option issues a BEGIN SQL statement before dumping data from the server. It is useful only with transactional tables such as InnoDB and BDB, because then it dumps the consistent state of the database at the time when BEGIN was issued without blocking any applications. (Reference.)

-O--no-ownerDo not output commands to set ownership of objects to match the original database. By default, pg_dump issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify -O.

June 11, 2008

Original post (6/2008): The Mac OS X Terminal gets a little better with each release of the OS, and the version in 10.5 (Leopard) was no exception. But there are still a few little problems. Like the fact that by default the backspace and delete keys don't work properly and consistently when sshing to machines running different unix variants. And problems with color working consistently with apps that use ncurses. All of this hearkens back to some sort of inconsistent/buggy implementation of the turtles-all-the-way-down unix terminal emulation that underlies it all. There isn't really a "solution" to this problem in the traditional sense, but you can get close enough if you (kind of) understand the issues at play. Some advice from over the years:

I ultimately just took the advice of the last article and set my terminal to identify itself as dtterm in the Advanced tab of the Settings pane in the preferences. This (mostly) did the trick. I also selected Delete sends Ctrl-H in the Advanced tab and Use option as meta key in the Keyboard tab. This makes backspace more consistent a and allows me to eg use Meta-B and Meta-F to move backward and forward on word boundaries in the shell.

Another helpful tool to get a more readable black Terminal theme is this SIMBL hack which allows customization of ANSI colors. After installing it I used this terminal theme as a starting point for my own theme customization.