Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Comparision of Linux Emulation Solutions on Windows

  1. Virtual machine based on Virtualbox, etc. is an overkill, generally speaking. It provides complete functionalities but is more CPU and memory hangry.

  2. WSL 2 is the currently the best solution comes with Windows 10+. It is essentially a virtual machine but based on Hyper-V.

  3. Cygwin, MobaXterm, etc. are outdated as …

Count Number of Fields in Each Line

Sometimes, a structured text file might be malformatted. A simple way to verify it is to count the number of fields in each line.

Using awk

You can count the number of fields in each line using the following awk command. Unfortunately, awk does not take escaped characters into consideration …

Resolve the DNS Contamination Issue in Firefox

The local DNS you use in China is probably contaminated and popular sites like Google, Facebook, etc. are not interpreted correctly. So if you are in China and use Firefox with Proxy, make sure to set network.proxy.socks_remote_dns to be true (follow steps below).

  1. Open an empty tab in …

Convert a Socks Proxy to a HTTP Proxy

There are multiple tools available to convert a Socks proxy to a HTTP/HTTPS proxy. The work by convertting HTTP requests into socks requests and send them to the socks proxy. Be aware that this might not be necessary as many tools accepting HTTP/HTTPS proxies also accept socks proxies …

Quickly Create a Scala Project Using Gradle in Intellij IDEA

Easy Way

  1. Create a directory (e.g., demo_proj) for your project.

  2. Run gradle init --type scala-library in terminal in the above directory.

  3. Import the directory as a Gradle project in IntelliJ IDEA. Alternatively, you can add apply plugin: 'idea' into build.gradle and then run the command ./gradlew openIdea to …