<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>lchsk - blog and technical articles</title>
    <link>https://lchsk.com/</link>
    <description>Recent content on lchsk - blog and technical articles</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 25 Aug 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://lchsk.com/posts.xml" rel="self" type="application/rss" />
    <item>
      <title>How to use dictionary data structure in Python?</title>
      <link>https://lchsk.com/dictionary-data-structure-in-python.html</link>
      <pubDate>Wed, 25 Aug 2021 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/dictionary-data-structure-in-python.html</guid>
      <description>There are many useful programming data structures which most developers use every single day. Python, like any other major language, offers great implementations of those structures – efficient and convenient to use. Let’s look at the Python dictionary data structure which is equivalent to maps/hashmaps in other languages.
Definition It’s useful to think of a dictionary as a set of key-value pairs. Each value we’re interested in is identified by a unique key that allows us to find the value quickly.</description>
    </item>
    
    <item>
      <title>Hello World in Go</title>
      <link>https://lchsk.com/hello-world-in-go.html</link>
      <pubDate>Sat, 07 Aug 2021 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/hello-world-in-go.html</guid>
      <description>This is a step-by-step guide to running your first Go application. It assumes that you already have installed the Go compiler. Setting up a new Go project may be a little more difficult than in some other languages, but this tutorial will help you start in no time.
This tutorial uses Go v1.16 but should work with any reasonably recent version.
Make sure your environment is set up correctly If you have installed Go correctly, you should have the $GOPATH variable set on your machine.</description>
    </item>
    
    <item>
      <title>Using std::optional in C&#43;&#43; to improve code safety</title>
      <link>https://lchsk.com/using-std-optional-in-cpp-to-improve-code-safety.html</link>
      <pubDate>Sat, 29 May 2021 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/using-std-optional-in-cpp-to-improve-code-safety.html</guid>
      <description>Attempting to use a null value is a common reason for crashes in computer programs. Many programming languages allow using null almost like any other value. If a variable can be null, we should ideally always check that case before continuing. Unfortunately, it requires a lot of discipline to remember about this.
C++17 added std::optional template which helps make our code safer.
Without using std::optional Let&amp;rsquo;s consider an example. We have create() function which returns an object of Something class wrapped in a unique pointer.</description>
    </item>
    
    <item>
      <title>Benchmarking concurrent operations in PostgreSQL</title>
      <link>https://lchsk.com/benchmarking-concurrent-operations-in-postgresql.html</link>
      <pubDate>Thu, 28 May 2020 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/benchmarking-concurrent-operations-in-postgresql.html</guid>
      <description>More:
Context: Database transactions, concurrency, isolation levels, and PostgreSQL Benchmark application source code When preparing the article about concurrency in PostgreSQL (Database transactions, concurrency, isolation levels, and PostgreSQL) I was also working on a benchmark that would give me an overview of how different operations are performing in a concurrent environment, under different load, and under different configuration (transaction isolation level).
I&amp;rsquo;ve prepared a C++ application that benchmarks a number of different operations in Postgres.</description>
    </item>
    
    <item>
      <title>Database transactions, concurrency, isolation levels, and PostgreSQL</title>
      <link>https://lchsk.com/database-transactions-concurrency-isolation-levels-and-postgresql.html</link>
      <pubDate>Wed, 27 May 2020 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/database-transactions-concurrency-isolation-levels-and-postgresql.html</guid>
      <description>More:
See results of benchmarking concurrent operations in Postgres: Benchmarking concurrent operations in PostgreSQL Services providing users with data must ensure the information they show is in a valid state. With many users accessing and modifying data at the same time, ensuring the correctness of data is no easy task. One of the main reasons we use databases is to take advantage all the hard work that had already gone into ensuring data consistency in those systems.</description>
    </item>
    
    <item>
      <title>Building a video game in C for a weekend game jam</title>
      <link>https://lchsk.com/building-a-video-game-in-c-for-a-weekend-game-jam.html</link>
      <pubDate>Mon, 27 Apr 2020 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/building-a-video-game-in-c-for-a-weekend-game-jam.html</guid>
      <description>It was the 46th edition of Ludum Dare game jam recently. I&amp;rsquo;ve completed a small video game as part of the event. Here&amp;rsquo;s a short write-up.
Summary:
Play the game online Source code of the game Ludum Dare 46 page Game play video: The game The theme this time was &amp;lsquo;Keep it alive&amp;rsquo;. I have decided to consider it literally and create a survival game. The main character is being attacked by an endless wave of enemies.</description>
    </item>
    
    <item>
      <title>How to use git submodules and CMake to install C&#43;&#43; libraries?</title>
      <link>https://lchsk.com/how-to-use-git-submodules-and-cmake-to-install-c-libraries.html</link>
      <pubDate>Sun, 16 Feb 2020 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/how-to-use-git-submodules-and-cmake-to-install-c-libraries.html</guid>
      <description>Installing C and C++ libraries is not easy as there isn&amp;rsquo;t a widely accepted package management solution similar to what exists in languages such as Python, JavaScript etc.
With git submodules you can embed another repository inside your own. In that way, you can track your dependencies and update them similarly to like you would an ordinary git repository.
This example shows how to install a C++ TOML parser as a dependency using git submodules and CMake.</description>
    </item>
    
    <item>
      <title>Stay paranoid and trust no one. Overview of common security vulnerabilities in web applications</title>
      <link>https://lchsk.com/stay-paranoid-and-trust-no-one.-overview-of-common-security-vulnerabilities-in-web-applications.html</link>
      <pubDate>Thu, 06 Feb 2020 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/stay-paranoid-and-trust-no-one.-overview-of-common-security-vulnerabilities-in-web-applications.html</guid>
      <description>On HackerNews There&amp;rsquo;s a lot of different security issues that affect web applications. However, there&amp;rsquo;s a number of very common problems that occur all the time. They&amp;rsquo;re quite well-known and the ways in which they can be mitigated are also well researched. This article summarises the most common issues according to Open Web Application Security Project (OWASP). Additionally, I&amp;rsquo;ve created a small web application in Django that showcases how some of the common security issues could be exploited.</description>
    </item>
    
    <item>
      <title>Static websites in Golang and Rust</title>
      <link>https://lchsk.com/static-websites-in-golang-and-rust.html</link>
      <pubDate>Sun, 02 Feb 2020 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/static-websites-in-golang-and-rust.html</guid>
      <description>The website you&amp;rsquo;re visiting right now consists of generated static HTML files. This solution is incredibly simple - there&amp;rsquo;s no need for databases and complex web frameworks. It&amp;rsquo;s also very fast and easy to change whenever I want. However, it doesn&amp;rsquo;t use any of many available popular solutions for building static pages.
Building a static page generator This website is generated by a small application in Go I have built specifically for this purpose.</description>
    </item>
    
    <item>
      <title>How to connect to a host Postgres database from a Docker container?</title>
      <link>https://lchsk.com/how-to-connect-to-a-host-postgres-database-from-a-docker-container.html</link>
      <pubDate>Sat, 05 Oct 2019 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/how-to-connect-to-a-host-postgres-database-from-a-docker-container.html</guid>
      <description>Let&amp;rsquo;s assume we have a web service running inside a Docker container. We also have a Postgres database running on a host system (i.e., outside of Docker as you probably don&amp;rsquo;t want to run a database in Docker in production). This means we need to allow a Docker container to connect to a local Postgres database. Assuming you don&amp;rsquo;t want the container to share the network with the host (using --network host parameter when running it), the database and the container need to be configured in order to communicate.</description>
    </item>
    
    <item>
      <title>Building a Postgres GUI client with C&#43;&#43; and GTK (SanchoSQL)</title>
      <link>https://lchsk.com/building-a-postgres-gui-client-with-c-and-gtk-sanchosql.html</link>
      <pubDate>Sun, 09 Jun 2019 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/building-a-postgres-gui-client-with-c-and-gtk-sanchosql.html</guid>
      <description>I&amp;rsquo;ve recently published version 0.1 of SanchoSQL, a GUI client for PostgreSQL. It&amp;rsquo;s written in C++ and designed for Linux systems. It is open source.
Why There aren&amp;rsquo;t many Postgres GUI clients developed for Linux. Those available are usually heavy and bloated. I was looking for a minimalistic option that works fast and has a simple and intuitive interface. I wanted to build one for myself so that it includes features I need and is as small as possible.</description>
    </item>
    
    <item>
      <title>Setting up CI for a C&#43;&#43; application with Docker</title>
      <link>https://lchsk.com/setting-up-ci-for-cpp-application-with-docker.html</link>
      <pubDate>Sun, 16 Dec 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/setting-up-ci-for-cpp-application-with-docker.html</guid>
      <description>Having an automated way to build an application and run tests is a convenient way to learn about failures as quickly as possible. It&amp;rsquo;s as important for businesses as it is for smaller open-source projects.
Why use Docker on CI? There are a few reasons why it&amp;rsquo;s worth to use Docker in a continuous integration environment. Keeping the build process isolated from the rest of the system is an important one.</description>
    </item>
    
    <item>
      <title>Debugging with git bisect</title>
      <link>https://lchsk.com/debugging-with-git-bisect.html</link>
      <pubDate>Sat, 29 Sep 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/debugging-with-git-bisect.html</guid>
      <description>One of the projects I&amp;rsquo;ve been working on and off for some time is derid. It&amp;rsquo;s terminal file manager which wraps ls command and provides the information in the same format but in an interactive fashion. As the name suggests, it&amp;rsquo;s inspired by dired, the file manager that comes with Emacs (derid being an ananym of dired).
It&amp;rsquo;s still in early development so it doesn&amp;rsquo;t have many features you would expect from a file manager yet.</description>
    </item>
    
    <item>
      <title>Launching applications from Emacs</title>
      <link>https://lchsk.com/launching-applications-from-emacs.html</link>
      <pubDate>Mon, 27 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/launching-applications-from-emacs.html</guid>
      <description>I spent a lot of time in Emacs so I&amp;rsquo;m always looking for something new to add to my workflow. I typically start applications using xstarter, a command line tool written in C that uses an ncurses interface. It allows me to quickly search an open programs I need. One of its useful features is recording applications that were recently opened and showing them on the screen so that they can be accessed quickly.</description>
    </item>
    
    <item>
      <title>Making a turn-based strategy game in C&#43;&#43; in 72 hours</title>
      <link>https://lchsk.com/making-a-turn-based-strategy-game-in-cpp-in-72-hours.html</link>
      <pubDate>Sat, 18 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/making-a-turn-based-strategy-game-in-cpp-in-72-hours.html</guid>
      <description>tl;dr
Gameplay video Source code Ludum Dare page DEB package ready to be installed My entry for Ludum Dare 46: Building a video game in C for a weekend game jam I&amp;rsquo;ve recently participated in the 42nd edition of Ludum Dare, an online game jam. The theme this time was &amp;lsquo;Running out of space&amp;rsquo;. I have managed to complete my entry within the limit of 72 hours (Friday 11pm - Monday 11pm).</description>
    </item>
    
    <item>
      <title>When the compiler fixes your mistakes</title>
      <link>https://lchsk.com/when-the-compiler-fixes-your-mistakes.html</link>
      <pubDate>Sun, 24 Jun 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/when-the-compiler-fixes-your-mistakes.html</guid>
      <description>I have been working on a new feature for my terminal-based application launcher. The feature itself is not important at this point although I&amp;rsquo;m happy to mention that I&amp;rsquo;m working on integrating the application launcher with Emacs. I want to be able to search for programs and run them from within Emacs using xstarter. So far, I&amp;rsquo;ve begun making changes to the application but I&amp;rsquo;m yet to build the Emacs interface.</description>
    </item>
    
    <item>
      <title>Benefits of a text-based user interface</title>
      <link>https://lchsk.com/on-the-benefits-of-a-text-based-user-interface.html</link>
      <pubDate>Mon, 28 May 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/on-the-benefits-of-a-text-based-user-interface.html</guid>
      <description>Modern user interfaces offer stunning graphic styles and impressive visual effects. However, there&amp;rsquo;s a category of applications that is seemingly outdated but yet offers unparalleled productivity and unique experience in interaction with a computer.
Enter tiling window manager When I first learned about window managers designed to prevent users from switching between a keyboard and a mouse, I became fascinated straight away. I was struggling with traditional user interfaces. I found them clunky and inefficient.</description>
    </item>
    
    <item>
      <title>How to install googletest library?</title>
      <link>https://lchsk.com/how-to-set-up-googletest-library-from-source.html</link>
      <pubDate>Fri, 18 May 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/how-to-set-up-googletest-library-from-source.html</guid>
      <description>Setting up googletest (or gtest, C++ unit testing library) can be tricky. When starting a new project, integrating googletest can be problematic, despite having no such issues with other libraries.
The following guide provides instructions on how to compile and add googletest to a C++ project. It uses pkg-config to obtain compiler flags and works with build systems such as cmake.
It was tested on Ubuntu but might work on other systems as well.</description>
    </item>
    
    <item>
      <title>Command-line projects</title>
      <link>https://lchsk.com/command-line-projects.html</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/command-line-projects.html</guid>
      <description>xstarter Application launcher for Linux It lives in terminal and works well with tiling window managers (e.g. xmonad, i3 etc).
C, ncurses
Links:
Website Source code Repetition Spaced repetition in terminal.
Go
Links:
Source code helm-xstarter This Emacs package offers a Helm interface for xstarter. It loads a list of installed applications and lets a user select one to launch.
Emacs Lisp
Links:
Source code derid (in progress) Terminal-based, dired-inspired file manager C++, ncurses</description>
    </item>
    
    <item>
      <title>Go - commands and simple cheatsheets</title>
      <link>https://lchsk.com/go-notes.html</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/go-notes.html</guid>
      <description>Build an application with Go, using static linking This might help e.g. if version of glibc on your local computer is different than on a server where you want to run it.
1go build -ldflags=&amp;#34;-extldflags=-static&amp;#34; </description>
    </item>
    
    <item>
      <title>Notes</title>
      <link>https://lchsk.com/notes.html</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/notes.html</guid>
      <description> Rust - notes, commands, and cheatsheets Go - useful commands </description>
    </item>
    
    <item>
      <title>Projects</title>
      <link>https://lchsk.com/projects.html</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/projects.html</guid>
      <description> xstarter - Application launcher for Linux Command line projects Games Web projects Game libraries Other projects Configuration </description>
    </item>
    
    <item>
      <title>Rust notes</title>
      <link>https://lchsk.com/rust-notes.html</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/rust-notes.html</guid>
      <description>Run tests and allow printing to the standard output Printing using println! will work.
1cargo test -- --nocapture </description>
    </item>
    
    <item>
      <title>About</title>
      <link>https://lchsk.com/about.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/about.html</guid>
      <description>Software Engineer based in London.
Contact email at lchsk.com
External links Github LinkedIn Twitter RSS </description>
    </item>
    
    <item>
      <title>Configuration projects</title>
      <link>https://lchsk.com/configuration-projects.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/configuration-projects.html</guid>
      <description>Cookiecutter template for C++ projects Generates a new C++ project built with CMake.
Source code
Cookiecutter template for C projects Generates a new C project built with CMake.
Source code
Personal Emacs config Source code
Dotfiles Personal configuration for xmonad, dzen, zsh etc.
Source code</description>
    </item>
    
    <item>
      <title>Game libraries</title>
      <link>https://lchsk.com/game-libraries.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/game-libraries.html</guid>
      <description>Engine212 Simple 2D game engine in C and SDL.
C, SDL
Links:
Source code simplepacker Simplepacker is a command-line tool that can create sprite sheets/sprite atlases.
$ simplepacker -i ./examples -o output2.jpg --height 200 --padding 5 --json Python Links:
Source code Simple Entity Component System A simple header-only implementation of an entity-component system.
C++
Links:
Source code Collection of small gamdev libraries for C++ + SFML C++, SFML
Links:
Source code </description>
    </item>
    
    <item>
      <title>Games</title>
      <link>https://lchsk.com/games.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/games.html</guid>
      <description>Alive: the game Submission for Ludum Dare 46 Play the game online The theme this time was &amp;lsquo;Keep it alive&amp;rsquo;. I have decided to consider it literally and create a survival game. The main character is being attacked by an endless wave of enemies. The player must keep him alive as long as possible (although he will eventually succumb as there&amp;rsquo;s no actual way of winning).
C, SDL
Links:
Source code Gameplay video Blog post: {{@building-a-video-game-in-c-for-a-weekend-game-jam}} Ludum Dare 46 entry Knight General Turn-based strategy for Ludum Dare 42.</description>
    </item>
    
    <item>
      <title>Other projects</title>
      <link>https://lchsk.com/other-projects.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/other-projects.html</guid>
      <description>PostgreSQL concurrent transactions benchmark Benchmark a number of different operations in Postgres. It simulates a concurrent environment with different transaction isolation levels.
Related posts:
Article describing the results of this benchmark: {{@benchmarking-concurrent-operations-in-postgresql}} Context about transactions and concurrent behavior in PostgreSQL: {{@database-transactions-concurrency-isolation-levels-and-postgresql}} C++, PostgreSQL
Links:
Source code SanchoSQL Postgres desktop client. SanchoSQL is a desktop client application for PostgreSQL database. It allows viewing and manipulating database objects.
C++, GTK+ (gtkmm)
Links:</description>
    </item>
    
    <item>
      <title>Privacy Policy</title>
      <link>https://lchsk.com/privacy-policy.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/privacy-policy.html</guid>
      <description>lchsk.com (&amp;ldquo;us&amp;rdquo;, &amp;ldquo;we&amp;rdquo;, &amp;ldquo;our&amp;rdquo;) operates the www.lchsk.com website (hereinafter referred to as the &amp;ldquo;Service&amp;rdquo;).
The following page describes our policies regarding the collection, use, and disclosure of personal data when you use our Service. We use data to provide and improve the Service. By using the Service, you agree to the collection and use of information as described in this policy.
Definitions Service
By Service we mean the website www.lchsk.com.</description>
    </item>
    
    <item>
      <title>Web projects</title>
      <link>https://lchsk.com/web-projects.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://lchsk.com/web-projects.html</guid>
      <description>Scipio A static website generator, powering this website.
Originally written in Rust, then rewritten in Golang.
Links:
Blog post: {{@static-websites-in-golang-and-rust}} source code (Go) source code (Rust) Language Monster Language Monster - games to teach foreign languages vocabulary Python, Django, JavaScript
Links:
Source code Baseball API Simple API with access to historical baseball data Go
Links:
Source code Django insecure Example of an insecure Django application Simple Django application presenting a number of security vulnerabilities.</description>
    </item>
    
  </channel>
</rss>
