Rezha Julio

My name is Rezha Julio
I am a chemist graduate from Bandung Institute of Technology. Currently working as Data Engineer at Traveloka.
You can reach me by email:

, @ Q Q

Powered by Hugo

filter by tags

Fix Java Unsupported major.minor version 52.0 on Ubuntu

time to read 1 min | 207 words

Today when I run gradle test, I hit Unsupported major.minor version 52.0 error. It comes when you are trying to run a class compiled using Java 1.8 compiler into a lower JRE version e.g. JRE 1.7 or JRE 1.6. Simplest way to fix this error is install the latest Java release i.e. Java 8 and run your program.

The Ubuntu archives have multiple versions of OpenJDK available. One of these is designated as the default and this has the package names default-jdk and default-jre. The java and javac programs will be symlinked to the binaries from this default JDK. On my Ubuntu, the default packages were linked to the openjdk-7-jdk and openjdk-7-jre packages.

However, you might want to install and use other versions of JDK. For example, to use Java 8 I did:

sudo apt install openjdk-8-jdk

The problem is that java, javac and other binaries still point to the default Java version. To switch the default Java binaries, use the update-java-alternatives tool.

To list the Java versions installed on your system, use the –list option:

update-java-alternatives --list
java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64

To set one of the above Java versions as the default, use the –set option:

$ sudo update-java-alternatives --set java-1.8.0-openjdk-amd64

Installing or Upgrading PostgreSQL 9.4 on Ubuntu 14.04

time to read 1 min | 131 words

I am currently having a side project that requiring JSON Blob feature on PostgreSQL 9.4. But Ubuntu 14.04 only delivering PostgreSQL 9.3 on their repositories. Now I’ll posting step by step how to install or upgrade if you already using PostgreSQL 9.3 on ubuntu 14.04 to PostgreSQL 9.4.

Add PostgreSQL 9.4 repository and Import repository signing key, and update the package lists

sudo echo 'deb trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list

wget --quiet -O - | \
  sudo apt-key add -

sudo apt-get update

Install PostgreSQL 9.4 and pgAdmin III

sudo apt-get install postgresql-9.4 pgadmin3

Check current clusters


Stop PostgreSQL 9.4 cluster, drop it, and upgrade PostgreSQL 9.3 cluster to 9.4

sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main

Confirm only 9.4 cluster remains


Fix Locale Settings Error On Ubuntu Server 14.04

time to read 1 min | 127 words

We are just migrating our cloud from Amazon Web Service to SoftLayer, and we feel really happy with performance improvement. But, somehow the new system has error like this.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US:",
	LC_ALL = (unset),
	LC_PAPER = "id_ID.UTF-8",
	LC_ADDRESS = "id_ID.UTF-8",
	LC_NUMERIC = "id_ID.UTF-8",
	LC_CTYPE = "en_US.UTF-8",
	LC_TIME = "id_ID.UTF-8",
	LC_NAME = "id_ID.UTF-8",
	LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Apparently our OS doesn’t know about en_US.UTF-8, and we can easily fix this just by running this few line of commands

export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
sudo locale-gen
sudo dpkg-reconfigure locales

Installing Varnish with nginx on Ubuntu 14.04

time to read 2 min | 418 words

About Varnish

Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the server itself if there is a need for an active process.

Installing Varnish

I assume you already have a web working with nginx. On your terminal, run this command one by one

sudo apt-get install apt-transport-https
curl | apt-key add -
echo "deb trusty varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list
sudo apt-get update
sudo apt-get install varnish

This will install the latest varnish 4 to your system. If you don’t add varnish repo, you’ll only get varnish 3 from official ubuntu repo. Just replace trusty with your version of ubuntu if you don’t use 14.04.

Configuring Varnish

Once you have varnish installed, you can start to configure them to ease the load on your virtual private server.

Varnish will serve the content on port 80, while fetching it from nginx which will run on port 8080.

Go ahead and start setting that up by opening the /etc/default/varnish file:

sudo nano /etc/default/varnish

Find the lines under “DAEMON_OPTS”— in the Alternative 2 section, and change the port number by “-a” to 80. The configuration should match the following code:

 DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m"

Next edit the file located at /etc/varnish/default.vcl. Change to port to from 80 to 8080 like below:

backend default {
    .host = "";
    .port = "8080";
    .connect_timeout = 60s;
    .first_byte_timeout = 60s;
    .between_bytes_timeout = 60s;
    .max_connections = 800;

Because this server run Wordpress and Ghost, I need to tell Varnish to not cache the admin area of wordpress and ghost. Still on /etc/varnish/default.vcl I need to modify sub vcl_recv block into this

sub vcl_recv {
        if (!(req.url ~ "wp-(login|admin)")) {
                unset req.http.cookie;

        if (!(req.url ~ "ghost")) {
                unset req.http.cookie;

Now the next step would be to edit the port used by nginx. Each server(it you have it configured that way) would need to be switched from 80 to 8080. The location of my config files are /etc/nginx/sites-available.

Once you have made all of the required changes, restart varnish and nginx.

sudo service nginx restart
sudo service varnish restart

Accessing your domain should instantly take you to the varnish cached version. To test, you can run varnishstat, and that should give you live data as you access the domain affected by varnish.

Disabling Apport Error Reporting on Ubuntu

time to read 2 min | 333 words

What is Apport ?

Apport is an Error Reporting Service provided by Ubuntu to intercept and analyze crashes and bugs as and when they occur. Crashes and Bugs may sound like bad things, but actually most operating systems will have several a day, and it doesn’t mean your computer is broken, nor does it necessarily stop working. As such, Apport can usually be safely disabled, as it doesn’t fix anything, it just tells developers that something went wrong.

Ubuntu 12.04 is the first release of Ubuntu that ships with Apport Error Reporting enabled by default, and as a result, you may get a large quantity of Internal System Error popups inside Ubuntu. Similar popups may also read Sorry, Ubuntu 12.04 has experienced an internal error. These popups are part of Apport, an internal debugger which automatically generate reports to submit for packages that crash. Many reports can’t be filed or have already been filed, and as such it is usually safe to turn off.

Stopping Apport

You can stop the currently running Apport service with the following command.

sudo service apport stop

Note that unless you remove it or disable it at boot it will start again the next time you turn on your computer.

Disable Apport at Boot

You need to manually edit a file to Stop Apport Running at Boot (when you turn on your machine. Open the Terminal, and paste the following command with Ctrl+Shift+V, or type it in manually.

sudo nano /etc/default/apport

Change the line that says enabled=1 to enabled=0 to disable Apport. To re-enable, change it back.

Uninstall Apport

It is fairly simple to uninstall Apport, as you can open the Ubuntu Software Centre, search for apport, and simply click Remove.

A similar process can be used for the package apport in both Synaptic and the Terminal.

sudo apt-get purge apport

Even thought it is safe to uninstall apport, I don’t really recommend it, just in case you want to enable it back, stopping apport is already enough.


  1. java 101 (13):
    Apr 29, 2017 - Translating Scanner tokens into primitive types
  2. python data structure (5):
    May 03, 2017 - Enhance your tuples
  3. python function (2):
    Apr 16, 2017 - Lambda Functions in Python
  4. python generator (4):
    Apr 26, 2017 - Next, Function or Method ?

Friends of Rezha