Font Smoothing in Snow Leopard
Apple have touted Mac OS X Snow Leopard as having no new features. Whilst there are no new big ticket features there have been plenty of tweaks and refinements. One part that got this treatment was the font smoothing options in System Preferences. In Leopard this allowed you to enable font smoothing and choose between four different levels of smoothing. In Snow Leopard there’s now only a single option to enable the smoothing.
The problem with this change is that is appears to default to the light option. As previously identified in, “Consolas on Mac Update”, my preferred fixed width font Consolas doesn’t look nice with the light smoothing and I prefer medium. Fortunately you can still choose the medium option but setting the preference directly via the defaults command in the Terminal:
Local Package Management with GNU Stow
I’m a bit of a purist when it comes to installing UNIX style software. I prefer to install it via the package manager on the platform of choice (E.g. apt on Debian or Mac Ports on Mac OS X). However these repositories don’t always contain the particular package you’re after or may contain an outdated version.
In situations like these where you end up building the package yourself I used to employ a system where I would install it into a subdirectory within my home directory. I did this because it doesn’t overwrite a pre-existing system installed version, doesn’t require root privileges and permits quick removal. To achieve this I just passed the --prefix option to the configure script before building. For example if I was building vala I might run the configure script as follows:
./configure --prefix=$HOME/Local/vala
Following that with the typical make, make install sees the package built and installed into that directory. The problem with this approach is that for every package you build you have to add the target directory to search paths such as: PATH, LD_LIBRARY_PATH, MANPATH, PKG_CONFIG_PATH. After a while this gets a bit unwieldy. This is where GNU Stow comes in.
Stow manages these separate target directories by creating symlinks into the parent directories. For example to build vala I would pass a prefix of $HOME/Local/stow/vala to the configure script. After vala is built and installed, change to the $HOME/Local/stow directory and run stow vala. This results in symlinks to the files in $HOME/Local/stow/vala being created in $HOME/Local, with directory structure preserved. So if vala installs files to bin and lib these files will end up under $HOME/Local/bin and $HOME/Local/lib respectively.
Stow can also delete the symlinks to support uninstalling. The end result is that you only need to add one extra directory to each of the search paths and custom software can be built, installed and uninstalled all without messing with the standard system and root privileges.
Spider a Site With wget Using sitemap.xml
On a number of sites at work we employ a static file caching extension to do just that: create static files that are served until the cache is invalidated. One of things that will invalidate the cache is deploying a new release of the code. This means that many of the requests after deploying will need to be generated from scratch, often causing the full Rails stack to be started (via Passenger) each time. To get around this I came up with the following to use wget to spider each of the URLs listed in the sitemap.xml. This ensures each of the major pages has been cached so most requests will be cache hits.
wget --quiet http://www.example.com/sitemap.xml --output-document - | egrep -o "http://www\.example\.com[^<]+" | wget --spider -i - --wait 1
That should all be executed on one line. There’s a one second wait in there to spread out the requests a bit but you can remove it if you like.
Exclude Directories From TextMate Side Bar for Faster Find in Project
I’m not much of a user of TextMate project files, generally preferring to just mate . in a directory. This works great until the directory or one under it contains large, irrelevant files like log files or database dumps. Its at this point you start encounter massive slow downs in the otherwise very useful ‘Find in Project…’ function. The slow downs turn into crashes if the files are big enough as this results in TextMate atttempting to grab vast amounts of memory. Eventually the OS tells it to, “bugger off, 1Gb is all I can give you”, or something along those lines.
A common solution, particularly when working on Rails projects is to create a shell alias that just invokes mate with the directories of interest. This works ok but given I’m working on a mix of project types (Pylons, Rails, Radiant) I wanted a solution that did the reverse: Choose everything except what I want to exclude. Informed by an answer to a question on Stack Overflow I came up with this:
As the comments in the script note I have this in a file called ‘ate’ in ~/Local/bin, which is in my PATH. I can now happily go to any directory, type ate and have it ignore that list of directories.
Mac Remote Desktop Connection Without Installer
Microsoft provide a Remote Desktop Connection (RDC) client for the Mac. This is a good thing. However it is packaged as an Installer meta package, which to me seemed unnecessary, so I went digging. Viewing the Packages folder within the meta package shows that Microsoft have thoughtfully included an Office updater, error reporter and help viewer as well as the RDC client itself:
- Office2008_en_autoupdate.pkg
- Office2008_en_errorreporting.pkg
- Office2008_en_helpviewer.pkg
- Remote Desktop Connection 2.pkg
- Remote Desktop Connection.pkg
Note: From what I can tell the second RDC package (the one with 2 on the end) exists to provide internationalisation, something I don’t need. If you aren’t an English speaker (yes I’m aware of the irony of this post being written in English) then you may not want to follow these directions.