Wednesday, December 3, 2014

From a recent article on Angela Merkel:

Germans and Russians are bound together by such terrible memories that any suggestion of conflict leads straight to the unthinkable. Michael Naumann put the Ukraine crisis in the context of "this enormous emotional nexus between perpetrator and victim," one that leaves Germans perpetually in the weaker position. In 1999, Naumann, at that time the culture minister under Schröder, tried to negotiate the return of five million artifacts taken out of East Germany by the Russians after the Second World War. During the negotiations, he and his Russian counterpart, Nikolai Gubenko, shared their stories. Naumann, who was born in 1941, lost his father a year later, at the Battle of Stalingrad. Gubenko was also born in 1941, and his father was also killed in action. Five months later, Gubenko's mother was hanged by the Germans.

"Checkmate," the Russian told the German. Both men cried.

"There was nothing to negotiate," Naumann recalled. "He said, 'We will not give anything back, as long as I live.'"

Wednesday, January 29, 2014

On Plural-Data Prescriptivism in Academia

I really have no problems with people using data in the plural. Rather, I'm annoyed at the small and sometimes vocal minority within the statistics community (and in the wider academic community) which likes to proselytise the plural-data rule as if there was some sort of authority to it. Unfortunately, that's not how language works; language is democratic, and its 'rules' naturally evolve through the usage of its speakers. Excepting a dead civilisation, mediæval European scholars, and some modern-day scholars, hardly anyone uses 'data' as a plural noun any more. The fact that some scientists or statisticians would claim that there is a 'correct' way of using this word, then, strikes me as rather contrary to the goal of science itself -- namely, to describe the mechanisms underlying a system by examining it empirically.

Wednesday, January 8, 2014

Arch + XMonad / GNOME on MacBook Pro Retina 11,1 (13-inch, late 2013)

For the past few months, I've tried running OS X as my main OS on my MacBook Pro Retina (late 2013). I eventually got tired of it, so a week ago I started trying to figure out how to dual boot Arch on this machine. This is a log of the steps that had to go through. (Before doing this, I reset OS X via the recovery partition, so this is a clean install.) The following additional pages may be helpful as reference:

I'm assuming that the reader has some basic level of familiarity with Linux and can understand most of what I'm doing (or look it up if need be). If anyone has any updates or helpful info, feel free to email me and/or comment below, and I will update the guide accordingly.

Boot disk

In OS X, download the standard Arch install ISO and run
dd if=arch.iso of=/dev/sdX
to create the boot disk.


We will use rEFInd because it seems slightly easier than hooking up GRUB to EFI. In OS X, download the rEFInd package and run
sudo ./ --alldrivers
Edit /EFI/refind/refind.conf and enable the scan_all_linux_kernels option. (I also enabled textonly mode because I thought the GUI looked tacky.) In the folder /EFI/refind/drivers_x64, remove all the drivers except the one for EXT4. (Not sure if the last step is necessary -- can someone confirm?)

Partitioning, Part 1

While still in OS X, use the partition manager to resize your OS X partition. I left it with 50 GB, but this is up to personal preference. Note that OS X actually has 3 partitions (EFI boot partition, main partition, recovery partition), but it only shows you one of them.


Boot into your Arch live USB (rEFInd should be able to detect it automatically). You need an internet connection to install the base system. I used USB tethering via an Android phone, but other options may work as well.

Partitioning, Part 2

Use cgdisk /dev/sda to set up / on /dev/sda4 and /home on /dev/sda5. Then run
mkfs.ext4 /dev/sda4
mkfs.ext4 /dev/sda5
mount /dev/sda4 /mnt
mkdir /mnt/home && mount /dev/sda5 /mnt/home
to create new EXT4 file systems on those partitions and mount them.

Base System / Partitions, Part 3

Run the following to set up the base system and fstab:
pacstrap /mnt base base-devel
genfstab /mnt >> /mnt/etc/fstab
At this step we have a basic working Linux system that you can chroot or reboot into:
arch-chroot /mnt /bin/bash

SSD Performance issues

We should edit /etc/fstab to improve SSD performance:
/dev/sda4   /       ext4    defaults,noatime,discard    0 1
/dev/sda5   /home   ext4    defaults,noatime,discard    0 2
The default boot options may cause the SSD to hang. Add the following line to /boot/refind_linux.conf to prevent this:
"Default" "ro root=/dev/sda4 libata.force=noncq"

Keyboard / Locale / Time

echo "somehostname" > /etc/hostname

# set up keyboard layout and system locale
echo "KEYMAP=dvorak" > /etc/vconsole.conf
vi /etc/locale.gen # uncomment what you want
echo "LANG=en_US.UTF-8" > /etc/locale.conf

# set local time and set hardware clock to UTC
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
hwclock --systohc --utc


# set root password

# add user
useradd -m -g users -G wheel -s /bin/bash someusername
passwd someusername
visudo # uncomment wheel
One last thing -- we should set up wifi before rebooting and logging in to the new account.

Yaourt, Wifi

Follow the instructions here to get yaourt. Then use it to install broadcom-wl from the AUR to get wifi drivers:
yaourt -S broadcom-wl
I like to manage my connection with wicd so I'll get that as well:
pacman -S wicd
systemctl enable wicd.service
Now we can reboot and start playing around with the system!

XMonad with GNOME

Normally I would forgo GNOME, but they currently have (as far as I know) the best solution to solving the high-DPI scaling issue. Grab the following packages:
pacman -S xorg-server xorg-xinit xorg-server-utils xf86-video-intel xf86-input-synaptics \
          gnome-session gnome-settings-daemon
yaourt -S xmonad-darcs xmonad-contrib-darcs
Then follow the instructions from my previous post to make XMonad and GNOME play nicely with each other.

Additional steps / troubleshooting

The above steps will get a minimal working setup on your Retina Macbook Pro. However, there are still a lot of useful things you could configure to make your life easier:


Change layout.css.devPixelsPerPx to 2 to make it scale everything up for the retina display.

Missing Cursor

Try running
gsettings set org.gnome.settings-daemon.plugins.cursor active false

USB Automounting

udiskie is a simple daemon to automount disks with very few dependencies, which is great for a minimal setup.


OS X ships with some great built-in fonts. I strongly recommend grabbing their fonts from these directories on your OS X install and copying them over to Linux.

Tuesday, January 7, 2014

Linux, retina / high-density displays, and external monitors

The issue

Currently most Linux desktop environments work rather poorly with high-density displays, and require a lot of manual tweaking. Recently, GNOME 3 added support for high-density displays, so the UI should automatically rescale itself properly for GNOME versions 3.10 and higher. Unfortunately, there's one slight issue: If you connect an external monitor, the text and icons are massive. This is because (as far as I know) GTK, X, and much of the substrata of renderers underlying the GUI only support a global DPI or scale setting for all monitors.


However, there is (sort of) a workaround. We can manually rescale so that the the external monitor is correct, but the retina monitor has small text. (Presumably if you are using an external monitor, then your laptop monitor is not your main work monitor.) In this patch, we see that GNOME rescales windows based on the parameter scaling-factor in schema org.gnome.desktop.interface. Thus, all we have to do to manually set the scale factor is to run
gsettings set org.gnome.desktop.interface scaling-factor X
where X is 1 or 2, depending on how we want pixels to be normal-sized or enlarged. (If X is 0, then GNOME decides for you, but this may or may not be what you want.) For expedience, you can attach a hotkey to these commands, or you can detect xrandr events and rescale automatically.

Required packages

It turns out that only a very minimal set of packages need to be installed for this to work -- gnome-session and gnome-settings-daemon, at least version 3.10 or higher. Because of the sparse requirements, this can be adapted to work for all GTK applications in lightweight desktop environments / window managers (e.g. XMonad or awesome) so long as you start them via a minimal GNOME session. I also strongly recommend building xmonad-darcs and xmonad-contrib-darcs from the AUR because of a bug (see edit below).

Minimal .xinitrc + XMonad + GNOME example

A minimal way to get the above method working involves creating the following files:
[Desktop Entry]

[GNOME Session]
Make sure you use gnomeConfig in your xmonad.hs. Then end your ~/.xinitrc with
exec gnome-session --session=xmonad
This will execute a minimal GNOME session instance which only runs gnome-settings-daemon, xmonad, and almost nothing else.

Edit (2014-07-16): With the latest version of D-Bus and with XMonad 0.11, gnomeConfig from XMonad.Config.Gnome doesn't properly register XMonad to GNOME, so you'll see a GNOME error dialog upon starting your XMonad-Gnome session. This has been fixed in XMonad-Contrib 0.12 from the AUR.