Basic usage of YaaS as a proxy for the microservice

2017-04-30 DSP2017, Hybris, Microservices, YaaS No comments


The company, where I currently work – SAP Hybris is developing a project called YaaS, which is an abbreviation of Hybris as a Service. Unfortunately, this article is not sponsored yet :). What a pity :(. I just like to understand many things & how they work to see the bigger picture. Moreover, company strategy is to leverage YaaS and search for the new possibilities and use cases of this project. There are situations where delegating some work to a separate service makes sense so this knowledge may be useful even when we’re developing the monolithic enterprise applications. That’s why I wrote this article. I work in a completely different project – Enterprise Commerce Platform, where I’m the part of the Backoffice team. As you can read on the official website, YaaS is a microservices ecosystem helping businesses to rapidly augment and build new, highly flexible solutions. It’s kind of marketing statement, which business people may like. Nevertheless, for developers, it’s just a bunch of buzzwords, which does not help you to understand this project. One of the aims of this article is to explain it in a simple and clear way.

yaas - hybris as a service

From the technical point of view, YaaS gives you the following possibilities:

  • it can be a proxy for your microservice, which can be deployed anywhere
  • it gives you separate proxy servers for EU and US, which you can use depending on the server or user location
  • it provides you a domain like api.eu.yaas.io/yourorganization/yourservice/
  • it provides secured connection
  • it gives a mechanism, which allows you to secure endpoints of your microservice via dynamically generated token
  • it gives you the possibility to manage access to your service for advanced use cases with features like clients, roles, etc.
  • it gives you monitoring possibilities
  • it allows you to perform versioning of your API
  • it allows you to integrate other services/packages from YaaS Market with your service
  • it gives you web interface called YaaS Builder, which you can use for managing your projects and organization

YaaS is NOT:

  • the hosting platform like Heroku or AWS – you need to have another place where you can deploy your service (like Heroku or whatever)
  • the part of the Core Hybris Platform – it’s completely separate project, but it can be integrated with the Hybris Platform

The official website of the project is: www.yaas.io.

In this article, I won’t explain all the features of YaaS. I will simply show you:

  • how to create a simple proxy for your microservice
  • how to secure endpoint of your microservice
  • how to access secured endpoint of your microservice

Maybe I’ll explain more features in the separate articles in the future.

Creating a simple proxy for the microservice

We need to do the following steps:

  1. Go to https://builder.yaas.io
  2. Create an account & log in
  3. Create an organization
  4. Create a project
  5. Within the project create a service
  6. Provide address to your service
  7. Provide API version (e.g. v1)
  8. Deploy service
  9. Right now, your service is deployed, but not accessible yet
  10. Create a Client and assign it to your service
  11. Now you should be able to access your service at: https://api.eu.yaas.io/orgranization/service/v1

Below you can see a screenshot from service configuration inside the YaaS Builder.

Securing the endpoint of the microservice

We have created our service. Now, we want to secure its endpoint. To do so, we can create Authorization Rule from the Service configuration inside YaaS Builder.

We can define methods of the HTTP request, endpoint address, and other parameters.

When we’re done, we can proceed to more tricky part. Authorization procedure of the microservice endpoint is presented in the scheme below.

calling microservice with authorization via YaaS proxy

First, we need to obtain Bearer ID. To do so, we need to perform HTTP request with Client ID and Client Secret. We can do it from terminal via curl:

curl -X POST -i 
-H "Content-Type: application/x-www-form-urlencoded" 
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" 

Then, we’ll receive a response like that:


and we can make an authorized call to our microservice:

curl -X POST -i 
-H "Authorization: Bearer 023-018f03da-cdb7-4710-a4cf-70f89e23003f" 
-H "Content-Type: application/json" 
-d "" 

after that, we should receive a response from the microservice. Note, that Bearer ID will be valid for the particular amount of time.

Hint #1: To make calls more readable in the article, I split them into lines. If you’re making a real call it’s better to have whole instruction in a single line.
Hint #2: You can get Client Secret and Client ID from the YaaS Builder while editing your Client.


As we could see, creating a microservice proxy and securing the endpoint is not so complicated, but it’s not straightforward as well. It requires some knowledge about YaaS and its design. Using this approach won’t be a good idea every time, but I think there are use cases when it can be useful. Especially, when we care about monitoring & security and when we want to have unified & controlled access to our services.

Here are a few of my ideas of delegating work to the microservice from the monolithic enterprise commerce application:

  • file or image storage
  • backups of the data
  • classification of the products – e.g. we can delegate images to the external service, which will use machine learning and neural networks to classify products by colors or by something else
  • long running operations & queues – e.g. we can delegate such things to the separate microservice to relieve CPU & Memory of the server, where core system is running and simply receive push notification with final result of the operation from the microservice when the work is done
  • sending e-mails and other types of notifications
  • and more… (if you have your own ideas – share them in comments!)

I think the basic idea could be the distribution of computations to the different servers, what may extend capabilities of the core system, make it faster, lighter and more stable. In addition, it should make work of developers easier and more joyful because they could work on the smaller parts of the system, which have a clearly specified goal and smaller codebase, which is easier to manage.

2 cool terminal emulators for Linux

2017-04-30 DSP2017, Linux, Tools 2 comments

There are many terminal emulators for Linux, but two of them acquired my attention.


Yakuake is a terminal emulator, which you can drop down from the top of the screen in any situation. It may look familiar to those who played Quake III, because this game has a very similar concept of the terminal for configuration purposes. It’s very convenient when we want to check something quickly. We can just press F12 do our task and press the same key to close the window.

yakuake - terminal emulator


Tilix is another interesting terminal emulator, which is quite similar to iTerm2 for macOS. It has the possibility to create tiles and tabs just like iTerm2. It can be some kind of alternative for Tmux. Moreover, it allows searching through the console what is very useful.

tilix - terminal emulator

Do you know more interesting terminal emulators for Linux or maybe for other operating systems? Share them in comments!

Facebook is making solutions to talk from the brain – so do I

2017-04-23 Brain Computer Interface, DSP2017 No comments

During F8 Facebook Developers Conference 2017, Facebook revealed its plans for the nearest years.
Among different stuff, keynote from the day 2 was especially interesting for me. Speakers talked about connectivity projects increasing access to the Internet across the globe, different methods of human-computer interaction, virtual reality, and last, but not least Brain-Computer Interface.

It’s super-interesting for me, because 4 years ago I wrote Master Thesis about Brain-Computer Interface for Mobile Devices at my university & published a few short articles about Brain-Computer Interface on this blog. You can also download my EEG Analyzer Android app from Google Play Store. I also wrote another app called EEG Controller for communicating with the external world with brain and optionally with eye blinks. It wasn’t published. Maybe I’ll enhance and publish it in the future or I’ll create a better app for the similar thing. Of course, my apps are much simpler & less advanced than the Facebook plans, but still, both of them are aiming to solve similar problems.

Facebook is planning to hire 60 engineers and PhDs to develop new Brain-Computer Interface. If I understood them correctly, they’re planning to create non-invasive hardware & software, which will be as much accurate as invasive hardware. In simple words it means, they’re not going to create implants for the brain, but some kind of wearable device, which will have the same (or better) accuracy as the brain implants, which exists today. Definitely, it’s not an easy task. If you are skeptical about such brain technologies, I can tell you that technology available today is far away from “reading the mind or thoughts”. It rather analyzes & interprets brain waves and signals. It allows to determine, if we are concentrated, relaxed, sleepy, tired, etc. With more precise tools, we can simply gather more data and information, which will hopefully allow developing tools, which are capable of “typing with the brain”. Nowadays, consumer wearable electroencephalographs like NeuroSky MindWave or Muse allows to read rather “binary” data like: you’re concentrated or not & you’re relaxed or not. In addition, they can give you such results in percentage value. It can be used for developing simple communication apps, which can allow people to communicate with just a brain, but using them may be not so convenient, slow or inefficient. Despite these disadvantages, for people with diseases like LIS, it may be the only hope for communicating with the world.

I’m keeping fingers crossed for the Facebook BCI project! Moreover, I’m planning to extend my own work and create more complex BCI solutions in the future. Right now, I had these ideas only in my head. I’m also not going to compete with Facebook because I don’t have knowledge or resources (at least not yet) to develop my own BCI hardware. Not to mention about 60 engineers, which are far smarter & more experienced than me. I have an idea about using hardware, which already exists on the market and to write better software for using it because a lot of solutions available now are quite poor in my opinion. It may leverage the potential of BCI in daily usage and make technologies like EEG more available & affordable for the people who need it for research or medical solutions. Having in mind the fact that Facebook is putting a lot of serious effort in BCI technology, I’m becoming more convinced that this technology may the future and the way to go.

3 Alternatives to Evernote

2017-04-23 DSP2017, Tools No comments


I’ve been using Evernote for some time for taking longer notes, but it started to annoy me a little bit. The main drawback is lack of the Linux desktop app. I’m using this app on Android phone, Macbook (at work) and on Linux (at home). There are community apps like NixNote2, which is nice, but in my opinion it’s not good enough. Moreover, Evernote seems to have too many features, which distract me and I don’t really use most of them. A few of these features may be really helpful for some use cases, but not for mine. I need simpler & cleaner tool for taking basic personal notes, which is available on all operating systems. I’ve started searching for Evernote alternatives. Below you can find my types worth checking.

Google Keep

It’s nice & quite popular tool from Google with Android app. I started using it before Evernote. It doesn’t have dedicated desktop app, but it has Chrome extension, which behaves almost like a desktop app. It’s great for short & quick text notes, simple hand drawing notes, notes with pictures & even simple voice notes. It’s some kind of replacement or extension for physical yellow sticky notes. When I want to note something like one sentence or keyword quickly and I have only my phone with me, it’s perfect choice. Nevertheless, it’s not so good for a longer notes.

Link: https://keep.google.com


This app is nice, clean & elegant. Moreover, it has desktop apps for all popular destkop & mobile operating systems: Windows, Linux, macOS, Android & iOS. It has less features than Evernote, but it’s sufficient for me. In addition, it easily synchronizes across all devices and allows you to export notes into single *.zip file. It doesn’t have folders/categories, but it has tags, which may be helpful during organizing your stuff. This is my strong personal candidate to replace Evernote. This app is developed by Automattic, a company behind WordPress & other nice tools.

Link: https://simplenote.com


Boostnote is another interesting tool worth checking out. It’s open-source and works on Linux, Windows & macOS. Unfortunately, it doesn’t have mobile & web apps yet. This tool is good for collecting code snippets and markdown notes, what makes it great for software developers. Moreover, you can attach any storage on your disk to this tool and fully control it. For example, you can add storage in your Dropbox account and synchronize it across devices. You can also attach it to your private Git repository and track changes in the notes. Nevertheless it requires additional work like committing & pushing changes to repository. This tool is under development. Maybe it wouldn’t be perfect replacement for Evernote, but it definitely looks promising.

Link: https://boostnote.io


As we can see there are many tools for taking notes. Sometimes, I also use regular physical notepad, sticky notes & pen, which are perfect when power goes down or you want to have a break from the machines. We don’t have to be sticked to one tool forever.

Transform Vim into efficient IDE

2017-04-16 DSP2017, Tools, Vim No comments


Some time ago, I decided to learn Vim. A lot of people are afraid of this editor and they usually don’t want to know anything about it or just learn how to quit it. In my opinion, it’s good to learn it because after mastering the basics, we can work very efficiently. After some time of usage, we may even replace editors like Atom or Sublime Text with Vim. Moreover, Vim is default editor for a few Unix tools like Git, so it’s good to know how to use it when we accidentally open it. In addition, sometimes we have an access only to the terminal (e.g. via ssh) and we need to perform a task on the remote server, so we don’t have any possibility to use editors with GUI. In such cases, Vim is a perfect solution. Last, but not least – if you want to be a real h4x0r, you should know it (or at least its basics) ;-).

Learning basics

Vim is not an intuitive text editor like many others. It needs to be learned. Just like a programming language. There are a few basic things, which you need to know to use Vim:

  • Opening editor: just type vi or vi filename to open file.
  • Basic modes: interactive (enter it with i key), visual (enter it via v key), read only (default – go back to this mode via Esc key). You can also use Esc key to cancel any kind of operation.
  • Navigation: to navigate in the document, we need to be in read only mode and instead of arrow keys, we use h (left), j (down), k (up), l (right). Note that these keys are close to each other in a row on the keyboard. Such setup may be even more comfortable than arrow keys.
  • Saving changes in file: to save file, type :w.
  • Quiting: To quit vim, type :q.
  • Quiting without saving: :q!.
  • Quiting with saving: :wq.

In my opinion, the best way to learn Vim basics is to use vimtutor application. Just open terminal and type vimtutor. It will open a text file with Vim tutorial inside Vim and you can follow instructions in this file to learn how to use this editor.

You can also use other resources like:

Efficient navigation and file editing

Thanks to various key bindings, Vim allows you to navigate & edit files very quickly. E.g. you can jump between words with w key. You can also combine different key bindings. E.g. d is for deleting text. When you combine d & w (dw) you can delete single word. This “Vim language” can be a subject of the separate article, so I won’t explain it in details in this article. It’s good to go through tutorials and learn this editor as you use it.

Personal configuration

You can customize Vim and keep its configuration in .vimrc file located in your home directory.
Below, you can find my configuration with comments. I copied it from somewhere and modified a little bit.

set clipboard=unnamed       "Enable clipboard
filetype plugin indent on   "Enable indent plugin
syntax enable               "Enable syntax coloring
syntax on                   "Turn syntax coloring on
:color desert               "Set desert syntax coloring
set nocompatible            "Allow Vim-only settings even if they break vi keybindings.
:filetype on                "Enable filetype detection
set incsearch               "Find as you type
set ignorecase              "Ignore case in search
set scrolloff=5             "Number of lines to keep above/below cursor
set smartcase               "Only ignore case when all letters are lowercase
set number                  "Show line numbers
set wildmode=longest,list   "Complete longest string, then list alternatives
set fileformats=unix        "Use Unix line endings
set smartindent             "Smart autoindenting on new line
set smarttab                "Respect space/tab settings
set history=300             "Number of commands to remember
set backspace=2             "Use standard backspace behavior
set hlsearch                "Highlight matches in search
set ruler                   "Show line and column number
set formatoptions=1         "Don't wrap text after a one-letter word
set linebreak               "Break lines when appropriate
set autoindent              "Auto indent based on previous line

                            "Prepare tab/space indent settings
set tabstop=4               "Set Tab width to 4
set shiftwidth=4            "Indents will have width of 4
set softtabstop=4           "Set the number of columns for tab
set expandtab               "Expand tabs to spaces

execute pathogen#infect()

Plugin manager

We can enhance Vim by adding additional plugins. There are a few plugin managers for Vim. I personally like pathogen because it’s quite easy to install and easy to use.

Useful plugins

I use 3 plugins right now:

  • nerdtree (adds sidebar with list of files and directories)
  • tagbar (adds overview of the currently edited file with navigation like list of methods, attributes etc. and works for different programming languages)
  • ctrlp (adds very fast file search)


Below, you can see my setup with nerdtree & tagbar opened. As you can see, Vim can be very powerful and customizable editor & can make our work more efficient. It has a lot of features. Nevertheless it’s not easy to learn and we have to spend some time to learn how to use it. I think, the best approach is to learn the basics, start using it and then learn rest of the stuff we need during the time. Of course, it has drawbacks like lack of default debugger, steep learning curve and so on. On the other hand, I still think it’s worth to learn it. There are also languages with command line debuggers, so you can combine Vim with Tmux and have everything you need on one screen. I hope you’ll find my tips helpful and you’ll be encouraged to give this editor a try. It’s definitely not a tool for newbies, but I suppose you are not one of them ;-).

ReactiveNetwork – release v. 0.9.0 with RxJava2.x support

2017-04-11 Android, DSP2017, Java, Open source, RxJava No comments

This time, I upgraded my another reactive Android open-source project called ReactiveNetwork to RxJava2.x. Many thanks goes to @tushar-acharya who performed initial migration to the newer version of RxJava. During migration, I’ve also created new package rx2 to avoid potential import conflicts during migration inside Android apps. Besides migration, I’ve updated sample apps, documentation & JavaDocs on Github pages. You can still use RxJava1.x version and it’s available on the branch with that name.

To use brand new ReactiveNetwork compatible with RxJava2.x, add the following dependency to your build.gradle file:

dependencies {
  compile 'com.github.pwittchen:reactivenetwork-rx2:0.9.0'

If you still want or need to use RxJava1.x, use the following dependency:

dependencies {
  compile 'com.github.pwittchen:reactivenetwork:0.9.0'

New updates and bug-fixes are on the way. Right now I have a few issues in the project backlog.

Feel free to contribute to this project and report new issues! Any constructive feedback will be appreciated.

Automate tile layouts creation in tmux with tmux-auto-pane

2017-04-08 Bash, DSP2017, Linux, Tmux No comments

I just released tmux-auto-pane. It’s a tiny shell script for creating pre-defined tile layouts in Tmux on Linux with xdotool.
In our workflow, we often have some pre-defined pane configurations in a terminal. The project called tmux-auto-pane helps to automate that process. It can save us some time and make us a bit more productive.

We can call tmux-auto-pane with one of the following parameters:

--help | -h   showing help
--1l1r        one left, one right
--1l2r        one left, two right
--2l1r        two left, one right
--1u1d        one up, one down
--1u2d        on up, two down
--2u1d        two up, one down
--4tiles      4 tiles, 1 in each corner

for example tmux-auto-pane --4tiles

will generate such layout:

 ____ ____
|    |    |
|    |    |

we can also have the following layouts:

    1l1r         1l2r         2l1r         1u1d        1u2d         2u1d
 ____ ____    ____ ____    ____ ____    _________    _________    ____ ____
|    |    |  |    |    |  |    |    |  |         |  |         |  |    |    |
|    |    |  |    |____|  |____|    |  |_________|  |____ ____|  |____|____|
|    |    |  |    |    |  |    |    |  |         |  |    |    |  |         |
|____|____|  |____|____|  |____|____|  |_________|  |____|____|  |_________|

Script can be installed via wget:

sh -c "$(wget https://raw.githubusercontent.com/pwittchen/tmux-auto-pane/master/install.sh -O -)"

or via curl:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/pwittchen/tmux-auto-pane/master/install.sh)"

Due to the fact, that tmux-auto-pane uses xdotool under the hood, unfortunately it works only with Linux right now.
It can be improved in the future to work with macOS as well.

Source of the project can be found at https://github.com/pwittchen/tmux-auto-pane.
This project could be extended to start specific applications in each pane.
Maybe, I’ll improve it in the future, so users could parametrize their custom applications.

I hope Tmux & Linux users will find it useful :).

ReactiveBeacons – release of v. 0.6.0 with support for RxJava2

2017-04-03 Android, Bluetooth Low Energy, DSP2017, Java, Open source, RxJava No comments

Thanks to @BugsBunnyBR I released new version of ReactiveBeacons library with the RxJava2.x support. It’s an Android library scanning BLE (Bluetooth Low Energy) beacons nearby with RxJava Observables. I also kept backward compatibility with RxJava1.x. Different versions of the libraries are located on the separate git branches. It’s a similar approach to original RxJava project. I have separate builds on Travis CI, separate artifacts and JavaDocs. Such approach generates more overhead, but in such case, RxJava1.x can be kept in a maintenance mode and RxJava2.x can be a subject of the future development.

What has been done in this version?

  • migrated library to RxJava2.x on RxJava2.x branch and released it as reactivebeacons-rx2 artifact
  • kept library compatible with RxJava1.x on a RxJava1.x branch and released it as reactivebeacons artifact
  • removed master branch
  • bumped library dependencies
  • added permission annotations
  • organized Gradle configuration
  • transformed instrumentation unit tests to pure java unit tests
  • started executing unit tests on Travis CI server
  • created separate JavaDoc for RxJava1.x and RxJava2.x

If you want to add RxJava2.x version to your Android project, add the following dependency to build.gradle file:

dependencies {
  compile 'com.github.pwittchen:reactivebeacons-rx2:0.6.0'

For RxJava1.x you can use old artifact id:

dependencies {
  compile 'com.github.pwittchen:reactivebeacons:0.6.0'

This library was one of the first experiments with my migrations to RxJava2.x. I have plans to migrate rest of my libraries soon.
Thanks to the awesome open-source community on GitHub, this process goes faster and I don’t have to do everything by myself.

Browsing directories with Vim

2017-04-02 DSP2017, Linux, Vim 2 comments

I’m still learning Vim every day. At first, it looks quite hard and most of the people want to learn how to quit it and never use again. Nevertheless, when you learn some basics, you can be really productive. This editor has much more cool functionalities than just :q shortcut ;-).
Recently I discovered, you can use Vim not only for editing files but you can use it for browsing directories as well! Just go to any directory you want in terminal and type:

vi .

Then you have very nice file browser:

You can use most of the regular Vim commands like /yourkeyword for searching.

You can also navigate up and down with j and k as inside the files. To enter directory, just press Enter You also have other features like - key for going up, s for sorting, R for renaming and D for deleting. To quit this browser, just type :q (the same shortcut as in the editor).

I know, this file browsing functionality is not perfect, but it’s much better than regular navigation and directory browsing in the console with cd, ls and searching with grep. In some cases it may be a perfect choice!

How to make open-source projects, which people want to use

2017-04-01 Conferences, DSP2017, Open source No comments

Today at Kariera IT conference in Katowice, Poland, I presented talk explaining how to make open-source projects, which people want to use from my perspective.

Below, you can find slides from my presentation. Thank you all for the attendance, interesting questions and organizers for inviting me. I hope you learned something new.
Of course, any constructive feedback for this talk will be appreciated :).