Muôn vẻ sinh viên… khó đỡ

Ghi chú vui một số trường hợp khó đỡ đã từng gặp trong thời gian hướng dẫn thực hành từ trước tới nay của mình. Có cách điệu lên một ít và có biên tập lại một ít, các câu thoại không phải là nguyên gốc và mình cũng không để tâm là của ai.

Nếu nhớ thêm tình huống nào sẽ bổ sung vào post này.

Case 1: Em nào có nhớ.

SV: Dạ thầy ơi, em lỡ tắt codeblocks (phần mềm dùng thực hành lập trình) rồi thì làm sao để nộp bài ạ?

Tắt codeblocks thì chương trình em viết vẫn còn mà, mở lên lại rồi nộp thôi em.

SV: Mở chương trình ở đâu thầy?

Ủa chứ lúc tạo project em lưu nó ở đâu?

Sinh viên nhìn vào màn hình, vẻ rất căng thẳng và đăm chiêu:
– Dạ em cũng không nhớ nữa !?

Case 2: LƯU luyến, luyến LƯU?

SV: Thầy ơi sao máy em không chạy?

Dĩ nhiên là không rồi, nó có gắn bánh xe đâu mà chạy! em tải xong phần mềm thực hành về chưa?

SV: Dạ rồi thầy!

Chắc là rồi không?

SV: Dạ chắc! Em tải xong rồi!

Tải về đâu?

SV: Thì tải từ cái link thầy đưa đó thầy!

Thì biết là từ link tui đưa rồi nhưng tải về lưu ở đâu?

SV: Lưu là sao thầy, em không hiểu…

Case 3: Em đi học rất đầy đủ.

Thầy ơi, sao bài em làm nộp lên nó cứ báo sai hoài

Sai là tại nó không đúng đó em. Em chạy thử chưa

Dạ chưa, máy em không chạy thử được!

– Bị sao mà không được?
Liếc qua màn hình sv thấy một file Untitled tổ bố không có cả phần đuôi .cpp
– Em tạo project cho bài tập này chưa?

Tạo project là sao thầy?

Là cái thao tác hướng dẫn tuần trước rồi đó

Dạ em không nhớ lắm

Không nhớ thì mở ghi chú của em ra rồi làm theo đi, thầy đâu có bắt thuộc lòng.

Dạ phần đó em không có ghi!

Nén cục khẩu nghiệp xuống, hướng dẫn tạo project.
Sao có cái báo lỗi thế này, em cài phần mềm chưa?

Dạ cài rồi thầy

Cài đúng hướng dẫn không? Sau khi tải về rồi em làm gì để chạy?

Dạ tải về rồi nhấn vô chạy thôi.

Còn vài bước nữa rồi mới chạy được, tui hướng dẫn rồi mà, mở ra coi lại coi?

Dạ em không có ghi!

Ryzen 7 3700X on archlinux

This post will document problem(s) I may or may have encountered running the 3700X on archlinux and the fix that I might have applied

Geekbench score

The score is OK for 3700X AFAIK, but I haven’t test with sustain load yet:

The sound card

The very first problem after booting was static and crackling noise from the sound card:

0b:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller

A quick googling lead me to a very old questions on Seem like it has been a common problem on ATI card but I haven’t got a chance to experience it, archwiki also got some line about the fix:

In short, edit


append the prameter tsched=0 will resolve the problem.

load-module module-udev-detect tsched=0

Thermal sensors

The second problem I encounter was no thermal sensors working, lm_sensors report 0 RPM Fan speed and no temperature of any kind:

$ sensors
Adapter: ISA adapter
cpu_fan:        0 RPM

Luckily, archwiki have a note for my exact case: . After installing the AUR package and append the kernel parameter and reboot, the sensors was fine.

$ sensors
Adapter: ISA adapter
cpu_fan:        0 RPM

Adapter: ISA adapter
in0:          +1.43 V  (min =  +0.99 V, max =  +0.50 V)  ALARM
in1:          +2.50 V  (min =  +2.25 V, max =  +2.67 V)
in2:          +2.00 V  (min =  +0.64 V, max =  +1.46 V)  ALARM
in3:          +1.98 V  (min =  +2.68 V, max =  +2.76 V)  ALARM
in4:          +0.03 V  (min =  +0.85 V, max =  +1.80 V)  ALARM
in5:          +0.03 V  (min =  +0.58 V, max =  +0.61 V)  ALARM
in6:          +0.03 V  (min =  +1.31 V, max =  +2.74 V)  ALARM
3VSB:         +3.36 V  (min =  +5.21 V, max =  +5.56 V)  ALARM
Vbat:         +3.25 V  
+3.3V:        +3.36 V  
fan1:        2636 RPM  (min =   33 RPM)
fan2:           0 RPM  (min =   15 RPM)
fan3:           0 RPM  (min =   15 RPM)
fan4:           0 RPM  (min =   -1 RPM)
fan6:        1149 RPM  (min =   -1 RPM)
temp1:        +56.0°C  (low  = -107.0°C, high = +127.0°C)
temp2:        +35.0°C  (low  = +112.0°C, high = +75.0°C)  sensor = thermistor
temp3:        +41.0°C  (low  = -25.0°C, high = -39.0°C)  ALARM  sensor = thermistor
temp4:        +41.0°C  (low  = -21.0°C, high = +123.0°C)  sensor = thermistor
temp5:        +41.0°C  (low  = +103.0°C, high = -71.0°C)  ALARM  sensor = thermistor
temp6:        +41.0°C  (low  = +46.0°C, high = +85.0°C)  sensor = thermistor
intrusion0:  ALARM

Back to AMD

How long was it? 12 years, since 2007, when I built my first PC to go to college. My first CPU was the Athlon 64 x2 4400+, if memory serves me well. Those were the time when AMD got a lead in technology, the first 64 bit multi-core CPU to hit consumer market. But those time was short lived, multi-core software took time to catchup and when it does, Intel got their reply.

The Athlon 64 served me well. It got me through college, and into my working years. But I never got an upgrade choice from AMD, their Athlon line up couldn’t compete, their Phenom still couldn’t, their FX also failed, and then they just sort of gave up. For years, they only sell cheap CPU, that can’t meet my demand. And when my Athlon died after 6 years of service, I switched to a Core i5 – 3550 or something.

Another 6 years passed, the Core i5 is now falling behind in many tasks and in dire need for an upgrade. It can’t play 4K video, it’s a bottle neck for my GPU in, and it takes a lot of times only heavy crunching workload. And most importantly, it struggle to run the variety of virtual machine that I’m using for code work. Thus I have to look for an upgrade, and when I start considering options, AMD bounce back.

The ryzen CPU was good, it showed how Intel was lazy and greedy for the last decades after they dominate the market. Right after ryzen release, people see that Intel could have added more core into one CPU dire, but they just didn’t want to. Intel could have thrown in a better heatsink fan but they just didn’t want to. And when news of Ryzen 3000 series with Zen2 architecture come out, I decide to switch.

My choice was the Ryzen 7 3700X, the price was announced at 8.690.000VND. I have been using mid-range CPU for my whole life, so this was a big bump, but 8 core – 16 threads with 4.2GHz boost in a 65W TDP seem too good. I don’t overclock so the 65W TDP limit is more of a pros than cons. And at that price, it beats anything Intel currently offer in every possible ways of comparision.

First time buying any CPU worth more than 6.000K VND

The mainboard choice was more of a hassle. Ryzen 3000 series was built for AMD X570 chipset, but I distrust that chipset. They seem a bit rush to releasing X570, PCIe 4.0 is more of a gimmick than a feature right now and the 15W TDP just for the mainboard running, doing absolutely nothing is a big annoyance. Moreover the required fan for the chipset seem like a major weak point. CPU HSF can be replaced but we don’t have any standard for replacing chipset fan.

And the biggest downside of of X570 is they are vastly overpriced. Moreover there was no plan to reduce price of the last gen X470 chpiset so I decide to go with B450 chipset in the Asus ROG Strix B450F. At 3.350.000VND, it was the biggest B450 board I could find. And since I have grown skeptical with Gigabyte BIOS updating process, it seems like a good chance to try out Asus board.

RAM choice was two sticks of Gskill Trident Z 3000. Even though the internet recommend even 3600 or 4000Mhz RAM for Ryzen 7, but 3200 were the highest got sold here and they are too pricy. I purchase the RAM first before Ryzen 3700X release. The was almost 3.050.000VND in May and the put the whole CPU upgrade price tag at almost 16.000.000VND. That was more than my first PC (with monitor include) and it should mark the time I switch to more serious workload.

I also switch to NVMe SSD so that I can migrate the old SSD to the new HTPC for family use, completing my computer vision at least for the next decade

Force firefox to use light theme for content widget, even when choosing dark GTK+ theme.

The problem that had been haunting me for so long is firefox and dark theme. When choosing a dark GTK theme, firefox will use that same theme for widgets on website, especially website with forms. Now, most website will try to tweak the display of their form widget a bit, but not all website did a good job tweaking. They may default font color form black to dark grey but leave background unchange. Or they may change background color to light grey but still use default fonts.

In both cases, we ended up with broken website when I enable dark theme (grey text on dark background)

Un readable text when using dark gtk theme on some website

The default grey font on light background that website prefer is completely incomprehensable.

But chromium doesn’t seem to have this problem because chromium enforce its default theme for website’s widget, and completely disregard system theme. This is an imperfect solution but it fits in an imperfect world. So after much googling around I found a reddit thread

Turned out this was report as a bug 3 years ago and 2 years ago came a work-around: Go to about:config and add a new string preference name: widget.content.gtk-theme-override

Then you can enter any light theme you want to be use as default theme for website content widget. You can even enter a wrong theme name, it will default to system theme (which is a light them on most gnome distro). Then voila:.

Now with the work around

Launch gnome-terminal with a specific profile from within code::blocks

I use code::blocks when teaching Programming introductory courses because it’s simple to install and get going. However, when running code from codeblocks it will default to launch xterm, which is not quite my taste. So I naturally go to:

Settings -> Environment

Then change the setting: “Terminal to launch console programs” to gnome-terminal. Most of the time I run code in codeblocks, I have to show the terminal on the school projector with horrendous contrast that make almost to read white text on dark background. Now the problem is I love dark background on my terminal and don’t want to change my gnome-terminal to  light background. Install another terminal just for use with codeblocks on projector could solve this but seem like a waste of resources.

Fortunately Gnome-terminal support multiple profile with different display settings and there is an argument for you to choose profile when launching. So, I create a “project” profile within gnome-temrinal with enormous font, light background, etc, ideal for readability on projectors.

Then in codeblock edit setting to launch gnome-terminal with this special profile:

gnome-terminal -t $TITLE --profile=projector -x