Skip to navigation

Firefox: open links from external apps in background tabs

May 22nd, 2008

While opening links in new tabs from within Firefox makes them open in the background (Setting in Edit → Preferences → Tabs), links clicked in other applications by default open in a foreground tab, and make Firefox steal the focus from the other app.

about:config, set browser.tabs.loadDivertedInBackground to true

Better buffer switching in Emacs

May 20th, 2008

I’ve switched from XEmacs to Emacs, about a month back. I like it much better. On Xubuntu, many more things work “out of the box” (for example the Noweb mode for Sweave). X clipboard contents are immediately available for yanking!

One thing that’s always annoyed me in both XEmacs and Emacs was the buffer switching using C-x b. In theory, this has a nice history you can cycle through using the up arrow, but this history never contained all of my open buffers. About fifty percent of the time, for reasons only known to the Lisp gurus, it did not offer the one buffer I wanted to switch to, even if I only had three different buffers open. OTOH, it did always contain all kinds of buffers I never in my life want to even see, such as *scratch*, *Messages*, *ESS*. Yikes.

This is what does away with all of this (in ~/.emacs):

; Better buffer switching
(iswitchb-mode 1)
; Ignore all kinds of special Emacs buffers that start with a *, 
; but don't ignore the R process buffer (*R*)
(add-to-list 'iswitchb-buffer-ignore "*[^R]")

Not only does this have a sensible history to cycle through, C-x b shows the names of all open buffers in the minibuffer, and you can “find as you type”, even for parts of the buffer name that are not at the beginning. So you can immediately type the letters that are unique to that buffer name, handy when you’re working on a project where the .tex and several .R files all start with the same project prefix.

How to change which profile is default in Firefox

May 20th, 2008

I had to edit ~/.mozilla/firefox/profiles.ini. Just move the line Default=1 to the desired profile block.

(I first tried renaming the profiles using firefox -ProfileManager. Renaming the default profile to “old” and the “firefox3” profile to “default” had no effect.)

SD card with ReiserFS for backups

May 15th, 2008

The hard drive on my laptop has occasionally been making some funny klicking noises recently, and I’m a bit worried it’s going to break down one of these days. So in addition to backups to an external HD and a USB stick, I bought a 4 GB SD card to just leave in the card reader.

I formatted this with gparted, first to ext3, then to ext2 (I wanted something that would preserve permissions), but after backup up some files to it (using rsync and rdiff-backup) I ended up with lots of input/output errors and bad superblocks and whatnot.

I then used gparted to make it ReiserFS, and that worked. One other thing that I did differently was that after formatting the SD card to ReiserFS, I removed the card, then shut down the machine and rebooted before reinserting the card and actually putting any data on it. I hadn’t done this for the ext* FS, no clue if it could have made a difference.

The filesystem works nicely and it seems quite a bit faster than both ext3 and ext2 (I have mostly small text files, and a few pdfs).

However, letting the card be automounted (by HAL, I assume?) resulted in occasional total freezes when mounting/ unmounting.

So I put a line into /etc/fstab

/dev/mmcblk0p1  /media/kate                 auto    auto,user,rw,exec 0 0

and now I can just leave the card in.

However, the laptop then failed to suspend and resume properly. That was solved by putting a script each into /etc/acpi/suspend.d and resume.d to unmount and remount the card:

audrey:~$ cat /etc/acpi/suspend.d/ 

/bin/umount /media/kate

and …

audrey:~$ cat /etc/acpi/resume.d/ 

/bin/mount /media/kate && /bin/chown mpromber:mpromber /media/kate

Nicely formatted p values in Sweave

May 15th, 2008

R function:

pval <- function (x) {

For any p < 0.001, this will output "p < 0.001", else it will give the exact value (e.g. p = .04). Then, in the latex part of your document, refer to it as:


where T.TEST is a t.test (either direct code or an object).