All Medium stories moved here

I have a Medium profile available here https://medium.com/@damianmarkowski. I used to have 5 articles published there but today I decided to move 4 of them here, to damianmarkowski.com/blog and delete 1 of them permanently since it was written specifically for Medium, it was about using an OpenAI API in an educational mobile app but it was not providing a lot of value.

Why did I publish those stories on Medium in the first place? The only potential advantage of using Medium as an article publisher tool for me was hope that it may give me audience, people that may potentially read my stories. Let’s have a look at some data, if it really gave me a lot of readers.







Those numbers are not horrible but not amazing neither. I could get the same number of views on my blog, here, without Medium readers. There are also a few other advantages of publishing posts only here:

  1. Monetisation – I show Google AdSense ads here so every time someone reads one of my posts I make some money,
  2. Full control over my content – I don’t need to make any backups of my posts, I don’t need to be worried that maybe at some point Medium decides to shut down their service and all my posts will be gone,
  3. Personal brand – having all my posts here works much better for building my personal brand, here posts are a part of the whole damianmarkowski.com service and also a URL for every post starts with damianmarkowski.com/blog/ not with https://medium.com/@damianmarkowski/.
  4. More focus on blogging – I’ve been focused on investing quite a lot of money in my product in the last 2 years but I decided to stop that, ROI was not big enough unfortunately so I want to focus on sharing my knowledge now, I want to be investing my time instead of money now and that’s consistent with moving all my content to damianmarkowski.com/blog.

Just to conclude this post, here are the links to the posts that I moved from Medium:

  1. Why I stopped using SwiftUI and AWS in my personal project
  2. iOS Developer – preparing for a recruitment process, part 1: CV
  3. iOS Developer — preparing for a recruitment process, part 2: technical screening
  4. iOS Developer — preparing for a recruitment process, part 3: technical interview

 

TimeZone.current on iOS

Where does a value for TimeZone.current (https://developer.apple.com/documentation/foundation/timezone/2293341-current) come from in Swift? I spent some time on checking that this weekend. A list of the time zones changes at least several times a year, it’s not constant. There is this article https://zachholman.com/talk/utc-is-enough-for-everyone-right that explains the “why” for that in a very nice, fun and detailed way. I really recommend reading that article! It’s quite long but super interesting 😀 The time zone list changed on the 4th September 2024 last time (https://www.iana.org/time-zones) so just a bit over 3 months ago. So maybe TimeZone.current makes some network request to check a current version of that database? What if a user’s device isn’t connected to the Internet? What’s a default value then?

Let’s have a look at the Foundation framework’s source code here https://github.com/swiftlang/swift-corelibs-foundation and more specifically saying an NSTimeZone.swift file. So there is this line

_timeZone.abbreviation(for: aDate)

there which – if we follow a chain of calling the functions – calls a C function called __InitTZStrings() from a CFTimeZone.c file later on. And now, what does __InitTZStrings() do?

static void __InitTZStrings(void) {
    __tzZoneInfo = CFSTR(TZDIR);
    __tzDir = TZDIR "zone.tab";
}

It creates a path to a file with the time zone list! That’s it, we found it!! 💃 So there is a constant value for a directory path called TZDIR and its value is the following (you can find it in the same file, CFTimeZone.c):

#define TZDIR	"/usr/share/zoneinfo/"

and then a zone.tab filename is just appended to that path so the answers to the questions that I put at the beginning of this blog post are:

  1. TimeZone.current doesn’t make any network requests to get an updated list of the time zones.
  2. Apple keeps that value in a /usr/share/zoneinfo/zone.tab file on iOS.
  3. Given point 2 – if you don’t update a version of the iOS system on your iPhone – you may have an outdated time zone list on your phone.

We may just try to answer the very last question in this post: what is a .tab format?

The .tab format on iOS refers to the tab-separated values in a text file, represented by the UTTypeTabSeparatedText (https://developer.apple.com/documentation/uniformtypeidentifiers/uttypetabseparatedtext) identifier in Apple’s frameworks. That type of a file contains data where fields are separated by the tab characters (\t). That format is widely supported across the iOS, iPadOS and macOS apps for handling structured data and it’s often used for the spreadsheet exports or data transfers.

GitHub profile cleanup

A few weeks ago, my friend sent me a few screenshots showing quite funny descriptions of my public GitHub repositories. Those descriptions were generated by https://github-roast.pages.dev. I had 19 public repos at that time. Those screenshots and descriptions reminded me how much out of date and untouched for a long time my GitHub profile was. So I decided to fix that.

After a cleanup, I have only 2 public repos now:

  1. https://github.com/DamianMarkowski/ios-security,
  2. https://github.com/DamianMarkowski/BuckSample.

I believe both of them may be useful for at least some people. Moving forward, I will be adding and hopefully maintaining more public repos with the code focused on algorithms and data structures.

Code reviews – how to approach them

We do it (almost) every day, we review someone else’s code and our code is being reviewed by our colleagues. It might be a bit tricky for junior developers to get used to it at the beginning though. Let’s write down some useful tips about code reviews.

  1. We do it to improve a codebase.

    A main purpose of a code review is to get a feedback on your code from a colleague from the team. The is no developer who writes perfect code, we all sometimes miss something, forget to test some edge case or commit some unneeded code. This is why code review is helpful – you get someone else looking at the same code, someone who approaches code in a bit different way, who tests different cases, someone who didn’t spend on your branch 4 last days and looks at it with a fresh mind.

  2. Try to teach, not blame.

    Blaming someone because of not perfect (in your opinion) code doesn’t help anyone. It destroys that code author’s day, it destroys your day too. Try to phrase your comments in a way you would like to get feedback too, the way it can be useful, full of knowledge. I think it often sounds nicer when you use plural form rather than a singular one while requesting some changes: for example “Can we move it to a class level?” rather than “Can you move it to a class level?”. It shows that the author of the code is not left alone, that you are trying to improve this code with them.

  3. Link documentation pages, blog posts.

    Different developers have different opinions how particular code could be improved, changed. There are many cases when it’s just subjective, there are a few different opinions and none of them is the only “right” one. On the other hand, there are certain well known patterns, that experienced developers just use automatically. Less experienced developers might not know about them. While trying to suggest such options try to give a link to documentation page, blog post or similar. It may have one nice side effect – author of the code may save this link in their notes, keep it for the future and learn quicker.

I think I will conclude the post at this point. Feel free to add your own tips in comments. Happy code-reviewing 🙂

3….2….1…. Advent of Code 2018!

This year I’m taking part in Advent of Code online challenge for the first time. The rules are really simple – there are 2 coding puzzles every day starting on the 1st of December till the 25th of December. I will be pushing my solutions to the following repository https://github.com/DamianMarkowski/Advent-of-Code-2018-puzzle-solutions.