Blog
Thoughts on programming, systems, robotics, and everything in between, sharing what I learn and build.

Making Requests Non-blocking in Tornado
Tornado is one of the most popular web frameworks for Python, which is based on a single thread IO loop (aka event loop). You can handle high concurrency with optimal performance. However, Tornado is single-threaded (in its common usage, although it supports multiple threads in advanced configurations), therefore any “blocking” task will block the whole server. This means that a blocking task will not allow the framework to pick the next task waiting to be processed.
Install QQ/TIM in Linux with Wine
Note: This post describes a Wine-based workaround from 2017. Tencent now ships an official native Linux client for QQ, rebuilt on the NT architecture and available as deb, rpm, and AppImage packages for both x86-64 and ARM. You should grab the native build from im.qq.com/linuxqq instead; the Wine instructions below are kept only for historical reference. This tutorial introduces how to install QQ/TIM in Linux with Wine, which had been tested on ArchLinux with Wine 2.4.
Single Sign-On with Apereo CAS
This tutorial walks a newcomer through standing up an Apereo CAS server for single sign-on and wiring a Java web application to it as a client. The complete CAS 7.1 server is available as a companion WAR overlay on GitLab. Note: This post has been rewritten for Apereo CAS 7.x. It was originally written for CAS 4.x, which you set up by copying the server source and hand-editing a pile of XML files (deployerConfigContext.xml, ticketGrantingTicketCookieGenerator.xml, …). CAS has changed completely since: the org.jasig.cas packages became org.apereo.cas, and the server is now built as a Spring Boot WAR overlay configured through a single cas.properties file.
Create a Desktop App with Angular 2 and Electron
Last week, I took part in the Google Developer Day held in Beijing. The Angular team introduced their new Angular 2. Angular is a development platform for building mobile and desktop web applications. This tutorial shows how to configure and use Angular 2 web components with the Electron framework for creating native cross-platform applications with web technologies. As recommended by the Angular team, TypeScript will be used throughout this tutorial. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open-source.
Gradient Boosting Decision Tree
In the previous article, we’ve talked about AdaBoost which combines output of weak learners into a weighted sum that represents the final output of the boosted classifier. If you know little about AdaBoost or additive model, we highly recommend you read the article first. Gradient boosting is a machine learning technique for regression and classification problems, which produces a prediction model in the form of an ensemble of weak prediction models, typically decision trees. It builds the model in a stage-wise fashion like other boosting methods do, and it generalizes them by allowing optimization of an arbitrary differentiable loss function.
AdaBoost
AdaBoost, short for “Adaptive Boosting”, is a machine learning meta-algorithm formulated by Yoav Freund and Robert Schapire who won the Gödel Prize in 2003 for their work. The output of the other learning algorithms (weak learners) is combined into a weighted sum that represents the final output of the boosted classifier. AdaBoost is adaptive in the sense that subsequent weak learners are tweaked in favor of those instances misclassified by previous classifiers. AdaBoost is sensitive to noisy data and outliers and is quite robust to overfitting.
Random Forest
Random forests are an ensemble learning method for classification, regression, and other tasks. They operate by constructing a multitude of decision trees at training time and outputting the class that is the mode of the classes (classification) or the mean prediction (regression) of the individual trees. Each tree is grown on a random subset of the training data and considers only a random subset of the features at each split, so the forest as a whole corrects for a decision tree’s habit of overfitting its training set: when it is time to make a prediction, the trees vote and the majority wins.
Setup Raspbian on Raspberry Pi
This post explains how to install Raspberry Pi OS and set up a Raspberry Pi from scratch. You will need another computer with an SD (or MicroSD) card reader to write the image. Note: This post has been updated for Raspberry Pi OS and Raspberry Pi Imager. Raspbian was renamed Raspberry Pi OS in 2020, and the old “download a .zip, unzip the .img, then flash it with Win32 Disk Imager” routine has been replaced by the official Raspberry Pi Imager, which downloads and writes the image in one step and can pre-configure SSH, Wi-Fi, and your user account before the first boot.