127.0.0.0/8 IP Range Is All Loopback

September 26, 2020

That the 127.0.0.1 IP is a loopback/localhost is widely known. It is used daily by many developers for testing of programs talking over the network. However, did you know that the whole 127.0.0.0/8 IP range are loopback addresses? You have a few million IP addresses reserved on each machine to talk to itself.

Millions of loopback addresses
Figure 1. Millions of IP addresses should be enough for talking to yourself
Continue reading →

Time is Complicated: java.time

July 12, 2020

Time is complicated, really complicated. We have historically grown calendar systems, historical units, timezones, limelight savings times, etc. On top of that, we have precise atomic clocks and astronomical time definitions drifting apart and need periodical corrections, like with leap seconds.

Agreeing On Time
Figure 1. Agreeing On Time
Continue reading →

Time Does Not Flow Evenly

May 31, 2020

You are working on some system and you need some kind of timestamp in milli- or nanoseconds. Nothing easier than that. In Unix you might use clock_gettime and in Java System.currentTimeMillis() and of your go.

// Forgive me my C, I probably got things wrong =)
#include <sys/time.h>
#include <stdint.h>

int64_t time_stamp_nanos(){
    struct timespec current;
    clock_gettime(CLOCK_REALTIME, &current);
    return current.tv_sec * 1000000000 + current.tv_nsec;
}
Continue reading →

Terminal Utilities I Often Use

May 17, 2020

In this blog post, I just list a few Unixy terminal utilities I often use. If you are a terminal veteran this will be boring for you. If you rarely use the terminal, it might have a utility or two you are not aware of yet.

I’m not giving a tutorial on the commands. Google for more details or read the man pages =). It is just to let you know that these tools exist.

Continue reading →

Slack Java API and the Data Non Problem

May 9, 2020

Recently I had the "joy" to work with the Slack Java API. I felt that this Java API is tedious and an example of an API which create busy work for little benefit. Let me show first how the API is used:

var slack = Slack.getInstance();
var methods = slack.methods();

var channeId = "C424242";
var request = ChatPostMessageRequest.builder()
        .channel(channeId)
        .text(":wave: Hi from a bot written in Java!")
        .build();

var response = methods.chatPostMessage(request);
Continue reading →