23 Feb 2020

Rotten Tomatoes ratings exporter

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

I have rated a lot of movies on Rotten Tomatoes and I'd like to export them to a text format. I also know PHP. How can I do that?

In 2013 I wrote Rotten Tomatoes ratings exporter for the purpose of exporting the movies I had rated into a format I could read and also store.

To automate the process of acquiring the ratings, I wrote a small class which needs information available in the site's cookies once you are logged in. With this information in hand, it is then possible to fetch the ratings from the website and store them in any desired format, given that the data returned to you is a plain PHP array.

22 Feb 2020

IMDb ratings importer

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

I have movie ratings that I would like to import into IMDb. I also happen to know PHP. How can I do that?

In 2013 I wrote IMDb ratings importer for the purpose of importing ratings I had created in another system (Rotten Tomatoes). I wanted to import my ratings into IMDb so that I could use their statistics reporting tools, which let you see your distribution of ratings and the distribution of the release year of the movies you've seen. A friend of mine also had his bot send a message to our discussion channel whenever one of us would update their ratings after watching a movie.

The library is pretty straightforward. It expects you to provide it with a string that uniquely identifies your cookie on the server side. With an array of all the titles and ratings that you have, you can submit those ratings and the library's importer will take care of calling IMDb by finding the closest movie title and assigning it the desired rating.

21 Feb 2020

Visual Studio Code Emoji extension

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

I use Visual Studio Code as my main editor and I am on Windows 7. I like to use emojis but those aren't properly rendered under Windows 7. Can I have pretty emojis in Visual Studio Code somehow?

I developed an extension in 2018 called Emoji which uses EmojiOne emojis to replace their non rendered equivalent in Visual Studio Code.

To do this, the extension makes use of the createTextEditorDecorationType method available on the window object in order to inject CSS that adds a background image where the text emoji would be rendered.

The extension listens to two events to determine in which editor it needs to do the replacement: window.onDidChangeActiveTextEditor and workspace.onDidChangeTextDocument. In the first case we update the editor that is now the active one, in the second, we update the active document when the text content changed.

Without the extension

With the extension

20 Feb 2020

Learning topics that are overwhelming

History / Edit / PDF / EPUB / BIB / 3 min read (~523 words)

I want to learn a new topic but it feels overwhelming. How can I do it?

When I wanted to learn about artificial general intelligence (AGI), I knew almost nothing about the field. I had a background in software engineering and I was curious about intelligence as a whole, but I had no clue what I would need to know in order to work on artificial general intelligence.

My initial approach was to read a lot about the topic. It allowed me to learn about a variety of concepts and the vocabulary associated with AGI. However, as I was doing that, I felt overwhelmed by the amount of information I would have to learn. In 2014 I was reading Artificial Intelligence: A Modern Approach, then in 2017 the Deep Learning book. It was hard to reconcile how the new concepts I was learning and how they were all connected.

At the time I already knew of mind maps. I thought it would make sense to try and map out all the knowledge I had acquired so that I could make sense of it and be able to refer to it as I would work.

I initially built a very large concept map using yEd that included everything I could think of that touched on the topic of AGI: machine learning, mathematics, computer science, neuroscience, etc. As the map got larger and larger, I started thinking about how I would organize it so that it was clearer to understand and that it was possible to progress through it if someone else wanted to learn from my experience. Thus, I extracted the machine learning, computer science and mathematics concept maps to their own respective concept maps.

The approach has been to spend time to write down what I knew, create a node in the graph with the term, then try to associate it with other terms already in the graph. As I learned new terms I would add them to the graph. I would also dedicate a bit of time during the week to try to brain dump whatever I might have learned or I knew about that could be added to the graph. This is an iterative process, so the graph itself is never really completed. However given this graph, it is now possible to know what I have already explored and the areas where I need to do more exploration because my understanding is lacking.

19 Feb 2020

Omnifocus "ofocus" format

History / Edit / PDF / EPUB / BIB / 3 min read (~475 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.