KISS 🇺🇦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

Segregating useless built-in OS X applications

| comments

OS X is a nice and (mostly) stable operating system overall. However Apple puts so much crap and junk that may not be for everyone and that cannot be officially uninstalled. There is a bunch of standard applications and there is also a lot of standard daemons, some of which are trying to get network access to contact Apple (keyboardservicesd, studentd, seriously?!).

I don’t like having unnecessary stuff in my system and would prefer to get rid of it. I’m not sure about removing built-in applications completely, unfortunately that may have bad consequences to the stability of the system. But at least when I open the /Applications/ directory, I don’t want to see them. So a simple solution is to move them to /Applications/junk/.

The set of applications that are useless (junk) for you is your personal choice. For example: FaceTime, Home, Messages, News, Photo Booth, Siri, Stickies, Stocks. This post is how to move them away.

A few tips about Xcode’s Instruments

| comments

Time Profiler in Instruments (along with other instruments) is a great tool for profiling iOS application. It has a number of options, which are not described anywhere. The official documentation only touches the surface of Instruments; there is more information in WWDC videos, but it’s not quickly accessible in that form. Here’s a short list of findings that I inferred myself:

Xcode’s Instruments doesn’t show symbolicated stacktraces

| comments

Xcode’s Instruments is a very useful tool to profile and analyze iOS applications. For example, you can use the Time Profiler instrument to figure out which functions use the most CPU time: you see all the captured stacktraces with the number of samples for each function in the bottom half of the Instruments window. The list is supposed to show symbolicated stacktraces, that is actual function names like UIViewController.viewDidLoad() instead of their addresses in memory like 0x10c100f87, and this works most of the time until you change something and it breaks.

Keyboards on the iOS lock screen

| comments

Apple’s iOS is definitely a user-centric mobile operation system (for regular users, not so much for geeks and hackers). Its thoughtfulness also goes beyond the UI as I’ve discovered an interesting feature about the keyboards on the lock screen.

Replacing iOS application container in terminal

| comments

Xcode has the “Devices and Simulators” window (Cmd+Shift+2) where you can see the applications installed on your iOS device and more importantly can download and upload a data container for an application that you’re developing. That container contains all the data generated by that application, so that for example you can get it into a certain state where you see a bug, save it and then restore it back to device as many times as necessary. The only official way to do that is via this Xcode’s window, however I find it clumsy because you need to open the window, select the application, click the gear icon, select “Download container…” in the popup menu, select where to save it, wait and after a while a new Finder window will be helpfully open, but stealing the focus of course. This whole process is much easier with the iOS Simulator, but sometimes you just need to use the app on a real device.

As alternative, there is this great program called ios-deploy, which can almost replace a container on the device. There are a few questions on StackOverflow, like this one, about programmatically uploading/downloading an app container, however none of the answers provide a complete guide. Here I describe my recent experience with replacing an application container in the command-line using ios-deploy.

fixtags is deprecated

| comments

My fixtags script is an extension for gPodder to automatically fix the MP3 tags (of the known podcasts) so that the Sandisk Sansa Clip+’s official firmware would properly recognize them. More information about this is in my old post. There are no new firmware versions anymore and the player seems to be discontinued.

I’ve started using Rockbox on my player a few years ago and it’s better and has many more features than the stock firmware. Here are some of the ones I’m using:

Airplane mode on iPad doesn’t work?!

| comments

This title reflects my utter surprise when I tested an iOS application on a connected iPad, turned on Airplane mode to terminate the application’s connection with the MacBook Pro… but it continued to work. The iOS application runs a server, publishes it using Bonjour (aka DNS-SD) and a client on the network (my macbook in this case) connects to it. To test some scenarios, I need to block the connection and the natural way is to enable the Airplane Mode or disable WiFi, but neither worked. This was very bizarre.

Thread Sanitizer reports null symbols

| comments

Clang has this useful tool called Thread Sanitizer that can detect data races in a program and Xcode makes it easy to use it by providing the “Thread Sanitizer” checkbox in the scheme’s Diagnostics page for Run and Test actions. I needed to run an iOS program with the TSan to see if it would find anything. It did, but all the stracktraces showed only <null>s instead of all symbols, so they weren’t at all clear. I’ve found a workaround how to see that information using breakpoints.

Removing unexpected event attendees in Thunderbird

| comments

I’m using Thunderbird as the email client for a few mailboxes. It’s a generally nice client (I like the keyboard shortcuts), but with a few rough corners. For example, I got a calendar invitation once and clicked Accept, but the acceptance email was sent from a different account. It wasn’t a very big deal in that case, but still quite uncomfortable.

I’ve been burned once there, so when I received another invitation, I clicked Accept without immediate response. Then there is the “Details…” button when you select the invitation email… and I saw the wrong email again. So the bug isn’t fixed yet (at least for my use case). This question was asked here: https://support.mozilla.org/en-US/questions/1206863 with reference to bug 589081.

Since you don’t use Lightning, you can’t change the Email entry in Calendar Properties, so at the moment it seems the only option is to set another account as Default in Account Settings/Account Actions. This is only worth doing if all invitations are sent to the same account.

This is good enough for me (at least for now). To do that, I right-clicked on the mailbox and opened “Settings”; then there is the “Account Actions” button in the bottom-left corner where you can “Set as Default” the correct account. I did that, clicked Accept without sending a response again and the Attendees section in the invitation details window now showed the correct accepted email. Success? Not yet, because that section also showed the old, wrong email as accepted too. I was afraid that in this state Thunderbird would send emails from both the accounts about the acceptance. But how do you remove that old attendee?

I tried changing the default email back to the previous account and declining the invitation, but the program continued to display both. There is no way to do anything with the attendees in that window. So time to dig deeper.

Creating an XCTest extensions target

| comments

The iOS application I’m working on is complicated and consists of multiple frameworks (which correspond to targets in the Xcode project), each one for a separate piece of functionality. Therefore we also have a number of testing targets, roughly one test target per framework. XCTest is the standard testing framework for iOS applications in Xcode, however it’s quite limited, it only has a number of basic assertions. It’s useful to create our own higher-level assertions to make the testing code more expressive. Then the question becomes, how to share those common assertions between multiple test frameworks? Well, create a new framework (target) with those assertions, of course! Alas, it’s not that simple when you need to import XCTest in that framework. I’ll show here how I made it work.