Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Dual Monitor for Linux Desktop

  1. Type xrandr or xrandr -q in terminal to dispaly information of all available output device. Then you can use the following commands to set dual display.
    xrandr --output VGA1 --auto 
    xrandr --output VGA1 --same-as LVDS1 --auto
    xrandr --output VGA1 --mode 1024x800
    xrandr --output VGA1 --off
    

where VGA1 and LVDS1 should …

Which One Is the Best Strategy?

Another interesting problem I met in statistic is: suppose we flip a coin which has probability 0.7 to be head again and again and two people choose two different sequences of length 3 (e.g. THH). The people whose sequence appears first wins. If you're allowed to choose first …

Performance Tips for C++

Performance

  1. If there is some block of useless code, the compile is smart enough to ignore it and thus speed up the program.

  2. Use the option -O2 to generate optimized code when you are ready to publish your code.

  3. Define variables only when needed to avoid the overhead of creating …

Lambda Function in C++11

Lambda Function

Check [here[(https://github.com/dclong/cearn/tree/master/lambda) for illustrative examples for the following discussions.

  1. When capture variables, you can define new variables in the [] of a lambda expression. For example, if a lambda function need the sum of two double variable x and y, you …

Rescue Linux from GUI Freezing

The kernel of Linux is usually very stable, but the existing free desktop environments are craps. Amongs these desktop environments I tried (Gnome, Xfce, LXDE and so on), none is even close to the desktop environments in Windows and Mac. I do not require desktop environments in Linux to be …