Welcome to my personal blog!

I am doing software development in many areas, with my main fields of experience being cross-platform software (C++/Qt), Android apps (native), Linux & DevOps (Bash/Python/Ruby, Docker, ...).

Open Source is one of my passions -- I am a developer and maintainer of many open projects and regularly start contributing to additional ones. Support me on my mission! My other favourite activities include photography and being outdoor as much as possible. I am too volunteering at the local fire department. I went to school at HTL Braunau (Electronics / Software Engineering & Mobile Computing), studied at FH Hagenberg (Mobile Computing) and work currently at Felgo.

This page helps you to get started using file synchronization with Syncthing and Markor as your favourite file editor of choice. Required applications are Syncthing (Desktop & Android) and Markor (Android).

Quick Guide

Syncthing is a protocol to sync files between your devices, with implementations for various platforms. Unlike other (even open source) sync and backup solutions, it does not require complex server setup or dependence on 3rd parties. According to their website:

Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it’s transmitted over the Internet.

To start off, install Syncthing and set up a shared folder. More info on how to do that here.

Then, all you need to do is tell Marker where to look for and save files:

  • Go to Markor’s main screen and swipe to More
  • Open Settings -> General -> Notebook
  • Select the folder you sync with Syncthing (The Syncthing app tells you the default path)

Detailed Guide

I use Syncthing - both on my desktop (Linux Debian) and on Android phone (Xiaomi Redmi 4x). Open source, privacy (my data doesn’t get to the third party), etc.

I use both with local networks settings (syncing by local home wifi) since in the recent past I didn’t have mobile internet, so I connect desktop (firefly at 192.168.1.4) and phone (redmi 4x new at 192.168.1.6).

I prefer keep separate folder for texts (~/text at desktop, and ~/text aka /storage/emulated/0/text at phone), because syncthing sync little text files lightning fast - without having to wait for all other (big) files to be synchronized.

For desktop linux I install syncthing by default repo (sudo apt install syncthing), start it and set it up via browser interface (http://127.0.0.1:8384/). I use “homebrew” selftuned Openbox install, so syncthing run at start via ~/.config/openbox/autostart.sh (added there (syncthing -no-browser) &).

For android phone I get syncthing from f-droid.org and connect it with desktop.

Rarely I may get version conflict, but syncthing keep both version of files (see at screenshot) and I just use vimdiff.

2018-10-04_1708-1538662113_1920x1080_scrot

So far - 143 files inside ~/text :)

Read more

Debugging is an essential part of software development. In case of Ubuntu Touch apps there are basically two ways to debug an app. This blog post showcases both ways.

Some basic knowledge of GDB is assumed as well as of Clickable which is the recommended tool to build Ubuntu Touch apps. If not, search the web for GDB tutorials and/or read the Clickable Documentation.

Desktop Mode

Clickable provides a desktop mode to run an Ubuntu Touch app on desktop. This mode also enables debugging via GDB. Again there are two ways:

1) Run GDB in a terminal 2) Start gdbserver and debug with your preferred IDE.

GDB on Command Line

From the project root directory run:

clickable desktop --gdb

This compiles the app with debug symbols (provided that CMake or qmake is used) and starts GDB inside a docker container. Use GDB commands like break main and run to start debugging. You can find more examples, like how to set breakpoints on a specific lines of code here.

Any IDE via gdbserver

From the project root directory run:

clickable desktop --gdbserver 3333

This starts the gdbserver on port 3333. Check for an option to do GDB Remote Debugging in your IDE and connect to localhost:3333.

On Device

Debugging in desktop mode is convenient, but it does not cover all use cases, e.g. those involving Content Hub, App Armor or arm specific issues. In such a case you need to debug directly on an Ubuntu Touch device.

You can always watch the logs from the device on your desktop via

clickable logs

This works independently of the debugging described below.

Clickable Debugging

Apps that are started through their own elf binary can be debugged on-device via Clickable’s Debug feature, as described in its docs. If this does not match your app, continue reading.

Preparation

Note: The steps described below make your rootfs writable and use apt to install packages. Do only proceed if you know what you are doing and how to reinstall Ubuntu Touch in case of trouble. Also note that your changes might get lost after system updates.

Make sure to install a debug build of your app, e.g. via Clickable:

clickable --debug

Make sure you have started the app at least once normally with that version.

Enter a shell on your device via SSH and run all subsequent commands on the device.

Remount the root filesystem writable and install gdb:

sudo mount -o rw,remount /
sudo apt update
sudo apt install gdb libc6-dbg

You may need to repeat this step after an OTA update. Installing libc6-dbg is necessary due to a bug that probably won’t be closed, soon.

Find the app’s desktop file in the ubuntu-app-launch cache

ls /home/phablet/.cache/ubuntu-app-launch/desktop/

Let’s use Webber as an example. In this example /home/phablet/.cache/ubuntu-app-launch/desktop/webber.timsueberkrueb_webber_0.5.1.desktop. You will need that path in a second.

Change directory to the installation path of the app, which can be found at /opt/click.ubuntu.com/<appname>.<maintainer>/current. In case of Webber

cd /opt/click.ubuntu.com/webber.timsueberkrueb/current

Look for the Exec line in the desktop file to find out how to start the app

cat /home/phablet/.cache/ubuntu-app-launch/desktop/webber.timsueberkrueb_webber_0.5.1.desktop | grep Exec

In case of Webber this returns Exec=webber %U. This means the app is started by the command webber (we can omit the %U). This executable may be located directly in the app installation directory or in the sub directory lib/<arch-triplet>/bin, where <arch-triplet is arm-linux-gnueabihf or aarch64-linux-gnu depending on your device. In case of Webber on a armhf device the executable is located at lib/arm-linux-gnueabihf/bin/webber.

Sourcing the app environment

When an app is started, some environment variables are set and the app may rely on them to work properly. That’s why you may or may not need to do this step before starting gdb on your app, too. In this sections you will learn how it can be done.

Start your app normally. Then find out the process ID (PID)

ps aux | grep <command>

where <command> is the executable that starts the app. Example for Webber:

phablet  32384  8.6  2.2 340256 62620 ?        Ssl  08:41   0:01 webber
phablet  32576  0.0  0.0   5684   812 pts/47   R+   08:41   0:00 grep --color=auto webber

We ignore the grep command we just ran and find the PID to be 32384. While the app is still running execute:

. <(xargs -0 bash -c 'printf "export %q\n" "$@"' -- < /proc/<PID>/environ)

replacing <PID> with the the PID identified above:

. <(xargs -0 bash -c 'printf "export %q\n" "$@"' -- < /proc/30649/environ)

Now the environment is set up as it would be on a normal app start. Close the app and start debugging as described in the next section.

Debugging

Now you are set up to start your debugging session:

gdb -ex "handle SIGILL nostop" --args <executable> --desktop_file_hint=<cached-desktop-file>

In case of Webber this is

gdb -ex "handle SIGILL nostop" --args lib/arm-linux-gnueabihf/bin/webber --desktop_file_hint=/home/phablet/.cache/ubuntu-app-launch/desktop/webber.timsueberkrueb_webber_0.5.1.desktop

The -ex "handle SIGILL nostop" part avoids stopping at a SIGILL signal caused by OpenSSL probing the abilities of the architecture. Use GDB commands like break main and run to start debugging.


Notice: Jonatan Hatakeyama Zeidler is the author of this article. The content was originally written in March 2020 and first published on this (gsantner’s) blog. ‘I’ refers to the original author.


Read more

Single-player blackjack game with optional basic strategy hints.
I started on the project in februrary 2020 to get 100% offline working crosstplaform apps running on a Ubuntu Touch / UBPorts phone and as a result uploaded the app to OpenStore.

Project description

NOTICE: Absolutely zero real money involved and no in-app-purchases or alike!
You always play with virtual coins, restart the game to get the initial amount of coins again.
The coin highscore is saved, you can view it in the left sidebar.

Rules

  • To keep the game simple, the initial bet is always one coin
  • 6 Decks, shuffled after 75% have been played
  • Blackjack pays 2-to-1
  • Dealer stands on any 17 (S17)
  • Double down on any two cards (D2)
  • Double down after splitting (DAS) (except Aces)
  • No resplitting (NR)
  • No insurance (NI)

The basic strategy suggestions are based on this ruleset.

Screenshots

 
 
 
 

– Please share this post & project in social networks and on UBPorts!
– Posted on Fediverse Friendica/diaspora/Mastodon
– Download from OpenStore

License

The app itself is MIT licensed, it’s a fork of kevinleedrum. My fork for Ubuntu touch has been changed to improve usability for mobile usage.

Read more