Sirens

2022-09-10

The sound of police sirens.

If it’s an ambulance or firefighters, that’s cool. But with police or politicians, it always annoys me. Who are you, so important you have to disturb my and other peoples’ peace?

Well, I watched King Charles’ first audience with the prime minister1 and there it was: the sound of sirens. And who are you, so important you have to disturb both the king and the prime minister?

  1. I just wanted to see how old he looked and how he was holding up. This was the first video that popped up. 

Social loops

2022-06-09

It has happened again!

I’m friends on Facebook with people called TK and VBV. They have never met, don’t know each other, and aren’t Facebook Friends™.

There exists a person with initials PC, whose Facebook profile I noticed because he’d organized a tournament of Through The Ages. Now PC is friends with both TK and VBV, but I have never met PC nor knew about his existence until about five minutes ago.

Interestingly, TK and VBV are in a similar situation: each of them knows both me and PC, while not knowing each other.

Such situations, in which each of the four people knows exactly two others but not the third, apparently arise pretty often. I’m not a very advanced Facebook stalker, yet I’ve seen this happen at least five times. Wild, isn’t it?

Some back-o-the-napkin calculations:

Say there’s 10 million Czechs.1 Say an average Czech has 200 other Czechs friended on Facebook.2 Say the distribution is random. To count the number of friends of friends, 200×200=40k, but I guess there’s vast overlap among those, so say 10k friends of friends per person? So for each friend-of-a-friend, there is a one in 10m/10k=1k chance they’re also a friend-of-another-friend. With 10k friends of friends, about 10 should be connected through two different friends.3

However, the distribution is not random. The people one hangs out with and the other people one hangs out with probably have something in common. With TK and VBV and PC, we all come from towns with 10k+ inhabitants, and each of us has lived in one of the two largest cities in the Czech Republic.4 This clustering further increases the number of shared friends-of-friends. So perhaps this is not so surprising after all?

  1. For simplicity, let’s limit this to the Czechs. I’ve seen this happen with a person where one of our common connections was a Czech non-go-player and the other was a foreign go player, which is even wilder. 

  2. In 2012, an average Facebook user had 245 friends according to WaPo. By 2019 supposedly 338 friends on average. Not all of them will have been Czechs. Furthermore, I don’t care about accuracy. Ballpark is fine. 

  3. For 10k unique friends of friends, it’s 10 connected through two different friends. For 20k it’s 40, for 30k it’s 90, and for 40k it’s 160. The number of shared friends of friends grows exponentially with how many friends people have. 

  4. In fact I’m the only one of us four who has never lived in Prague! And it just began to dawn on me – maybe I’m the weird one! They all lived in Prague, no surprise some of them met. But, how did it happen I met both VBV and TK? 

My programming career

2022-04-26

I started my programming career writing Idris. It’s a programming language similar to Haskell, with dependent types. That means types are first class citizens, so you can perform computation on them. It’s quite a bit of hassle, all for the dubious benefit of program correctness. The library ecosystem was almost nonexistent.

Then I had a brief stint with Elm and Scheme Lisp. Elm is like an easier Haskell or Idris, with friendly error messages. I no longer had to deal with the higher-kinded types. Scheme is a language with almost no syntax, hence very well suited for beginners like me.

After that, my career progressed to Scala, the first commercially successful language I’ve used. Oh boy, let me tell you about Scala – apart from the functional programming paradigm, it supports object-oriented programming, allowing one to mutate shared state. Also it runs on the JVM, which is pretty cool, with many third party libraries available.

I’ve also used Python a bit meanwhile, and who hasn’t? Yes the 2 vs 3 was a fiasco but the ecosystem is amazing and it reads like pseudocode, nevermind that one doesn’t know which functions mutate things in place and which return new things. Also I drink a beer every now and then, one only lives once (OOLO), leave me alone mmkay?

Later I’ve come to the pinnacle of my programming career: PHP. I’ve spent a good deal of time with PHP, using domain driven development, test driven development, and doing continuous integration, like a good developer should. The language might have its warts, but the productivity is amazing. We used Vagrant and Chef to manage our environments, also we’d deploy things using Docker.

Finally, I stopped using the Symfony Framework, and started using various in-house frameworks, and sometimes even no frameworks at all. At some point I stopped using Subversion and started copying PHP files straight to the web servers. Also I found out that apart from object-oriented programming, PHP also supports “imperative programming”. This means one does not have to write code within classes and instantiate objects, rather one can directly mutate global state. This further decreased the ceremony and increased my productivity.

One Friday, upon coming back from lunch break, I learned the customer wanted to have a points-based eshop ready by Monday morning. Their customers had been collecting points for doing whatever, and now was the time for them to buy merch using those points. Here’s the list of the merch, including photos and prices in points, please send us a weekly list of who ordered what, ta! Do you think I spent the weekend working? Nope! I buckled up, wrote five hundred lines of PHP in several hours of perfect flow, tested it a little, fixed a bug or two that came up, copied the files over to the production server, called it a day, and went home for the evening. Come Monday, everything worked just fine.


Is this a joke? Well, the timeline, perhaps, a little bit. Apart from that, not so much. I really did write the points-based eshop in PHP in an afternoon, and it really did work. As people grow their career, they achieve more and more. Me, I achieve less and less. I really don’t have anything to point at that I wrote in Idris. [insert shrug emoji]

Elm and Maximum call stack size exceeded

2022-04-21

A-ha, this will be an easy blog post!

So perhaps your JavaScript console tells you Uncaught RangeError: Maximum call stack size exceeded.

That probably means your recursion isn’t tail-recursive. A recursive function calls itself. A tail-recursive function calls itself as its final step – it does not further modify the result of the recursive call.

A thing that caught me out just now, while f (a b) and f <| a b are functionally equivalent, the former is tail recursive while the latter is not.

From Basics.elm:

{-| Saying `f <| x` is exactly the same as `f x`.

It can help you avoid parentheses, which can be nice sometimes. Maybe you want
to apply a function to a `case` expression? That sort of thing.
-}
apL : (a -> b) -> a -> b
apL f x =
  f x

In f (a b), the a b part is evaluated first, and then f is called as the last thing. In f <| a b, the <| itself is application of a function, thus breaking the tail elimination as f is not the last thing called.

Elm says no runtime exceptions. Generally true, not too much of a stretch. But you still do have to watch out a tiny little bit…

Audio books

2022-02-16

Long walks, I get plenty of them these days. Usually listening to podcasts. I choose podcasts to learn something, but if you ask me what I listened to a week ago, I probably won’t be able to tell. So, if it’s just entertainment, I could listen to fiction as well?

It turns out there’s plenty of good audiobooks on LibriVox. Here’s Ruth Golding’s list of British readers on Librivox.

I recently finished listening to The Count of Monte Cristo, and the following quote near the end of the book quite struck me:

There is neither happiness nor misery in the world; there is only the comparison of one state with another, nothing more. He who has felt the deepest grief is best able to experience supreme happiness. We must have felt what it is to die that we may appreciate the enjoyments of living.

School is easier than work

2021-06-12

You think having to go to school is bad? These are the easy years, life is going to get much tougher when you’re an adult and have to work.

So adults told me when I was little, and I believed it, because I had no point of comparison. And it might be true, but misses the point.

School is forced upon children by adults, and even if it weren’t too bad, it wouldn’t be how children would choose to spend their time. Adults, however, have it exactly like the children think: adults have freedom and can do whatever they want. I’m not surprised kids want to be adults, because they want to have this same freedom. Children don’t want to have it easy, they want to have freedom.

I still regularly see adults claiming kids should be grateful for being kids. Why do adults do this? It feels like taking advantage of the kids’ naivety. Adults should be grateful for being so lucky as to be adults!

Adults: you have to work? Nope. You’ve just made some calculations and choose to work, because you want to have a roof over your head and food on the table and buy clothes and what not. It’s a choice, you can stop going to work anytime. Perhaps you can get another job, or you can do without and live under a bridge.

Children: you want to have freedom? Good news – you have freedom. When adults tell you that you must do something, you don’t have to listen. Bad news – if you don’t do what the adults want, we’ll probably punish you. I’m so sorry.

New Blog 2021

2021-05-01

I’ve not only stopped writing things on the blog, I also stopped updating its various workings, styles, etc. Time to change the latter, and see if it leads to the former. Knowing life, it probably won’t.

Why not WordPress?

WordPress has served me well since 2006. 15 years? Not bad – there are few things with this longevity in my computers. But I’ve grown afraid of it:

  • The interface keeps changing. I’m old and don’t like it when interfaces improve.
  • Everything is stored in MySQL. Fine, I can take a mysqldump every now and then? But what can I do with it really? And I have to actually keep running a MySQL server! If WordPress were able to use SQLite, I might’ve stuck with it.
  • PHP, WordPress… guess how often I updated them? Yes – how didn’t everything get hacked yet?

Why Jekyll?

I like versioning things with git. I like simplicity. I like plain text files I can just edit. Digital restraint or hipsterism?

I’ve used Middleman in the past, and now can’t update my tsumego website. Apparently my Ruby is too new for my dependencies, so I update the dependencies, and then run into a Thor issue, which also is tracked on Debian and Ubuntu, and I really don’t care about any of this and just want things to work. Jekyll seems to continue working. I hope it continues working for the next 10 years at least. And if it breaks, I’ve got everything in relatively plain html/markdown files and should be able to take it from there.

Comments

Your wonderful comments were often much more interesting than my posts, and I worked hard to preserve them. Unfortunately, I’m not sure how to make commenting possible without suck. Some options:

  1. Disqus, Facebook, etc: yes it’s easy, but where is the simplicity? I wanted more control and predictability and safe feelings, using a centralized third party to handle your precious comments would be downright irresponsible.
  2. The Jekyll resources page lists some options that allow commenting using GitHub issues: I quite like that a bit, but the end result looks dodgy – each commenter has to agree to give some random app the write access to their soul.
  3. The poor-man solution. As this is mirrored on GitHub anyway, just go and create a PR to add a comment? It’s not exactly user friendly, but hey, at least there’s a barrier to entry. I’ve written down instructions how to add comments. If GitHub ever goes away, the comments will be part of the repo and I can take them elsewhere. That, plus no one comments here anymore anyway.

Common addictions

2021-03-11

Many items of daily use have exactly the opposite effect to what’s desired. One’s body gets used to the thing, and then can’t do without, exacerbating any problems one might have started with.

In my particular case, the lip balm has been the worst offender. I started using lip balm quite young, my lips were dry and a lip balm immediately made me feel better. At some point during my use, my lips switched from becoming dry to simply burning. Suddenly, I had to apply the lip balm all the time, otherwise I’d get an immediate burning sensation. This was very annoying, but oh well, I just took a lip balm with me everywhere. Then one day it dawned on me that other people didn’t have this problem. I tried different lip balms, to no avail. Then one day, I stopped using lip balm. Within two days, the burning sensation turned into the much more bearable dry lips. After ceasing usage, my lips became ok after a week.

Things of daily use for which I’ve developed an addiction and managed to get rid of it:

  • Lip balm – the worst, avoid!
  • Nasal spray – I blame it for my prolonged colds. Perhaps three years ago, girlfriend told me not to use nasal spray when I had a cold, and I suffered a little at the beginning, but went through the cold quicker and I haven’t had much of a cold since. Coincidence? I don’t know…
  • Antiperspirant – Used one for one summer, smelled like a dead cat whenever I forgot to use it for a day. Afterwards, reeked for weeks. Never again.
  • Shampoo – I had to wash my hair every day otherwise my head would become oily and itchy. Some years ago on a yacht, Regina told a story about a woman who stopped shampooing her hair. I tried the same with great success: now that I only wash my head with warm water, it no longer feels the need to produce as much oil. Mind, I’m still bald.

Things I have not developed an addiction for:

  • Hand lotion – If you use hand lotion, I’ll show you my hands. You can admire the silkiness. I never use gloves when dealing with aggressive detergents etc.
  • That’s it! Can’t think of anything else I’m not addicted to. I’ll amend this later if I come up with something!

[This blog post brought to you by Diana. Diana said I should write a blog!]

Make Gnome on Ubuntu 20.04 usable

2020-10-06

Back when I hated Unity, I wrote down some steps to make it nicer. Well I’m still on Ubuntu (which might change soon – snaps suck), and these days like to hate on Gnome.

I’ve since moved some settings to config files, but most of the setup is still manual and will keep evolving as Gnome keeps breaking things.

Start by installing gnome-tweak-tool. Under “Windows”, choose “Focus on Hover”, perhaps tweak some other settings, and then install the Extensions.

Gnome ignores ~/.xsession, ~/.xinitrc etc, so under “Keyboard & Mouse”, choose “Additional Layout Options” and “Ctrl position” and “Swap Ctrl and Caps Lock”. Also “Switching to another layout”, “Two shifts together”.

Must have, without these I’d off Gnome:

  • Workspace Matrix – my virtual desktops must be in a grid. In settings, select “Show workspace grid in the overview”.
  • No Title Bar – Forked – Vertical space is precious, don’t take it away from me. There used to be “Pixel Saver”, then “No Title Bar”, and now “No Title Bar - Forked”. Gnome keeps breaking things, extension developers can’t keep up.
  • System Monitor Next – I really need to see what my system is doing. Same story as above, there are many versions, most no longer work.

Nice to have:

Sleep

2020-09-17

I’ve been having trouble with insomnia for several years. It came in waves, a couple weeks it was better, a couple weeks worse. I’ve been using a sleep tracking app to keep track of how bad I slept. I’d look at it and analyze everything and feel sorry for myself.

Say it was like 3 years and say I spent on average 2 hours a night not being able to sleep. That’d be over 2000 hours lost, and that’s probably a conservative estimate.

I always knew one had to get up regularly, but haven’t been doing it since probably 2012. I’d try to limit blue-light in the evening, and did all kinds of things which are tangential to good sleep. Anything but regular sleep schedule!

About two weeks ago I decided enough was enough, deleted the sleep tracking app, set up a “dumb” alarm for 7:07 every day of the week, and reduced total time in bed to something uncomfortably short (around six and half hours). For the past week I’ve been sleeping great, all thanks to these two things. I still have trouble getting up at 7:07, but that’s a short moment of discomfort compared to hours of insomnia.

There’s a wonderful page describing how to sleep better. I didn’t even need to do all that much to cure my terrible insomnia – just the basic basics helped almost immediately. I wonder, how else can I easily drastically improve my quality of life?