Archive for September, 2009

(For some reason, I found it difficult to find the solution to this online. I googled for it in the past, but always without success. Hopefully, this will help anyone else who wants to exclude / omit / ignore directories from an rgrep search in Emacs.)

rgrep performs grep recursively on a directory and all the directories contained therein. The nice thing about rgrep in Emacs–versus, say, ack–is that:

  1. it prompts you for the starting directory (and ido still works!)
  2. it prompts for the file name pattern to search (but defaults to the current extension, so you can just hit <return>)
  3. the line isn’t filled up with the raw grep or ack command

The Emacs grep commands already intelligently omit certain directories, but I am spending a lot of time in Rails projects, and rgrep-ing from the project root would dive into the “log” and “vendor” directories. Rails development and testing logs can become very large (which slows down rgrep) and often include a match for the term I am searching (so the search results would consist mainly of log entries). The vendor directory can contain a very large number of files (especially when Rails is frozen into the project), and I usually don’t want search results from 3rd party plugins or the Rails source.

The solution is the grep-find-ignored-directories option:
M-x customize-option

Add “log” and “vendor” as omitted directories, and then “save for future sessions”. That saves the settings to custom.el in your .emacs.d directory. If you keep your .emacs.d directory under source control (as you can do for free at Github if you make it a public repository), make sure you don’t exclude custom.el.

Note that if you ever do want to search the vendor directory, you can simply set the vendor directory as the “Base directory” in the rgrep prompt.

Unfortunately, this doesn’t appear to be taken into account by find-grep-dired, which is how I perform global search and replace. If anyone knows how to do this for find-grep-dired, please leave a comment. Thanks!

Read Full Post »

Slide presentation containing some useful links. Some slides are merely placeholders for me to talk around, so not very interesting.

Read Full Post »

My Global Git Settings

$ git config --global github.user <your GitHub user name>
$ git config --global github.token <your GitHub API token>
$ git config --global color.ui "auto"

The user and token settings work with gist.el (available through elpa: M-x package-list-packages, mark for installation by moving the cursor to desired line and pressing i, execute installation by pressing x). Once installed, you can easily create new Gists of the selected region or buffer. Use apropos to find a complete list of gist commands: C-h a gist- enter.

The color.ui setting results in nice red and green colorization of path names and diff results.

Read Full Post »

If you get an error like the following while trying to install the MySQL gem:

checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

…make sure you have installed the MySQL development package (in addition to mysql-server). On Ubuntu, this looks like:

$ sudo apt-get install libmysql++-dev

Read Full Post »

Ubuntu 9.04, Jaunty Jackalope, changed the Gnome GUI for turning off the system beep. You know, the beep that doesn’t come over your speakers, but issues from within the computer case.

To turn it off, open System > Preferences > Sound. Click the Sounds tab. Uncheck Play alert sound.

I know this sounds too obvious for a blog post, but lower down in the Sound Preferences dialog, there is an Alerts and Sound Effects box, and when you click the play button by the Alert sound option, you get a nice sound played through the speakers. So it doesn’t seem like that would be connected to the obnoxious system beep. But it is.

Read Full Post »

[30 October 2009 update: Ubuntu 9.10, Karmic Koala, has been released and my display is performing beautifully, including the (now very fast) visual effects]

The default settings of Ubuntu 9.04, Jaunty Jackalope, on my new Optiplex 760 resulted in frequent glitches when displaying windows or interface element changes. The glitches seemed to be more frequent the more time passed (which may be more a factor of the number of open windows than passing time). Toggling between windows, or minimizing and maximizing windows resolved the problem for a time, but after a while, it was really unusable.

I found a how-to article detailing my exact specifications, which indicated that Ubuntu 9.10, Karmic Koala, should resolve the problem. The author of that article describes a process of updating drivers in 9.04 using drivers from the forthcoming 9.10 release, but the specific version numbers mentioned are no longer available, and the drivers now require several other drivers to be updated. I did go through the process of updating the drivers and their dependencies, but after rebooting and logging in, my display was solid black, with a white cursor.

It turns out that simply turning off visual effects removed all the glitches. I’m glad to know that the drivers have been improved, so that when 9.10 is released at the end of October, I can have the effects back, but until then, I’m just happy to be glitch free. (To turn off visual effects: System > Preferences > Appearance, Visual Effects tab, None radio button.)

Read Full Post »

Encryption of my entire home directory is made easy by Ubuntu 9.04’s built-in encrypted home directories. I tried to use TrueCrypt, but could not get it to successfully mount my home directory on start-up. It was while researching workarounds that I stumbled upon the aforementioned blog post.

I still want to use TrueCrypt for portable drives. As an aside, TrueCrypt can format its internal file system using EXT3, meaning that I no longer need to worry about unacceptable characters in my file names when copying to the external drive (EXT3 only forbids the forward slash; whereas, NTFS and FAT forbid several characters).

Installing TrueCrypt is very easy, but verifying that the downloaded installer tarball is not corrupt and has not been tampered with involves a few extra steps that I am recording here for future reference.

  1. Visit the TrueCrypt download page.
    • Under Linux, select Ubuntu – x86.deb if you are on a 32 bit system, Ubuntu – x64 (64 bit).deb otherwise
    • Click Download and save the tarball to your desktop
    • Click PGP Signature and download it to your desktop (don’t worry if you see a message about their public key; we will cover that next). This will be used to verify the integrity of the tarball
  2. In order to use the signature file to confirm the tarball integrity, you need to download TrueCrypt.org’s public key from the TrueCrypt.org contact page
    • At the time of writing, the link to the key is at the bottom of the page, and is titled TrueCrypt-Foundation-Public-Key.asc. Click that link and save the key to your desktop
    • Keep the contact page open so that you can refer to the public key fingerprint
  3. In order to use the public key you just downloaded, you need to sign it
    • First you need a PGP key. If you don’t have one, follow these easy instructions to create one. You only need to follow the instructions in the first post
    • Keep the Passwords and Encryption Keys panel open (if you closed it, open it again through Applications > Accessories > Passwords and Encryption Keys). Click File > Import. Select the .asc file you saved to the desktop
    • Click the Other Collected Keys tab, right-click on the newly added key and select Properties. Then click the Details tab
    • Compare the ten groups of four characters under Fingerprint against the fingerprint provided on the TrueCrypt.org contact page. Make sure they match
    • If the fingerprints match, then click the Sign Key button in the Passwords and Encryption Keys panel
  4. Now we can finally verify the tarball. Open a terminal
    $ cd ~/Desktop
    ~/Desktop$ gpg --verify truecrypt-6.2a-ubuntu-x86.tar.gz.sig truecrypt-6.2a-ubuntu-x86.tar.gz

    If it says
    gpg: Good signature from "TrueCrypt Foundation "
    Then the file is valid
  5. Continuing in the terminal, we will extract and run the TrueCrypt installer
    ~/Desktop$ tar xzf truecrypt-6.2a-ubuntu-x86.tar.gz
    ~/Desktop$ ./truecrypt-6.2a-setup-ubuntu-x86
  6. Walk through the installer
    • Click Install TrueCrypt
    • Read and, if you agree to the terms of use, click I accept and agree to be bound by the license terms (click and drag to scroll through the terms)
    • The Package Manager should open. Click Install
  7. Now that TrueCrypt is installed, open it from Applications > Other and follow the TrueCrypt tutorial. Pay special attention to the fact that encrypting a drive or a partition will delete all data on that drive / partition, so back up first, and only restore after establishing TrueCrypt encryption on that drive / partition

Read Full Post »

Older Posts »