Movie "Awakenings" (無語問蒼天)

awakenings.jpeg

最近頗讀了幾本與大腦有關的書。這個禮拜我在讀的書是《讓成熟的大腦自由》。在這本書裏提到了"Awakenings" (有名爲《睡人》和《甦醒》兩個不同的中文譯本,遺憾的是我沒有找到電子版本)這本書,又提到這本書被拍成了一部同名電影,進而得知它還得了一個中文名字《無語問蒼天》。出於對腦科學的好奇,我今天一個人看了這部電影。它真的是蠻感人的一部影片,劇情很緊湊,沒有什麼費話和刻意,我很喜歡。另外,它足足有兩個小時長,如果你也想看的話,建議找一個相對比較完整的時間。

我是在這個 在線觀影 地方用電腦看的這部電影。

它讓我感受到腦科學的神奇和複雜,也讓我對一線的腦科學研究者產生了深深的敬意。我應該約 Eric 抽個時間再看一遍。

git diff/difftool

set meld as an external diff tool, it is the Old way, which is no longer preferred

First you will need to create a simple wrapper script for meld

$ cat ~/bin/git-meld
#!/usr/bin/bash
exec Meld "$2" "$5"

Please don't forget to add the directory containes Meld.exe to your PATH environment variable.
if you are using a real Linux system instead of MSYS2, you will normally need to change Meld to meld and /usr/bin/bash to /bin/bash

After that, run git config --global diff.external git-meld. Ok, you have done. Every time you run git diff, meld will be called.

In case you want to temporarily disable the behaviour, run git diff --no-ext-diff

Normally it is enough for your daily diff job. However, there is also another approach that you can always keep the default text diff behaviour for git diff while you use git difftool for a gui diff.

Another way / Preferred way

Regarding this approach,

  • don't set the diff.external config, so we will not change the default diff behaviour
  • run the following config instructions:
    git config --global diff.tool meld
    git config --global difftool.prompt false
    

If you want a normal text diff, run git diff as usual. If you want a GUI diff, run git difftool instead.
PS. Based on my experience, the second way is more comfortable, so it is the preferred way.

Set bash terminal integration with Visual Studio 2019

bash-in-visual-studio.png

Solution for Slow logon via Remote Desktop to Server 2012: Disable the Large Send Offload

Recently, I found it became very slow when I am logging onto my development VM, a windows server 2012R2 instance through Remote Desktop. There are many kinds of solutions in Google's search results. I tried many of them and found only this one suits me.

On the Windows Server 2012 machine, disable the Large Send Offload via the following steps:

Open Network Connections. 
Click Change adapter settings
Right-click the icon of the Network card and select Properties.
In Networking tab, click Configure… button.
In the next window, switch to Advanced tab.
Click the Large Send Offload Version 2 (IPv4) and change the value to Disabled.
Click the Large Send Offload Version 2 (IPv6) and change the value to Disabled.

Your RDP connection will disconnect right away after you apply the change. Don't worry, connect it back and you will find the annoying delay disappears!

Reference

CTE 101

Today I first learnt the concept of CTE (Common Table Expression) from my colleague Rod. Basically, CTE can be used to improve the readability of your long and complex SQL statement.

for example, without CTE, you might write the following SQL:

CREATE OR REPLACE VIEW dfx.test_vw123 AS
SELECT 
	a.FIELD_A, 
	a.FIELD_B, 
	b.FIELD_C
	b.FIELD_D
FROM (
	SELECT 
		MAX(FIELD_A) AS FIELD_A, 
		COUNT(*) AS FIELD_B 
	FROM TABLE_A ta 
	WHERE ta.FIELD_E = 'General' 
	GROUP BY ta.FIELD_F
) a 
LEFT JOIN TABLE_A b 
ON a.FIELD_A = b.FIELD_A

with CTE, you could write the following one with better readability.

CREATE OR REPLACE VIEW dfx.test_vw123 AS
WITH TABLE_A_STATS AS (
	SELECT 
		MAX(FIELD_A) AS FIELD_A, 
		COUNT(*) AS FIELD_B 
	FROM TABLE_A ta 
	WHERE ta.FIELD_E = 'General' 
	GROUP BY ta.FIELD_F
)
SELECT 
	a.FIELD_A, 
	a.FIELD_B, 
	b.FIELD_C
	b.FIELD_D
FROM TABLE_A_STATS a 
LEFT JOIN TABLE_A b 
ON a.FIELD_A = b.FIELD_A;

For further information about CTE, click Reference
I also found another article about CTE in Chinese.