Why trying to preserve control over your privacy for me means running Android

Why trying to preserve control over your privacy for me means running Android

Background

I switched from Android to iOS roughly a year ago. The main reasons for this were:

Apple released “affordable” hardware for the masses

The lowest end iPhones went into a range that “normal” people also can afford. Of course they are a bit more expensive than the cheapest Android phones you can find but taken Apples update strategy into account (and combining this with the fact that the phone cycle slows down) this has become a real alternative for anyone.

This fact removes the “if you can afford it you can have privacy” label (at least a bit) from Apple that I really disliked.

Apple really puts their marketing into privacy

You can argue if Apple does this because they really think it is the best for their users or - like some people think - because they had no other choice (no way to beat Google, Microsoft or Amazon in the Cloud and data game) but they put privacy on top of almost every marketing material.

So the assumption is that they will try their very best to make sure to deliver on that end because they would really really harm themselves by violating that rule.

Phones get more “boring”

Read more...

Using Flutter to teach the next generation - the project

Using Flutter to teach the next generation - the project

This is a quick follow-up to the last two posts.

As I got asked quite often to show off the project the kids implemented I thought it might be quite interesting for the readers here as well.

So I just built the Flutter app for web. I translated the german strings to english for your reading pleasure 🥸

The only problem I had was that on this statically generated blog the project is not the root of the domain so I had to remove the href=”/“ tag in the index.html for the app to run from a subfolder.

Without further ado, here you can find the tic tac toe app:
tictactoe

Depending on your device and browser the experience might have some problems - but you will get the idea

Software development

Using Flutter to teach the next generation part2

Using Flutter to teach the next generation part2

As promised I now want to share how well the teaching experiment went.

How the day went

Preparation

I used our kitchen table and moved it closer to the TV to mirror the MacBook’s screen to it.
I used AirPlay for that which turned out to be quite laggy (moving the mouse was very hard) so the next time I would rather run an HDMI cable to the TV
Kitchen table
TV showing the MacBook screen

Start

We gathered 6 kids (2 of my kids and 4 friends) and started off discussing what the TicTacToe game has to look and behave like.
I used the version I already created beforehand to show what our goal will be.

After doing that we started Android Studio and created a new project. I explained briefly what the main parts of a Flutter app are and where we will spend our effort at (Position wise). Of course I didn’t explain all the details of what’s written there. No information about State(less)Widgets, classes or anything on that end.

We started by simply placing 9 texts and layouted them using Columns and Rows. Before we started to fine tune the cells I mentioned that we might want to extract the Text part to a method so that we don’t have to make any modification 9 times.
The concept of a Function was already clear to my children (they used Swift Playgrounds a bit) so they were eager to explain the concept to the other kids.

So we created a method that creates the cell content, moved the Text there and made the content a parameter.
Afterwards we replaced all Texts with a call to that method.
The cells up to that point simply contain the “cell id” (1-9) to see how the text will look like.

Read more...

Software development

Using Flutter to teach the next generation

Using Flutter to teach the next generation

What I already tried

I have 3 kids at the age of 12, 10 and 2.
Without trying to be one of the parents that really insists on the kids having to do what the parents enjoy doing I still want to provide enough opportunities for them to get hooked by software development.
The tries I had to this point didn’t really work out:

Board games

I used board games that encourage “programmer thinking” (Robot Turtles). While it was quite funny to play it never sticked so now it is waiting in the drawer for the 2y old to pick it up one day.

Educational Hardware pieces

I thought “maybe this is too theoretical and there is no connection to the real world” so I bought some hardware that is meant to be controlled by high level visual programming languages (Makeblock).

This also was fun only for a short period of time and then the kids lost interest.

Next plan: Apps

As the older kids are quite tied to their smartphones and given the battle that we as parents have almost every day regarding the smartphone usage (the kids have a very strict screen time with their smartphones) I thought “maybe it would be a good idea if they would be able to create an useful app for their smartphone”.

Read more...

Software development

Avoid MacOS accent menu

Avoid MacOS accent popup menu

For the Flutter based Terminal application I wanted to deactivate the MacOS behaviour that shows an accent selection popup when a key gets pressed long (instead of repeating the pressed character).

MacOS accent menu

This is actually a feature in MacOS and can be disabled by tweaking some MacOS settings via terminal commands.
I wanted to do that programatically as this behaviour doesn’t make much sense for Terminal applications.

Finding information about this topic is really challanging even if the solution isn’t that complicated so I decided to leave that piece of information here so that someone else might stumble upon it.

Overriding MacOS default settings

The key to the desired behaviour is to override the ApplePressAndHoldEnabled setting for our application. This can be done by tweaking the integration layer of the Flutter app (the MacOs project).

Just extend the AppDelegate located in AppDelegate.swift by adding the following method:

override func applicationDidFinishLaunching(_ notification: Notification) {
    UserDefaults.standard.set(false, forKey: "ApplePressAndHoldEnabled");
}

That’s all. Now your application doesn’t trigger the accent popup any more.

Read more...

Software development

Enums in Dart are worth an extension

Enums in Dart are worth an extension

Dart is a relatively simple programming language.
In general this is a good thing as the number of possibilities and patterns you have to know in order to develop something with it or when reading code is lower.
On the other hand you will miss certain features that other programming languages have that can lead to quite elegant solutions for certain problems.

Enums int Dart are such a case.

Enums are very simple in Dart. In general they are classes / objects like everything else but you can’t do neat tricks with them like for example with C#.

Lets assume we have a byte value and want to read some bits of it. Those bits should have names (mapped to an enum) for better understandability.

Enums in C#

In C# there is a language feature for exactly that. You can use any enum to represent bits in a bitfield.

[Flags]
public enum FlagValues : byte
{
    None    = 0x00,
    Flag1 = 0x01 << 0,
    Flag2 = 0x01 << 1,
    Flag3 = 0x01 << 2,
    Flag4 = 0x01 << 3,
    Option4 = 0x01 << 4,
    All = 0xFF
};

// later in the code

byte val = 0x05; //00000101

var flags = (FlagValues) val;
flags.HasFlag(FlagValues.Flag1); // true
flags.HasFlag(FlagValues.Flag2); // false
flags.HasFlag(FlagValues.Flag3); // true
flags.HasFlag(FlagValues.Flag4); // false

You can even do bitwise operations directly with the enum like

FlagValues flags = FlagValues.Flag2;
flags |= FlagValues.Flag4;
Read more...

Software developmentProjects

Dart Isolates and huge amounts of data

Dart Isolates and huge amounts of data

Why?

I’m currently experimenting with Dart and Flutter to take another shot at the terminal emulation application. This time not using C# but something completely new.
For this I decided to take a look at Flutter and Dart and try to implement the terminal application using that technology.
Gladly there is already a person in the internet that is working on implementing the xterm protocol for Dart and also has a working Flutter UI that renders the terminal.
https://github.com/TerminalStudio/xterm.dart
This implementation is not yet finished and has a couple of problems but is a really good starting point to dig into a Dart and Flutter based development of a terminal application.
One “problem” of the solution is that the whole terminal logic happens in the UI thread. So I wanted to move that logic into a separate thread and only copy the UI state to the UI thread for the UI to show it.
I did this for the C# based approaches and it speeded up the performance (especially reflow) a lot.

Dart and threads

Dart has a very special way of handling threads. The designers have chosen to use an approach that rules out any race condition by design.

For this they decided that in Dart threads don’t have shared memory and they have to define so called ports for explicit data exchange (the data gets copied).
This is called an Isolate in Dart. So you can create and spawn a new Isolate, specify its “main” method and define the port to communicate with it.

Dart makes sure that the data that is sent to a port is serialized and deserialized on the other end. This way two Isolates never work on the same place in memory. By design.

Then comes the terminal

I tried this with the terminal logic and it worked but the performance gain from moving the xterm logic to a separate thread was completely eaten up by the overhead of copying the whole UI state for each change in the terminal state.

Read more...

Software developmentProjects

Current state (of the Terminal application)

Current state

I know, I know. I planned to do this much more frequently as it then happened. I will do my best to keep you updated with anything of interest here.
There has not been so much going on in terms of development or side projects mostly because the Terminal application project got stale and there no all-focus new side project yet.

I started reviewing my small Smart Home setup I have here and see where I can improve things. When this gets more concrete it might also be worth on or two blog posts.

Current state of the Terminal application

The Terminal application got a bit stale due to several reasons.
Starting point of all that was me starting to think about the UI for the additional features. Things like managing different profiles as a starting point.
I played around with a couple of ideas and did some prototypes and I didn’t like anyone of them. Not so much because of the UX they used but the design.
I basically faced the standard problem of cross platform UI development. Qt can have styles - yes - but you will never reach a state where the application feels “natural” on any platform. I think this is especially visible on MacOS as a MacOS user is not very used to seeing all different kind of visual approaches between different applications.
This topic blocked me from continuing because I can not see how I will end up with a Qt/Qml based solution that looks like a nice MacOS application. Even small things like using some blur effect that modern MacOs apps have would be a pain if at all possible.

So I decided to got some steps back, make a fork and try a completely different approach.
I wanted to use Xamarin Forms as it is cross platform as Qt but allows full control over the native experience where needed.
It also uses the native controls in the back so for the OS it is not only a Canvas where the application draws something. This means easier integration in things like accessibility and uses the look&feel of the underlying OS (which is a good thing)

Using Xamarin.Forms also allows to remove that Console Host layer completely because Qt has been the only reason to do this (some weird C++ library in .Net issue that leads to a crash when using forkpty). So I got another step back and reworked the complete backend.

I ported the frontend part to Xamarin.Forms (with some problems like input handling) and got it working. I basically used SkiaSharp to draw the terminal content and Xamarin.Forms to host it.

This took some evenings to finally work on MacOS and Linux and then I started thinking about “how to create a package?”.

Read more...

Software developmentProjects

At some point in time you have to let it go

At some point in time you have to let it go

Minimalistic Text is almost 10 years old. The first commit to the repository happened on 7th of November 2010.

How it began

I did not expect to create something that will reach the number of people Minimalistic Text did. It was basically just a try to create something for my new Smartphone (a Samsung Galaxy S). I was inspired by an application that already existed and was able to show the time as spoken text as a widget.

Recreating that widget and extending it by a first level of customization was basically the starting point. I started a thread over at Xda-Developers and immediately received great feedback. That encouraged me to extend the app step by step till it was a really feature packed text widget creator.

Generating income

At some point users wanted to know how they can contribute and donate some money for the app they use to make their homescreen look nice so I decided to create a donation system (separate app and in-app purchases) and to give the donators some benefit made new features available for the donators first. I also added Google Ads that were not shown for donators.
This generated some income that allowed me to buy a bunch of equipment like laptops or new smartphones. I had to test my app on the latest and greatest phones out there, right? ;)
It was not to a level that I get rich or could quit my day job but it allowed me to have some extra cash that could be invested in tech stuff.

AppStore feature

One day in January 2013 I received an email from Google that they consider featuring my app in the PlayStore. They had some requirements though (only the major ones listed here):

Read more...

Software developmentProjects

Creating a terminal application - frontend 2

Creating a terminal application - Frontend take 2

Recap

We remember that the current state of building the terminal application was creating the user interface. I tried to use HTML to do the formatting of the text which turned out to be way too slow.

So I had to find a different approach as I wanted to stick with QML and .Net (for the already mentioned reasons)

QML alternatives

In QML there are a few alternatives for getting a formatted text to the screen. We already had a look at the HTML approach.
Another approach is to create a QQuickPaintedItem. You can imagine that control to be a drawing surface inside your QML layout that then can use a QPainter and its drawing API to draw whatever it wants.

This works by deriving a class from QQuickPaintedItem, implement the paint method and use the passed QPainter instance to draw.
The paint method is called whenever the content has to be redrawn.
This new class then has to be registered as a QuickItem with the QmlEngine and can then be used like any other QuickItem in your layout.

The problem

Using .Net code and Qml.Net for bridging both worlds it is not possible to derive from a C++ class and register that with QML without changing the C++ part of Qml.Net.

Read more...

Software developmentProjects