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…

Oil
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.

Fuel
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.

Conclusion
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

hackintosh
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.

Ideas
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

Update
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:

DSCN5193

DSCN5194

DSCN5196

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.

Performance
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
/dev/sda:
 Timing buffered disk reads:  82 MB in  3.03 seconds =  27.09 MB/sec

$ sudo /sbin/hdparm -T /dev/sda
/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">
  <head>
    <meta charset="utf-8">
    <title>Hello World</title>
  </head>

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

  <body>
    Hello {{ name }}
  </body>
</html>

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">
</script>

instead.

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
GNoSR
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.

easy-rsa
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.

Playing with smart.js and V7

I have been playing quite much with Node.js lately, and I have put some effort into trying to build it for typical OpenWRT hardware. It turns out that Node.js/V8 is not, and will never be, suitable for hardware without an FPU and at least 128MB RAM.

My curiousity led me to smart.js which is based on the V7 javascript engine. Among the positive details were posix compability, ECMA script 5.1 support, HTTP support (not very different from Node.js, just much less of it), and supposed to be the fastest non-compiled JavaScript engine.

smart.js
smart.js seems to be the IoT-platform, while v7 is just the JavaScript engine. smart.js had some peculiar properties:

  • The source zip I downloaded from github failed to compiled becuase of a missing .git-directory. Using git clone solved this.
  • The binary always reads and executes smart.js from the same folder. If you give more command line arguments, it executes those after smart.js.
  • I found no way to pass command line arguments.

It comes with a little set of IoT-example files, and I found this a little confusing.

v7
I found out it was possible to use v7 standalone. It is a very nice v7.c file that is simply compiled:

$ gcc -O3 -DV7_EXE -o v7 v7.c -lm

This is very promising – a lot easier than building node.

I found that neither console.log or process.argv exist and found ways to work around this. My plan was to build a little benchmark suite and test different things. I did not get so far: the below program just creates 100 random objects (TestBit) 10 times and stores in arrays.

if ( 'undefined' === typeof process ) {
  process = {
    exit : exit,
    argv : [ 'v7', 'v7bench.c' ]  // faking command line arguments
  };
}

if ( 'undefined' === typeof console ) {
  console = {
    log : print
  }
}

var TestBit = function() {
  this.n  = Math.random();
  this.s  = '' + this.n;
  this.s1 = this.s.substr(2,1);
  this.s2 = this.s.substr(3,2);
  this.s3 = this.s.substr(5,3);
  this.b  = this.s > 0.5;
};

var generateTestBits = function(n) {
  var i;
  var r = new Array(n);
  for ( i=0 ; i<n ; i++ ) {
    r[i] = new TestBit();
  }
  return r;
}

var Timer = function() {
  this.start = Date.now();
  this.last  = this.start;

  this.split = function() {
    var r;
    var n = Date.now();
    r = n - this.last;
    this.last = n;
    return r;
  }
}

var timer = new Timer();

var i = 0;
var tests = [];
var tmp;

console.log('Start');

while(i<10) {
  tests.push(generateTestBits(100));
  i++;
  console.log('' + ( i*100) + ':' + timer.split());
}

This simple program unfortunately proved that performance is much worse than I could expect. Below are timings for generating the 1000 objects, in steps of 100 at a time. Benchmarks on a RPi2 900MHz ARMv7 CPU.

There is a flag (-vo) described as “object arena size” that I decided to play with (values 1, 10, 100 gave very similar results as 1000)

       default    -vo 1000    -vo 5000    -vo 10000
 100      0.2s       0.12s        6.8s          28s                         
 200      0.4s       0.16s        8.6s
 300      1.3s       0.23s       12  s
 400      7.4s       0.24s        2.6s
 500     13  s       0.37s       15  s
 600     35  s       0.93s       32  s
 700     47  s       2.9 s       48  s
 800     79  s       4.6 s       45  s
 900    160  s       5.9 s       36  s
1000    160  s       8.0 s       37  s

Well, generating 100 random objects on a RPi2 using a simple interpreter could take 0.2 seconds (the top left value): quite reasonable I guess. As the number of generated objects grows the performance is completey ruined. With default parameter, a full 1.6 seconds is spent to generate one single “TestBit”. Memory usage of the v7 process is insignificant.

I dont know what the “object arena size” setting does, but it obviously changes something. The 400-value for the vo=5000 series is actually reproducable.

Even for an IoT-platform I find this performance (and the lack of predictability) unacceptable. V7 officially aims to be the fastest interpreted JavaScript engine out there: it must be cabable of handling what is actually small arrays (10×100 elements) of small objects.

Upgrading Windows 7 to Windows 10

After installing Windows 10 on a friends’ computer, I thought it was time to upgrade my own. My primary concern was my limited available space on my C-drive (I have two more drives with plenty of space). I tried to find good advice or information online, but no luck, so here is my report:

Upgrading Windows 7 to Windows 10: storage requirements

My Windows 7 computer had a C-drive with the following available capacity:
12.6 of 55.3 GB Free (after running disk cleanup).

That is, Windows and some programs were installed on C, most files on other drives. Anyway, Windows 7 was pretty eager to upgrade, and I started the procedure.

  1. It was “Checking requirements” (3 times, different dialogues)
  2. Downloading: available space down to 9.4GB
  3. Preparing for installation: down to 8,1GB

So far it had been the typical low-quality MS experience of different dialogs giving quite dull information and no real sense of progress, but now it got really bad:

win7to10_1

The f**k is this? I did not know anything about installing the Insider Preview (there has never been any pre-release W7 whatsoever on this computer). And “something needing my attention”, being thrown back from the Windows 10 upgrade wizard to the Windows 7 system upgrade, not very impressive. Anyway, I just clicked “check your PC”, the Windows 10 upgrade continued, and I got this:

win7to10_2

This is really crap! It had already checked requirements three different times, yet not figured out I had too little space. I could have told it, before it even started, that I probably had too little space. The good thing however was that I could pick another drive to use for extra space, and I happened to have an internal drive available.

After that, up to 10.5Gb availble space on my C-drive, and restart. Now my computer was working on its own for almost an hour. After that Windows 10 came up, and everything seemed fine.

With Windows 10, I now have 17.8GB free space on my C-drive. That was nice! Perhaps a reason in its own to upgrade to Windows 10.

Conclusion: upgrading to Windows 10 with limited available space on C is a good idea, but make sure to have an extra external (or internal) drive for the process itself.