About Blog Notes Photos Portfolio

June 2020

Notes ยท Jun 1, 2020

Table of Contents

SQLDelight on Server

SQLDelight simplifies database interactions but it’s not just another ORM library. Instead of trying to abstract away SQL, it takes quite an unorthodox approach by encouraging you to use vanilla SQL for every query. Why bother with a library then? Well, we still need to transform our SQL queries into nice type-safe data objects and that’s exactly what SQLDelight does. I use SQLDelight in every Android app I make. Why only Android? For a long time, the only SQL dialect supported by SQLDelight was SQLite so Android and Kotlin Native were a natural fit for such a tool.

Time flies and now SQLDelight also supports PostgreSQL and MySQL dialects. I’m planning to use it with a PostgreSQL database in one of my projects. This feature is still in beta but I’m feeling lucky. Let’s see how that goes.

Another thing to note is the fact that SQLite by itself is not incompatible with servers. I maintain a small open source project that stores a list of bitcoin accepting merchants and provides a simple API to that data. It has a few thousand users and this kind of load is totally OK with SQLite so I tried to use it for that project and it works like a charm. It also simplifies code testing and database management so it can be a nice server side database for certain kinds of projects.

Migrating to Vanilla CSS

I don’t make web front-ends often and, honestly, I would prefer not to do it at all. That said, I still have this website as well as a few blogs and landing pages to support so I don’t have much of a choice. I have no time and no interest in trying dozens of different CSS frameworks in search for the Holy Grail so I’ve been using the most mainstream solution for a while. Of course, I’m talking about Bootstrap.

Bootstrap is cool. It’s customizable, it’s not too verbose and it just works (in most of the cases). The only thing that annoys me a lot is the fact that it needs crazy amounts of JavaScript for no good reason and I’m not a big fan of bloated web-pages. Over-sized web-pages is a huge problem and I don’t want to be a part of it.

The Bootstrap contributors understand those complaints and they cut down on JavaScript in of Bootstrap 5, which is still in development. First, I wanted to switch to Bootstrap 5 but then I thought “why don’t I try vanilla CSS?”. One weekend later, it turned out that it’s pretty easy to use vanilla CSS and it actually made it easier for me to experiment with website styling. There is some comfort in not having to manage NPM dependencies and it’s a pleasure to build directly on the well thought standards that are aimed to last for decades. Software tools are so ephemeral nowadays, maybe it’s better to cut down on navel-gazing a bit, at least in the area I don’t really like.

Goodbye, Joda-Time

The first language I used professionally is Java 6. Even at that time it was already considered old and obsolete. Some of its native APIs is a pure horror, and that’s why the open source community created a lot of libraries that make Java 6 developer’s life a bit more pleasant. Joda-Time is still a great success, mostly because of a total failure which is a time API used in Java 6 and 7.

Old habits die hard, I guess. So, in June 2020 I finally decided to check if there are better tools than Joda-Time. Why change the things that work? Well, at least it would allow me to cut one more external dependency, which is already a good move in my book.

After doing some research, I ended up switching to Java 8 time API. It looks like it borrowed heavily from Joda-Time, which is pretty nice. Nothing to add here, really. It just works. The only difference is that my dependencies list had shrunk by one line. What a great use of human effort.

Movie: Chicago Boys

Chicago Boys is a controversial documentary that touches some extremely hard and deep questions. It also shows us how good economic policies can lift countries out of poverty.

Economic reforms are hard and painful. They tend to lead to better outcomes for the majority of people, but it doesn’t mean some people won’t get hurt in the process. That’s exactly what happened in my birth country in 90-s and that’s also what happened in Chile in 70-s and 80-s during the rule of Augusto Pinochet. He transformed Chile from a socialist shithole into a Latin America’s leading economy. Now let’s talk about the price of this economic miracle.

It turns out, the price is about 3,000 people’s lives, at least. Augusto Pinochet killed a lot of people and destroyed a more or less functional democracy. Was it a right decision? Taking down a socialist government before it starts a full-scale terror campaign against it’s own population, as they always do, may help to prevent millions of deaths so breaking this system while it’s weak seems like a rational act but it also obvious that the majority of those victims weren’t really a threat.

Here is the example. Western powers didn’t help Russia enough to defeat the communists during the civil war. That would have prevented a lot of suffering, needles to say it would also saved a lot of money that were spent waging the Cold War. What I’m trying to say is it’s extremely important to consider the price of both options before making any judgments about certain decisions that were made in the past. Sometimes people face hard choices and inaction is not the best kind or a response.

Of course, I don’t know many details but after watching that movie I remained convinced that those deaths were absolutely unnecessary. It seems like an emotional act rather than a rational calculation. Destroying a sick democracy? Why not, there is no point in maintaining a system that doesn’t work for a particular country in a particular period of time. Killing people for no good reason? That looks like a crime.

As history shows us, sometimes there is a good reason to suppress a group of people by all means necessary and people may be forced by their beliefs to embark on such gambles. DEA believes that the people involved in the drug trade are evil and pretty much everyone believes that terrorists are evil so there are always some groups that, in our opinion, are malicious and therefore deserve to be wiped out (as a preventive measure of course). It just doesn’t seem to be the case when it comes to Chile, because those socialists seem to be pretty toothless and they clearly lacked popular support. It all looks like a consequence of mixing paranoia with centralized power. Russia also suffered from this kind of injustice during the years of Stalin dictatorship.

Game: Disco Elysium

Honestly, I don’t know why I still play video-games. For people of my age, it’s more orthodox to satisfy all of the digital entertainment needs by using Netflix and Spotify. I have both, but I don’t use them often. Yea, I’m a pretty boring workaholic.

That might be true, but I would argue that modern music, movies and video-games are also pretty boring. Once you consume enough of it, it all starts to look like an endless stream of deeply familiar patterns. I didn’t have high expectations of Disco Elysium and this game exceeded my expectations by quite a bit.

The thing that sold it to me was an “Open World PRG” label. It’s easy. See an open world RPG? Buy it. It works for me every time. Well, almost every time. I was expecting something like Diablo (I don’t know why, isometric view, maybe?) but I was faced with something closer to a quest game. This game is not based on fighting, it’s based on dialogs and the real beauty of Disco Elysium is the topics you have to discuss with different NPCs populating the game world. Expected fights? Here is some dark humor and philosophical ramblings instead. Unexpected. Wow, that’s something new. I rarely finish a game and I must say, I enjoyed every minute of it and there are many minutes in 35 hours.

SQLDelight   CSS   Movies   Games

This page doesn't show ads and the reasons are simple:

  • Most people don't want to see ads (what a surprise)
  • Ads can track you and violate your privacy
  • Ads is the main reason why many websites are so slow

If you find this content valuable or you want to see more content like this, you can leave a tip with bitcoin:

34CXtg7c4Vbw8DZjAwFQVsrbu9eDEbTzbA
bitcoin tips QR