Xcode update stuck at waiting

My upgrade of Xcode (v8.0) was stuck at waiting. For days. I restarted the computer. Tried different things in the App Store applications. No success.

Finally I deleted the Xcode application from /Applications (just put it in Trash, not even emptying). That helped.

I found that idea here.

Gaming mouse, KVM and Linux

My old ugly Logitech mouse since 10 years died. For long I have been thinking about replacing it not really knowing what to get instead.

I have a “das keyboard” and I want a mouse with the same build quality and feel, but without a million configurable buttons. I also have a KVM switch (using two computers with the same display, keyboard and mouse) from Aten.

I bought a Corsair Katar mouse.


  • When KVM-switching it takes a few seconds for the mouse to start working.
  • The mouse is very fast at first. In Windows it slows down after a few seconds (I guess when drivers and mouse profile kick in).
  • The mouse works just fine in Ubuntu, but it is too fast for my taste (even with basic mouse configuration options set at slowest).

Perhaps I would have been better off with a sub-$10-noname-mouse.

Update 2016-10-16
I found a way to slow down my mouse! This support post was useful, although my solution was slightly different.

First run:

$ xinput list
? Virtual core pointer                    	id=2	[master pointer  (3)]
?   ? Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
?   ? Corsair Corsair Gaming KATAR Mouse      	id=11	[slave  pointer  (2)]
?   ? Corsair Corsair Gaming KATAR Mouse      	id=12	[slave  pointer  (2)]
? Virtual core keyboard                   	id=3	[master keyboard (2)]
    ? Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ? Power Button                            	id=6	[slave  keyboard (3)]
    ? Video Bus                               	id=7	[slave  keyboard (3)]
    ? Power Button                            	id=8	[slave  keyboard (3)]
    ? Metadot - Das Keyboard Das Keyboard Model S	id=9	[slave  keyboard (3)]
    ? Metadot - Das Keyboard Das Keyboard Model S	id=10	[slave  keyboard (3)]

I found out that fixing device 11 was useless, but device 12 was helpful.

My mouse parameters are obtained:

$ xinput list-props 12
Device 'Corsair Corsair Gaming KATAR Mouse':
	Device Enabled (142):	1
	Coordinate Transformation Matrix (144):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 3.000000
	Device Accel Profile (269):	0
	Device Accel Constant Deceleration (270):	1.000000
	Device Accel Adaptive Deceleration (271):	1.000000
	Device Accel Velocity Scaling (272):	10.000000
	Device Product ID (262):	6940, 6946
	Device Node (263):	"/dev/input/event6"
	Evdev Axis Inversion (273):	0, 0
	Evdev Axes Swap (275):	0
	Axis Labels (276):	"Rel X" (152), "Rel Y" (153), "Rel Vert Wheel" (268)
	Button Labels (277):	"Button Left" (145), "Button Middle" (146), "Button Right" (147), "Button Wheel Up" (148), "Button Wheel Down" (149), "Button Horiz Wheel Left" (150), "Button Horiz Wheel Right" (151), "Button Side" (266), "Button Extra" (267), "Button Forward" (291), "Button Back" (292), "Button Task" (293), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265), "Button Unknown" (265)
	Evdev Scrolling Distance (278):	1, 1, 1
	Evdev Middle Button Emulation (279):	0
	Evdev Middle Button Timeout (280):	50
	Evdev Third Button Emulation (281):	0
	Evdev Third Button Emulation Timeout (282):	1000
	Evdev Third Button Emulation Button (283):	3
	Evdev Third Button Emulation Threshold (284):	20
	Evdev Wheel Emulation (285):	0
	Evdev Wheel Emulation Axes (286):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (287):	10
	Evdev Wheel Emulation Timeout (288):	200
	Evdev Wheel Emulation Button (289):	4
	Evdev Drag Lock Buttons (290):	0

Here, the “Coordinate Transformation Matrix” is the key to speeding the mouse down. The last parameter was 1.0, it is now 3.0, this seems to mean my mouse is just a third as fast as it used to be. To set it:

xinput --set-prop 12 "Coordinate Transformation Matrix" 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 3.0

I suppose your mouse can go quite crazy if you change all those 0.0 to something else. Good luck!

Wilesco D2

I got myself a Wilesco D2 steam engine. It is a nice little steam engine that is a little more civilized to casually run compared to my Wilesco D10. What I mean is that it is less noisy, it smells less, it takes less space and you run it until it has no water left and then just blows out the candle.

A few findings…

The Wilesco D2 is all about lubricant. I ran my brand new engine once. Quite (relatively) much grease came out of it. I filled up again, it ran worse, and after a while I couldn’t get it to run at all. If the machine vibrates to the point that it does not stand still it needs more oil. The package comes with oil, the instructions tell you to use oil, but the D10 is less sensitive. I can conclude after a few runs that the original Wilesco Z83 oil is better than ordinary sewing machine oil. I can see the difference that the sewing machine oil works for a while but its effect disappears, while the Z83 lasts longer.

The machine comes with one beeswax candle. I love bees, and the candle works fine. An ordinary teapot candle does not produce enough heat. It is not hard to find beeswax candles where I live, but I dont know if they are comparable to the Wilesco candles.

I find that a better option is to use the Ethanol burner from my Stirling engine. The price and convenience of ethanol (red spirit, or Meth?) is better than the candle, I think. Perhaps the ethanol runs warmer than the candle and you need to be more careful to remember to blow it out, but on the other hand the ethanol burner only lasts for 30 minutes – the time the engine is designed to run.

Get the Z 83 oil when you get the machine. The included oil is small and quite greasy to deal with (it is not a bottle). And consider getting an ethanol burner. Check this video.

Syncthing: breaking upgrades

Syncthing is usually very easy to upgrade: it upgrades itself silently or via apt-get. Problem is, when it changes version (lastly from 0.12 to 0.13) it is not compatible anymore. It is not a big problem since it is easy to upgrade, but you kind of have to upgrade your entire Syncthing cluster at the same time, otherwise you get an undesired fork.

This was the quite confusing error message i got on the newly updated system that failed to connect to non upgraded systems:

[THC2C] 19:17:52 INFO: Failed to exchange Hello messages with <ID> (<ADDRESS>): EOF

So, be mindful when upgrading syncthing so you dont get a non breaking upgrade when you dont have time to upgrade everything.

Hackintosh – a first attempt

I really have no love for Windows 10, but I use it for Steam and a few games. For a long long time people did not buy Apple computers because there were no games for them. Now I find there are more games than I can possibly want but there is no Apple computer I want to buy to play games on:

  • MacBook Air: I have this one – it gets warm and noisy with games
  • MacMini: underpowered for games, and so little value, especially if you want more RAM
  • Mac Pro: its perfect, just very much too expensive to replace a Windows 10 machine
  • iMac: I already have a display and KVM connected to a Linux computer, and I dont believe in throwing away the display because a hard drive breaks.

So I sound like my friends did 10-15 years ago: Macs are too expensive to play games!

But then there is Hackintosh: an ordinary PC running OS X.
There is even a Buyer’s guide, and something like this would suit me well.

I decided to try to turn my current Windows 10 PC into a Hackintosh and followed the instructions.

It was a gamble all the time:

  • My ASUS P8H67-M mainboard: some people seem to have had success with it, but it is not exactly a first choice.
  • My Radeon HD 6950 graphics card is not a good Hackintosh card at all. If I remove it I can fall back to the Intel HD 2000 that is integrated in the i5 CPU (or on the mainboard – I dont know). That is also not a good Hackintosh GPU.

Anyway, I disconnected my Windows hard drives and connected a 60GB SSD to install OS X. And for a while it was good. Some BIOS (UEFI) tweaking, and I

  1. got the installer running
  2. installed OS X
  3. started my new OS X (from the install USB-key, since bootloader was yet to be installed)
  4. played around in OS X, bragging about my feat

Audio was not working, and Video performance sucked, but ethernet worked and it was very useable.

I went on trying to install the bootloader and some drivers (using MultiBeast, following the instruction). This is where all my luck ended. MultiBeast reported that it failed.

I never managed to start OS X again. Not the installed system. Not the install USB-key. I tried:

  1. Removing all hard drives
  2. Reset BIOS/UEFI settings, and try many combinations
  3. Recreate the USB-key
  4. Remove my Radeon 6950 and fallback to Intel HD 2000
  5. Remove files from the USB-key that contains “kernel cache” and things like that
  6. Different boot options from Clover – both the standard menu and non standard options that I found in forums
  7. Create a UEFI-USB-key instead of a Legacy-USB-key

No success at all. I basically got this error.

In order to get things working in the first place I changed a few BIOS/UEFI settings:

  • SATA mode: IDE => AHCI
  • Serial: Disable

(I found no other relevant settings on my mainboard).

After changing IDE => AHCI Windows did not boot. That was an expected and common problem, and I fixed it following some simple steps (forcing safe boot). It was after that OS X never started again. I wonder if something happened to my mainboard/UEFI there, that Windows did, that I can not control/undo?

Update 2016-05-18
I found this post to follow. Much better now. I write this post from my Hackintosh.

In order to eliminate all possible old problems i deleted the 10Mb of the USB-key and hard drive using linux and

dd if=/dev/zero of=/dev/sdX bs=1024 count=10240

Obviously replace sdX with your drive.

About my “working” configuration:

legacy: USB-key is legacy. Clover is installed in Legacy-Root-mode.
MultiBeast: During installation, Step 5 (MultiBeast) fails, and I had to resort to Step 6.
safe mode: my startup arguments are:

dart=0 kext-dev-mode=1 PCIRootUID=0 UseKernelCache=NO -x

I have twice rendered my system unbootable but fixed it with multiple restarts. I think it is the CustoMac Essentials that install some kexts that are are not ok.
Audio is supposed to be ACL892 but it does not work. Probably because CustoMac Essentials fail.
Dual Boot with Windows does not work. This was expected. Clover fails to start Windows (although, there is some limited success, but Windows does not make it all the way).
Clover Configurator: what was not so obvious was the config.plist. It finds 3 different ones on my system. The one that seems to be in use is /EFI/CLOVER/config.plist – so that is the one to edit. But you need to save your changed configuration to a new file, and the copy using the command line and sudo.

Well, I have some ideas how to get to a better situation.

  • Install everything NOT in Legacy mode but use UEFI-stuff all the way. Perhaps that just fixes stuff. Or not. I anyway need to get into my UEFI/BIOS to change to booting Windows.
  • Changing graphics adapter: it could be the reason I have to be in safe mode. And the safe mode could be the reason audio does not work. And so on

I tried removing my Radeon 6950 falling back to HD2000. That did not work. I could neither boot from my hard drive nor the install USB-Key. Putting the Radeon back in the computer did not work at first. But after several reboots (also with the USB key) OS X now starts up again (in safe mode).

I tried everything from the beginning with HD 2000: erase drives, disconnect windows drives, upgrade BIOS, reset BIOS, create new USB key (both Legacy and UEFI): never did I manage to boot the installer using HD 2000. So the ill-supported Radeon 6950 (which possibly restricts me from going beyond Safe Mode) works better than the integrated HD 2000.

I do understand the advantage with a “supported” mainboard that has all the recommended UEFI/BIOS settings.

Raspberry Pi Server

The Raspberry Pi has been around for some years now and it has been used in unbelievable projects. As a budget desktop computer it has not quite had the required performance (although v2 and v3 are much improving the situation over v1). However, for simple hobby server tasks the RPi can work very well.

A simple RPi (any version) setup typically requires:

  • RPi
  • SD Card
  • USB PSU + USB cable
  • Network Cable
  • External USB Drive + USB Cable (+power adapter)
  • A case

That is without display, mouse and keyboard, and you dont have a power button. It gets a bit messy.

The market is full of RPi cases that all do the same thing: nothing. They just contain the board. The market is full of mini/micro-towers for MiniITX. There are rather expensive NAS devices that come without hard drives. Why are there no small tower cases that comes with:

  • PSU
  • Slots for 1-2 hard drives (+USB to SATA converters)
  • Cabling that makes everything tidy and neat

Powering the RPi using an external hard drive
I happened to have an external USB drive with an integrated USB hub (an Iomega Minimax that was left alone when its Mac Mini died). With some wood and glue I built a simple stand for the hard drive and the RPi:




As you can see:

  • the hard drive powers the RPi, and I can even use the hard drive power switch
  • the Ethernet and USB ports are conveniently available on the back side
  • the footprint is just slightly larger (just taller) than the hard drive itself
  • the two USB cables between RPi and harddrive are nicely contained
  • heat/ventilation should be pretty good

I have experienced no problems powering the RPi from a USB drive that it itself is connected to. It may not be a supported or recommended configuration, but for practical purposes it works for me.

I mostly run Syncthing on this RPi. The bottleneck is very much the 700MHz ARMv6 CPU, not the USB2-to-SATA-overhead.

hdparm gives me:

$ sudo /sbin/hdparm -t /dev/sda
 Timing buffered disk reads:  82 MB in  3.03 seconds =  27.09 MB/sec

$ sudo /sbin/hdparm -T /dev/sda
 Timing cached reads:   496 MB in  2.01 seconds = 247.36 MB/sec

Of course it sucks compared to what you can get in 2016, but it is not remarkably bad in anyway. And it is not so fun to live on an SD card.

The Western Digital Kit
The other day Western Digital announced both a special 314GB hard drive and accessories to make it all nice.

Plusberry Pi
There is also the interesting Plusberry Pi project.

Angular.js Hello World program

Usually when writing a small utility I use the command line. But sometimes a simple web page with JavaScript gives a more functional UI.

I like AngularJS, but I don’t start from scratch very often, and when I do, I need to start searching for code to copy. So, here is my Angular Hello World template.

<!DOCTYPE html>
<html ng-app="theApplication" ng-controller="theController">
    <meta charset="utf-8">
    <title>Hello World</title>

  <script src="angular.js"></script>
    angular.module('theApplication', []).
    controller('theController', ['$scope',function($scope) {
      $scope.name = 'Zo0ok';

    Hello {{ name }}

Obviously, if you don’t host angular.js yourself you need to use something like

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js">


Scenarios for Hedborough North

I created a scenario for the Hedborough North route for Train Simulator. Unfortunately, it can not be published to workshop. So I publish it here.

English Summer Rain
Diesel freight, shunting and train spotting in a 45 minute long scenario taking place in the picturesque Hedborough North industrial estate, a very rainy morning. Download: English Summer Rain

Scenarios for other routes
Granfield Branch

OpenWrt, easy-rsa, openvpn and stunnel

Certificates are confusing. I have wanted to generate self signed certificates on OpenWrt using easy-rsa, and use them for openvpn and stunnel. Below are the relevant commands and configurations.

The vpn guide for OpenWrt is quite good. A summary:

# cd /etc/easy-rsa
# vim vars                   -- edit as you like
# source ./vars
# build-ca                   -- generates ca.crt
# build-dh                   -- generates dh2048.pem
# build-key-server myserver  -- generates myserver.[crt+key+csr]
# build-key myclient         -- generates myclient.[crt+key+csr]

For stunnel purposes, you need to copy/rename your .crt file to .pem. The content is the same.

The .csr files are not needed. The clients need the ca.crt plus their .crt (or .pem) and .key files.

openvpn server

option ca '/etc/openvpn/ca.crt'
option cert '/etc/openvpn/myserver.crt'
option key '/etc/openvpn/myserver.key'
option dh '/etc/openvpn/dh2048.pem'

openvpn client

option ca '/etc/openvpn/ca.crt'
option cert '/etc/openvpn/myclient.crt'
option key '/etc/openvpn/myclient.key'

stunnel server

cert = /etc/stunnel/myserver.pem
key = /etc/stunnel/myserver.key
CAfile = /etc/stunnel/ca.crt
verify = 2

stunnel client

cert = /etc/stunnel/myclient.pem
key = /etc/stunnel/mysclient.key
CAfile = /etc/stunnel/ca.crt
verify = 2

It looks very simple now, but without a working configuration it is not so easy to find the error.

Comfast CF-2410P Review

I needed decent directed antennas for my TP Link WDR3600. I decided to try the Comfast CF-2410P, despite its cheap price.

I can not find that it has any advantages to the standard antennas that came with the router. I would rather say it is crap.