Index on Bloghttps://blog.ubavic.rs/Recent content in Index on BlogHugo -- gohugo.ioWriting GUI apps doesn't have to be painfulhttps://blog.ubavic.rs/10/Sun, 07 Jul 2024 13:09:58 +0200https://blog.ubavic.rs/10/Recently, I came across the article Writing GUI apps for Windows is painful which resonated with me. Just over a year ago, I was in a similar position as the author. I was just starting a new project and was looking for a GUI library with the following requirements:
Should support Linux Should be easy to set up for development The compiled binary should be small and easy for the end user to use (minimal dependencies) The project I was starting was a reader for smart card documents (like personal identification cards).Porting the GCLC to the webhttps://blog.ubavic.rs/9/Fri, 29 Mar 2024 18:22:08 +0100https://blog.ubavic.rs/9/This week, Professor Predrag Janičić and I released the web version of GCLC.
If you are not a mathematician, chances are that you never heard of GCLC. GCLC is a programming language/compiler for mathematical illustrations. The first version was created in 1995 by Professor Janičić, and since then the program has been constantly expanded with new features. Comparing it to some more popular tools, it sits somewhere between TikZ and Geogebra: users create illustrations by programming in custom Turing-complete language (just like in TikZ), but users also can move free points or play animations (just like in Geogebra).Don't worry, your Parser is a functorhttps://blog.ubavic.rs/8/Sat, 30 Sep 2023 22:25:48 +0200https://blog.ubavic.rs/8/If you’re delving into the world of applicative parsers, at the very start you’ll encounter the following abstract type (or something similar):
newtype Parser a = P (String -> Maybe (String, a)) This type represents a function that takes an input string and maybe produces a pair containing the parsed token with the rest of the string.
Once you’ve grasped the concept of the Parser type, you can explore how to make it a functor.Reading Serbian ID cards with Golanghttps://blog.ubavic.rs/7/Fri, 04 Aug 2023 21:09:02 +0200https://blog.ubavic.rs/7/I am a little bit late with this post, but I feel it is good to publish it nevertheless.
Three weeks ago, I released the Baš Čelik, a program for reading ID cards issued by the government of Serbia. This program can read data from an ID card, and save it as a PDF which looks the same as a PDF produced by the official application. And believe me, in Serbia for some reason you need this PDF (or print of it) quite often.Lambda calculus and differential geometryhttps://blog.ubavic.rs/6/Mon, 24 Jul 2023 22:10:30 +0200https://blog.ubavic.rs/6/You can perfectly demonstrate the essence of currying in almost any modern language, but there are some phenomena that are only revealed to programmers who program in ML/Lisp languages. I want to say something about that.
Take for example map function in Haskell. Its type is (a - > b) -> ([a] -> [b]) (often written as (a - > b) -> [a] -> [b]). This type can be interpreted in two different ways:Proggy-buggy 2023https://blog.ubavic.rs/5/Thu, 25 May 2023 23:36:54 +0200https://blog.ubavic.rs/5/Today I participated in the online programming contest Proggy-buggy 2023, organized by Ukrainian company DataArt. This is my first programming contest, so I am excited to share impressions.
We were presented with 13 programming problems and had 42 minutes to solve them. Problems were indeed very simple: for example, the first one could be solved by multiplying two numbers given in stdin, and the second one was a classical look-and-say problem (given one iteration, deduce the next iteration).Restoring addresses with Haskellhttps://blog.ubavic.rs/4/Mon, 01 May 2023 09:42:26 +0200https://blog.ubavic.rs/4/Leetcode has a very nice problem called Restore IP Addresses. The task is that for given string s containing only digits, we find all possible valid IPv4 addresses that can be formed by inserting dots into s. For example, from "25525511135" we can form only addresses 255.255.11.135 and 255.255.111.35.
Solution in 16 lines First, we will construct three functions of type String -> [(Int, String)]. These functions from the start of a given string try to parse a single-digit, a two-digit, or a three-digit number.Chaos gamehttps://blog.ubavic.rs/3/Sun, 26 Mar 2023 00:30:20 +0100https://blog.ubavic.rs/3/Today I released the interactive demonstration of iterated function system know as Chaos game. You can read more about Chaos game on the Wikipedia, but long story short, we fix a plane polygon $\Pi = \{V_1, \dots V_m\}$ and choose an arbitrary plane point $P_0$. Then we iteratively generate orbit $\mathcal O = \{P_0, P_1, P_2, …\}$ by using formula $$ \vec P_{i+1} = \frac12\left(\vec P_i+\vec V\right),$$ where $V$ is at each iteration chosen randomly from $\{V_1, \dots V_m\}$.Setting up the minimal bloghttps://blog.ubavic.rs/1/Thu, 16 Mar 2023 23:23:13 +0100https://blog.ubavic.rs/1/I found countless nicely designed blogs that have a single post, a post about setting up a blog (there is a popular meme about this). Some of these blogs had been in such state for years, suggesting that the author often didn’t find inspiration past the first post. I am not sure why is that, but yesterday I found out why they even publish that first post.
You see, setting up your blog with a static generator is a very rewarding process.