20 Feb 2020

Writing one article per day

History / Edit / PDF / EPUB / BIB / 2 min read (~212 words)

What are the benefits of writing one article per day?

The main benefit I get from writing at least one article per day is that it forces me to spend time to think about a single question and to write down and express my thoughts clearly.

It allows me to practice my writing abilities, even though I use them daily to write down notes. It forces me to ask myself whether my grammar is correct and whether what I wrote makes sense, which is something I care a lot less about when I write down notes.

It lets me get into the habit of writing daily, so that writing and communicating doesn't feel like it requires a lot of energy.

I see writing one article per day as a habit to acquire in order to be able to write more effectively and communicate better. It is like exercising regularly. The purpose is to keep the muscle of writing alive and strengthening it slowly over time. By writing a lot we slowly acquire a voice that we can work to change and improve. Just like processes that are made explicit can be improved, so can communication be improved by spending time to write down what you want to share with others.

20 Feb 2020

Omnifocus "ofocus" format

History / Edit / PDF / EPUB / BIB / 2 min read (~391 words)

I use Omnifocus but I'd like to have access to the underlying data and use it in another application. How can I do that?

The first step to solve this problem is figuring out if we can access the underlying data easily. Sometimes we're lucky and the data is just a single file with the data in a format that we need to manipulate a little. In other cases, like for the ofocus format, files are organized in a single directory that contains zip archives. Unzipping some of those files we can observe there are two kinds: a master file and many transaction files. By playing around a bit with Omnifocus, we can make all the transactions files disappear, effectively merging them into the master file.

The next step is to look at the content of the master file. This file contains most of what we would expect to find when we use Omnifocus, namely contexts, folders and tasks. By inspecting multiple copies of the same type of entry it is possible to collect the different attributes that constitute them and whether some are optional while others are always present.

When I tried to reverse-engineer the format of ofocus files, I used my own database which contained many entries. This allowed me to quickly find most of the attributes of each type of entry. Another approach would've been to start with a clean database and to create each of the types of entry and create two variants: one with all the attributes defined, the other one with the least amount of attributes necessary.

Once the structure of those entries is identified, it is not too difficult to use reasoning to determine from where certain values come from. In some cases, values are references to other entries, similar to how you would have foreign keys in a database.

With all this knowledge now available to us, it is easy to simply convert the XML file into a JSON file. Once the data is available in JSON, it's slightly easier to work with it in PHP than using XML. By understanding the structure and relationships within the data, it is possible to make use of this data to build your own application that would reproduce the hierarchy of folders/tasks that are displayed inside Omnifocus.

19 Feb 2020

Reading one Wikipedia article per day

History / Edit / PDF / EPUB / BIB / 2 min read (~207 words)

What are the benefits of reading one Wikipedia article per day?

From my experience so far with reading one Wikipedia article per day, I've enjoyed learning about topics I had not looked into for a long time.

I find biology, and more specifically genetics, highly interesting from a programmer's perspective because I see DNA as code and it makes me wonder how Nature developed this code.

I also find astronomy and everything related with space (space travel, planets, organization of space) also deeply interesting because I rarely spend any time thinking about it, yet I used to watch a lot of TV shows on parallel universes, string theory, etc. which I found fascinating.

I've spent some time reading on statistics as well since it is a tool I use daily at work and I think it is important that I master it as much as possible. Wikipedia allows me to explore and discover new topics that are related to statistics, something which might be a lot more difficult to do by simply reading books.

I think that as long as you add variety in what you read, Wikipedia will provide you with a lot of information and additional references that might be interesting to investigate.

19 Feb 2020

PHP semantic versioning checker

History / Edit / PDF / EPUB / BIB / 2 min read (~310 words)

I use semantic versioning 2.0.0 for my PHP libraries and I'd like to know when I generate breaking changes to my code. I would like to have a tool that tells me when that happens, as soon as possible so I can avoid creating backward-incompatible changes.

In 2015 I was working on a lot of PHP code and releasing various libraries as well as using a lot of libraries which were not always respecting the semantic versioning 2.0.0 rules. I understood that it was difficult to keep track of all the changes done to a codebase and that you needed a certain level of expertise to tell what kind of semantic versioning impact changes had. I knew that most of the semantic versioning rules however were rules that could be codified such that you could run a program that would look at a before and after snapshot of a piece of code and tell you how it changed. Those changes could then be categorized according to what they changed, and based on the semantics of semantic versioning, a semantic versioning change could be generated for the code change itself.

Thus PHP Semantic Versioning Checker was born. It analyzes a before and after snapshot of a directory of source code and generates a report of all the changes that occurred. It is then possible to review all the changes by their type (class, function, method, trait, interface) and their semantic impact (major, minor, patch, none). It also computes a suggested versioning change, which is the highest semantic impact found amongst the different types inspected.

I hope that this library and the concept of scanning source code for semantic versioning changes becomes more mainstream, such that every project runs this kind of tool as part of their CI pipeline.

18 Feb 2020

Tracking my readings

History / Edit / PDF / EPUB / BIB / 1 min read (~178 words)

Why do I track how much time I read and how many pages I've read?

It allows me to have an idea of how long a book will take me to read. It also allows me to determine over time if I'm getting slower or faster reading books by using a website like How Long to Read. While the website says that reading a book such as Liu Cixin's Death's End should take 10h to read to the average reader at 300 WPM, it took me more than 20h to read it, which means I'm a very slow reader and that I read at less than 150 WPM.

The benefit of knowing how long a book will take me to read is that I can decide if I want to actually spend that time finishing the book or not. When a book is good, this question is not considered, but when it is bad, it is important to decide whether spending more time is a worthwhile use of my time.