Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Java Interfaces for Python

JPype, py4j and PyJNIus are all good options for Java interface for Python. Jpype is easy to use and widely adopted. PyJNIus is an even easier solution compred to JPype. py4j is more complicated to use compared to JPype and PyJNIus, however, it has a better performance, generally speaking.

JPype …

Avoid Database Lock in SQLite3

  1. According to https://www.sqlite.org/lockingv3.html, POSIX advisory locking is known to be buggy or even unimplemented on many NFS implementations (including recent versions of Mac OS X) and that there are reports of locking problems for network filesystems under Windows. So, the rule of thumb is to …

Work with Long Strings in Python

This article discusses different ways to write long strings in Python.

Long String in One Line

A long string can be put on the the same line, which is ugly of course.

Make Your Linux Server Securer

  1. Define host access rules in /etc/hosts.allow and /etc/hosts.deny. Usually I only allow login to my private server from my home and work ip. If I have to login into my private server from some other network, I login to a computer at my workplace, login into …

The eval Function in Python

The function eval takes a single line of code as string, evaluates it, and returns the value. Notice that objects in the evaluated expression must be present in the current scope, otherwise, exceptions will be thrown.

Even though eval (together with exec) might be useful in some situations, e.g., when implementing a REPL. It is strongly suggested that you avoid using eval

Make Your Life Easier with Portable Applications

Using portable applications is a good way to make your digital life easier. They do not eat up your disk quickly nor do they mess up the registry of your Windows OS. You can always copy these applications from one computer to another and use it out of box. Or …