An invitation for Hackin’ Gliwice mini-conference on 15.03.2018

2018-02-17 Conferences, Java No comments

On the 15th of March 2018 in my hometown – Gliwice, Poland the next edition of Hackin’ Gliwice mini-conference will take place.
Language of the conference is Polish.

There’ll be 3 talks:

I’ll try to do my best to deliver as good presentation as I can.
Moreover, I can assure you that remaining talks will be interesting and provided by very good and experienced speakers.
I would go to this event even if I won’t be a speaker ;-). If you are interested in the modern software development, Java 9, RxJava, Reactive Programming, Reactive Streams, Concurrency, Go or Microservices, then you should be there. Conference is free, but registration is obligatory.

Useful links:

See what people say on Twitter:

I hope to see you there!

Automating generation of the on-line documentation for Java library

2018-02-11 Bash, Gradle, Java, Open source No comments


In one of my open-source projects – ReactiveNetwork I have a documentation in file and I have JavaDocs as well. This project is an Android library written in Java and built with Gradle. Moreover, I develop this project on two separate Git branches – one for RxJava1.x and another one for RxJava2.x. Similar convention is in the RxJava repository, so I followed it. After each release I publish documentation and JavaDocs on GitHub pages for both versions. It’s kind of boring and repeatable task, so I was wondering if there’s any way to automate it.

Generating JavaDocs

I have a Gradle task, which does that as follows:

./gradlew androidJavadocs

and generates JavaDocs in library/build/docs/javadoc/ directory.
I keep generated JavaDocs on gh-pages branch in /javadoc/RxJava1.x/ and /javadoc/RxJava2.x/ directories.
Now, I need to checkout to RxJava2.x branch generate JavaDocs, switch to gh-pages branch delete contents of javadoc/RxJava2.x/ directory, copy contents from library/build/docs/javadoc/ into javadoc/RxJava2.x/, commit changes, do the same for RxJava1.x branch and push changes. As you noticed, It’s a lot of manual work. I’ve scripted it as follows in my file:

#!/usr/bin/env bash

# update javadocs for RxJava2.x
git checkout RxJava2.x
./gradlew clean androidJavadocs
git checkout gh-pages
rm -rf javadoc/RxJava2.x/*
cp -avr library/build/docs/javadoc/* ./javadoc/RxJava2.x
git add -A
git commit -m "updating JavaDoc for RxJava2.x"
rm -rf library/build/docs
echo "javadocs for RxJava2.x updated"

# update javadocs for RxJava1.x
git checkout RxJava1.x
./gradlew clean androidJavadocs
git checkout gh-pages
rm -rf javadoc/RxJava1.x/*
cp -avr library/build/docs/javadoc/* ./javadoc/RxJava1.x
git add -A
git commit -m "updating javadocs for RxJava1.x"
echo "javadocs for RxJava1.x updated"

echo "javadocs for both RxJava1.x and RxJava2.x updated - now you can push your changes"

Generating user-friendly documentation

I keep my whole documentation for the user in file. In order to generate user-friendly website with documentation I used docsify. You can install it as follows via npm:

npm i docsify-cli -g

Next, on gh-pages branch I’ve created docs/RxJava1.x/ and docs/RxJava2.x/ directories and copied there appropriate files from RxJava1.x and RxJava2.x branches. Next I could go inside each directory and type:

docsify init .

Docsify generated nice website with documentation gathered dynamically from file. After that, I’ve done a few manual adjustments.
Now, the only thing a need to do is to keep files updated. That’s why I made a script for copying files from RxJava1.x and RxJava2.x branch into appropriate directories on gh-pages branch and named it

#!/usr/bin/env bash
git checkout gh-pages
git show >docs/RxJava1.x/
git show >docs/RxJava2.x/
git add -A
git commit -m "updating docs"
echo "docs updated, now you can push your changes"


Now, I have boring process of generating Docs and JavaDocs for two separate Git branches automated and I can simply invoke my scripts:


git push

and that’s it!

You can see websites with documentation at:

and JavaDocs at:

I hope this article will give some ideas of automating your repeatable tasks.

Quality Meetup #15 – Fixing a billion dollar mistake

2018-02-09 Java, Meetups No comments

Quality Meetup #15

On the 8th of February 2018, during Quality Meetup #15, I gave a presentation titled “Fixing a billion dollar mistake”.

Tony Hoare introduced Null Reference w in ALGOL language in 1965. He calls this decision a “billion dollar mistake”. It was so easy to implement and probably it caused a loss of millions of dollars due to the mistakes done in the software over the 40 years. During the time, people came up with different ideas of solving that problem with software libraries, good programming practices, static code analysis and compile time code analysis. Moreover, we have new programming languages with null safety features. During the presentation I’ve shown how to deal with the null reference problem in the JVM projects no matter if it’s a greenfield solution or legacy code.

Slides from the presentation are available below.

Thanks everyone for coming!

Air quality monitoring script for Argos (Linux) and BitBar (macOS)

2017-12-29 Bash, Linux, macOS No comments

From some time, I wanted to create my own app, which will display some data in top panel in macOS or Gnome environment on Linux. I collected some resources about that and I knew that for macOS I need to write an app in Obj-C and for Gnome I need to write a plugin in JavaScript. In both cases it requires some ceremony and preparation. Recently I’ve found a great app for macOS called BitBar (by the way it’s open-source). BitBar allows to put anything to macOS menu bar (top panel) in no time! With this project creating top panel apps is simplified to the limit. Moreover, there’s another project called Argos, which does the same thing, but for Linux with Gnome (it’s an open-source Gnome Extension).

In both cases, we just need to create a shell script, put it into appropriate directory (in case of Argos, it’s ~/.config/argos/ and in case of BitBar, we define it during the installation or first run) and then app displays our data automatically. We can also set refresh rate. E.g. if we want our script to be executed every 60 seconds, we can name it We can also create more advanced scripts and more details can be found in BitBar and Argos documentation.

In my case, I wanted to create a script, which reads CAQI (Common Air Quality Index) in my current location based on Airly sensors. Airly provides nice API, which we can use in our projects. Please remember that most of the sensors are located in Poland.

On my Ubuntu Linux with Gnome 3, I created a new script in the following path:


For a BitBar script location could be different. Both for BitBar and Argos follow the same naming convention.

My script looks as follows:

#!/usr/bin/env bash

CAQI=$(curl -s -X GET --header 'Accept: application/json' --header 'apikey: YOUR_API_KEY' \
    '' \
    | jq .airQualityIndex | cut -f1 -d".")


case 1 in
  $(($CAQI <= 25)))  MSG="Great!";;
  $(($CAQI <= 50)))  MSG="Good!";;
  $(($CAQI <= 75)))  MSG="Medium";;
  $(($CAQI <= 100))) MSG="Bad";;
  $(($CAQI >= 101))) MSG="Very Bad";;

echo "CAQI: $CAQI ($MSG)"

It works fine on Linux. The only requirement is to install jq. For macOS, I needed to change jq to /usr/local/bin/jq to make it work. I gathered information about air quality level from this website: [PL]. Of course, we need to replace API_KEY with our api key, which we can get from website as well as YOUR_LATITUDE and YOUR_LONGITUDE with coordinates of our location. It can be static location in our city. We can get them e.g. from Google Maps.

As a result, we have beautiful text in our top panel:

This screenshot was taken on Ubuntu Linux with Gnome 3. On macOS it works the same (I checked it).

Creating a Docker container with Alpine Linux including Java 8 and 9

2017-12-27 Docker, Java, Linux No comments

Recently, I’ve decided to refresh my knowledge regarding Docker and created an image with Alpine Linux and Java 9, which can be a useful base for the future projects. I used Alpine as a base image because it became quite popular in the Docker world due to its simplicity and the fact that it’s pretty lightweight when we compare it to containers based on other Linux distributions. Pure Alpine Docker container has about 4.144 MB, what is really impressing.

Container with Java 9

My Dockerfile looks pretty simple:

FROM alpine:latest
MAINTAINER pwittchen
USER root

RUN wget
RUN tar -xzvf *.tar.gz
RUN chmod +x jdk-9
RUN mv jdk-9 /usr/local/share
ENV JAVA_HOME=/usr/local/share/jdk-9
RUN rm -rf *.tar.gz

We’re downloading JDK, unpacking it, moving to /usr/local/share directory, creating $JAVA_HOME environmental variable and adding $JAVA_HOME/bin to the $PATH. After that, we’re removing downloaded *.tar.gz file.

Repository with this project is available at:
We can also find it on Docker Hub:

To pull the image from Docker Hub, just type:

sudo docker pull pwittchen/alpine-java9

To run it with CLI, type:

sudo docker run -i -t pwittchen/alpine-java9

Then, we can play around with jshell inside the container:

/ # jshell
Dec 27, 2017 1:18:10 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
|  Welcome to JShell -- Version 9-ea
|  For an introduction type: /help intro

jshell> System.out.println("hello from docker!")
hello from docker!

This container is not so small and has about 919.2 MB. It contains whole JDK, so probably this size could be reduced.

Container with Java 8

I’ve also created another image with Java 8 (just in case):

FROM alpine:latest
MAINTAINER pwittchen
USER root

RUN apk update
RUN apk fetch openjdk8
RUN apk add openjdk8

We can also find it on the web:
Docker Hub:

and pull it from the Docker Hub:

sudo docker pull pwittchen/alpine-java8

and run it with CLI as follows:

sudo docker run -i -t pwittchen/alpine-java8

In this case, container has 118.5 MB, which is better result than for the previous container. In this case, we’re installing Java 8 for Alpine from official repository, so probably it’s already optimized.

I hope, you’ll find it useful while developing your projects in Java 8 or Java 9.

DroidCon Poland: Is your app really connected?

2017-12-02 Android, Conferences No comments

Yesterday, I gave a presentation about connectivity in the Android apps during the DroidCon Poland 2017 Conference in Kraków.

Below, you can see slides from this presentation.

There’s also tweet related to this presentation from DroidCon Kraków:

I hope, you enjoyed it. Any kind of feedback is welcome (in the comments below this article or via e-mail).

Don’t forget to check ReactiveNetwork library I mentioned during the presentation.

Simple reactive HTTP client & server with RxJava, Vert.x and Android

2017-11-09 Android, Java, RxJava, Vert.x No comments

During Hack Your Career event at the Silesian University of Technology, I’ve prepared a presentation titled Reactive Programming – Efficient Server Applications with a colleague from work. Arek told about theory of Reactive Programming, shown basic concepts, data types and a few examples in the code. During my part of the presentation, I’ve wrote a very simple server and client in Java (9 on the server, 7 on the client) with Vert.x (Core and Rx), RxJava 2, OkHttp 3, Android and RxAndroid. Presentation was targeted mainly to the university students with no experience with reactive programming, but it was an open event and anyone could attend it.

Below, we can see a very simple code snippet showing how to create a reactive HTTP server with Vert.x. We can create a stream of requests, make Flowable out of it, apply any kind of RxJava 2 operator including backpressure handling and subscribe the stream. Moreover, we can also reactively start the server with rxListen(int port) method. This is just a basic example, where will be sending request to the only one endpoint. In the case, when we want to handle more endpoints, we can use vertx-web library and design REST API.

final HttpServer server = Vertx

    .subscribe(request -> {"{} {}", request.rawMethod(), request.absoluteURI());
      request.response().end("request received");

    .subscribe(httpServer ->"server is running at port 8080..."));

We can build this server with Gradle as follows:

./gradlew shadowJar

and then, we can run it:

java -jar build/libs/server-fat.jar

Our client will be an Android application, which will read data from the accelerometer sensor, send it to the server and display it in the TextView on a mobile device. We will use ReactiveSensors library (which was recently migrated to RxJava 2) for getting sensor readings as a Flowable data stream. Next, we will apply backpressure DROP strategy, filter only events of changing sensors (we neglect changing of the accuracy), read only one event per one second with throttleLast(int, TimeUnit) operator and map event to a String with device coordinates. Next, we are ready to send data with Completable performRequest(String), which we created earlier. Sensors readings are acquired in the computation() scheduler, send to the server with io() scheduler and passed to the UI thread on Android with AndroidSchedulers.mainThread(). Distributing operations to the different schedulers is made with subscribeOn(Scheduler) and observeOn(Scheduler).

    .throttleLast(1, TimeUnit.SECONDS)
    .doOnNext(event -> performRequest(event)
    .subscribe(event -> tvReadings.setText(event));

It’s worth noticing that Completable performRequest(String) is using OkHttp 3 under the hood as a HTTP client, because it’s very simple example with one endpoint. In the case, we want to handle more endpoints on the client-side, it’s better to use Retrofit library.

It’s also interesting that in our case, we can simulate behavior of the accelerometer and other sensors with the latest Android device emulator available in the Android SDK. It works surprisingly smooth.

Complete working example can be found at:

Later, I’ve also shown, how to use RxJava to distribute computational operations to a different threads of the CPU cores, but I’ll probably publish a separate article about that on this blog. It was the same example I shown during my JDD presentation this year.

Slides from my part of the presentation are available below.

5 ways to attend expensive IT conferences for (almost) free

2017-11-02 Conferences No comments


In the past months, I’ve attended a few conferences and meetups related to IT. I also plan to attend a few more in the last quarter of the year as a speaker. I’d like to show you a few tips, which can encourage you to attend such events, be more involved in them and spend some time away from your desk ;-). If you are working in a software company, in the most cases you could treat going for a conference as a non-customer facing business trip, so your regular days off will be safe and can be used for your personal plans and holidays :-).
I tried all of the methods described in this article both in Poland and abroad, so I can tell you they’re confirmed in practice.

Use your company’s educational budget

There are companies, which offer so called educational budget, which is defined each year. Such budget can be used for attending the conferences and trainings. In the company where I work now (SAP Hybris), I have such benefit and I could use it to go to the Spring I/O in the Barcelona, Spain last year, J On The Beach in Malaga, Spain and Devoxx in Kraków, Poland this year. Of course, travel, food and accommodation expanses were covered by this budget as well as conference tickets.

ICE Kraków Congress Centre – Devoxx Poland 2017 Venue

Malaga, Spain

Be a speaker

This year I was a speaker during JDD conference in Kraków, Poland. I had confirmed business trip and an accommodation in high quality hotel paid by the conference organizers. I could also attend a dinner with other conference speakers and see all conference talks and hang out with participants without spending a penny. In the December 2017, I’m also going to be a speaker during DroidCon Poland conference, where organizers offered to cover accommodation costs as well. Usually, you can expect that from good quality events, but it may happen that part of the costs will have to be covered by you, so it’s good to be prepared for that.

My JDD 2017 Conference Talk in Kraków, Poland

Be a rejected speaker

I’ve send my submission during Call For Papers for GDG Dev Fest in Lviv, Ukraine. I was rejected, but organizers offered me a free conference ticket. Organizers had over 150 C4P submissions including those of people from Google, Twitter, etc., so I wasn’t lucky this time. Ukraine is quite cheap country comparing to Poland and I wanted to visit Lviv, so I paid for travel and accommodation by myself and joined this event.

GDG Dev Fest Ukraine 2017 Conference in Lviv

View from Pravda Beer Theatre on the Market Square in Lviv, Ukraine

Be a blogger

I create this blog for a few years and I think its quality is becoming better and better every year and more people visit it. Last year, JDD conference organizers offered me a free conference ticket in exchange for promoting their conference on my blog. It was good exchange, because this event is interesting and related to the content of my website. In addition, conference ticket is not so cheap and costs about ~500 PLN or something like that. This situation encouraged me to be more engaged in the Java community and this year I attended the same conference as a speaker.

Be a volunteer

From a long time I wanted to visit London in UK and attend DroidCon London conference as well. It’s one of the most popular Android conferences in the Europe. Conference ticket is very expansive and costs 695 GBP, which is approximately ~3352 PLN. Nevertheless, you can save some money if you buy it very early (like almost one year before the conference). I used most of my personal educational budget in the company and I could, but I didn’t want to spend such amount of money from my own pocket just for a conference ticket. I’ve sent to the organizers a proposal of promotion of their event on my blog in exchange for a free conference ticket. They didn’t really want that, but they asked me to be a volunteer for a 2 days, so I could help them a little and get the free ticket. I decided to go for it. UK is much more expansive place than any city in Poland, so I had to spend some money for accommodation, food and transportation. Nevertheless, I don’t regret it, because it was nice experience and London is worth visiting at least for a few days. Moreover, I haven’t really encountered typical London weather. There was hot and sunny during my stay. Only one day was a bit cloudy with a small rain, but it wasn’t as cold as in Poland on my way back. I also made a few connections and gave my business cards to a few people. Such kind of networking can create new possibilities related to work, local & global communities, speaking on meetups, conferences etc. Of course, when you go to UK, don’t forget to check out the map of every pub in UK.

Business Design Centre London – DroidCon London 2017 Venue

London, UK in late October 2017 (The Shard is visible in the background)

Tower Bridge visible from The Shard, London, UK


As you can see, there are many ways to attend expensive IT conferences and you don’t really have to spend your own money on the tickets every time. You just need to be in a good company, a bit more engaged, give something from yourself to others and it will bring you profits. Attending many conferences won’t make you the best developer in the world, but sitting in front of your desk and doing the same thing for many days won’t do that either. It’s good to find a balance and time for the new experiences, changing your surroundings for some time, seeing new places and meeting new people. When you can mix that with your profession and work, that’s great!

Meet & Code 2017: “Git – tips & tricks” presentation

2017-10-21 Conferences, Git No comments

Recently, during Meet & Code event organized by Media 3.0 and SAP Hybris, I’ve gave a talk for university and high-school students about basics of Git. Presentation was titled Git – tips & tricks and was organized at the Silesian Univeristy of Technology in the AEI Department where I was studying a few years ago. Presentation covered quite essential usage of Git, which could be helpful for people who are planning to learn it from the scratch. Nevertheless, in the talk I included a few tips, which could be applied even by more advanced users in their daily work. You can view slides from this presentation below.

JDD 2017: Get ready for java.util.concurrent.Flow! – slides, code and recap

2017-10-05 Conferences, Java, RxJava 2 comments

Recently on the JDD 2017 conference, I gave a presentation regarding introduction to Reactive Streams standard in Java 9. I also talked about existing implementations of this standard with the strongest focus on RxJava2 and created simple Reactive Streams implementation in pure Java 9 during the presentation. Below, you can find slides from this talk.

Code snippets shown during this presentation are available at
I have done a tiny live coding session during this talk. Luckily, everything went fine, the code was compiled and executed without errors. Everything I’ve done during this presentation and additional exploratory unit tests could be found in this repository so you can check it out if you’re interested.

There were also tweets made by the audience just before the presentation.

I can say that conference room was full. There were even people sitting on the floor due to lack of free chairs what really surprised me. In the Eventory app, more than 85 people joined the lecture, but in reality, there could be about 100 people or more. It was really flattering that such huge and great audience decided to listen to my talk. In fact, that was the biggest audience I have ever had during the public presentation so far. Moreover, people were asking many interesting questions during Q&A session and after the presentation, so it means they were interested in this topic and they wanted to learn more, understand it and apply it in their projects. If you haven’t had the opportunity to see this presentation, but you would like to, JDD organizers will provide video recordings from the sessions. In addition, you can monitor Talks page on this blog, where I publish my past and upcoming sessions. Probably, I’ll present this topic again during one or two meetups because people are interested in it.

Joining JDD 2017 as a speaker was a great experience. It cost me an additional work and effort after hours, but at the end of the day, it was totally worth it and it was much easier to establish contacts and meet new people as a speaker than as an attendee, what is important for me. Moreover, I could learn new things from other people as well because general level of the conference presentations was pretty high.

Thanks for the interesting questions, discussions, other good presentations and support before the talk!

Below you can find two pictures from this talk made by JDD 2017 photographers.