Calculating range of Java integer types

February 14, 2016 Java 3 comments


Java types range

Learn with this article how to calculate range of Java integer types. You will never have to Google for the Jave type range table anymore! (more…)

Converting between String and numeric types in Java

February 13, 2016 Java 1 comment

String to int Java

In this article I will shorty explain how to perform conversions between String and numeric types in Java, like String to integer. (more…)

org.apache.http.HttpException: Unsupported Content-Coding: none solution

February 9, 2016 Java 4 comments

Apache Commons HTTP Components HTTPClient

Did your code using Apache Commons HTTPClient just throwed the org.apache.http.HttpException: Unsupported Content-Coding: none exception? No worries, I have a solution. (more…)

How to install Java on Ubuntu with fully automated script

January 31, 2016 Systems Administration 19 comments , ,

How to install Ubuntu on Java

This article explains how to install Java on Ubuntu and its derivatives like Linux Mint. Thanks to UbuntuJavaInstaller, a fully automated Ubuntu Java installer, we can install Java on Ubuntu very fast, simply and effortlessly. (more…)

Check if bash script is run with root permissions

January 31, 2016 Systems Administration No comments

Check if bash script is run with root permissions

Short code snippet to check if bash script is run with root permissions.

Check if bash script is run with root permissions example code.

Below I present code that verifies if bash script is ran with root permissions. The code works without any problems with sudo.


Check if bash script is run with root permissions example


# Check if ran with root permissions
if [ `id -u` -ne 0 ]; then
   printf "The script must be run as root! (you can use sudo)\n"
   exit 1


The script uses id utility that displays real and effective user ID. Thanks to this utility, we can verify that user runs the script with root privileges. This technique makes the script to effectively detect use of sudo as well.

The root ID is 0 (zero), therefore we compare ID returned by id utility with number zero. If the match is made, we know that the script is executed with root permissions. If it’s not, then we know that the user has no root permissions. In this case, we display an information message and leave the script.


JavaScript performance library simpleperfo.js

January 30, 2016 JavaScript, Libraries & Frameworks 4 comments

JavaScript performance library

Learn how to measure your JavaScript performance with my effective and super simple in use library. Simpleperfo.js is a JavaScript performance library that allows to measure execution times of your functions in order to allow you to optimize them effectively.

The library is very simple in use. My intention was to provide a library that will be easy to use even for JavaScript beginners. There are no difficult configurations or complicated APIs. Simply load the library to your existing project and use one of the available functions.

Below is an example code to measure two functions calculating Fibonacci numbers. Checking which one is faster is just matter of a few lines of simple code!

/* Algorithms to tests */
function fiboIterative(no) {
if(no<=2) { return 1; }
var a=1, b=1, sum=0;
for (var i=3; i<=no; i++) {
sum = a+b;
a = b;
b = sum;
return sum;

function fiboRecursive(no) {
if(no<=2) {
return 1;
} else {
return fiboRecursive(no-2) + fiboRecursive(no-1);

/* Measuring execution time */
var result1 = simpleperfo.executionTime(fiboIterative,[15]);
var result2 = simpleperfo.executionTime(fiboRecursive,[15]);

console.log("fiboIterative(15): " + result1 + "ms");
console.log("fiboRecursive(15): " + result2 + "ms");

This JavaScript performance library is available for download on simpleperfo.js on GitHub


From Mathematics to Generic Programming review

January 13, 2016 Book reviews 11 comments

From Mathematics to Generic Programming” review. A book by Alexander Stepanov and Daniel Rose. Published by Addison-Wesley.

From Mathematics to Generic Programming (more…)

How to fix font problems in printing on Ubuntu

December 10, 2015 Systems Administration 5 comments ,

Last time, again, I got a problem with printing documents on my Linux Mint (OS based on Ubuntu). All the documents I printed were missing umlauts (German characters ä ö ü). In past I had the same problem, when my printed documents were missing Polish characters (like Ł). This problem lies in missing or improperly configured fonts. Below you can find how to fix them.

The first thing to try is to install missing fonts. The first set of fonts to try are the Microsoft fonts, as most likely your OS is missing them. You can install them with the following command:

sudo apt-get install ttf-mscorefonts-installer

You can also try to install other fonts, by search for “font” in Synaptic.

If it doesn’t help, reset your fonts configuration:

sudo apt-get install --reinstall --purge fontconfig fontconfig-config

If you was able to print documents properly in the past, the command above most likely will solve the problem.

Learn more about Ubuntu


TinyMCE count words plugin

August 27, 2015 Libraries & Frameworks 18 comments

Are you looking for a plugin that displays both characters and words count in TinyMCE ? You just found it. charwordcount is a plugin that allow you to count words in TinyMCE.

TinyMCE count words and characters plugin

The plugin count words in TinyMCE editor and additionally characters count. By default, the plugin ignores counting HTML tags and entities (like &nbsp;). If you need to count HTML tags and entities as well, you can enable that in the configuration. (more…)

Squid IP whitelist guide

August 22, 2015 Systems Administration 2 comments

Squid proxy and cache server guide

This is a quick guide showing how to configure Squid IP whitelist, limiting connections to Squid proxy server only from particular IPs.