RSSAmplifier

Blog

Posts on Ivan Yurchenko

Recent content in Posts on Ivan Yurchenko

ivanyu.meRSS feed ↗18 posts

Latest posts

Embedding JVM in Rust

Java ecosystem is rich and mature. I won’t be surprised if some application may need to call a piece of Java code. There are several options to do this, starting from the basic multi-processing. In this short post, I want to tell about embedding Java virtual machine (JVM) directly into Rust programs with the jni crate. 
 
 In this post: 
 

 Embedding JVM…

Proptest: property testing in Rust

You probably heard about property testing (AKA property-based testing ), a testing technique where test inputs are randomly generated in great quantity and particular desired properties of the code under test are checked. It’s very practical and I’m a big proponent of using it where it makes sense. 
 In this post, I will tell you how I used property testing with the Proptest…

Kafka protocol practical guide

I worked with the Apache Kafka protocol on the low level quite a bit. It wasn’t easy to start doing this following the official guide only and I read the code a lot. With this post, I want to give you a head start by guiding you step by step from primitive values to meaningful requests. 
 
 In this post: 
 

 Explore the Kafka protocol code and the protocol…

Java agents, Javassist and Byte Buddy

Java Virtual Machine (JVM) is a really great platform, mature, and well-established. Apart from lots of normal features used by all developers, there are some that are more low-level, designed to serve more “system” or “tooling” purposes. One example is sun.misc.Unsafe , which gives e.g. low-level access to memory. Another such feature is agents . Agents are the JVM…

Publishing JARs to Bintray with Maven and SBT

Update 26.03.2023: In February 2021, Bintray was shut down . This post still may be useful from the point of view of artifact publishing in Maven and SBT. 
 Many developers are interested in making their JVM artifacts (e.g. libraries) available for others. Probably, the simplest way to do this is to publish an artifact to Bintray , which gives free hosting for publicly available artifacts.…

About Akka Streams

Excellent post about Akka Streams — Akka Team 
 Really nice introduction to #Akka Streams! FEEL THE POWER! ^^ — Viktor Klang 
 A must-read on #Akka #Streams!!! — Ellan Vannin CA 
 In many computer programs, the whole logic (or a vast part of it) is essentially step-by-step processing of data. Of course, this includes the situation when we iterate over the data and just execute the…

Time-based (version 1) UUIDs ordering in PostgreSQL

The problem 
 UUID standard has several versions. Version 4 is purely random numbers, version 1 relies on the identity of a machine and the timestamp with the counter, etc. Let’s consider version 1 UUIDs. They include timestamps with counters, so they naturally can be ordered by it. In other words, having two time-based UUIDs, I wanted to say if the first is lower, greater or equal to…

Type-safe query builders in Scala revisited: shapeless

Not so long ago, I wrote a post about creating type-safe query builders in Scala from scratch . In it, I also suggested using shapeless library to do what was described. Now, I decided to write how it could be done. The code is in this repository . 
 Problem reminder 
 Without going into much details, the problem was to provide a type-safe way to build queries (to an abstract database, for…

Type-safe query builders in Scala

Update 11.01.2016: the next post about type-safe query builders using shapeless . 
 Recently, I was hacking on a Scala library for queries to Cassandra database, phantom . At the moment, it was not able to build prepared statements, which I needed, so I added this functionality. However, phantom developers also implemented prepared statements quickly :) Nevertheless, I decided to write this…

The Bloom filter

In many software engineering problems, we have a set and need to determine if some value belongs to this set. If the possible maximum set cardinality (size; maximum size = total count of elements we consider) is small, the solution is straightforward: just store the set explicitly (for instance, in form of a RB-tree), update it when necessary and check if the set contains elements that we are…

Delayed message delivery in RabbitMQ

UPD June 01, 2015: there is a plugin for this now. 
 A lot of developers use RabbitMQ message broker. It is quite mature but still lacks for some features that one may need. One of them is delayed message delivery: there is no way to send a message that will be delivered after a specified delay (it’s a limitation of AMQP protocol ). Hopefully, there is a hack for this. 
 
…

Introduction to Akka

Update 26.03.2023: In September 2022, Lightbend changed the license of Akka from Apache 2.0 to the source-available Business Source License (BSL) 1.1 . Akka was forked as Pekko . 
 There are several models of concurrent computing, the actor model is one of them. I am going to give a glimpse of this model and one of its implementation - Akka toolkit . 
 
 The actor model 
 In the…

Value Classes in Scala

Type systems and compile-time type checking are great things that can save you a couple of hours of debugging and also have documenting potential, could make the code more understandable. In my opinion, it’s wise to use them, and unfortunately, sometimes we don’t do this enough. Consider Integer / Int / int . A counter could be Integer , an entity identifier could be Integer , an…

Why I like Scala

I am familiar (more or less) with a number of programming languages and have both emotional and rational thoughts of them. Scala is for certain in the group of languages I like. I have decided to summarize my judgments of Scala attractive parts in a blog post and here it is. Also, I have got some ideas of posts about Scala and its technology stack and an introduction is possibly needed. 
…

Creating a simple parser with ANTLR

Recently, I’ve faced a task of developing a tool which allows the application to have base of (not very complex) logical rules. There were three demands: 
 
 The rules were to be written by non-programmers, so using of the languages which the program is written in (Java/Scala), wasn’t very good. 
 The rule base should be changeable without redeployment of the application,…

GNU Parallel

How much CPU cores does your computer have? 2-8, I think. It’s very time to use them all, isn’t it? But there are plenty of Unix utils such as grep , find , wc etc., which have no idea about parallel data processing. They can’t split their input into 8 pieces and spawn the corresponding number of threads or processes to process it using all the power of your modern CPU. 
 Definitely, this…

Finding a cycle in a linked list

There is a popular task at software developer job interviews: having a singly linked list, write a piece of code which tells if the list has a cycle . 
 In a linked list , each element is a structure which contains the value of an element and the link to the next element. The next-link of the last element has a special value which marks the end (usually, null ). If a list has a cycle, the last…

Z algorithm


 Introduction 
 There are some algorithms of exact substring searching (e.g. Knuth-Morris-Pratt , Boyer-Moore etc.) I want to explain one of them which is called Z algorithm in some sources. 
 Z-boxes and Z-values 
 Let’s consider the concept of Z-box . Take the string S = “abcxxxabyyy” . We have an internal part “ab” in the string which repeats its…