30. April 2019

How to run Fedora GUI in Docker – just 6 commands

Docker is great for experimenting and testing server an applications. But what about GUI? How is it possible to run application which requires GUI in Docker container?

There are several ways how to access GUI application from the container. E.g. using ssh tunnel with X-Forwarding. The downside of this approach is speed and responsiveness of UI.

Much better responsiveness has TigerVNC server with VNC client.

Let’s pull and run Fedora image. We will also open a port 5901 where we can connect with VNC client:

docker run -p 5901:5901 -it fedora /bin/bash

Now install some basic applications. We will use TigerVNC server to serve the UI. Then we will use Fluxbox as a window manager because it’s small and versatile. We will need also xterm to invoke our commands.

yum -y install fluxbox tigervnc-server xterm

In a classic desktop installation of Fedora we’re using Display manager which allows to type user’s login. This is not necessary for Docker and instead of starting XServer we will launch TigerVNC server which will launch Fluxbox for us.

Write following configuration to ~/.vnc/xtasrtup:

mkdir -p ~/.vnc
echo "fluxbox &"> ~/.vnc/xstartup
chmod u+x ~/.vnc/xstartup

Now we can start the VNC server:


It will prompt you for a password for protecting the connection. Just enter a password of your choice.

The server will automatically bind to 5901.

Now let’s start VNC Client on the host machine (I recommend RealVNC, because it’s fast and easy to use) and connect it to localhost:5901.

Here is the result:

If you need to invoke context menu in Fluxbox just right click with mouse.

You can stop TigerVNC server by command:

vncserver -kill :1

27. April 2019

How to start TigetVNC server on port 5900

When you start TigerVNC server by following command:


then it will automatically bind to port 5901.

When you want to start the server on 5900 then you need to type following command:

vncserver :0

This looks a little bit mysterious, but if you dig through the documentation you might find that there is the following mapping:

:0 -> 5900
:1 -> 5901
:2 -> 5902
:3 -> 5903

Now it’s clear that when you omit the parameter, it will default to code :1 which is mapped to the port 5901.

23. April 2019

Android Studio Unresolved reference: activity_main – R.layout and R.id

You can easily run into mysterious errors with Android Studio. Here is one.

Suddenly all references related to R.layout or R.id stopped to work and build failed with a message like this:

Compilation error. See log for more details
Unresolved reference: activity_main
Unresolved reference: url_edittext
Unresolved reference: update_button

The code looked like this:

    override fun onCreate(savedInstanceState: Bundle?) {

I tried clean, builds, rebuilds. Nothing helped. The problem was caused by simple import which accidentally occurred in Activity file:

import android.R

After removing this line the whole project was working again and even code hinting was correct.

15. April 2019

Android Emulator application crash: Chromium WebView package does not exist

Android application with WebView might crash with a strange error in Android Emulator:

E/WebViewFactory: Chromium WebView package does not exist
    android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
        at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:334)
        at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:398)
        at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:211)

Check the definition of Virtual Device. It’s very likely that your device is using plain Android target which does not contain the WebView. You have to create Virtual Device which contains Google APIs.

Click Create Virtual Device. Select an image with “Google APIs“:

Now you can start the application in the newly created emulator with Google APIs.

The application should run without a problem.

3. March 2019

How to quickly zip files on Windows 10

Windows 10 has built-in support for ZIP compression. You do not need to install 7-Zip or other additional software to create ZIP package.

Select files or folders in File Explorer which you’d like to compress into a single ZIP file.

From the top menu select Share and click Zip icon.

Windows will create zip file.