And Todays’s Quote Would Be..

Life begins at the end of your comfort zone.

Neale Donald Walsch

Download A Free Screen Recorder Software (CamStudio), and get A Lot of Crapware

Today i decided to download free Camstudio application from, and perhaps it’s my fault for not reading Terms and Condition, just simple next and next, accept and accept, but what i got is so many crapware.

This is for example,

And i dont even know, what else crapware that i got.
TL;DR, dont use CamStudio, because i uninstalled like 5 minutes after i download this application.


remove highstair application from control panel, it will help remove the unwanted ads on your browsers.


Database KodePos Seluruh Indonesia

Awalnya iseng-iseng mencari data kodepos seluruh Indonesia, akhirnya dapet juga setelah email secara resmi ke PT Pos Indonesia. Namun file yang dikirimkan oleh PT Pos berupa file Excel (xls), walaupun dengan sedikit effort akhirnya bisa juga diimport ke database MySql.

Oh ya, file SQL-nya bisa didownload dari Github gw,

Semoga bisa membantu :-)


[Java] Creating a Microsoft Word Report Easily using Servlet and A Plain HTML Template

Yesterday one of my friend, Edward Barchia, asked me a very simple question, “how can i creating an MSWord Report without using Jasper Report”. Because somehow, jasper report creates a very weird output when exported into Word file (.doc).

One fastest solution is using a html file, and renamed into .doc. Not an elegant solution, but perhaps (at that moment) is the best solution we had.

Okay, so basically what i need is only 2 files, 1 html template and a java servlet files. This is my HTML template, i put it on drie E and name it hello.html

		Test, hello ${name}

And this is my servlet file,

package com.edw.testdownloaddoc.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "downloadServlet", urlPatterns = {"/downloadServlet"})
public class DownloadServlet extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        BufferedReader downloadFile = new BufferedReader(new FileReader("e:\\hello.html"));
        FileInputStream inputStream = null;
        OutputStream outStream = null;
        try {
            String s;
            StringBuilder sb = new StringBuilder();
            while ((s=downloadFile.readLine()) != null) {
                    s = s.replace("${name}", "Edwin");
            response.setContentLength((int) sb.toString().length());
            // response header
            String nameFile = "hello.doc";
            String headerKey = "Content-Disposition";
            String headerValue = String.format("attachment; filename=\"%s\"",nameFile);
            response.setHeader(headerKey, headerValue);
            // Write response
            outStream = response.getOutputStream();
            IOUtils.write(sb.toString(), outStream);
        } catch (Exception e) {
        } finally{

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);

Oh, and before i forgot, this is my pom.xml dependencies


This is the final output looks like,


How to Perform “Autopsy” on OutOfMemoryError Application

Just several days ago, my application was down because of OutOfMemoryError, and I haven’t got a clue what the root cause is. That’s why I’m looking for a way on how to find the culprit when my application is down again. So im using this jvm parameter to dump all the object on memory when OutOfMemoryError happen.

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=E:\ -Xmx10m -Xms10m

For example, im using this java class to simulate OutOfMemoryError,

package mybatistesting;

import java.util.ArrayList;
import java.util.List;

public class MyBatisTesting {
    public static void main(String[] args) throws Exception {
        List list = new ArrayList();
        for (int i = 0; i < 10000000000l; i++) {
                System.out.println("adding -- "+i);

As you can see on your console log,

java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to E:\java_pid5812.hprof ...
Heap dump file created [15155736 bytes in 0.237 secs]

You can open java_pid5812.hprof using your preferable application, for example using Eclipse MAT or JProfiler.

eclipse mat

jprofiler 1

jprofiler 2

Have fun ;)


[PostgreSQL] Got Error “FATAL: database databasename does not exist” Despite Database is Exists on PGAdmin

Today i spent a ridiculous amount of time trying to figure out how come suddenly my java application cannot connect to postgresql database. It gives error “FATAL: database databasename does not exist”, and the weird thing is that i can browse and query to my postgresql database from PGAdmin and other database browser.

Here is my application’s complete error stacktrace

Caused by: org.postgresql.util.PSQLException: FATAL: database "geoportal" does not exist
    at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
    at org.postgresql.core.ConnectionFactory.openConnection(
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(
    at org.postgresql.Driver.makeConnection(
    at org.postgresql.Driver.connect(

Weird because i can see my db both from PGAdmin and psql console,
pg geoportal

pg console

When suddenly i realize when im checking my postgresql port, and i can see 2 different postgresql with different PID occupied the same port, 5432. Somehow my PGAdmin and psql connect to the right instance while my application connect to the wrong instance.

After killing my unwanted postgresql PID from taskmanager, suddenly my java application can run well again.
pg success connect