Docker fails to start on Ubuntu 15.04

I installed Docker on Ubuntu 15.04 using:

wget -qO- https://get.docker.com/ | sh

as described at Install Docker on Ubuntu.

I added myself to the docker group:

sudo usermod -aG docker balaaman

Then I logged out and logged in again, and ran:

docker run hello-world

and saw this:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

When I tried to start the Docker daemon like this:

sudo service docker start

I got this error:

Failed to start docker.service: Unit docker.service is masked.

Thanks to Yannick Lizzi on this thread I found this fix:

systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service

After this, “docker run hello-world” worked fine, and all was well.

Preventing Audacity from crashing when using PulseAudio

I found that Audacity would crash whenever the Playback Device in the Devices section of Preferences was set to “pulse” or “default”.

This can be fixed by launching Audacity like this:

Exec=env PULSE_LATENCY_MSEC=100 audacity

I fixed it “permanently” by modifying my Audacity launcher file, which is in /usr/share/applications/audacity.desktop.

I changed the line starting “Exec=” to:

Exec=env PULSE_LATENCY_MSEC=100 audacity %F

More info is on the Audacity forum.

Code for detecting when you leave an Android app

Further to Detecting whether an Android app is stopping (or starting), I implemented code to decide when you are leaving or entering my game Rabbit Escape.

The relevant class is called Lifecycle2SoundEvents. (Yes, it’s a terrible name. Yes, I spent a long time trying to name it, and this is the best I came up with.)

And the tests, which are in TestLifecycle2SoundEvents, look like this:

@Test
public void Press_the_home_button_api10_causes_pause()
{
    Tester t = new Tester( activity1 );

    t.in.onSaveInstanceState( activity1 );
    t.in.onPause( activity1 );
    t.in.onStop( activity1 );

    // When we press home, we must at least pause (really we stop)
    t.assertPaused();
}

which I was reasonably pleased with, because they match my original blog post Order of Android Activity lifecycle events fairly well, without too much noise.

Mocks are Bad, Layers are Bad

In which I argue that mocks are a code smell, and layers lead to increased coupling:

Mocks are Bad, Layers are Bad (in ACCU‘s Overload Journal issue 127)

I also suggest some ways to avoid both mocks and layers, including Classical TDD, Selfish Object, Refactor to Functional and, of course, the Unix Philosophy. I work through a code example to demonstrate some of these things.

I also suggest that frameworks and inheritance hierarchies are bad, but the title was getting too long already.

You can also get the PDF of Overload 127.

Prediction result: corporate Linux

Ten years ago I predicted that 30% of corporate desktops would be Linux or similar open source desktops.

It’s very hard to find any accurate (or even confident) numbers, but it seems clear I was wrong.

This month, NetMarketShare puts Linux usage at 1.28%, and w3schools puts Linux usage at 5.2%.

I think companies almost certainly use Linux more than home consumers. Certainly, my own company has a very large section of its population using Linux – all users who have access to sensitive information are required to use it to increase security.

But, I would be very surprised if levels were at 30%.

Linux desktop usage does continue to creep upwards though, while everyone is distracted looking at phones and tablets. At some time there may be a tipping point.