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 :).


Handling different Android versions with strategy pattern

2017-03-26 Android, DSP2017, Software Design Patterns No comments

When we’re developing Android apps, we have to remember that different users have different versions of the Android OS. Unfortunately, not all of them has the newest version of the system and some of them have older devices with older systems. Some of these devices may be even unsupported because e.g. Google supports their devices like Nexus and Pixel for only 2 years. When we want to reach as many users as possible and make the app available for almost everyone, we have to handle different Android versions. One of the solutions for that problem is strategy design pattern (it’s also called Policy in Domain-Driven Design).

I’m developing an Android open-source library called ReactiveNetwork, which is used for monitoring connectivity with the network in the system. Network monitoring strategies vary between different versions of Android and I wanted to choose an appropriate strategy for appropriate Android version. To do so, I’ve created NetworkObservingStrategy interface:

This interface can have many implementations like LollipopNetworkObservingStrategy, PreLollipopNetworkObservingStrategy and MarshmallowNetworkObservingStrategy. Morever, more implementations can be added in the future.

After that, we can choose valid strategy for concrete version of the system:

That’s it. Now, we have the separate code working for Android M, L and all devices with system version lower than L.
This approach can also be applied to other areas.

Review your changes in the code before the commit

2017-03-26 DSP2017, Git 2 comments

Most of the people use git as follows.

  1. they create a feature branch
  2. they make some changes
  3. they add all the changes: git add -A
  4. they commit changes: git commit -m "I've done changes"
  5. they push it: git push

There’s a problem with such approach. When we created a lot of changes, it may happen that we forgot to delete something and we pushed some garbage to the remote repository.

It’s better to review our own changes before the commit.

When we’ve done some changes, instead of typing git add -A, we can type git add -p. It will allow us to review our own changes and approve or disapprove them with typing y (yes) or n (no).

After that process, all changes approved by us are “staged”. Changes, which are not approved are not staged. We can discard unstaged (and also unapproved) changes by typing git checkout -- .. After that, our repository is clean – unwanted changes are discarded & changes, which we approved are staged. Next, we can simply commit & push our changes to the remote repository.

This approach is, in my opinion, very useful and helps to avoid pushing unwanted code to the remote repository, what will hopefully make your co-workers happy.