Systemd Service Dependency On Device

In my SailfishOS port for Motorola Photon Q there was a dependency issue. Sometimes the mce service was starting before the LEDs become available and as a result they were not used. I solved the issue by creating a dependency on one of the LEDs for the mce service.
In general, in order to add a systemd service dependency on a device do the following:
Read the rest of this entry »

Porting Ubuntu Touch for Motorola Photon Q

Introduction

This post describes how to build Ubuntu Touch for Motorola Photon Q. It’s based on the official porting guide. If you face any issues or have doubts, please consult the official porting guide.

Requirements

This guide assumes that you are using Ubuntu Linux as your host OS. All the commands are relevant to Ubuntu only.
Read the rest of this entry »

Bash Script to Review Local Subversion Modifications

Daily task when you work with a source control system is to review your changes before check in, in order to avoid accidentally committing temporary (debugging) or incomplete changes.
Reviewing the changes from the command line (terminal) is a tedious task. Read the rest of this entry »

Using Autotools

There are many Linux distributions, shipping different libraries and tools to different locations. Developing software that is portable across several Posix-compatible operating systems is hard. Luckily, there are several build suites, designed to make the build process portable. One of them is Autotools. Autotools is a set of tools:

  • Autoconf – generates configuration script from a template (configure.ac) file. Generates Makefiles from Makefile.in files.
  • Automake – takes Makefile.am files as an input and generates Makefile.in files
  • Libtool – handles all the requirements for building shared libraries

Read the rest of this entry »

“It’s not my code” Syndrome

Multiple times in my career I stumbled upon a phenomenon. It always goes on in exactly the same way:

I am working on some legacy code and I find an issue with performance, lack of comments, bad practices, etc. Then I discuss the issue with my colleagues. Usually the people I talk to just shrug their shoulders, saying “It’s not my code”. They use this phrase to dismiss the conversation and leave the things as is. I call this “It’s not my code” syndrome.

Read the rest of this entry »

Unlocking the Bootloader of Photon Q

Introduction

Bootloaders basically boot the operating system kernel. They are hardware specific and every manufacturer has its own version of the bootloader, specific for the hardware present in its environment. The bootloader is usually locked on Android devices. It is impossible to flash a custom ROM on a locked device. Unlocking the bootloader allows you to install custom firmware on your phone. Installing Ubuntu Touch requires unlocking the bootloader first.
Read the rest of this entry »

Motorola Photon Q

Motorola Photon Q

Motorola Photon Q

I used to have Nokia’s Maemo phone: N900. Maemo is a Linux-based OS. Traditionally Linux has had rich multitasking capabilities and Maemo is not an exception. Multitasking on N900 was the best I ever had on a mobile phone. The hardware QWERTY keyboard was great too. I enjoyed using the N900, but unfortunately Nokia stopped supporting it and I had to move on. I went with the stream and both an Android phone. I’ve been an Android user for a year now, but I always missed the user experience of Maemo and the hardware keyboard of N900.
Ever since Ubuntu started working on Touch I wanted to try it out, because I think that it can be a good replacement for the aging Maemo platform. Unfortunately the developer preview is available only for Nexus devices. I wanted to try Ubuntu on a phone with hardware keyboard, but they are not popular and there are just a few available devices. That is why, when I came across Motorola Photon Q, I did not hesitate and bought it.
Read the rest of this entry »

Binary Search Algorithm

Description

The binary search algorithm is a divide and conquer algorithm, that takes a sorted array as an input. It works by comparing the searched value (key) to the middle element of the array. If they match, then its index is returned. If the key is less than the middle element, the algorithm is invoked on the left sub-array, otherwise it is invoked on right sub-array. This continues until the key is found or the input array is reduced to zero.

Recursion tree

Recursion tree

Read the rest of this entry »

C++ Observer Implementation

The Observer design pattern is used for state change notifications. An object called subject (or publisher) has a list of dependents, called observers (or subscribers). When the subject changes state, all its dependents are notified by calling a method. The Observer pattern is useful for the implementation of event handling.

UML diagram


The observer interface has an abstract method used for notifications and the subject has methods for attachment and detachment of observers.
Read the rest of this entry »

C++ Singleton Implementation

Singleton is the simplest and probably the most widely used of all design patterns. It’s so popular that some IDEs (like SlickEdit) have templates for its generation. The purpose of this design pattern is to ensure that only one instance of a class is created.
So, why discuss Singleton?
Read the rest of this entry »