Li-Zhao's HomePage


I (LI Zhao) am from School of Computer Engineering, Nanyang Technological University, working in Sybase.
This is a memory book for me, so, miscellaneous topics can be found here.
Have fun!



Loading Blog Search...

Wednesday, October 28, 2020

Run snap in WSL2

To use snap in WSL2, we need systemd enabled, following instruction at https://github.com/diddledan/ubuntu-wsl2-systemd-script/. However after enabling systemd using the script, visual studio code can't open terminal anymore. There will be a fix. Before you receive the fix, there is a workaround, to change the last several lines of to:
else
exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a /bin/login -p -f "$SUDO_USER"
fi
My MobaXterm also can't open WSL session. Not sure whether it is caused by above scripts. A workaround is to change default shell to cmd/powershell and run bash from there. To run GUI apps from WSL, we could use vcxsrv/x410 or MobaXterm. vcxsrv is more bugful though. Due to WSL is using different network interfaces, we can set DISPLAY by adding the line to ~/.bashrc: export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

Wednesday, September 02, 2020

New Xiaomi Moann Inkpad X

Inkpad X was released it's new e-ink reader Inkpad X at July, 2020. The specs listed is:

It costs me RMB 1699 (340 SGD) to buy from Taobao on 7, Aug. Due to Covid-19, air shipment is unavailable to ship to Singapore and sea shipment took three weeks with higher costs (due to GST tax). Inkpad X features a large 10 inch e-ink screen with 1600x1200, which is not unpar with Kindle technically. But be honest, I can't differentiate it much from 50cm away, my usual reading distance. Quite satisfied with the overall building quality and its powerhouse rendering books, especially its PDF handling much better than Kindle Oasis. For Android 8.1 under-hood, it theoretically supports almost all apps. But after two days use, I resisted attractions to use them and here you go some tips to make it a better tool for you, who just want to indulge yourself in reading.
  • Use Calibre
  • Install Koreader
  • Solve Problems
For whom would read a lot of PDF, there are obvious reasons to follow these tips for you. Before showing the evidences, let's have a look at Inkpad X default UI. After unboxing it, you could see the default calendar ScreenSaver, and Inkpad X provides a very convenient scheduler app. Unfortunately, the events added in scheduler won't appear in ScreenSaver. Good news is Inkpad X allows to change ScreenSaver.
Pressing the beautiful red button on top of Inkpad X would bring you to its default UI, with four items in left menu:
  • Reading (this is to use DuoKan, the default reading app for Inkpad X)
  • Scheduler
  • Applications, listing all apps installed. I loaded Wechat Reader, Kindle, Overdrive to borrow NLB library books, KOReader. Please be noted the floating ball app I enabled to make navigation handy.
  • Settings
The floating ball was used to take all screenshots here. All the screenshots are colorful, including DuoKan's reading interface, except for Koreader's. This is the first reason I recommend not using DuoKan when reading PDF. I guess Koreader pre-processed the PDF to greyscale and rendered better graphic effects comparing with DuoKan, side by side. Second reason is Koreader's PDF rendering is much faster.
DuoKan seems able to scan at backend to pickup books copied to Books directory when you connect Inkpad X to Windows PC. However, it didn't list all the books copied, while Koreader recoganized all of them except for AZW3 format. So I converted all AZW3 to Mobi so make Koreader to list all. This is the 3rd reason I don't like DuoKan for its weaker format support or whatever reason not listing copied books. A very different between Koreader and DuoKan/Kindle is the organization of books. Koreader does not reorganize books according to metadata in categories, instead, it just displays the books as how they are saved in file system structure. This sounds a bad thing especially when the books are not well organized before hand. Calibre saved my day and make it even better with its customizable file system structure when copying books into devices based on embedded metadata. I tend to use Inkpad as pure reader and not use other apps or take notes on it, which could be killer app for many though. For my kids, dictionary is the key to learn. But Koreader v2020.08.1 dictionary does not work out of box. After asking Koreader's developers, it's a bug causing downloaded dictionary uncompressed. The solution working for me is to uncompress the dictionary downloaded at koreader/data/dict. Now my kids are happy.

Tuesday, May 07, 2019

AMD emulator on Hyper-V

AMD CPU based Android emulator is working according to the blog. However, when I tried it with Android Studio 3.4, it kept crashing with error messages like:

Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Failed to exec a virtual processor

Luckily, after my Windows was upgraded to insider preview version 18890.1000, the emulator is working now. And it's a surprise to be much faster than emulator on my old i7 CPU.




Saturday, March 30, 2019

Visual Studio Xaramin debug with Bluestacks

Got a AMD Lenovo A485 with Windows 10 Home, which does not have Hyper-V.  To use it for Visual Studio Xamarin experiments, I want a native Android emulator. Although it can install AMD native Android emulator, with hypervisor windows platform enabled, it does not allow other VMs to be installed, e.g., using Virtualbox. Luckily, Android VMs on Virtualbox or VMWare with TCP/IP based remote ADB support are able to act as Emulator. Bluestacks is another choice.


  • Install bluestacks
  • Enable ADB in bluestacks, this will open 5555 port to connect from Visual Studio

  • Goto Android install directory/android-sdk/platform-tools, run
adb connect localhost:5555
  • For Visual Studio Xamarin Android project, you then could find a new Android device to deploy to.




Monday, January 09, 2017

BPMN and Activiti

A quick guide: http://www.nurkiewicz.com/2011/01/activiti-processes-and-executions.html

BPMN is easy to be transformed to petri net for formal analysis.

Saturday, April 23, 2016

Fix HDMI audio for ubuntu/NUC

My NUC is hooked to Philips 221E via HDMI cable. The audio is fine if the monitor is never turned off. Once the monitor reboots, the distorted audio really make it unusable.

To solve the problem at ubuntu, append 'tsched=0' to 'load-module module-udev-detect' at /etc/pulse/default.pa

Wednesday, August 27, 2014

How to add extra dir to CLASSPATH at spring-boot

Spring-boot has three built-in launchers as real main classes, JarLauncher, WarLauncher and PropertiesLauncher, which could be used to call executable. These launchers set the path to load resources and classes.
Only PropertiesLauncher could be use dir outside the jar file. To add an extra dir 'EXTRA' to classpath:
1. for maven, add the following fragment
                        <plugin>
                                <groupId>org.springframework.boot</groupId>
                                <artifactId>spring-boot-maven-plugin</artifactId>
                                <configuration>
                                        <layout>ZIP</layout>
                                </configuration>
                        </plugin>
2. Use loader.path when execute the jar
java -Dloader.path="lib/,config/,EXTRA/" -jar the.jar

Then, for example, ClassPathResource("1.properties") could get 1.properties from EXTRA dir.