Hire Me!

Back to C++


written by Mickey on 2023-05-09 Click to comment

I learned C++ in the late 1990s, back then with Microsoft's Visual Studio C++ and the Microsoft Foundation Classes. When I left Windows behind and embraced Linux and macOS, I concentrated on Objective-C, Vala, and (since 2020, being late to the game) Swift.

Just recently I started getting into MCU programming (notably the ESP32-series). As I'm (still) not very fond of C, I was pleasantly surprised to see that C++ was supported well. I didn't look at C++ for almost two decades, but I like what the committee did since 2014. Type inference, move semantics, coroutines, ranges, and all that are pretty helpful and can help secure the usability of C++ in an almost saturated world of programming languages.

Naturally I started with abstractions, this time for FreeRTOS "objects". FreeRTOS is a simple, yet pretty capable operating system and it provides most of what you will need to write concurrent programs. Although ­– after stumbling about the most impressive Swift for Arduino ­– I had wished I could write in Swift, C++ is really fine these days. I have a nice development environment with a capable language now.

Stay tuned for a more detailed progress report of what I'm actually building.





Activating an Apple Watch eSIM w/ O2


written by Mickey on 2022-10-06 Click to comment

When activating an Apple Watch eSIM, the process is usually pretty straightforward. Most providers are using a QR code that you can scan during setup ­– this transfers the eSIM data and off you go. Not with O2 though ­– at least here in Germany; they open a builtin web browser and require you to log into your account to order the eSIM from within your account.

So I tried this. During eSIM setup in the O2 login form, you can choose between login via E-Mail-Address or phone number. If you try the E-Mail-Address you get an error message w/ "Please register with the O2 App". If you use the phone number here, you'll get a prompt "This device's phone number does not belong to your account. Please use a different account". And now you're stuck.

So after investigating several ways (the O2 support not being helpful at all…), I found the culprit: When you have multiple tarrifs in your account, the automated process does not scan all your phone numbers, but only takes the first one, the "main phone number". What you now have to do is to login (best via web portal) and change the main phone number to the one you want to order an eSIM for (you can change it back again after the process).

Once you did that, you can finally use that phone number to login during the eSIM setup process and ­ordering should work.





SPM-ifying YapDatabase


written by Mickey on 2020-10-18 Click to comment

Converting an existing Objective-C/Swift framework to Swift Package Manager

I'm a big fan of the database library YapDatabase, which is a collection/key/value store for macOS, iOS, tvOS & watchOS. It comes with many high level features and is built atop sqlite.

In the last 5 years, I have used this successfully for many of my projects. It is written in Objective-C and comes with a bunch of Swift files for more Swifty use. Since I recently announced to go all-in with Swift, I want to convert all my dependencies to the Swift Package Management system. I have never been a fan of CocoaPods or Carthage as I found them too invasive.

As this point of time though, YapDatabase is not Swift Package Manager (SPM) compatible and all approaches to do this using the current source layout did fail. So I had a fresh look at it and decided to do it slightly differently: If you don't have to work with the constraints of an existing tree layout, the process is relatively straightforward. Read on to find out what I did.

Prerequisites

I couldn't name the Objective-C library simply YapDatabase, since this would have required to rename the (then umbrella) header file YapDatabase.h, which I didn't want to.

Swift vs. Objective-C

At the moment, SPM is not capable of handling mixed language targets, i.e., you either have only Swift files or no Swift files at all in your target – therefore I split the repository accordingly and moved Swift files below Sources/SwiftYapDatabase.

Source and Header file locations

SPM is pretty rigid when it comes to the location of source and header files. This is the reason why I unfortunately could not deliver this work on top of the original source repository.

Fortunately though, the source repository was very well structured. To layout the files in a way that makes SPM happy, I

Swift

The aforementioned steps were enough to make SPM compile the ObjCYapDatabase. To make the Swift part compile, I had to

This made the SwiftYapDatabase compile.

What's Next

There are some parts missing: I didn't include the example programs, the tests, and the Xcode project.

I don't know Robbie Hanson's (creator of YapDatabase) plans. As it stands, this shuffling around was merely a proof-of-concept to find out whether such an approach is sufficient to SPM-ify YapDatabase or whether to there are more problems to consider. I will incorporate this in one of my projects to put it through a real world test.

I have published the repository as mickeyl/SwiftYapDatabase and will report this work via the YapDatabase issue tracker. Let's see what happens next.





Programming Languages


written by Mickey on 2020-10-03 Click to comment

While I never got much into natural languages (beyond my native tounge, a halfway solid english, and some bits and pieces of french), I have always been fascinated by (some) programming languages – I even wrote books about some of them.

I (literally) grew up with BASIC and 6502/6510 ASSEMBLER – on the VC20 and the C64. Later on, learned to hate C and love 680x0 ASSEMBLER – on the AMIGA. During the 90s, I enjoyed PASCAL and MODULA II, and then found a preliminary home in Python.

The 2000s were largely affected by C++ (which I always found much more interesting than JAVA) until I got acquainted with Objective-C – which later rised to the 2nd place in my top list – shared with Vala, which I still have a sweet spot for, since it liberated me from having to use C.

As I grew older (and suddenly realized that my lifetime is actually limited, imagine my surprise…), I learned to embrace higher abstractions and being able to formulate algorithms clear and concise. While Python allowed me to do that, its reliance on runtime errors as opposed to compile-time always bugged me.

During the 2010s, I settled on using Python on the server, and Objective-C on the client – still dreaming about a language I could use for both.

Fast-forward to 2020.

I have been a vocal critic of Apple's new language, Swift, since its debut – for reasons which I'm not going to repeat. Three months have passed since I started learning Swift and I think it's time for a first preliminary report.

TLDR: I like it – a lot more than I have ever thought – and will from now on try to use it pretty much everywhere.

Before moving on with some details, let me also confess that I'm pretty glad having waited for so long. Judging from the outside, the road to Swift 5 was a very rocky ride. Were I to begin with an earlier version, I might have given up or wasted many hours following a language that was such a moving target – changing every year in more ways than I would have been willing to participate.

Syntax, Semantics, and Idioms

Swift is very expressive and rich in syntax, semantics, and idioms – and it has a tough learning curve. As someone who has written Objective-C for almost a decade now, let me tell you that whoever told you that Swift is more accessible than Objective-C is a downright lier. Objective-C is a very simple language, as it adds one (yes, just one) construct (and some decorators) on top of another simple language – C.

Once I was beyond my reluctance to look into it, I finally see the beauty. Swift has almost everything I have ever wanted in a programming language. Among many other features, it has

On top of that it has a REPL (Read-Eval-Print-Loop), which can't be praised enough – it is the #1 missing feature in most compiled languages – and syntax for building DSLs (Domain Specific Languages).

And: It is Open Source – which is the #1 feature that has always irritated me with Objective-C.

Interoperability

I hate repeating myself. I love generic solutions. Over the last decade, I created a number of reusable frameworks that powered all the apps I wrote. It has accumulated quite a bit of stuff, as you can see here (generated using David A Wheeler's SLOCCount):

SLOC    Directory   SLOC-by-Language (Sorted)
2110719 LTSupportCore   objc=2063905,ansic=31423,java=5914,cs=3822,cpp=2772,
                        python=2397,sh=486
106939  LTSupportDB     objc=106108,sh=831
35669   LTSupportTracking objc=17443,ansic=12219,cpp=4922,java=902,sh=128,
                        python=55
30331   LTSupportUI     objc=30053,sh=278
27116   LTSupportDRM    objc=27116
9499    LTSupportBluetooth objc=9365,python=134
6143    LTSupportAutomotive objc=6143
5141    LTSupportAudio  objc=5141
4510    LTSupportVideo  objc=4510
3324    LTSupportCommonControls objc=3324
679     LTSupportDBUI   objc=679
340     LTSupportMidi   objc=340
271     LTSupportDiagnostics objc=271

One of the things contributing to scare me before switching to Swift was that I may had to rewrite all that again. But it ain't necessarily so.

Calling Objective-C from Swift

Being probably the company that has the largest Objective-C codebase in the world, Apple worked hard on interoperability. Calling Objective-C from Swift is a breeze – they'll even convert method names for you. Not much to complain here. Almost every Objective-C construct is visible to Swift.

Calling Swift from Objective-C

Calling Swift from Objective-C is a tad bit harder. Apart from having to including (generated) extra headers, the whole plane of types with value semantics is more or less invisible to Objective-C. There are ways to bridge (AnyObject), but it's cumbersome and sometimes very for generic code (__SwiftValue__).

Beyond Apple

In a surprising move, Apple released Swift as an open source project. And although the struggle of combining a product oriented software release cycle with a community oriented evolution process is sometimes obvious (you can follow the tension if you read some of the evolution threads on the Swift forums), they manage it quite well.

What catched my attention in particular was the invention of Server-side Swift and the Swift Package Manager, since these two projects have the power to replace my use of Python forever.

Foreign Platforms

My new set of swift-frameworks will be open source and also support UNIX-like platforms (to a certain degree, since Apple still has their crown jewels like UIKit and AppKit closed), hence finally I can use my reusable solutions both on the client and the server.

Unfortunately Google backed somewhat out of using Swift. For quite some time it looked like they would embrace it as another first-class language for their forthcoming Android successor. This would have been the icing on the cake, but let's see – Kotlin is pretty similar Swift, but not it.

Conclusion

I'm now familiar enough with Swift that I made the decision to go all-in, helping to improve the server-side ecosystem as I go. Speaking about which – I still miss a bunch of features, in particular first-class coroutines for asynchronous algorithms, a proper database abstraction, and a cross-platform logging solution. But what I enjoy the most is to be a part of a vibrant (language) community again. People are way more excited when it comes to Swift as they ever were with Objective-C. And this is great!





Feeling like Don Quixote


written by Mickey on 2020-06-25 Click to comment

For some years now, I have been feeling like Don Quixote fighting against windmills. This is a multidimensional feeling that has its roots in both personal and professional circumstances. With regards to personal issues, I won't go into details as I want to keep this blog free from politics, society, and economics.

With regards to professional circumstances, something that bugs me a lot is that I seem to engage in fighting wars that can't be won. Free software lost a lot of wars, most notably though in the mobile sector. As I have complained more than once before, over the last decade, the phone and tablet world has become much less free. Even big companies struggle these days and it looks like we're stuck with a duopoly for a long long time.

Today though I want to complain about one of these two players, namely the Apple development platforms. By 2013, software development for Apple devices was a lot of fun. We had a great mature language, nice frameworks, and a big market to try out all kinds of ideas and ways to make a living. For some reason though this changed, when Apple introduced the Swift programming language. It split the developer world and alienated a lot of the veterans.

The claims of better readability, performance, and what not could not be achieved. In fact, I (and a lot of people not wearing rose-colored glasses agree with me) think, what has been proposed as a way to flatten the learning curve is actually harder to learn and less readable.

For the major part of the last years I ignored everything Swift, hoping that for the remainder of my professional career (lets say 20 more years, if all goes well) Objective-C would be at least well enough supported that I could continue writing programs -- even without a vibrant open source community (since most folks have switched to Swift immediately and despite popular belief mix and match is not a thing) and proper API docs.

Last year though the first swift-only frameworks and a whole new approach for semi-declarative UIs appeared. SwiftUI -- they even named it like the programming language sigh. This year they are "moving forward" by deprecating more Objective-C frameworks and introducing SwiftUI as the one and only way in some places.

It's now clear to me: It's either I leave the platform or I stop trying to achieve perfection with a certain -- restricted -- set of tools but rather walking their rocky road. And I must confess, I still love the Apple platform so much that I give up fighting aginst the windmills and start from scratch. Learning SwiftUI. Learning Swift.

On a slightly related note: For a new contract, I have to revisit the successful build system I co-founded 20 years ago: OpenEmbedded. Though being quite rusty (left the project 11 years ago), I'm looking forward to finding out what the community made out of it.

Stay safe and healthy.





Welcome, 2020


written by Mickey on 2020-02-10 Click to comment

Here's the new decade. 2019 went by as an important year where I regained some of my health, discipline, and motivation.

Next to the inevitable iOS development, the most important milestones were the release of the 2nd edition of my Vala book and my first music album after more than two decades of inactiveness.

I'm looking forward to this decade. The best is yet to come.





Fabrique Noir – Space Travel


written by Mickey on 2019-07-22 Click to comment

I'm enjoying creating music since 1981. First on analogue synthesizers (SIEL OPERA 6) and drum machines (ROLAND TR-505), later on with digital synths and workstations (KORG M1, KORG 01/Wfd). From 1986 to 1989 I created my music mainly on the COMMODORE AMIGA. The PC platform almost killed my motivation. Switching from hardware sequencers to a software sequencer was tough for me, later on an abundance of possibilities (I earned money and bought too many devices) somewhat paralyzed me. The birth of my daughter Lara-Marie in 2011 did add a share to my "uncreative pause".

Still, I never stopped enjoying (making) music, in the meantime with Pianos, Guitars, and Ukuleles. Over three decades worth of melody and text fragments have continued to haunt me again and again ("use us, finish us, ...").

When I had health issues early this year (everything well now), I finally vowed to my self to start releasing music again. Four months later the first result of these endeavours can be seen. Originally it should've been a completely different thing, but sometimes creative processes take their own turns.

My first album after three decades of mostly idling is called "Space Travel", inspired by the legendary Apollo 11 mission from 1969. It is an electronic album and available here:

As for the aforementioned melody and text fragments… apart from one tiny sequence, there is only new material on this album. I wanted to check whether I still have the mojo before going back in time. A bit of more info with regards to the tracks is here.





Health


written by Mickey on 2019-05-17 Click to comment

When I started this blog in 1999, it contained mostly personal stuff. Blogs were a new thing, Facebook and Twitter were five respectively seven years away, and it felt appropriate to me.

Later on, I switched to english and added more about my professional projects – hence the focus moved to rather technical posts. Personal matters felt more appropriate on Facebook. In an attempt to gain back control about my content, I recently moved the blog from Wordpress to Lektor.

The next step for me is reintroducing personal matters. Not many, but now and then. I won't bother with adding tags or so, so hopefully my dear readers won't mind stumbling over non-technical content here and there.

This is the first personal matter entry.

I used to have fairly good health. Apart from being a slight bit overweight for the most part of my life and the obligatory annual cold I never had any serious issues. I went for diet once and then, but the damn yoyo effect always cought me. My height is 165cm and in the last 18 years I went from 76kg (which was okish) to 96kg (which is way too much).

Just recently I started to feel sick. I was tired more often and had a little base nervousness that had no obvious reasons. From time to time I had pressure on my ears which turned slowly into a ringing.

On the 23th of March this year, I went to bed after a tabletennis match at midnight, being almost shaky. I woke up 5 hours later and felt miserable – very nervous and with an uncomfortable level of ear pressure. I drove to the emergency hospitalization and they found out that my blood pressure and my level of blood glucose were much too high. They gave me 5mg of an antihypertensive drug and released me some hours later.

My family doctor dropped the truth bomb: I have the blood values of a 60 year old. I'm weighing way too much and need to start excercising as well as change my nutrition.

As an interesting coincidence, I'm now at the same age (47) my father died. I was eleven years old when that happens – and now I have a little daughter and a wife who both need me. I NEED TO TAKE BETTER CARE OF MY HEALTH.

This time I'm doing it for real. Since 23th of March, I lost 10kg by eating better and being more active. Here's what I did in detail:

Besides loosing the 10kg, the net effect is I'm feeling way better. My blood values are back to normal, I'm less tired, have more energy and can concentrate better. I'm going to continue with this routine until I'm back at 76kg and then try to develop a balance so that mid-term my weight keeps being stable.

So: All is good. I'm more often hungry than before, but I learned to live with it, almost embracing it, before the next meal is due.

This is what I wanted to share with you. Look after your health, don't neglect it.





Converting Wordpress Posts To Lektor


written by Mickey on 2019-02-19 Click to comment

As promised in the previous installment of this column, I have now imported all my old blog posts from Wordpress. In case you have a similar requirement, here's how I did it:

1. Export your posts from Wordpress. Login to your Wordpress administration interface and then click on Tools → Export Data. Select the content you want to export (blog posts in my case) and you will download an XML file with all your content. Here's a fragment for a single post without comments:

<item>
        <title>A New Blog</title>
        <link>https://archive.vanille.de/a-new-blog/</link>
        <pubDate>Wed, 14 Jun 2006 02:31:04 +0000</pubDate>
        <dc:creator><![CDATA[mickey]]></dc:creator>
        <guid isPermaLink="false">http://www.vanille-media.de/site/?p=5</guid>
        <description></description>
        <content:encoded><![CDATA[Finally, in coincidence with my new site <a title="VanilleMedia" href="http://www.vanille-media.de">VanilleMedia</a>, I started a new blog. It's not that I was unsatisfied with my last handcoded one, but these days it looks like there is a tendency to use all those nice planet sites -- i.e. <a title="planet.linuxtogo.org" href="http://planet.linuxtogo.org">planet.linuxtogo.org</a> or <a title="planet.maemo.org" href="http://planet.maemo.org">planet.maemo.org</a> -- syndicating blogs from different places, which needs a standardized XML format. I really didn't want to reinvent the wheel here, so after evaluating a lot of content management systems and blog packages, I settled on using wordpress for the complete site.
This also marks the start of me blogging in english -- I guess blogging in german wouldn't be all that useful for most of those planet sites.]]></content:encoded>
        <excerpt:encoded><![CDATA[]]></excerpt:encoded>
        <wp:post_id>95</wp:post_id>
        <wp:post_date><![CDATA[2006-06-14 04:31:04]]></wp:post_date>
        <wp:post_date_gmt><![CDATA[2006-06-14 02:31:04]]></wp:post_date_gmt>
        <wp:comment_status><![CDATA[open]]></wp:comment_status>
        <wp:ping_status><![CDATA[open]]></wp:ping_status>
        <wp:post_name><![CDATA[a-new-blog]]></wp:post_name>
        <wp:status><![CDATA[publish]]></wp:status>
        <wp:post_parent>0</wp:post_parent>
        <wp:menu_order>0</wp:menu_order>
        <wp:post_type><![CDATA[post]]></wp:post_type>
        <wp:post_password><![CDATA[]]></wp:post_password>
        <wp:is_sticky>0</wp:is_sticky>
        <category domain="category" nicename="general"><![CDATA[general]]></category>
</item>

2. Convert the XML file into individual markdown files. For this step, there are a number of tools. I settled on pelican-import, which is a part of the Pelican static site generator. Call it like that:

pelican-import -m markdown --wpfile -o posts vanille-archive.xml

and it will convert all your blog posts into individual files like a-new-blog.md:

Title: A New Blog
Date: 2006-06-14 04:31
Author: mickey
Category: general
Slug: a-new-blog
Status: published

Finally, in coincidence with my new site [VanilleMedia](http://www.vanille-media.de "VanilleMedia"), I
started a new blog. It's not that I was unsatisfied with my last handcoded one, but these days it
looks like there is a tendency to use all those nice planet sites -- i.e.
[planet.linuxtogo.org](http://planet.linuxtogo.org "planet.linuxtogo.org") or
[planet.maemo.org](http://planet.maemo.org "planet.maemo.org") -- syndicating blogs from different
places, which needs a standardized XML format. I really didn't want to reinvent the wheel here, so
after evaluating a lot of content management systems and blog packages, I settled on using wordpress
for the complete site. This also marks the start of me blogging in english -- I guess blogging in german
wouldn't be all that useful for most of those planet sites.

Note that this process makes you lose the comments from your readers. These comments are super-important for me, so I will soon start working on enhancing pelican-import to render the comments (into a seperate markdown file) as well.

3. Adjust the markdown files to make them work with Lektor. Lektor expects a slightly different format for the frontmatter, so I wrote a quick'n'dirty python script to adjust the necessary things. Here's the script pelican2lektor.py:

 import os

 postnames = os.listdir()
 for postname in postnames:
    print( f"Converting {postname}...")
    lektordirname = os.path.join( "lektor", postname )
    lektorfilename = os.path.join( "lektor", postname, "contents.lr" )
    os.makedirs( lektordirname, exist_ok=True )

    postlines = open( postname ).readlines()
    header = postlines[:6]

    meta = dict()
    for line in header:
        stripped = line.strip()
        key, value = stripped.split(": ", 1)
        key = key.lower()
        meta[key] = value

    date = meta["date"].split()[0]

    post = """title: %s
---
 author: %s
---
 pub_date: %s
---
 body: %s
 """

    post = post % ( meta["title"], meta["author"], date, "".join( postlines[6:] ) )

    with open( lektorfilename, "w" ) as outfile:
        outfile.write( post )

Running this creates a lektor directory with the appropriate subdirectories – one for every blog post – and the corresponding contents.lr files:

 title: A New Blog
---
 author: mickey
---
 pub_date: 2006-06-14
---
 body:
 Finally, in coincidence with my new site [VanilleMedia](http://www.vanille-media.de "VanilleMedia"), I started a new blog. It's not that I was unsatisfied with my last handcoded one, but these days it looks like there is a tendency to use all those nice planet sites -- i.e. [planet.linuxtogo.org](http://planet.linuxtogo.org "planet.linuxtogo.org") or [planet.maemo.org](http://planet.maemo.org "planet.maemo.org") -- syndicating blogs from different places, which needs a standardized XML format. I really didn't want to reinvent the wheel here, so after evaluating a lot of content management systems and blog packages, I settled on using wordpress for the complete site.
 This also marks the start of me blogging in english -- I guess blogging in german wouldn't be all that useful for most of those planet sites.

As long as there are still some content errors (missing comments, broken links, missing images, bogus format statements, etc.) left – which I will hopefully fix over the next days – I'm going to leave the archive @ archive.vanille.de intact.





From Wordpress To Lektor


written by Mickey on 2019-01-21 Click to comment

Every five to six years I'm revamping my website. This is now the 4th major incarnation.

I created my first website somewhere in the 1990s – back then handcoded with HTML. I vaguely remember that it looked better than many others due my use of Bitstream's TrueDoc Technology.

In 1999, I started my blog. It was a custom development based on the web framework Spyce, something like PHP using Python. To create a new article, I just copied a new file to a dedicated directory and it appeared after reloading the page.

Some years later facilities like HTML-based live editing and a proper management interface teased me into migrating the site to Wordpress. Apart from adding content and switching themes once and then, nothing groundbreaking happened though.

The longer I had used Wordpress the more I felt uneasy about the "lack of control". I missed maintaining my site with a revision control system. I also fell in love with Markdown as a more agnostic and future-proof way to format articles. And – last but not least – to be honest, I feel that a site that only changes about once a month does not need to be dynamically generated.

So I made the decision to get rid of Wordpress and come back to something way more simple. In the meantime, a lot of static site generator (SSG) projects have appeared and so I had a wealth of projects to choose from. Due to my unstoppable love for Python, I chose Lektor.

Although automatic export and import facilities are available, I decided to more or less rewrite the site, thus I did not integrate the older articles yet. I really plan to do this though. Until then you can get to the old site via archive.vanille.de.