Since I've been doing a good amount of code reviews lately, I decided to give the Atlassian SourceTree tool a spin. Of course, I still need Emacs and EDiff to be productive, so I had to come up with some hacks to get that to integrate properly. First, I repurposed some of the hooks that I have, which makes EDiff nice and wide and can take advantage of proper side-by-side diffing. In my ~/.emacs, I have something like
(if window-system (progn (add-hook 'ediff-before-setup-hook 'new-frame) (add-hook 'ediff-quit-hook 'delete-frame) (add-hook 'ediff-startup-hook '(lambda () (set-frame-size (selected-frame) 300 80) (set-face-attribute 'default (selected-frame) :height 130) (raise-frame (selected-frame)) )) ))
I also have a few convenience things in my ~/.emacs, which are not absolutely necessary:
(global-set-key "\C-xv-" 'vc-ediff) (setq ediff-window-setup-function 'ediff-setup-windows-plain) (setq ediff-split-window-function 'split-window-horizontally)
For the SourceTree tool, now it's just a matter of sending the appropriate emacs or emacsclient command. Of course, you have to make sure to start emacs-server in your running Emacs, if you wish to use one single instance of Emacs, and emacsclient. In my SourceTree Preferences, I added an external differ, with the Other command being /usr/local/bin/emacsclient, and the argument
--eval "(ediff-files \"$LOCAL\" \"$REMOTE\")"
That's it! Now that I click on External Diff (Command-D), it launches a new, wide Emacs frame with a side-by-side EDiff. Super convenient, and easy to use (n for next diff, p for previous, q to quit, ? to see more commands).
This is my first blog post regarding the Raspberry Pi, a neat little toy that I've had so much fun playing with the last few weeks. At the moment, I'm using it primarily as a cheap, low power XBMC media center. I have it connected over NFS to my media server, so there's no additional disks or storage near the media system. I installed the standard Raspbian image, and on top of that a custom build of XBMC from:
I'm not sure why Raspbian doesn't ship an XBMC out of their repo, hopefully soon. Using this, running XBMC without an X11 window manager, I had some issues with the boot screen (and login prompt) showing up for media with letterbox borders. I could not figure out how to get XBMC to handle this, or clear it, so I took a slightly different route:
- I created an account, xbmc, and modified /etc/inittab to boot into this user on startup
- Edit the xbmc users .bashrc to clear the background, set the cursor to be invisible, and then fire up xbmc in a loop (so it restarts during a crash or shutdown)
I created the xbmc account with
$ sudo useradd -g users -G 4,20,24,29,44,46,60,1001 --shell /bin/bash xbmc
The inittab is simply
1:2345:respawn:/sbin/getty -a xbmc 38400 tty1
And the ~xbmc/.bashrc script is
clear echo -e '\033[?1c' PS1="" while [ 1 ]; do /usr/lib/xbmc/xbmc.bin --standalone --fs sleep 10 done
For this to work well, you also have to set a 128M/128M split, using the raspi-config utility. In addition, I'd recommend running the medium overclock mode, again set using a (recently updated) raspi-config. In my case, I run with this from /boot/config.txt:
arm_freq=900 core_freq=333 sdram_freq=450 over_voltage=2
You can check temperature and arm frequency with e.g.
root@rpi-2:/home/leif# vcgencmd measure_temp temp=62.7'C root@rpi-2:/home/leif# vcgencmd measure_clock arm frequency(45)=700000000
This shows standard CPU frequency, since the system running the XBMC menu system consumes a fairly small amount of CPU.
Update: If someone has a better solution to eliminate the framebuffer crap (login prompts etc.) from the XBMC letterbox borders, please post a comment!
I decided to clean out some older users I have on my Cyrus IMAP server. The documentation says to do e.g.
> sam user.foo cyradm d > dm user.foo
This however did not work for me, even though the "d" flag is what the docs says. Searching the Cyrus forums, I found out that the permission for the admin user has to be set to "c" for the user / folder to delete. So I did
> sam user.foo cyradm cd > dm user.foo
And things works fine agin.
Drumroll.... Here it is:
$ sudo apt-get remove indicator-appmenu
That's right, get rid of the damn "global" menu bar. This is just retarded, it's the one misfeature of OSX that I can't stand, since it effectively makes it impossible to do mouse follow focus. At least the Unity people have made the problem painfully visible, the question is, why do they still have this BS at all? No one knows ...
The company I work for uses Exchange, and Outlook is their preferred client. This means (apparently...) that the Trash folder is named "Deleted Items". This messes with Thunderbird, since it creates and uses a folder named "Trash". For some odd reason, the configuration pane in Thunderbird does not have an option to modify this, instead, you have to manually edit the prefs.js file, and add a line similar to this (make sure you use the correct server #):
user_pref("mail.server.server3.trash_folder_name", "Deleted Items");
I run Drupal behind an Apache Traffic Server caching proxy. In my setup, the proxy listens on port 80, and the real Apache HTTPD server listens on port 82 (which is firewall off). In my Traffic Server remap.config, I have a rule like
map http://www.boot.org http://www.boot.org:82
Granted, in retrospect, this is not the best of setups, but it does however causes serious problems with Drupal 7, whereas it does not cause problems with Drupal 6. In D7, the favicon.ico and all JS and CSS URLs in the head are created to use absolute URLs. I don't set an explicit $base_url in my Drupal settings.php, more on that later, and this causes the URLs to get the wrong base! These URLs are all getting a form like
Yikes! This obviously fails, since port 82 is not accesible from the outside. Browsing the forums, the "solution" seems to be to set the $base_url in the Drupal settings.php configuration file, e.g.
$base_url = 'http://www.boot.org'; // NO trailing slash!
This does indeed solve the problem, however, it now breaks when I want to use e.g. https://www.boot.org for admin access. Besides, why these URLs should be absolute, is a mystery to me, they certainly were not in D6.
The solution I'm ending up with is of course to change Apache Traffic Server to use what we call "pristine host headers", so that the Origin server (Apache HTTPD and Drupal) sees the original client Host: header. I could not get any help from the Drupal IRC, or forums, but if anyone has any insight on why D7 is doing this crazy stuff with absolute URLs, please post. In an ideal world, they really should change these to be relative, e.g. /misc/favicon.ico.
I use Drupal for most of my sites. It generally works well, despite all the weirdness it does (Drupal 7 is doing strange things behind a proxy, more later). One thing is, I've started using a CDN (NetDNA) for my site. With HTTPS, this generally doesn't work well, since I'm not enabling HTTPS for the CDN (at least not yet). The CDN module in Drupal generally works well, but I couldn't see an option to prevent it from using the CDN with HTTPS. This would generate those annoying warnings from Internet Explorer for example.
Since I'm also using an Apache Traffic Server proxy in front of Apache HTTPD, the protocol information was lost oncey it hit Apache, PHP and Drupal. Bummer. I browsed through the CDN code, and noticed they do indeed honor a header of X-Forwarded-Proto, which if set to "https" will prevent the CDN from being used. I added a plugin for my remap rules, with a config like
[SEND_REQUEST_HDR] X-Forwarded-Proto =https=
And I activated this for the https remap.config rules for Apache Traffic Server. With this, my Drupal site now stops using the CDN when Apache Traffic Server maps from https:// to the http://localhost URL.
I always configure my Linux window managers to use "focus follow mouse". Meaning, whichever window the mouse cursor is currently in, gets keyboard focus. This is not possible with most OSX applications, because of how they've designed the UI with one Menu bar etc. However, at least two apps. Terminal and the X11 server, can be configured to do just this. It's really easy:
$ defaults write org.x.X11 wm_ffm -bool true $ defaults write com.apple.terminal FocusFollowsMouse -string YES
This must be an epic failure in providing usable error codes, from a mySQL select query.
Got error 28 from storage engine
Doing some Binging, this turns out to mean "Your disk is full". Really? How about printing that out??
I use more and more remote X11 applications now, and VNC, since I switched my desktop (and laptops) over to use OSX entirely. This works great. Sometimes, it can be a bit annoying to get the clipboards and selections to synchronize across windows, or even to just get a portion of a file from e.g. X11 into OSX. There's a very useful command for this, that can easily be scripted (and bound) to some key of your own preference. For example, to take the clipboard from an X11 app, and put it into the main selection buffer, you can do
$ xclip -o -selection clip | xclip -i
To put a portion of a file into both the clipboard and the primary selection:
$ head -10 /etc/group | tee >(xclip) >(xclip -sel clip) > /dev/null
You can obviously make some convenience macros around this, or simple shell scripts.