We try to write first Midlet and run it at Raspberry Pi device remotely. You need Raspberry Pi prepared. I’m using recommended OS for Raspberry: Rasbian. It’s debian based linux distribution prepared for this machine. If you work often with the same Pi you should set up static IP. It’s recommended way, you no need find current IP every reboot. You can do this in two ways: in the router, to bind IP with Pi Network Card’s MAC number, or at the Pi network config to retrieve static IP. The article doesn’t cover instalation and using ssh also. If all is prepared we can start. Czytaj dalej…

Few days ago Oracle has rolled out Java 8. In my opinion it’s revolutionary release, but it isn’t topic of this article. In parallel we can use new Java ME distribution for embedded platform – Java ME 8. Sadly SDK is at the moment at Early Access state and prepared only for Windows. I’m Mac user, then there is no possibility to check this out without VirtualBox. Czytaj dalej…

Few years ago I was programmer that write my own algorithms for every problem I’ve tried to resolve. One day I asked myself „Is any library that help me to resolve decisions in way, I provide data and conditions and get solution in back?” That day I’ve found Constraint programming.

Contraint programming is an emergent software technology for declarative description and effective solving of large, particularly combinatorial, problems especially in areas of planning and scheduling. It represents the most exciting developments in programming languages of the last decade and, not surprisingly, it has recently been identified by the ACM (Association for Computing Machinery) as one of the strategic directions in computer research.(source)

Czytaj dalej…

Java 8 has a lot of improvements, many of them touch interfaces. The problem is when new release want to add new methods to old interfaces from standard library. Every class implementing that interface should be rewrited to add implementations of missing methods. That’s very big problem – unacceptable in Java.

Java 8 provide solution for problem of this kind – default methods.

Czytaj dalej…

With Lambda expressions Java 8 has new power for developing smart and fast applications. If you don’t know how lambda expressions works just take a look a link above.

Sometimes, there is already a method that carries out exactly the action that you’d like to pass on to some other code. For example, suppose you simply want to print the event object whenever a button is clicked. You can use code below:

button.setOnAction(event -> System.out.println(event));
Czytaj dalej…

There will be few new features included in Java 8. Lambda expressions are one of them. They provide a concise and clear way to represent method interface using an expression. Labda represents an anonymous function like anonymous classes well known from previous java releases, but with clean and simple syntax.

Lambda expression is a block of code with parameters, you can use it whenever you want, a block of code is executed at later point of time.

Up to now, giving someone a block of code hasn’t been easy in Java. Java is an object-oriented language, so you had to construct an object belonging to a class that has a method with the desied code.

Czytaj dalej…

Lately my friend ask me: „I’ve forked repository from github.com, how can I update it?”. I’ll write an answer for this question here.


As example I’ll use Kotlin Language repository from github.com (I like Kotlin and I’m proud of it :)) Czytaj dalej…

I Like Tuples in Scala. I’m almost as happy as when I met Ranges in Groovy/Ruby. My main programming language is Java and there aren’t such nice control structures.

Then, what is Tuple?

Tuple in Scala is part of the Collections API.
Tuple combines a fixed number of items together and all can be used as one object. Tuples can hold objects with different types (unlike an array or list) and are immutable. Czytaj dalej…

MySQL – syntax examples: create table, primary and foreign keys

Last night I was asked for very basic example how create tables in MySQL and how to set keys up. I want to publish it here maybe it’ll be helpful for somebody, especially for beginners. Czytaj dalej…

If you’re any kind of developer it’s big chance you’re using linux as application server. Sooner or later will need the command that find the files and remove them (or another do something else with them).

There is an rm command but it doesn’t support search criteria.

However ther is find command. With find you can search for files in directory and remove them on the fly.

To do this you need to combine both commands together.

Syntax of find command is quite easy:


as ROOT_FOLDER can be /, . as current directory ot any other path. ROOT_FOLDER is the starting point for search.

CRITERIA can be many kinds, for example: -type f serach for files onlby (d – directories)
-name "PATTERN" serach for files with name in pattern,
-iname "PATTERN" the same as above but case insensitive,
-depth 2 search only in descendants deeper up to 2 steps from root_folder
-empty find empty files/directories
-size 123k find files with it’s size 123kilobytes.
-mtime -4h30m search for files that was modificated in last 4 hours and 30 minutes,

there is a lot of another criteria, for more use man pages.

There is another option for find: -exec. with this we can run command with found files.

$ find . -type f -iname "*.jpg" -exec rm -f {} \;

{} near the end means that command should be executed with evry found file, \; ends the command

In command above we search for all files with jpg exension from current directory and down, and remove them.

If we want to confirm every file’s remove, we should use:

find . -type f -name "*.bak" -exec rm -i {} \;

Good luck :)