3
Aug 18

I have tried finding an example implementation for this online and to my surprise nothing I found did the trick. Therefore I am sharing my solution here in case anyone else runs into this in the future. I am new to Spring Boot and it's possible there are other, better ways to go about it, but something is better than nothing.

The problem

You want to make an http call from your server to another server, but you don't want to block your thread waiting for the other server to respond. How do you do that in Spring Boot?

The solution

WebClient does the trick. Check out the following implementation:

@Async
public CompletableFuture<String> loadDataFromAPI() {
    CompletableFuture<String> future = new CompletableFuture<>();
    try {
        WebClient
        .create("https://reqres.in/")
        .get()
        .uri("/api/users?page=2")
        .retrieve()
        .bodyToMono(String.class)
        .subscribe(future::complete);
    } catch (Exception e) {
        LOGGER.error("Failed loading data from API", e);
    }
    return future;
}

I won't go over this code line by line as it should be self explanatory. There is no error handling here, I just wanted to provide a barebone working example for you to build upon.

19
Feb 18
We are not very good at perceiving things as they are. We habitually add an interpretational layer to events and we unconsciously pay more attention to details that fit with the narrative we are currently invested in while overlooking or downplaying any evidence to the contrary. An insecure person is overly sensitive to other people's judgment of them, and an overly secure person tends to be oblivious to criticism. 

Read more »

21
Dec 17
Mindfulness, for the purpose of the article, is pretty much a synonym of Metacognition. It is the ability to consciously take a mental step back from what it is you're immersed in and experience it from a non-invested, (more) objective perspective.
To understand how this skill comes into play be for someone in a leadership or facilitator role, let's consider meetings. Infamous for being inefficient and coma inducing, as so often they get derailed, run beyond the allotted time and rarely achieve their intended goals. The reason this happens is not because the participants are too incompetent to achieve the goals or because there were not goals to begin with. In most cases the goals are clear and the participants have more than enough combined brain power to achieve them. But what often goes wrong is that the participants get immersed in the irrelevant things, such as following threads of discussions that lead them away from the intended goal or investing too much time in petty arguments. They follow these threads and arguments, wholly convinced, in the heat of the moment, that these are important and timely conversations, until the meeting runs out of time and the original purpose was barely discussed and no relevant decisions were made. Looking back on such a meeting one would conclude that it was a waste of time despite the fact that most people were following what at the time seemed like "important and timely conversations" to the best of their understanding. After enough of such experiences there's little surprise most of us develop an innate aversion to meetings as a wasteful endeavor. They are not, however, innately wasteful. Losing sight of the goal and chasing irrelevant threads is what makes meetings wasteful.

Read more »

19
Dec 17

December 8th is observed in the west as "Boddhi day" - the day that celebrates the waking up of the Buddha. On that day I wrote a short description of what Buddhism is and what "waking up" is for my friends on Facebook. It came out quite nice so I thought I'd share it here as well.

Read more »

6
Sep 17

Imagine you're a member in a close-knit cooperative commune. The commune has been buzzing along for a few years now, and the members know each other well and coexist nicely. However, it is decided that a crucial skill for the commune is missing and new talent is needed. As the natural leader of the commune, you are asked to interview and decide which candidate would bring the most benefit to the commune.

You've seen two candidates. The first seems to be highly skilled in that one thing your commune is looking for. The second candidate also has the same skill, but he may be not as skilled as the first one. Alright, dilemma over, let's pick candidate #1. Or are we really done?

Read more »

13
Aug 17

In this post I don't want to convince you that you need to meditate. I want to explain what creating a habit of meditation can do for you, and you can decide for yourself whether it's something you value enough in order to give it a shot or not. If this post was titled "Why lift weights", I would be saying that lifting weights increases your strength and/or muscle mass, and will probably make your body look nicer. If that's something you want and value, obviously lifting weights is one way to go about it.

If you want to increase your capacity to exercise conscious control over the content of your own mind, or in other words to be more the influencer of your thoughts rather than to be influenced by them, you should practice meditation. Specifically, you should start with single pointed focus meditation.

Read more »

26
Jun 17

If you could narrow down the team leader's role to one sentence, what would it be?

Try asking your manager what they think your role is. They may say something like "make sure team members are doing their job". If you're lucky, they may even suffice with "make sure the team releases high quality products on time". Fair enough, both are components of a successful team. But I believe there is a principle that encompasses both of these and many other components that make a team successful. And it's a more positive principle to boot.

This is my answer:

Team leadership is all about making work fun for your team

The premise is simple: If the work activity is fun, people will do it in the best possible way. This includes quality, reliability and crucially but often overlooked, sustainability.

Read more »

12
May 17
Unless you are a one person team, you are working with a process. It can be an explicit and defined process like Scrum or Kanban, it can be something of your own concoction, or even just a set of unspoken rules and expectations among you and your coworkers.
The thing about processes is that they can either be the best thing for your team's productivity, or they can be the reason your team never delivers anything on time. Sadly, most processes tend to gravitate towards the inefficiency end of this spectrum. That's why when people think of processes they usually have an alarm bell going off in their head. They perceive the process as something that gets in their way, stops their flow, dictates their actions and generally just slows them down. And with good reason: Who among us was not victimized by coma inducing meetings, or conventions that consume precious time without actually producing any tangible value?
Process tends to become inefficient in a similar way to how software tends to become bloated: It contains bugs, it accumulates useless features over time, and it gets filled with ad hoc solutions to problems that no longer exist. Process, like software, can easily become cumbersome to the point of embarrassment. Unless, that is, someone cares enough to stop every now and then and clean it up.
This is true no matter what kind of process you have in place. This is why you need to hold retrospectives at regular intervals.

Read more »

23
Jan 17

Officially, Broken Windows theory refers to a behavioral pattern on a societal level, where environments that tolerate little 'glitches', like a broken window or uncollected litter, will tend to slide towards the direction of more and more glitches. Throwing a piece of trash on the floor is perceived as a worse offense when the streets are trash free, yet it can be perceived as barely an offense at all when the streets are filthy. This is, in part, a mental bias: The action done is the same (throwing trash in public space), the end result is the same (an equal amount of trash is added to the environment), but we perceive the severity entirely different.

Read more »

28
Sep 16

Habitmint.com is a hobby project that intends to provide a nonsense-free, cross-device assistance in tracking your daily habits and goals. I've been using it personally for months now and I'm very happy with the outcome.

demo-e8c35d759c1fea6b226bf2deffd2eeaa

Read more »