Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Build a Fat JAR Using Maven Without a Java Project

You can use Maven to download dependencies of Java packages without creating a Java project. For example, if you want to download all dependencies of arrow-jvm and arrow-memory and build everything into a single fat jar (for easy use in other places), you can first crate a file pom.xml …

The list Collection in Python

Tips and Traps

  1. list is essentially a resizable array of objects in Python.

  2. Almosts all methods of list are in-place.

  3. list.pop is inplace and returns the removed element.

  4. To get unique elements in a list, you can first coerce the list to a set and then convert the set back to a list.

     unique_list = list(set(alist))

Working with Iterators in Python

Iterator vs Generator

Generator is a special case of Iterator. Generator is easy and convenient to use but at additional cost (memory and speed). If you need performance, use plain iterator (with the help of the itertools module). If you need convenience and concise code, use generator.

Please refer to Python Generator vs Iterator for more detailed discussions.

TeXstudio, Bravo!

I have heard about TeXstudio for a long time. I tried it today on a Debian virtual machine. It works like a charm. I like the preview function a lot. Using inline preview, you can see compiled result while you are typing. It works even with user-defined commands. This is …

Install Python Packages Using pip

PyPi Statistics

You can check download statistics of Python Packages on PYPI at https://pypistats.org/. This is especially helpful if you want to choose from multiple packages.

Prefer pip

pip is preferred over OS tools (e.g., apt-get, yum, wajig, aptitude, etc.) for managing Python packages. If you are …