Safe Bool Idiom


How to allow if(myType), but disallow bool b = myType;
C++11’s solution is keyword “explicit” like so:
explicit operator bool() const;
This still allows if(myType) by taking advantage of the fact that there is already an explicit cast to bool with if.
This disallows implicit cast to bool, therefore disallows operation such as comparison and arithmetic operations.

Advertisements

Why image compressible


Why can images be compressed?
Due to human eye:
Not sensible to chroma as to luma, which leads to YUV compression.
Not sensible to red and blue as to green, which leads to Bayer format.
Not sensible to high frequency change, AKA details, which leads to DCT
Due to redundancy´╝Ü Lossless compression

OE Bitbake


OE: “git clone git://…oe-core” downloads meta data prepared as input of Bitbake
Bitbake: Python program to make, e.g. linux. usually calls bash and python code.
Recipe is to bitbake as target is to make
Example $bitbake SayHello , where SayHello is a recipe
RecipeSayHello.bb file: Recipe file. SayHello is PN in this file.

Folder structure: $BBPATH tells where to find the .conf files
conf/
bitbake.conf : tells where to find folders, like TMPDIR
bblayers.conf : lists all the layer folders
classes/
base.bbclass : lists tasks common to all recipes
mylayer/ e.g. BSP Board Specific Package and UI, hold the .bb files
RecipeSayHello.bb: list the recipe name and code to execute the task
conf/layer.conf tells where to find .bb files in this folder
build/ the bitbake output.

Reference: https://a4z.bitbucket.io/docs/BitBake/guide.html

Ghost blog server


Ghost v2.14: open source blog server, based on Node.js10, SQLite3. from ghost.org
Steps:
Node.js 10: download node-v10.13.0-linux-x64.tar.gz and uncompress to, e.g node-v10/.
SQLite3: installed as part of Ghost installation script
$npm install ghost-cli@latest -g
this generates node-v10/lib/node_modules/ghost-cli , including bin/ghost
$ghost install local

Commands: ghost restart or start stop

By default, ghost only binds to localhost 2368, config.js 0.0.0.0 to bind to all interfaces.

nginx proxy for remote access.
location /blog
proxy_pass https://127.0.0.1:2368;
Installed site (not finished): http://riowing.net/blog