Author Archives: sheng gao

My Covid experience

18 April, Monday. Go restaurant with friends for lunch and dinner. Then in the evening, throat is very painful and cannot sleep well.

19 April, Tuesday. Throat pain is less. In morning, ART test shows negative. But in the evening, in the road of backing home, feel tired.

20 April, Wednesday. Throat is little pain but very tired and sweat. After processing urgent work, from afternoon, sleep until 21 April morning.

21 April, Thursday. In morning, there is a little sweat but in the afternoon, no sweat and little tired. But start a little running nose and nose stuffed up.

22-23 April, Friday & Sunday: Nose stuffed up.

Bokeh – A Python package to create figure & UI

To plot figure in Python, matplotlib is an native module. Now there is another good option, Bokeh, Bokeh is Python lib, which core module is written by JS.

Using Bokeh, you can create more interactive & beautiful user interface using build-in models, or even using native html script (I like). This is a snapshot I use Bokeh to display candlestick using selected date range, and also update information in a table (integrating native html script).

Candlestick plot using Bokeh

How to setup PostgreSQL in Python

  • Install Psycopg2 package in Python
pip install psycopg2 or
pipenv install psycopg2 (virtual python environment)
  • Install postgresql in Ubuntu
sudo apt update
sudo apt install postgresql postgresql-contrib
  • After successfully install postgresql, the default role is postgres. So when you connect postgresql service in your own Ubuntu user, you cannot connect it, reporting the username not in the role. Thus create a role using your own username, and add your username in ROLE of postgres
psql postgres 

postgres=# CREATE ROLE ubuntu_username superuser;
postgres=# ALTER ROLE ubuntu_username WITH LOGIN;
  • In python, connect postgresql, e.g.
import psycopg2

conn = psycopg2.connect("dbname=test user=user_name")

How to install Ubuntu & Windows 10 dual OS system in Surface book

There are many tutorials on how to install Ubuntu & Windows 10 systems. But when setup in surface book, there is a difficulty to be solved, i.e. Ubuntu cannot identify surface keyboard. Thus, we cannot click continue to install because it needs keyboard to input account, password and setup WIFI.

Step-by-step to install following:

  1. Prepared:
    • Ubunbu 20.04 in USB (google to find how to prepare a startup Ubuntu USB)
    • Bluetooth keyboard & bluetooth mouse
  2. Disable bitlock in Windows 10
  3. Enter BIOS to turn off UEFI
  4. Insert Ubuntu USB, and start up surface. Following the instruction, click continue until you see options: Try Ubuntu, or Install.
    • Careful: must choose Try Ubuntu. Then you will enter Ubuntu system for try. In Try Version, connect bluetooth keyboard and bluetooth mouse. After successfully connecting, you can use bluetooth keyboard & mouse for input
    • In Try Ubuntu, click install. Then following instruction to install. Now you can setup WIFI, account and password
« Older Entries