I got error Could not load the Qt platform plugin “xcb” in “” even though it was found Even following this did not solve the problem. But it seems that going headless works. That is, pip uninstall opencv-python pip install opencv-python-headless
Category: Programming
Marching cube
A great explanation of the Marching Cube algorithm is here. The algorithm’s goal is to draw meshes of an implicit surface function $latex f(x,y,z) = threshold$. Based on the 8 corner points for each tiny cube is above or below the threshold, the mesh triangles for the cube can be easily determined. The algorithm then…
Mixin
Mixin is an incomplete class that can be mixed into multiple classes. For example, mixin Fluttering { void flutter() { print(‘fluttering’); } } abstract class Bird with Fluttering { void chirp() { print(‘chirp chirp’); } } Note that the Fluttering mixin can be used in multiple classes. If we want to restrict the mixin to…
Cannot locate adb starting Android emulator in Android Studio
I got this obscure problem and couldn’t resolve it no matter what I tried. It turns out it simply was because I was running virtualbox on another desktop and I wasn’t aware of that. The error is totally misleading. I was using Ubuntu 16.04. After I shut down the other virtual machine, Android emulator started…
Game programming with Flutter and Flame
A very nice video tutorial to build 2D game with Flame/Flutter. I’m new to Flutter and Dart. I usually write in Python and wrote some Java decade ago. Dart is reasonable intuitive if one is familiar with Java or C/C++/C#. I came across some issues going through the tutorial though. I use Ubuntu 16.04 and…
Asynchronous programming in Dart
There are three keywords future, await, async to achieve asynchronous programming in Dart. I found the below example from the official documentation is most insightfull. Future printOrderMessage() async { print(‘Awaiting user order…’); var order = await fetchUserOrder(); print(‘Your order is: $order’); } Future fetchUserOrder() { // Imagine that this function is more complex and slow….