Spelling Suggestions In OS X

suggestionsOne of the lesser known OS X niceties is the ability to get spelling suggestions/completions from any standard Cocoa text input. To accomplish this, simply hit the Escape key1) in any supported application (iChat, Mail, and TextEdit are some examples) and be amazed. I find this feature very useful for quickly obtaining the correct spelling of a word without taking your hands off the keyboard to get a correction. Sadly, many applications use their own text handling for various reasons so this won’t work universally (Word, TextMate, et cetera).

  1. In some cases Escape already has a bound behavior. For these situations pressing Option-Escape may give the expected dropdown. For example, in Adium the Escape key will clear your entry, but if you hit Option-Escape you will get the completion dropdown.

Upgrading Ubuntu Server 8.10 (Intrepid) to 9.04 (Jaunty)

Now that Ubuntu 9.04 (Jaunty Jackalope) is out I decided to upgrade a few of my servers from 8.10 (Intrepid Ibex) to the latest release. To upgrade via the command line follow these steps (as root or via sudo):

aptitude update
aptitude safe-upgrade
aptitude install update-manager-core

This will get your system upgraded to the latest packages of 8.10 and install the scripts to move to Jaunty. Be sure you have screen installed as well — Ubuntu does not like having upgrades interrupted so you want to be able to resume if your session is interrupted for any reason.

screen do-release-upgrade

It will download and check a few things and then warn you about operating an upgrade over ssh (along with starting an extra ssh daemon on port 9004). Simply follow the instructions from there and you’ll have a fully upgraded server!1

cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION="Ubuntu 9.04"
  1. Bear in mind that during the upgrade you will occasionally be asked questions about config files, so don’t try to run this upgrade unattended.

RAM Disks in OS X

If you’ve ever wanted to set up a ramdisk in Mac OS X, here’s a quick script you can use. Simply invoke it with a size in MB and the name for your volume and it will create and automount it for you. It also won’t leave any dangling directories in your /Volumes/ when you eject it! Be sure to chmod the file you place the script in to make it executable (755 or likewise).

#!/bin/bash
if [ -n "$3" ]; then NUM_ARG=ERR; fi
if [ -z "$1" ]; then NUM_ARG=ERR; fi
 
if [ -n "$NUM_ARG" ];
then
echo 'Usage: ./ramdisk <size in MB> <name, optional>'
exit
fi
SIZE=$1
NAME='my_ramdisk'
let "SIZE *= 2048"
if [ -n "$2" ]; then NAME=$2; fi
diskutil erasevolume HFS+ "$NAME" `hdiutil attach -nomount ram://${SIZE}`
echo 'Done'

Subversion Global Ignores

If you’re a Mac OS X user running Subversion on the command line and mounting remote disks you may have run into instances where you want to globally ignore ._*, .AppleDouble, and *:2e_* files. To do this simply open your Terminal and edit your ~/.subversion/config file and look for the line below.

#global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store

Uncomment it by removing the # and add the necessary additional exclusions and it will now look like this.

global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store ._* .AppleDouble *:2e_*

Save it and you’re all set. Now you won’t need to edit your svn:ignore property for every project!

Firefox Autoenrollment With A Microsoft CA

If you’re running a Microsoft CA and you want to be able to accept enrollment requests from clients supporting keygen (Firefox, Safari, Opera, et cetera) you’ve probably found that the /certsrv/ page allows enrollment, but the requests fail when you attempt to issue the certificate.  This is because the server is not parsing the subject attributes from the request.  To fix this, run the following on your server as administrator on the command line.

certutil -setreg ca\CRLFlags +CRLF_ALLOW_REQUEST_ATTRIBUTE_SUBJECT

You can also set your server to auto-issue on request for certain certificate profiles.  To do this add the CA snap-in and get properties of your CA. Under the policy module tab click properties again and click the “Follow the settings..” radio button.
add-snapinmmc

propertiesrequesthandling

MLB.tv NexDef On OS X

I have found myself growing tired of paying for cable TV, so this year I wanted to see if I could use MLB.tv as a replacement. One of the major new features MLB is marketing for MLB.tv in 2009 is called “NexDef” and purports to provide an HD stream along with DVR functionality. How could I go wrong?

As it turns out, NexDef runs as a daemon on both Windows and Mac (it uses Autobahn). There is a shell app that launches at boot and invokes a Java http server. Leaving aside the ugliness of the whole solution, having it running constantly in the background is beyond obnoxious. Plus, even when you’re not watching a game it will occasionally consume large quantities of CPU and bandwidth.1

With that in mind I decided to tear apart the installation on OS X to find the jar it uses. If you already have the app installed, check in ~/Library/Application Support/Swarmcast (that’s your home directory’s library directory) and find autobahn.jar. Pull this out and then run the uninstall command located in the same directory to remove the launchd agent and other garbage it has placed on your system. At this point you can now just invoke the autobahn.jar with Terminal.app. As soon as the Jetty server comes up MLB.tv will detect it and everything will work.

java -jar /path/to/autobahn.jar

When you’re done just hit ctrl-c in your terminal window and it will stop!

Update: For those of you finding this page searching for Linux NexDef support, you can invoke the autobahn jar on the command line in Linux and (provided that you have Java 1.4.1 or later installed) it should work properly.

  1. Of course, Flash (even 10) on OS X is miserable, so NexDef at maximum quality takes all of one core on a 2.4GHz C2D MBP