Switching flyspell dictionaries on the fly

Since I am using Emacs for most of my text processing, and it comes with the nice Flyspell mode, and I do write English and German the most, I found this nice snippet from the Emacs wiki:


(defun fd-switch-dictionary()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "deutsch8") "english" "deutsch8")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))

(global-set-key (kbd "<f8>") 'fd-switch-dictionary)

On OS X, I recommend to use emacs-app or emacs-app-devel from MacPorts. For flyspell to work correctly, also make sure to install aspell and e.g. aspell-dict-de. Otherwise the above function will complain, most probably.

Cisco VPN Client triggering system crashes?

I am not quite sure, but I suspect my Cisco VPN Client for OS X is triggering some crashes on the MacBook Pro. Only when I have been using the VPN Client, suspend the machine, then wake it up again, the system becomes unstable in some cases. Once, I got a OS X death screen right away, the other time I just got the blue screen, and the activity LED on the front was just off. This so far only seems to happen after I have been using the VPN Client. The current release of the client is 4.9.0180, and is already pretty old. Funny enough the Cisco webpage lists only OS X 10.4 and 10.5 as supported, and not 10.6, which has been out for what… 9 months or so? If I find anything new on this, I will update this post.

Update: There is Tunnelblick, a free UI for OpenVPN, which can be used as well. Trying this out now, to see if it is any better.
Update: So far no more crashes. I’ve used Tunnelblick for some weeks now. So I guess the Cisco client indeed is the culprit

Arrow keys broken for console applications in OS X 10.6.3

I was just trying to configure some project using the curses based ccmake tool. I noticed that I cannot do that, since the arrow keys on my keyboard stopped responding when running ccmake. Turns out, Apple broke curses in OS X 10.6.3. Workaround is to copy the ncurses dylib from a 10.6.2 system, which I don’t have at hand right now. Funny enough, the keys are also broken when using xterm instead of the standard terminal, so there is definitely something very broken in ncurses right now.

XCode cannot compare SVN directories

I am missing one feature in XCode: it can’t compare whole directories under version control. Only single files can be compared. For example, I have a directory named “Classes”. It’s info dialog does not show the version control tab:
However, if I choose some source file, I get the SCM tab and can compare my local version with the head version in the repository:

Setting PATH and other variables on OS X

Since OS X is a UNIX like many others, I usually put my environment variable settings like PATH in ~/.profile. However, for Cocoa based apps, that are not run from a terminal, this will not help. Luckily, there is a documented procedure for setting environment variables for Cocoa applications. In short, you just have to edit a plist. If it already exists on your system, just type the following in a terminal:

open ~/.MacOSX/environment.plist
If the file does not yet exist, just run the Property List Editor (e.g. via spotlight), and create that folder and that file.

Extremely slow SMB performance over WiFi using OS X

I have an OpenSUSE machine running a Samba server to provide files to my network. Now when I use the MacBook Pro to access those files, this happens awfully slow, with 80-200 KiB per second. I never figured out why, since rsync and sftp work very fast (for WiFi at least), at speeds of around 1.2 MiB per second. Today I googled for it, and it turns out that OS X delays ACK packages. I have no clue why it does that and what good this does, but you can disable it by running:

sudo sysctl -w net.inet.tcp.delayed_ack=0
After that, my SMB transfers jumped to 1 MiB per second, minimum. You can presumably make this change permanent by adding “net.inet.tcp.delayed_ack=0” to the file /etc/sysctl.conf. This will then be applied during system startup.
Update: Here is a nice explanation why the performance of OS X suffers sometimes, when using delayed ACK, and also why it might be useful in some cases.

OpenCL on OS X

I have just tried to run an official OpenCL sample program by Apple on a MBP 10.6.3 machine. Result: a crash. Why? I do not know yet, but it seems that OpenCL somehow crashlanded the nvidia OpenGL driver. This is what I get:
08.04.10 17:04:50 kernel NVDA(OpenGL): Channel exception! exception type = 0xd = GR: SW Notify Error
08.04.10 17:04:50 kernel 0000006e
08.04.10 17:04:50 kernel 00200000 00008397 00000474 00000040
08.04.10 17:04:50 kernel 0000047e 00001408 00000001 00000008
08.04.10 17:04:50 kernel 00000000 00000000 01dfdc03
08.04.10 17:05:04 kernel NVDA(OpenGL): Channel exception! exception type = 0x8 = Fifo: Watchdog Timeout Error
08.04.10 17:05:04 kernel 0000006e
08.04.10 17:05:04 kernel 00000010 00008397 00000474 00000000
08.04.10 17:05:04 kernel 0000047e 00001528 00000000 00000008
08.04.10 17:05:04 kernel 00000000 00000000 019fdc03
As soon as I know something more and especially how to fix it, I will share it here.
Update: It does not crash, if I don’t touch any keys when the kernel runs. So I guess the OpenCL drivers are a bit buggy still…