Pooky`s Logbook

Ahoj světe! Hallo Welt! Hello World!


Java Wiki

I have decided to start write down some my knowledge about Java world and ecosystem. I have a lot of experience with java since my highschool. I have been working as java developer, I have read a lot of books, get training but I still felt, that there is so many information, standards, versions, components, types that I need it to document just how the things interact and what I know about each of them.

Currently, there are two main branches on which I mainly focus. Web-development and Spring integration. In this area I feel most confusion and complex solutions which are not easy to understand. Therefore, they need some documentation not about how to use them but what they are and where do you need them.

Both branches has repository on GitHub with the simplest possible example. This example is basic configuration which can be blueprint for future projects. Besides the code there is also documentation and wiki.

Servlet example
Spring Dependency Injection example
Java Wiki


Amazon currently offer really cool and cheap device Fire TV stick. This Fire TV stick is similar to Chromecast. You plug it in your TV and then your TV is magically smart land full of movies and series to watch. Only one thing, you have to have Amazon Prime, without this subscription is it just stick without any content with preinstalled Android and remote control – which is beautiful and incredibly usefull.

Fire TV stick is basically Android device. Well, there are a lot of Android Apps, for instance KODI. Open-source media center, which allows you to watch whatever you want, only thing you need to invest is time and knowledge.

How to do it:

1) Buy Amazon Fire TV Stick

You can buy it from Amazon webstore. You can get it here currently for 39eur.

2) Plug it in and connect to your Wifi
3) Install android App

How to install android app on Fire TV stick?

This step can be solved by many differend approaches. The most usefull one will be this:

Allow untrusted application and developer options – direct approach with pictures is here
Settings->Device->Developer options->Allow ADB debug and Untrusted Apps.

After this, you can either: install application from amazon apps store or use this app for installing other applications for your Fire TV.

You can also use Android Developer Bridge (ADB) and by it control your Fire TV stick. This app allow you to connect to your device, install some package .apk or browse filesystem.

Current version of KODI can be downloaded here (choose android version).

Basically, when you manage to install KODI that’s the win. After that, you can install any other Android App on your own wish.

Kodi and Fire TV Stick

After you install KODI, there are some things you will need to get used to. For example:

Remote control has no „fullscreen“ button

This can be solved by presing „back“ button and then „left“, you should see left options sidebar and in the bottom, there is remote control button for fullscreen.

How install other repositories to KODI

First install of KODI is without any Addons, only available addons are in some global repository. The really useful one are mostly on private repositories. To install that, just copy „zip file“ of repository to your KODI. For this operation you can use ABDLink and press button „filemanager“, then copy your repository to KODI.

Fire TV Stick specification


Switzerland writer Max Frisch wrote few questions which are really interesting. This questions are interesting not for some score but just for themselves to be risen up and to expand our horizons of thoughts.

Q: Are you really interested in the preservation of the human race once you and all the people you know are no longer alive? State briefly why.

A: Yes, I`m human and I want our race to continue.

Q: How many of your children do not owe their existence to deliberate intention?

A: None, I don`t have children yet.

Q: Whom would you rather never have met?

A: No-one, I`m grateful for every person I have meet and it brings me a lot of experience – bad or good, that doesn’t matter.

Q: Are you conscious of being in the wrong in relation to some other person (who need not necessarily be aware of it)? If so, does this make you hate yourself – or the other person?

A: Yes, that`s make me angry.

Q: Would you like to have perfect memory?

A: Human memory is good as it is, there is nothing like perfect memory.

Q: Give the name of a politician whose death through illness, accident, etc. would fill you with hope. Or do you consider none of them indispensible?

A: I don`t wish any harm to any person or human being.

Q: Which person or persons, now dead, would you like to see again?

A: My grandfather.

Q: Which not?

A: None

Q: Would you rather have belonged to a different nation (or civilization)? If so, which?

A: I think our nation is fine, there is no better (perfect) nation.

Q: To what age do you wish to live?

A: at least 115 years

Q: If you had the power to put into effect things you consider right, would you do so against the wishes of the majority? (Yes or no)

A: Yes

Q: Why not, if you think they are right?

Q: Which do you find it easier to hate, a group or an individual? And do you prefer to hate individually or as part of a group?

A: It`s easily to hate group without face but haters is wrong even for group or individual.

Q: When did you stop believing you could become wiser – or do you still believe it? Give your age.

A: I still believe I can be wiser, everyone can. I`m now 25 years old.

Q: Are you convinced by your own self-criticism?

A: Yes, one of the biggest.

Q: What in your opinion do others dislike about you, and what do you dislike about yourself? If not the same thing, which do you find it easier to excuse?

A: Others dot like my mood swing, my opinions which they don`t understand or seem correct to them. I don`t like also my mood swing and sometimes my stubborn. It`s easier to excuse my strong opinions towards others, I do it for their own good.

Q: Do you find the thought that you might never have been born (if it ever occurs to you) disturbing?

A: Not at all

Q: When you think of someone dead, would you like him to speak to you, or would you rather say something more to him?

A: Both, conversation would be nice.

Q: Do you love anybody?

A: Yes, I do.

Q: How do you know?

A: I`m smart person, I know.

Q: Let us assume that you have never killed another human being. How do you account for it?

A: It`s natural to not kill your own species.

Q: What do you need in order to be happy?

A: Free-time, money, company, books, sport, sex, love, animals, shelter, invention, food, sun

Q: What are you grateful for?

A: I`m grateful for human existence and all human being on the planet.

Q: Which would you rather do: die or live on as a healthy animal? Which animal?

A: Animal, totally animal! Almost anyone fish, cat, bird, dog, elephant. My favorite would be dog.


Learning new language is hard. I know that. It takes time, effort, commitment and any progress is really hard to see or test. Many of students try to start with new language, but they will be soon disappointed with his difficulty, grammatical rules and lack of vocabulary. They are also not sure, why even they should learn new language in first place. In regular environment, there is not many possibilities how to practice your new language and even if there will be, it’s hard to practice it regularly.

The limits of my language means the limits of my world.
Ludwig Wittgenstein

I recently see some results from EU barometer. In year 2005 in Czech Republic there has been about 61% of residents to be able hold conversation at least in one addition language. In year 2012 there was drop about 12% to current 49%, which is not much. There is also interesting number, that only 27% of responders can speak English language and about 14% can speak German. If we take in account, that subjective scale of each responder is probably very different and language without active usage is going to be forgotten really soon, the numbers are really bad.

Source: ec.europa.eu/public_opinion/archives/ebs/ebs_386_en.pdf


Javascript ist heute die meistens benutzte Programmiersprache des Welt. Er hat lange Weg von kleine und verachten Sprache zu dem größte und alle-benutzen Sprache gekommen. Heute kann man nicht ohne diese Sprache funktioniere. Es gibt viele Tutorials und große Menge von Javascript Bibliothek aber nicht viele geht um Sache wie man gute Code geschrieben sollte.

Ich habe lange Zeit versuchten gute Tutorial finden, wie soll man Javascript-Module schreiben. Es dauert mich Lange Zeit und ich muss wirklich viele „nicht-so-gut“ Muster sehen zu die Beste finden. So jetzt ich möchte mit ihr mein Entdeckung teilen.

Javascript ist immer jung und es gibt keine „universale“ Standarte für Javascript-Coding-Style. Es gibt viele verschiedene Möglichkeiten, wie gute Code schreiben aber ich will hier zeigen, welche ich dachte, die beste ist.

  1. Alles ist über Scope

Wenn man Javascript-Code schreiben möchte, muss man verstehen, was Scope ist. Im kurz – Scope ist kleine namespace für jede Funktion. Für dise Grund wir sind erlauben im jede Funktion verschiedene variablen mit gleiche Name ohne Kollision zu machen. Es hat Vorteile und auch Nachteile – ich versuche das einfach durch Beispiele erklären.

Local scope & Global scope

var x = 5; // global scope – immer verfügbar

var fn = function(){

var y = 9, x = 15; console.log(x, y); // 15, 9 }

console.log(x); // 5 console.log(y); // error – nur local scope

Hier, im diese einfache Funktion Deklaration, haben wir zwei Variablen mit Name `x`. Jede Variable ist aber in andere Scope. Das ist wichtig. Ohne das kann wir leicht überschreiben Variable `x` im Global Scope aus Funktion oder umgekehrt. Auch, wenn wir wollen `x` irgendwo benutzen, sollen wir wissen, welchem `x` wir wollen und mit welcher `x` wir arbeiten.

Eine Speziale Variable verbinden mit Scope heißt `this`. Im jede Scope ist auch wichtig zu verstehen, was this bedeutet, deshalb this bezieht im welche scope wir sind! Wir kann this übersetzen wie „da“ oder „diese“ (Funktion).

var fn = function(){

var x = 5; var self = this; // wir speichern scope im Variable

console.log(x); // 5 – local scope fn()

var fn2 = function(){

var x = 9; // local scope fn2() var y = this.x + self.x; // wir nehmen fn x und fn2 x zusammen console.log(y); // 14 } }

  1. Modules

Modules im Javascript sind einbisschen gleich wie Klassen. Modul soll ein kleine selbständige Teile sein, welcher wir kann benutzen ohne zu andere Teile versehren. Jede Modul soll privat und public Methode und Variable haben und deshalb wir brauchen zu jeder Module selbst Scope hat. Es ist nicht einfach diese Struktur verstehen, wenn jemand nicht gut Javascript kennst.

Unsere module ist speicher im Variable „Additions“. Diese Modul ist mit Closure gebaut. Closure ist anonymous Funktion welcher wird gleich ausführen sein.

Hier ist Beispiele:

/** Das ist Closure **/ function(){ // local scope }(); /** Closure mit züruck geben Object **/ var Additions = (function(){ return {}; }());

Jetzt wir haben Grundlage für unsere Modul. Wir haben Module-Scope und wir kann züruck
geben Object. So jetzt wir machen Variable und Funktion im unsere Module.

/** Module mit private Variablen und Funktion ** var Additions = (function(){ var a = 1; var b = 2; var c = null; var fn = function(){ } return {}; }()) console.log(Additions.a) // errpr

So jetzt brauchen wir aber auch public Methode und Variable. Wie macht das? Ziemlich einfach, wir müssen nur referenz dürch unsere Object züruckgeben.

/** Module mit public Variablen **/ var Additions = (function(){ var a = 1; var b = 2; var c = null; var fn = function(){ } return { a: a, b: b, c: c, fn: fn }; }()) console.log(Additions.a); // 1

Und alles zusammen:

var Additions = (function($){

var self = {}; // einfach Object für public Eingang

self.a = null; // public verfügbar Variable self.b = null; // public verfügbar Variable

var c = null; // private Variable

/** * Init Methode * @param options {} **/ self.init = function(options){

// Im diese init Funktion sollte des Variablen Initialisier // und auch verbinden Methode zu DOM-Objekte



self.increaseCounter = function(){

return true; };

var privateMethod = function(){ return true; }

// geben unsere public Object züruck return self;

})(jQuery); Additions.init(); // Jetzt wir Initialize unsere Modul

Javascript Modules sind nicht perfekt. Es gibt viele unterschiede Möglichkeit, wie kann man ihn schreiben und alle Möglichkeiten haben Vortaile und Nachteile. Mit diese Grosse von Javascript Bibliothen und Ökosystem brauchen wir mehr Abstraction und deshalb jede Module sollte selbst Scope benutzen. Es ist ohne Zweifel.

Wenn man Lust hat, mehr über Scope und Modules hier finden kann: