Sunday, September 25, 2016

Fine Tuning X Window Settings of My Desktop (Nvidia, Dual Mon, Xubuntu 16.04)

Recently, I bought a new desktop and two new monitors. I spent some time to get them working nicely. So, I would like to share my story here.

I installed Xubuntu 16.04 to the desktop. The display card is GeForce GTX 950. Then, I downloaded and installed the Nvidia Linux Driver. I run the Nvidia X Server Settings and export a xorg.conf file.

Here was the "Screen" section of xorg.conf file:
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-2.8"
    Option         "metamodes" "DP-0.8: nvidia-auto-select +0+503, DP-0.1.8: nvidia-auto-select +1920+0 {rotation=left}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
You can see the "metamodes" was to setup the screen positions and rotation. Please note that the monitor on left is rotated.

Basically, the Nvidia driver worked, but with some issues:
  1. Heavy tearing
  2. In text mode (i.e. alt-F1), the text is on the monitor rotated left. 
After some googling on the web, issue 1 can be fixed by adding "ForceCompositionPipeline = On" in the metamodes. So, the "metamodes" becomes:
"DP-0.8: nvidia-auto-select +0+503 {ForceCompositionPipeline = On}, DP-0.1.8: nvidia-auto-select +1920+0 {rotation=left, ForceCompositionPipeline = On}"
However, issue 2 is bit tricky. After some trial-and-error, I found that the sequence of screens declare on the "metamodes"did the trick. The last screen shows the text in text mode. So, I swapped the DP-0.8 and DP-0.1.8 in the "metamodes":
"DP-0.1.8: nvidia-auto-select +1920+0 {rotation=left, ForceCompositionPipeline = On}, DP-0.8: nvidia-auto-select +0+503 {ForceCompositionPipeline = On}"
Now, it works perfectly.

Sunday, July 20, 2014

Trying Noto Font in Ubuntu 14.04

Google and Adobe developed new Open Source fonts recently. I installed Noto Sans on my Ubuntu 14.04 Desktop. The screenshot below shows three different fonts displaying in a Facebook page in Chrome browser (Ver. 36.0.1985.125) in Ubuntu 14.04 Desktop. The upper screenshot is Google's Noto Sans Traditional Chinese font. Middle one is Microsoft JhengHei (a M$ font from Windows 7). The lower one is WenQuanYi Zen Hei (another open source font come with Ubuntu). You can see Noto Sans performs well. Now, I no longer need M$ fonts for my Linux box.

Saturday, August 25, 2007

MTU is really a matter

Long time ago, I lower the MTU of my router to solve a networking issue (see my previous blog entry). However, it is not the end of story.
Recently, I have changed my job. My new company provides Citrix Presentation Server for employees to work at home via remote desktop.
Then, at home, I tried to connect to Citrix server and run remote desktop. I can login but the link is very unstable. It disconnected every 10 to 20 seconds.
After some investigation, I found it is the MTU problem again. The problem is fully explained at the following site:
I should change the MTU of my desktop at home to match the router. Finally, it works!

Sunday, July 01, 2007

Boost C++ Libraries

Recently, I checked some job ad. on the web and found some jobs require knowledge about "Boost". I have not heard "Boost" before. After some googling, I visit the web site of Boost. Boost is really a great thing. It is a set of C++ libraries contains many useful programming constructs with good documentation, e.g. smart pointers, regular expression, object pools, state machines.... Lastly, it is open source and free.

Sunday, June 17, 2007

Dig out dead looping thread

It is not easy to write multi-threading applications. One of the common bugs is dead looping of a thread. To kill this kind of bugs, the first step is to find out which thread causes dead looping. However, an application may have dozens of threads. How to dig out the dead looping thread? My trick is to issue the ps -eLf command to list the information of threads in the whole system. The "time" column of the output of ps shows the CPU time have spent by the threads. Most likely, the dead looping thread would be the thread spending most CPU time. Then, drop down the LWP number of the thread. Next, you use gdb to attach the process and to debug the thread.

Sunday, June 10, 2007

Job Interview Questions

Recently, I got some job interviews. The interviewers asked me tones of questions. Most of them were very technical. The most difficult question was an IQ puzzle. Under stress, it is difficult to overclock my brain :<
At home, I found a web site which included the IQ puzzle:

Saturday, May 12, 2007

Undefined symbols in C++

In C++ programming, we sometimes encounter "undefined symbols" problem during compilation or dlopen. The name of undefined symbols looks obfuscated. E.g.:
Unable to dlopen( Undefined symbol "_ZN6moduleD2Ev"
You may wonder why the symbol looks so ugly. Actually, this conversion of symbol is called name mangling. C++ supports polymorphism, this means functions can have same name but different types and numbers of parameters. Therefore, compiler cannot just use the function name as the symbol. Instead, both function name and parameter types should be included in symbol naming. Name mangling is the technique to encode a function name and parameter types into one symbol.

To translate the mangled symbols to more meaningful text, we can use the c++flit utility. E.g.
ahlam@oxygen:~$ c++filt _ZN6moduleD2Ev
Now, you know "_ZN6moduleD2Ev" is the destructor of class module.