Tabs or spaces

I used to be a tabs guy ages ago. Then switched to spaces. I don’t actually remember why and when. Maybe after arguing about this among fellow programming teachers at the university.

The debate around tabs versus spaces, some times quite heated, has been mostly about programming style. But today I saw a tweet that has a relevant argument for using tabs. Programmers using screen readers or braille readers lose valuable space because of spaces (pun intended).

Understandably it takes more space (!) and time to read e.g. nine spaces than three tabs, assuming the tab is configured to match three characters. It is all about accessibility.

So, I will be converting back to using tabs when indenting code.

Strange weather

The weather app in iPhone has strange opinions about the daylight in my home town.

It gets barely dark here due to sun being below horizon only a couple of hours. But this tile shows something completely different…

Verified that the same thing happens in at least three other iPhones when adding the city of Oulu in Finland to the Weather app.

Filed a bug report to Apple.

Update: the issue is clearly because here, at mid summer, the Sun sets after midnight and then rises a couple of hours later. Now (July 7th) when the Sun sets just before midnight, everything looks as it should. The weather app just can’t handle this.

New version of SortSpectacle

My sorting algorithm learning tool / demo app SortSpectacle now includes a new method, Block sort.

Block sort is a variant of Merge sort. Merge sort uses additional arrays to recursively divide the original array into smaller arrays which are then sorted and combined to a final sorted array.

Block sort is an in-place variant of Merge sort. It uses a small cache to move elements around. Thus it is more memory efficient than Merge sort. And according to the demo app, also quite fast.

I still need to implement the step-by-step version of the algorithm — without it the execution is not animated. But if you take a look a the implementation (a Swift port I did based on the Java code WikiSort implemented by Mike McFadden), you can see that it will be quite a challenge to do…

Also it was quite nice to read in Twitter that someone is actually using my sorting algorithms in their own Swift/SwiftUI app to demonstrate the new SwiftUI Charts in action!

Anyhows, here’s a YouTube demo video showing the new version in action: