Ben Chuanlong Du's Blog

It's never too late to learn.

ODBC vs JDBC in Python

Overall speaking, Python has better ODBC support than JDBC support. Most database related packages in Python support or rely on ODBC. Currently, ODBC packages also have richer feathers than JDBC packages. However, it is not an easy job to install and configure ODBC drivers for a non-open source databases.

JDBC ...

Manage Docker Images and Containers

Remove Containers

Note that running containers will NOT be removed by default. This is what users want generally speaking. You can use the option -f to force removing running containers, but use it with caution and at your own risk.

  1. Remove all existing containers (not images).

    docker rm $(docker ps ...

Java Packages

Date Time

joda time and java.time

Appach Common

Appach CommonMath

  1. StatUtils.varance is OK.


  1. sample of RandomSample is OK.

Parallel Colt

  1. ParallelColt does not make RNG parallized.

Comparison of Packages

  1. Colt is faster in random number generating than CommonMath, especially for simple random number generation (e.g. normal ...

Extensions for Java

Here are some code examples for the following topics.

Java Native Interface

  1. You can call native code (typically C, C++ or Fortran) in Java using the Java Native Interface (JNI). For the code implemented in native code, you must use keyword "native" to tell the compiler that it is implemented ...

Zero-length Vector Issue in R

The corner case of 0-length vectors is not well considered in R. It causes issues in several situations. First, 1:n is probably not what you want when n = 0. Second, df$col = 0 throws error when df is an empty (0 row) data frame. To avoid these issues, it ...

Add Users to a Group in Linux

There are several ways to add users to a group in Linux. The following uses the sudo group as illustration.

  1. gpasswd, usermod and adduser can all be used to add a user to a given group. However, it is suggested that you use gpasswd as it is more portable and ...