<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><![CDATA[Staque 棧列]]></title>
<description><![CDATA[Staque 棧列]]></description>
<link>https://blog.staque.me/</link>
<lastBuildDate>Sat, 04 Jul 2026 09:47:44 +0200</lastBuildDate>
<item>
  <title><![CDATA[Running Multiple Cloudflare Service Instances on a Single Machine]]></title>
  <description><![CDATA[
<div class="post-date">Feb 9, 2025</div>
<p>
I recently tried to host two Cloudflare domains on my server: one that needs to be publicly accessible, and another that keeps private, (e.g., through Tailscale). Here are some notes from the setup.
</p>

<p>
Note: This tutorial involves stopping the currently running <code>cloudflared</code> process, which may lead to service downtime. Please proceed with caution and run the commands at your own risk.
</p>
<section id="outline-container-org8948797" class="outline-2">
<h2 id="org8948797">Backup the Existing Certificate</h2>
<div class="outline-text-2" id="text-org8948797">
<p>
If you already have an existing <code>cloudflared</code> setup with the default
configuration files, rename the current certificate to avoid overwriting
it:
</p>

<div class="org-src-container">
<pre class="src src-sh">mv /root/.cloudflared/cert.pem /root/.cloudflared/cert_orig.pem
</pre>
</div>
</div>
</section>
<section id="outline-container-orgf4316c4" class="outline-2">
<h2 id="orgf4316c4">Authenticate and Install a New Account Certificate</h2>
<div class="outline-text-2" id="text-orgf4316c4">
<p>
Authenticate <code>cloudflared</code> and install a new certificate on the server:
</p>

<div class="org-src-container">
<pre class="src src-sh">cloudflared tunnel login
</pre>
</div>

<p>
If successful, you'll be prompted to select a domain and install the
corresponding certificate at <code>/root/.cloudflared/cert.pem</code>:
</p>

<pre class="example" id="org37a066c">
Please open the following URL and log in with your Cloudflare account:

&lt;callback url&gt;

Leave cloudflared running to download the cert automatically.
You have successfully logged in.
If you wish to copy your credentials to a server, they have been saved to:
/root/.cloudflared/cert.pem
</pre>

<p>
Since this is our second certificate, rename it for clarity:
</p>

<div class="org-src-container">
<pre class="src src-sh">mv /root/.cloudflared/cert.pem /root/.cloudflared/cert_test.pem
</pre>
</div>
</div>
</section>
<section id="outline-container-org5dc7041" class="outline-2">
<h2 id="org5dc7041">Create a New Tunnel and Config</h2>
<div class="outline-text-2" id="text-org5dc7041">
<p>
Create a new Cloudflare tunnel:
</p>

<div class="org-src-container">
<pre class="src src-sh">cloudflared tunnel create test
</pre>
</div>

<p>
Example output:
</p>

<pre class="example" id="orge449b50">
Tunnel credentials written to /root/.cloudflared/36216cb7-d0b4-4572-9fdf-c03d62b41778.json.
cloudflared chose this file based on where your origin certificate was found. Keep this file secret.
To revoke these credentials, delete the tunnel.

Created tunnel test with id 36216cb7-d0b4-4572-9fdf-c03d62b41778
</pre>

<p>
Now, create a configuration file for the <code>test</code> instance:
</p>

<div class="org-src-container">
<pre class="src src-sh">cat &lt;&lt;EOF &gt; /etc/cloudflared/config_test.yml<span style="font-weight: bold;">
tunnel: 36216cb7-d0b4-4572-9fdf-c03d62b41778
credentials-file: /root/.cloudflared/36216cb7-d0b4-4572-9fdf-c03d62b41778.json
origincert: /root/.cloudflared/cert_test.pem
# Additional configurations can go here...
EOF</span>
</pre>
</div>
</div>
</section>
<section id="outline-container-org9e9c835" class="outline-2">
<h2 id="org9e9c835">Service Downtime (Hold Tight!)</h2>
<div class="outline-text-2" id="text-org9e9c835">
<p>
At this stage, we need to stop the running Cloudflare service and rename
the existing configurations. This will temporarily disrupt the service,
so proceed when ready.
</p>

<p>
First, stop the current Cloudflare service:
</p>

<div class="org-src-container">
<pre class="src src-sh">systemctl stop cloudflared.service
</pre>
</div>

<p>
Now, remove the old systemd service file:
</p>

<div class="org-src-container">
<pre class="src src-sh">rm /etc/systemd/system/cloudflared.service
</pre>
</div>

<p>
And rename the existing config:
</p>

<div class="org-src-container">
<pre class="src src-sh">mv /etc/cloudflared/config.yml /etc/cloudflared/config_orig.yml
</pre>
</div>

<p>
Now, define a new systemd service file for the original instance:
</p>

<div class="org-src-container">
<pre class="src src-sh">cat &lt;&lt;EOF &gt; /etc/systemd/system/cloudflared_orig.service<span style="font-weight: bold;">
[Unit]
Description=cloudflared (orig)
After=network.target

[Service]
TimeoutStartSec=0
Type=notify
ExecStart=/usr/bin/cloudflared --no-autoupdate --config /etc/cloudflared/config_orig.yml tunnel run
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
EOF</span>
</pre>
</div>

<p>
And a separate systemd service for the test instance:
</p>

<div class="org-src-container">
<pre class="src src-sh">cat &lt;&lt;EOF &gt; /etc/systemd/system/cloudflared_test.service<span style="font-weight: bold;">
[Unit]
Description=cloudflared (test)
After=network.target

[Service]
TimeoutStartSec=0
Type=notify
ExecStart=/usr/bin/cloudflared --no-autoupdate --config /etc/cloudflared/config_test.yml tunnel run
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
EOF</span>
</pre>
</div>
</div>
</section>
<section id="outline-container-orge57af97" class="outline-2">
<h2 id="orge57af97">Start Everything Up Again</h2>
<div class="outline-text-2" id="text-orge57af97">
<p>
Reload systemd, enable the services, and start them:
</p>

<div class="org-src-container">
<pre class="src src-sh">systemctl daemon-reload
systemctl enable --now cloudflared_orig.service
systemctl enable --now cloudflared_test.service
</pre>
</div>

<p>
Check if both services are running:
</p>

<div class="org-src-container">
<pre class="src src-sh">systemctl status cloudflared_orig.service
systemctl status cloudflared_test.service
</pre>
</div>

<p>
Your machine is now successfully running multiple Cloudflare instances and tunnels
independently. Enjoy your setup!
</p>
</div>
</section>
<section id="outline-container-org31501e3" class="outline-2">
<h2 id="org31501e3">Reference</h2>
<div class="outline-text-2" id="text-org31501e3">
<ul class="org-ul">
<li><a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/">Create a locally-managed tunnel (CLI) · Cloudflare Zero Trust
docs</a></li>
<li><a href="https://community.cloudflare.com/t/issue-with-multiple-services-on-same-instance/180394/16">Issue with multiple services on same instance - Cloudflare
Community</a></li>
</ul>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/multiple_cloudflared_service_instances_on_a_single_machine.html</link>
  <guid>https://blog.staque.me/multiple_cloudflared_service_instances_on_a_single_machine.html</guid>
  <pubDate>Sun, 09 Feb 2025 00:00:00 +0100</pubDate>
</item>
<item>
  <title><![CDATA[UIUC 交換心得 — 反思篇]]></title>
  <description><![CDATA[
<div class="post-date">Aug 13, 2023</div>
<p>
還記得在寫學校的期中交換心得的時候，心得大綱有一項叫做「研修之具體效益」，看到的時候我頓時愣住了，我想不到我「具體」在交換期間內做過哪些對自己有效益的事情，是要列舉去過哪些國家或城市，還是交了幾個外國朋友，我當時沒有來得及思考這個問題，因此也沒在期中交上報告。
</p>

<p>
過去的高中與大學生活，我總是固守在舒適圈中，與特定領域與特定朋友互動，收束生活的各方各面，因此當初交換的原因除了是想修習那些有趣的課程，充實自身專業知識之外，也是想幫自己的生活增加一點隨機性，讓自己的生活不要變得如此單調且侷限。
</p>

<p>
一開始認識了來自世界各地的交換生，彼此分享自己的文化背景，互相交換了聯絡方式，也一起去了其他地方玩，每天都能感受到自己的舒適圈都被擴展了一點點，覺得自己正在改變。但隨著我將越來越多的時間投入在課程與自己的研究課題上，與他人相處交流的時間也逐漸變少，離大家的生活漸行漸遠。
</p>

<p>
隨著自己的研究進展停滯，偶爾會想打開社群媒體跟之前的朋友訴苦，但因為時差的關係，朋友這時間都在睡覺，因而屢屢打消了念頭。但我總會意外地瞥見其他交換生分享的生活動態，像是去了其他城市遊覽，或是參加朋友的聚會等等。生活強烈的對比使我陷入了自我懷疑，不斷的思考當初的選擇是否正確，負面情緒不斷地折磨我，我徘徊不前，陷入前所未有的低潮。
</p>

<p>
在這段期間內，我不斷嘗試找出造成負面情緒的來源，發現到自己除了沒有分配好心力之外，也觀察到我過度拘泥於所謂那些交換生必做的事情 &#x2014; 那些在搜尋引擎打上「交換學生心得」會出現的結果，諸如「去不同的城市旅遊」或「結交不同文化的朋友」等等，似乎沒有體驗到這些事情就失去了去異國交換的意義，這些因素導致我過度在意其他人的生活，失去了生活的重心。
</p>

<p>
後來我逐漸學會了深入與內心對話，試圖找出自己的價值，過去我太關注於別人生活，卻不禁忽略了那些在實驗室與其他成員徹夜討論專案技術時的激動與振奮，也忽略了在溜冰課期末被推選當作團體表演 center 的經驗與感動，還有無數難忘瞬間，這些回憶讓我與眾不同，我學會接納生活的不完美，重新定義了自己的生活。
</p>

<p>
心得的最後補交期限即將在最近截止，我再次拾起那期中未完成的心得，看著當初答不出的問題，或許，交換的效益，無關乎具體或不具體，而是在這段時間我們如何探索自己，找到生活中的真正價值所在。我無視「具體」兩字，最後在那問題寫下那些積蓄心裡的思緒，將我那不具體但卻真實的感受凝聚成文字，為這次的交換做一個完美的結尾。
</p>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/uiuc_reflection.html</link>
  <guid>https://blog.staque.me/uiuc_reflection.html</guid>
  <pubDate>Sun, 13 Aug 2023 00:00:00 +0200</pubDate>
</item>
<item>
  <title><![CDATA[UIUC 交換心得 — 環境篇]]></title>
  <description><![CDATA[
<div class="post-date">Aug 9, 2023</div>
<section id="outline-container-org9beed48" class="outline-2">
<h2 id="org9beed48">大學城？玉米田？</h2>
<div class="outline-text-2" id="text-org9beed48">
<p>
UIUC 全名為 University of Illinois Urbana-Champaign ，是一所位於美國伊利諾伊州的州立大學，校園橫跨香檳 (Champaign) 與厄巴納 (Urbana) 兩座小城市，距離芝加哥 (Chicago) 車程大約兩個多小時。UIUC 的校園本體非常大，從最南端走到最北端大約要 50 分鐘左右。在學術方面，UIUC 的 Computer Science 在 2023 的 US News 調查被列為全美第五名 1，在 csrankings.org 的排名為全美第二名 (2013 ~ 2022) 2，僅次於 CMU 。順帶一提，著名的 LLVM 就是由 UIUC 的教授 Vikram Adve 和他的學生 Chris Lattner 發明的， License 也採用 <a href="https://choosealicense.com/licenses/ncsa/">UIUC License</a> 。
</p>

<p>
UIUC 的校園大致以 Main Quad &#x2014; 一大片長方形綠地為中心，圍繞著 Main Quad 的是外語、商管，與化學等等學院的建築；北邊是以電機、資工、物理為主，而南邊則是包含了農科、生科與法律等等，最南邊還有 Research Park ，擁有超過百間公司，很多學生在暑假的時候也會來這邊實習。校區內也有很多兄弟會的房子，房子外牆印有三個大大的希臘字母，在遠方一眼就可以認出是哪個組織的，而出了校區就是一望無際的玉米田了～
</p>


<figure id="orgee35afe">
<img src="../assets/winter_main_quad.jpg" alt="winter_main_quad.jpg" width="512">

<figcaption><span class="figure-number">Figure 1: </span>下雪時的 Main Quad</figcaption>
</figure>
<p width="512">
<img src="../assets/main_quad_picnic.jpg" alt="main_quad_picnic.jpg" width="512">
雖然交換生不會被分配到一個特定的系，只會被分配到特定學院，（例如我被分配到的是工程學院 <i>Grainger College of Engineering</i> ） ，但是我最常去的系館是 Computer Science 的系館，該系館建築叫 <a href="https://en.wikipedia.org/wiki/Thomas_M._Siebel_Center_for_Computer_Science">Thomas M. Siebel Center for Computer Science</a> (下略 Siebel Center)，由校友 <i>Thomas Siebel</i> 所捐贈。 Siebel Center 跟校園內其他建築一樣，佔地面積很大但樓層高度不高，雖然只有四層樓，但是單單一層能容納的空間非常驚人。以四樓來說，實驗室加上辦公室的數量就快一百間 3 ，剛來的時候真的常常迷路。另一個有趣的發現是 Siebel Center 擁有的開放式空間非常多，學期間常常看到學生在寫作業或是聚集討論，不少空間旁也有白板方便討論。
</p>


<figure id="org9639605">
<img src="../assets/siebel.jpg" alt="siebel.jpg" width="512">

<figcaption><span class="figure-number">Figure 2: </span>Siebel Center 一景</figcaption>
</figure>


<figure id="org7f6f53b">
<img src="../assets/siebel_internal.jpg" alt="siebel_internal.jpg" width="512">

<figcaption><span class="figure-number">Figure 3: </span>Siebel Center 的一樓</figcaption>
</figure>

<p>
而因為校區很大，我也沒買任何交通工具，因此有時要去比較遠的地方就要靠公車移動，像是去體育館或者是健康中心等等，而這裡的公車只要憑學生證或搭車路線在校區範圍內就可以免費乘坐，路線涵蓋的很廣，至少那些我去過的學校建築旁都設有一個以上的公車站。很酷的是公車的公司有跟 Google Map 合作，因此只要用 Google Map 就可以查到要發車時間與目前公車位置，還滿方便的。
</p>


<figure id="orgb948b55">
<img src="../assets/bus.jpg" alt="bus.jpg" width="512">

<figcaption><span class="figure-number">Figure 4: </span>雙倍加長的公車，灰色結構可以伸縮和彎曲，幫助車身轉彎，跟捷運一樣</figcaption>
</figure>
</div>
</section>
<section id="outline-container-orgfa898cb" class="outline-2">
<h2 id="orgfa898cb">住</h2>
<div class="outline-text-2" id="text-orgfa898cb">
<p>
我住的地方位於校園的西北邊，房型是 2B2B ，即兩個房間兩個獨立衛浴，地點我覺得絕佳：離最近的公車站走路大約兩分鐘、離最近的兩間超市走路都大約五分鐘、離系館距離大概走路十分鐘，但是 一個大缺點就是房子隔音極差，不僅可以不小心聽到隔壁室友電話中的談話內容，也能在每週六晚上享受隔壁建築開趴傳來的音樂與尖叫（以及飄來的麻味）。
</p>


<figure id="org2dc1f56">
<img src="../assets/apartment.jpg" alt="apartment.jpg" width="512">

<figcaption><span class="figure-number">Figure 5: </span>公寓的客廳和廚房</figcaption>
</figure>


<figure id="orgde0f8b8">
<img src="../assets/park.jpg" alt="park.jpg" width="512">

<figcaption><span class="figure-number">Figure 6: </span>公寓附近很舒服的公園</figcaption>
</figure>
</div>
</section>
<section id="outline-container-org194cf40" class="outline-2">
<h2 id="org194cf40">動物朋友</h2>
<div class="outline-text-2" id="text-org194cf40">
<p>
在這裡最常看到的動物非松鼠莫屬，時常發現它們在翻著公寓旁的垃圾桶，一跟我對到眼就會趕緊叼著食物溜到車底下偷偷躲著吃。 但更讓我驚訝的是這裡竟然可以在路邊就看見野兔！它們似乎比松鼠更怕人，跳著逃跑的樣子非常可愛。 很奇怪的是，我從來沒有在路上或是校園內看過野狗或野貓，原因不明，然後我住的公寓裡面也極少出現昆蟲，幾乎沒有在房子裡面看過蟑螂、螞蟻或蚊子等等，對某些臺灣人來說這裡可能是他們的天堂吧 XD
</p>


<figure id="org7161a33">
<img src="../assets/rabbit.jpg" alt="rabbit.jpg" width="512">

<figcaption><span class="figure-number">Figure 7: </span>是野生的兔子！</figcaption>
</figure>
</div>
</section>
<section id="outline-container-orga55bdd4" class="outline-2">
<h2 id="orga55bdd4">氣候</h2>
<div class="outline-text-2" id="text-orga55bdd4">
<p>
至於氣候的部分，在一二月的時候，雖然有時候會下雪但並沒有想像中的冷，可能是環境乾燥然後平常的風又沒很強的關係（對比新竹）。我在這裡遇到最冷的溫度是攝氏零下十度左右，但大多數時候裡面穿個發熱衣加長袖，外面再套個羽絨衣就足以應付了。（後來我聽說十二月的時候氣溫有到攝氏零下二十度，沒遇到該說是幸運還是不幸呢）而到了三四月，氣溫逐漸變暖，下雪的頻率也逐漸下降，但氣候變化幅度超級大，有時候出大太陽有時候下雪有時候暴風雨，不看天氣預報真的出不了門。其中比較印象深刻的是有遇到龍捲風，在校園受到影響那段時間的課都停了。
</p>


<figure id="org0043671">
<img src="../assets/duck_army.webp" alt="duck_army.webp" width="512">

<figcaption><span class="figure-number">Figure 8: </span>雪鴨鴨大軍 (r/UIUC)</figcaption>
</figure>


<figure id="org0c8fbd7">
<img src="../assets/tornado.jpg" alt="tornado.jpg" width="512">

<figcaption><span class="figure-number">Figure 9: </span>其他人拍到的龍捲風（我沒親眼看到） (r/UIUC)</figcaption>
</figure>

<p>
另外一個新奇的體驗是有夏令時間，時間提早了一個小時，有一天很長的錯覺，在夏天的時候甚至有過那些日子是八點半太陽才下山，九點才全黑，那段時間不知不覺地就會拖到十點才吃飯 XD
</p>
</div>
</section>
<section id="outline-container-orgf718da5" class="outline-2">
<h2 id="orgf718da5">人</h2>
<div class="outline-text-2" id="text-orgf718da5">
<p>
在來交換之前，我以為這邊會有很多認知上的「美國人」，但實際來才發現學生的國籍組成非常多樣，光看外表其實辨別不出來是來自哪個國家，而且擁有亞洲面孔的學生是出乎我意料的多，就如奕安學長在<a href="https://ianchen.tw/posts/2019-08-11-exchange-report">他的交換心得</a>說的：「ECE 跟 CS 兩個科系中充滿了亞裔跟印度裔學生，在國際生之中最多也來自中國，有時候上課的時候還會很懷疑美國人跑到哪裡去，當我修其他學門的課程才會發現正常的人種比例。」我也是在上溜冰課的時候才有在美國上課的感覺。除此之外，我也覺得這裡的人比我想像中的還要友善且大方，我還記得有一次我在搭電梯的時候，旁邊有個印度人突然對我說 “I like your outfit” 然後就徑直走出電梯，留下原地被驚嚇到還在想要怎麼回應的我 &#x2014; 這輩子還是第一次被陌生人稱讚穿搭欸！
</p>


<figure id="orgff52af2">
<img src="../assets/chinese_on_bus_doors.png" alt="chinese_on_bus_doors.png" width="512">

<figcaption><span class="figure-number">Figure 10: </span>公車門上的中文標語</figcaption>
</figure>

<p>
至於很多人擔心的安全問題，雖然校園與校園周圍相對沒那麼危險，有專門的警察駐守，但不時還是會收到來自學校的警告信件，表示校園附近有 sex assaulting, stabbing 或是 shooting 等等的事件發生，告訴大家要小心 ，如果看到事件發生的地址離住的地方不遠時還是會有點怕。記得有天晚上我跟室友走在路上，突然有人從旁邊冒出來，雖然他只是說他很冷，可不可以給他買衣服禦寒之類的，當時遇到的時候還是有點膽戰心驚。總之，我覺得這邊的環境相對於台灣不是那麼的安全，走在路上需要有一點警覺和防備心，特別是晚上的時候。順帶一提，學校有提供 "Safe Walk" 的服務，如果擔心一個人晚上走在街上危險，可以免費請專門人員陪你走回去或是送你回家。（但我是沒有體驗過啦）
</p>


<figure id="org79c4fb7">
<img src="../assets/illini-alert.png" alt="illini-alert.png" width="512">

<figcaption><span class="figure-number">Figure 11: </span>某次 stabbing 的警報的提醒郵件</figcaption>
</figure>
</div>
</section>
<section id="outline-container-org0b22235" class="outline-2">
<h2 id="org0b22235">感想</h2>
<div class="outline-text-2" id="text-org0b22235">
<p>
實際在這邊生活了七個月，其中一個收穫是體認到一個環境沒有絕對的優或劣，不同地方的選擇其實都是 trade-off：行人的路權與交通的便利、選擇性多的異國料理與熟悉的家鄉味，還有乾燥嚴寒和變化多端的天氣與溼悶酷熱和各種昆蟲的侵擾；有時當我們在稱羨一個地方的優點時，往往會忽略了在舊有生活所依賴的那些重大要素，導致錯誤的判斷而作出不理性的結論或抉擇。我想，交換的其中 一個意義，就是像駐地記者一般，透過自身的觀察加上與他人的互動來捕捉不同環境間的差異，並寫成文章供人們檢視參考以及自己懷念吧。
</p>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/uiuc_environment.html</link>
  <guid>https://blog.staque.me/uiuc_environment.html</guid>
  <pubDate>Wed, 09 Aug 2023 00:00:00 +0200</pubDate>
</item>
<item>
  <title><![CDATA[UIUC 交換心得 — 修課篇]]></title>
  <description><![CDATA[
<div class="post-date">Aug 1, 2023</div>
<section id="outline-container-org7925b9e" class="outline-2">
<h2 id="org7925b9e">前言</h2>
<div class="outline-text-2" id="text-org7925b9e">
<p>
這篇文章我會介紹我在 UIUC 這段期間修課的心得，我最後有拿到學分的有下面這些課，加起來共 12 學分：
</p>

<ul class="org-ul">
<li>CS461 Computer Security I</li>
<li>CS523 Advanced Operating Systems</li>
<li>CS391 Independent Study</li>
<li>KIN104 Skating Activities</li>
<li>ENG398 Grainger Engr: Design Your Exc</li>
</ul>

<p>
下面一一介紹這些課程的內容與我的個人心得，結尾有總結的感想～
</p>
</div>
</section>
<section id="outline-container-org0ce0959" class="outline-2">
<h2 id="org0ce0959">CS461 Computer Security I</h2>
<div class="outline-text-2" id="text-org0ce0959">
<p>
課程網頁：<a href="https://courses.grainger.illinois.edu/ece422/sp2023/">https://courses.grainger.illinois.edu/ece422/sp2023/</a>
</p>

<p>
這堂課介紹了一些基礎的電腦安全知識，包含四大主題：application security, web security, cryptography 和 network security ，每個主題都有相對應的 homework ，需要在助教提供的虛擬機環境操作，而期中期末各有一次紙筆測驗。
</p>
</div>
<div id="outline-container-org9639605" class="outline-3">
<h3 id="org9639605">感想</h3>
<div class="outline-text-3" id="text-org9639605">
<p>
因為之前有一些打 CTF 的經驗，因此這堂課的實作對我來說沒有很難，是花時間下去就可以完成的。其中 network security 的 lab 滿有趣的，是要求覆現知名駭客 Kevin Mitnick (最近去世了 R.I.P.) 的 The Mitnick attack ，其牽涉到 TCP 底層的一些知識，在臺灣沒有看過相關類型的題目，因此覺得滿好玩的。紙筆測驗的題目有些也是蠻有創意的，不會死板的考知識點，而是像是給情境，然後用一個個子問題引導你回答到最終的題目。
</p>
</div>
</div>
</section>
<section id="outline-container-org7f6f53b" class="outline-2">
<h2 id="org7f6f53b">CS391 Independent Study</h2>
<div class="outline-text-2" id="text-org7f6f53b">
<p>
這堂課嚴格來說不算課，其實就是像臺灣的大學中常見的「專題研究」，選修時需要找教授並填表單申請。
</p>

<p>
因為我開學時就加入某位教授的實驗室跟著學長做研究，因此順理成章找了該教授當作的導師，研究內容也當然是實驗室專案的內容。
</p>
</div>
</section>
<section id="outline-container-org9beed48" class="outline-2">
<h2 id="org9beed48">CS523 Advanced Operating Systems</h2>
<div class="outline-text-2" id="text-org9beed48">
<p>
課程網頁： <a href="https://cs523-uiuc.github.io/spring23/index.html">https://cs523-uiuc.github.io/spring23/index.html</a>
</p>

<p>
這堂課透過閱讀經典論文來瞭解系統各領域所關注的議題，課堂進行方式是以討論為主：一人會先報告論文，報告完之後老師會跟大家討論這篇論文的背景、內容與優缺點等等。期末前需要交一個專案，而在這之前也需要報告專案的提案與進度。
</p>
</div>
<div id="outline-container-org2dc1f56" class="outline-3">
<h3 id="org2dc1f56">感想</h3>
<div class="outline-text-3" id="text-org2dc1f56">
<p>
我在臺灣沒有修過這種純論文報告與討論的課程，一開始的時候很不習慣，很怕講錯或者是講的不流暢，但我後來發現我也沒有比別人差到哪裡去，因此後來就比較能適應課堂的步調，而我的期末專案也是跟實驗室在做的專案一樣。整體來說這堂課滿有收穫的，瞭解到其實很多看似新穎的概念或想法其實都是從這些非常經典的論文演變而來，並在其之上順應不同的工作場景或者是優化原有的實作方法。
</p>
</div>
</div>
</section>
<section id="outline-container-orgde0f8b8" class="outline-2">
<h2 id="orgde0f8b8">ENG398 Grainger Engr: Design Your Exc</h2>
<div class="outline-text-2" id="text-orgde0f8b8">
<p>
這堂課是工程學院交換生的必修課，時長只有半學期，內容大概圍繞著學校和美國的文化，像是介紹學校附近的好玩的景點或是美國的節日等等，而老師是正在就讀碩士的 UIUC 學生，因此沒什麼距離感，老師本人也很漂亮 &gt;&lt; 。
</p>
</div>
<div id="outline-container-org194cf40" class="outline-3">
<h3 id="org194cf40">感想</h3>
<div class="outline-text-3" id="text-org194cf40">
<p>
還記得第一週是分組玩 scavenger hunt ， 概念類似尋寶遊戲。當時跟瑞典人和愛爾蘭人一組去找特定學校的建築物，根本聽不懂他們在講什麼 QQ。另一個超感動的記憶是某一週的課程是情人節特輯，所以老師發了很多不同的糖果讓我們投票決定哪個最好吃，最後課堂結束還送我們一盒巧克力，超愛老師！
</p>


<figure id="orgfa898cb">
<img src="../assets/valentine_chocolate.jpg" alt="valentine_chocolate.jpg" width="512">

<figcaption><span class="figure-number">Figure 1: </span>老師送的情人節巧克力 &lt;3</figcaption>
</figure>

<p>
題外話一：在朋友的聊天當中得知，似乎我們這個班級在三班之中是氣氛最糟糕的，有時候老師問完問題都沒人回答，超尷尬 QQ ， 所以我有時候會幫忙回答一下，讓氣氛不要那麼僵（？
</p>

<p>
題外話二：這是我們老師被採訪的文章 <a href="https://grainger.illinois.edu/news/voices/54019">https://grainger.illinois.edu/news/voices/54019</a>
</p>
</div>
</div>
</section>
<section id="outline-container-org0043671" class="outline-2">
<h2 id="org0043671">KIN104 Skating Activities</h2>
<div class="outline-text-2" id="text-org0043671">
<p>
這堂課也只有半學期，主要內容涵蓋了一些基本的溜冰技巧像是 foward/backward swizzles, one-foot/two-foot glides, 到最後的 two-foot spin 等等。課程進行方式是由四位 student instructors 來帶，一開始會先複習之前的動作然後再教新的動作讓學生練習。期中期末各有一次團體的三分鐘表演，需要每組自己想 synchronization 的動作以及挑選適合的音樂。每個禮拜還有非常簡單的小測驗，期中期末也有一些心得要寫。
</p>
</div>
<div id="outline-container-orga55bdd4" class="outline-3">
<h3 id="orga55bdd4">感想</h3>
<div class="outline-text-3" id="text-orga55bdd4">
<p>
這堂課是所有課裡面最喜歡的！！ instructor 們非常非常非常的 nice ，如果有動作不會，可以直接叫她們示範給你看，然後幫你看你的動作正不正確。她們也都超厲害的，在期末的時候也有小表演一下，全場掌聲超級熱烈的～ 而我覺得我是之前有學過直排輪的關係，所以好像對溜冰掌握度還算不錯，但我似乎也是班上摔倒最多次的人，基本上每堂課必摔。但我真的很享受在溜冰場上的每分每秒，特別是當在冰上全力衝刺、那種沒有摩擦的快感真的超級刺激，真的希望之後還有機會溜。
</p>


<figure id="org0c8fbd7">
<img src="../assets/ice_arena.jpg" alt="ice_arena.jpg" width="512">

<figcaption><span class="figure-number">Figure 2: </span>溜冰場一景</figcaption>
</figure>

<p>
BTW, 課程結束後去找我們這組的 instructor 跟她合照，她說 “You are one of the talented students I've ever seen” ，聽到這句話的時候我真的超開心的！
</p>
</div>
</div>
</section>
<section id="outline-container-org79c4fb7" class="outline-2">
<h2 id="org79c4fb7">番外：那些我退選的課</h2>
<div class="outline-text-2" id="text-org79c4fb7">
<p>
我曾經有修過兩門課但後來都退了：
</p>

<ul class="org-ul">
<li>INFO 102 Little Bits to Big Ideas</li>
<li>ECE 220 Computer Systems &amp; Programming</li>
</ul>

<p>
我承認我一開始選這兩門課只是為了刷學分 (滿足 J-1 簽證資格每學期必須至少要修 12 學分以上），但發現雖然教的東西很水，但是作業一點都不好刷欸 ==
</p>

<p>
INFO 102 這堂課像是計算機概論那種課，涵蓋知識範圍很廣但是都非常基礎，作業會要求你寫一份很冗的報告，舉例來說，某堂課教了 Python 的 <code>^</code> 和 <code>|</code> operator ，它會要求你寫你從實驗發現了什麼，然後學到了什麼之類的問題，而且評分極為嚴格，我寫太高級的回答還會被扣分 QQ ，而且實驗課還會強制要求出席，會點名算分數。
</p>

<p>
ECE 220 則是一堂教 assembly (用學校發明的 LC-3) 還有 C 語言的課，兩者都不難，然而一學期分別有 9/6/3 個 homeworks/labs/tests ，而且作業都是那種勞力型的作業，不需要動腦但是要實作很多細節。
</p>

<p>
反正最後我覺得修這兩課對我來說真的在浪費時間，所以去了幾次課堂和寫了幾次作業之後就都 drop 了。
</p>


<figure id="org1520f12">
<img src="../assets/emacs.jpg" alt="emacs.jpg" width="512">

<figcaption><span class="figure-number">Figure 3: </span>教授用 Emacs 超酷</figcaption>
</figure>

<figure id="orgff52af2">
<img src="../assets/so_many_people.jpg" alt="so_many_people.jpg" width="512">

<figcaption><span class="figure-number">Figure 4: </span>200 人規模的上課方式</figcaption>
</figure>
</div>
</section>
<section id="outline-container-org0c2fec5" class="outline-2">
<h2 id="org0c2fec5">感想</h2>
<div class="outline-text-2" id="text-org0c2fec5">
</div>
<div id="outline-container-orgf718da5" class="outline-3">
<h3 id="orgf718da5">選課感想</h3>
<div class="outline-text-3" id="text-orgf718da5">
<p>
當初為了選到自己想要的課可說是歷經了千辛萬苦，首先是交換生一開始不能用選課系統選本系的課，因為會有先修課程的規定，所以要寄信給行政單位手動選課，然而他們的行政處理速度非常緩慢，在 12 月底正要開始選課的時候結果行政人員跑去休假了，後來想要加選她又不回，最後是直接殺去辦公室找她才成功選到我要的課。
</p>

<p>
再來是交換生只能選 <b>2</b> 門 CS 的課程，申請時沒有人告訴我這條規定 QQ 。但幸運的是方法總比問題多：一個繞過的方法是，如果是與 ECE 共同開的但由 ECE 主導的不受此限制，另外一個發現是如果選了兩門課後，選 500-level 的課並經過該教授同意，他們不會要求你退掉原有的課。
</p>
</div>
</div>
<div id="outline-container-org0b22235" class="outline-3">
<h3 id="org0b22235">修課感想</h3>
<div class="outline-text-3" id="text-org0b22235">
<p>
老實說我在這裡沒有修太多課程，因此我可能察覺不太出這裡與臺灣的教學差異，以下是我的觀察：
</p>

<p>
Q: 在這裡的課程怎麼宣佈課程事項還有交作業？
</p>

<blockquote>
<p>
這裡大部分的課程都是用 Canvas 或 Moodle ，有些課程例如 CS461 會串 Github OAuth 讓學生去存取課程 orgnization 底下的專案以方便寫和交作業。
</p>
</blockquote>

<p>
Q: 這裡的助教狀況？
</p>

<blockquote>
<p>
我覺得跟交大最大的不同是這裡很多課程都配有很多位助教，而且會開很多 office hours 和 “discussion sections”。 前者就是開放問各種問題，後者比較偏向講解這週的作業等等。以 CS461 為例，一週的 discuss section 有 7 個時段，而 office hours 高達 11 個時段。
</p>
</blockquote>

<p>
Q: 聽說美國的大學生都很會問問題，都很喜歡坐在最前排？
</p>

<blockquote>
<p>
以 ECE220 為例， 前排大部分還是空著，坐的人大部分都是遲到的人。課堂上問問題也只有少數人在問，但線上論壇是滿活躍的。
</p>
</blockquote>

<p>
Q: 這裡的作業跟交大有什麼不同？
</p>

<blockquote>
<p>
我會說這裡有意培養大學生成為研究型的人才，課堂或者是作業會要求學生先讀論文或是相關程式的原始碼，這跟交大是完全不一樣的，交大很多課都是只給 spec 然後照著實作即可。
</p>
</blockquote>

<p>
總而言之，第一次上全英文的課程非常新鮮有趣，也看到不同國家的學校在教一樣主題的課時各自的教育方法，很值得思考。
</p>
</div>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/uiuc_course.html</link>
  <guid>https://blog.staque.me/uiuc_course.html</guid>
  <pubDate>Tue, 01 Aug 2023 00:00:00 +0200</pubDate>
</item>
<item>
  <title><![CDATA[AsiaBSDCon 2023 Trip Report]]></title>
  <description><![CDATA[
<div class="post-date">Apr 9, 2023</div>
<p>
The FreeBSD Foundation sponsored my trip to AsiaBSDCon 2023, which took place in Tokyo, Japan. This was my first time attending a BSD conference and also my first time participating as a speaker. I would like to express my gratitude to the FreeBSD Foundation for providing me with a travel grant that made it possible for me to attend.
</p>

<p>
On the first day of the developer summit, the host, Li-Wen Hsu, discussed the following schedule with attendees. The first session, presented by Brooks Davis, was a talk about the current progress and issues of CheriBSD. CheriBSD is modified from FreeBSD for supporting CHERI, an hardware architecture with focus on security. As I had never heard of CHERI or CheriBSD before, I quickly read through the papers they published to get a basic understanding of the design and the implementation. Knowing the difficulties to build a whole ecosystem from scratch from Brooks' presentation, I was surprised that Brook and their team were able to overcome these obstacles and complete such an amazing project. After lunch, it was my turn to present my work - VT-IME. I introduced the project and demonstrated how to use VT-IME to type CJK characters in the virtual terminal. In addition, I asked opinions about the current design and architecture of VT-IME since I felt this project is relatively too immature to be adapted into the system. Fortunately, many attendees gave me useful feedback from a developer's perspective. I was grateful for their advice and would definitely take it into consideration in my future implementations.
</p>

<p>
On the next day, En-wei Wu, who also came from Taiwan and was a GSoC participant like me, shared his plans for future work on wtap(4). In brief, he planned to support virtio network device on wtap(4), which lets users be able to test network drivers under different VMs, each of them with different operating systems installed. It sounded so exciting, and I looked forward to this work. Another talk that interested me was "Thoughts about FreeBSD containers", brought by Yan Ka Chiu. He presented "xc", a FreeBSD container runtime that aims to be as full-fledged as the existing tools in linux container ecosystem. My favorite part is how he dealed with the container image with zfs. He pointed out several issues of unionfs, which is adopted by existing tools such as bastile, when achieving the layer concept in the container image, and explained how he leveraged zfs to avoid these issues.
</p>

<p>
The following two days are conference talks. The talks I listened to were all very interesting and enlightening. Among them, the talk I remembered the most is "bhyve Debug Server Enhancements". The speaker, Bojan Novković, shared his experience on adding more gdb debugging features for the virtual machine such as single-stepping feature and hardware watchpoints. I learned a lot about gdb internals from that talk. I also presented my talk successfully (despite I was a little bit nervous and out of breath at the beginning) and received much feedback from the attendees as well. I still couldn't forget how happy I was when a person told me that he thought my work is quite interesting since he types Japanese in his daily life. Perhaps this is the meaning of being an engineer &#x2014; to solve existing problems and bring people joy.
</p>

<p>
During those four days, I had the opportunity to meet BSD enthusiasts from all over the world in person. I had a chance to talk with Yan Ka Chiu and Hiroki Sato about VT-IME, and they gave me much insightful advice. Roller Angel shared with me a lot of his home lab knowledge during the banquet. I also had conversations with Michael Dexter, Chih-Hsin Chang, Wei Hu and many others whose names I didn't get a chance to know. I appreciated everyone who talked with me, and I learned so much from them.
</p>

<p>
Apart from the technical sessions, I also traveled to many places, including Asakusa (淺草), Ueno (上野), Akihabara (秋葉原) and Shinjuku (新宿). The food, the people, the atmosphere there were all very impressive! I can't even list them all or this article will get too long XD. I also want to thank En-wei for hanging out with me, and I really enjoyed the time we spent in Tokyo together.
</p>


<figure id="org7925b9e">
<img src="../assets/yozakura.jpg" alt="yozakura.jpg" width="512">

<figcaption><span class="figure-number">Figure 1: </span>千鳥ヶ淵</figcaption>
</figure>
<!-- （千代田のさくらまつり開催時）  -->

<p>
In summary, it was one of the most wonderful experience in my life. If I had to choose just one thing I learned, it must be their passion in BSD systems. Their contributions to the BSD community are really admirable, and I hoped to become that kind of person someday :).
</p>

<p>
Thanks FreeBSD foundation again for sponsoring me to attend the AsiaBSDCon this year. Also thanks to Li-Wen Hsu, who encouraged me to submit a paper to the conference. I hoped to continue attending such events in the future!
</p>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/AsiaBSDCon2023.html</link>
  <guid>https://blog.staque.me/AsiaBSDCon2023.html</guid>
  <pubDate>Sun, 09 Apr 2023 00:00:00 +0200</pubDate>
</item>
<item>
  <title><![CDATA[2023 Linux 筆電選購心得]]></title>
  <description><![CDATA[
<div class="post-date">Jan 20, 2023</div>
<section id="outline-container-org7925b9e" class="outline-2">
<h2 id="org7925b9e">目前狀況</h2>
<div class="outline-text-2" id="text-org7925b9e">
<p>
目前使用的筆電是 Macbook Air 2017 ，使用了約四年，相關規格為：
</p>

<ul class="org-ul">
<li>處理器： i5-5350U 1.8GHz</li>
<li>螢幕： 13.3-inch 1440 x 900</li>
<li>記憶體： 8GiB</li>
<li>硬碟： 512GiB</li>
<li>尺寸： 32.5 x 22.7 x 1.7cm</li>
<li>重量： 1.35kg</li>
</ul>

<p>
升級原因主要是電池老化，循環次數為 476 次，大約只能撐 10 分鐘不到，根本無法在沒有插座的地方使用。而且處理器和記憶體力不從心，只要 進行系統更新，開始編譯東西或者是瀏覽器開超過五十個分頁就沒辦法順暢使用。
</p>
</div>
</section>
<section id="outline-container-org2dc1f56" class="outline-2">
<h2 id="org2dc1f56">選購理念</h2>
<div class="outline-text-2" id="text-org2dc1f56">
<ul class="org-ul">
<li>使用習慣：長時間待在同個地方並有插座，不太會在不固定地點（例如咖啡廳）使用</li>
<li>價格不會是一個比較因素，只要在一定範圍內就可接受
<ul class="org-ul">
<li>期望電腦是會用比較久的東西，成本相較於其他不可變因素比較不那麼重要</li>
</ul></li>
<li>日常使用 Arch Linux ，因此需要有良好的 Linux 支援度</li>
<li>重量和體積要與現在的電腦相似或更好</li>
<li>覺得目前筆電螢幕略小 (13.3-inch)，因此認為最佳尺寸是 14 inch</li>
<li>記憶體至少要 16 GiB ，硬碟至少要 512 GiB</li>
</ul>

<p>
根據這些基本的條件，我挑了五台電腦來進行深入的比較，分別為
</p>

<ul class="org-ul">
<li><a href="https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadt/thinkpad-t14s-gen-3-(14-inch-amd)/len101t0015?orgRef=https%253A%252F%252Fwww.google.com%252F">Lenovo ThinkPad T14s Gen3 (14“ AMD)</a></li>
<li><a href="https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadz/thinkpad-z13-(13-inch-amd)/len101t0036?orgRef=https%253A%252F%252Fwww.google.com%252F">Lenovo ThinkPad Z13 (13“ AMD)</a></li>
<li><a href="https://www.dell.com/en-us/shop/dell-laptops/xps-13-plus-laptop/spd/xps-13-9320-laptop">Dell XPS 13 Plus 9320</a></li>
<li><a href="https://www.apple.com/shop/buy-mac/macbook-air/midnight-apple-m2-chip-with-8-core-cpu-and-10-core-gpu-512gb">Apple MacBook Air M2</a></li>
<li><a href="https://system76.com/laptops/lemur">System76 Lemur Pro (Lemp11)</a></li>
</ul>

<p>
詳細的硬體規格可以參考<a href="https://www.notebookcheck.net/index.php?id=127065&amp;specs%5B%5D=330825&amp;specs%5B%5D=332490&amp;specs%5B%5D=331125&amp;specs%5B%5D=331063">這個網站</a> （但目前沒有 Lemur Pro 的相關資訊，而且 Z13 為 Ryzen 5 版本、 XPS 13 Plus 為 i5 版本)。
</p>
</div>
</section>
<section id="outline-container-org0b22235" class="outline-2">
<h2 id="org0b22235">各項比較</h2>
<div class="outline-text-2" id="text-org0b22235">
</div>
<div id="outline-container-orgfa898cb" class="outline-3">
<h3 id="orgfa898cb">效能</h3>
<div class="outline-text-3" id="text-orgfa898cb">
<p>
我對效能的要求其實沒有很高，基本上我只要求瀏覽器分頁可以開超過 100 個不會 lag 就可以了，而記憶體有 16GiB 應該就能輕鬆達成這個需求。根據<a href="https://www.phoronix.com/review/apple-m2-linux">這個跑分結果</a>，五者對我來說體感上應該不會有差別。
</p>

<p>
排名：MacBook Air M2 &gt; T14s Gen3 = XPS 13 Plus = Lemur Pro
</p>
</div>
</div>
<div id="outline-container-org7161a33" class="outline-3">
<h3 id="org7161a33">螢幕</h3>
<div class="outline-text-3" id="text-org7161a33">
<p>
Macbook 的螢幕肯定是最好的，不但解析度最高 (2560x1664) ，還是 Retina 螢幕。再來我的排序應該是 T14s (with 400-nits display) 、 XPS 13 Plus 、 Z13 ，最後是 Lemur Pro ，主要是按照品質與尺寸的考量。
</p>

<p>
排名： MacBook Air M2 &gt;&gt; T14s &gt; XPS 13 Plus &gt; Z13 &gt; Lemur Pro
</p>
</div>
</div>
<div id="outline-container-org194cf40" class="outline-3">
<h3 id="org194cf40">攜帶性</h3>
<div class="outline-text-3" id="text-org194cf40">
<p>
下圖是這五台的體積大小比較，而紅線畫出來的長方形代表 Lemur Pro 的長寬 (322 x 217cm)。
</p>

<p width="512">
<img src="../assets/laptop_size_comparision.png" alt="laptop_size_comparision.png" width="512">
在這之中 Z13 是長+寬+深是最小的，但最輕的是 Lemur Pro (1.15kg) 。
</p>

<p>
排名： Z13 &gt; Dell XPS Plus 13 &gt; Lemur Pro &gt; MacBook Air M2 &gt; T14s
</p>
</div>
</div>
<div id="outline-container-org0043671" class="outline-3">
<h3 id="org0043671">接孔</h3>
<div class="outline-text-3" id="text-org0043671">
<p>
至於接孔的部分，T14s 接孔是最多的，總共有 4 個 USB 接孔，通常情況下不需要再另外使用擴充埠。次之為 Lemur Pro ，有 3 個 USB 接孔。而 Macbook Air, Z13 和 XPS 13 Plus 都只有兩個 USB 接孔，但 Macbook 有獨立充電孔和 audio jack ， Z13 有 audio jack ，而 XPS 13 Plus 沒有任何額外接孔。
</p>

<p>
排名： T14s &gt; Lemur Pro &gt;&gt; Macbook Air M2 &gt; Z13 &gt; XPS 13 Plus
</p>
</div>
</div>
<div id="outline-container-org0c8fbd7" class="outline-3">
<h3 id="org0c8fbd7">擴充性</h3>
<div class="outline-text-3" id="text-org0c8fbd7">
<p>
T14s, Z13 和 XPS 13 Plus 都可以換 SSD 、 電池、網路卡等等的 1 , 2 , 3 ，然而三者都不能換記憶體。 T14s 和 Z13 還有提供官方手冊教你怎麼更換零件 4 , 5 。 而 MacBook Air &#x2026; ，就算了吧 QQ 。
</p>

<p>
排名： T14s = Z13 = XPS 13 Plus &gt; Lemur Pro &gt;&gt; MacBook Air
</p>
</div>
</div>
<div id="outline-container-org1520f12" class="outline-3">
<h3 id="org1520f12">Linux 支援性</h3>
<div class="outline-text-3" id="text-org1520f12">
<p>
T14s 和 XPS 13 Plus 對 Linux 的支援都不差 6 , 7 ，只有有些地方可能需要手動調參數或裝套件。然而 Asahi Linux 對於 M2 的支援現在還尚未成熟。雖然早些時候宣佈了 GPU driver release 8 ， 但根據<a href="https://github.com/AsahiLinux/docs/wiki/Feature-Support#m2-series-device-specific-support">官方目前的 Feature Support</a> (2022/01/11)，目前前置鏡頭和喇叭都還是無法使用的狀態，外接螢幕也還不支援9 。這對我來說是難以接受，因為有時會有視訊會議需要開鏡頭，也有把音樂用喇叭播出的時候。此外，由於架構是 aarch64 ，會有機率遇到軟體不相容的問題，會影響到日常的使用。
</p>

<p>
排名： Lemur Pro &gt; T14s = Z13 = XPS 13 Plus &gt;&gt; MacBook Air M2
</p>
</div>
</div>
<div id="outline-container-orgff52af2" class="outline-3">
<h3 id="orgff52af2">鍵盤</h3>
<div class="outline-text-3" id="text-orgff52af2">
<p>
雖然網路上很多人說 ThinkPad 的鍵盤打起來很棒，我有打過 X1 Carbon 的鍵盤，是真的不錯。然而令人悲傷的是 T14s Gen3 的鍵程跟 T14s Gen1, X1 Carbon Gen6 的 1.8mm 不同，為 1.5 mm ，因此不確定鍵程少 0.3mm 會有多大的手感差異。小紅點我沒有特別愛用所以對我來說不是個加分。 XPS 13 Plus 的鍵盤看起來還行，但網路上有人說如果把手放在鍵盤上會刮手10 。 MacBook Air M2 的鍵盤我體驗過覺得還不錯，手感脆脆的，比我現在的 Mac Air 2017 鍵盤還要好打。
</p>

<p>
觸控版的部分 MacBook Air M2 應該是最好的，面積大而且很滑。雖然在 Linux 環境下沒辦法像在 MacOS 原生支援的那麼好，但以我自己用 MacBook Air 的感受，其實已經很不錯了。而 T14s 有一些災情發生，說是在 tap trackpad 時也會發出聲音 (rattling) 11 ，這感覺不是很舒服 QQ 。
</p>

<p>
排名: Macbook Air M2 = T14s &gt; XPS 13 Plus &gt; Z13 &gt; Lemur Pro
</p>
</div>
</div>
<div id="outline-container-org79c4fb7" class="outline-3">
<h3 id="org79c4fb7">電池</h3>
<div class="outline-text-3" id="text-org79c4fb7">
<p>
主要參考上方的比較， 進行 wifi surfing ， MacBook Air M2 可以撐 15 小時，而 T14s 和 Z13 的電池可以撐 14 和 12 小時，而 XPS 最差，只能撐 8 小時。Lemur Pro 找不到相關的電量測試數據，但 Lemur Pro 有最大的電池容量 (73Wh) ，相關論壇留言表示最長可以撐到 14 小時 12 , 13 。
</p>

<p>
排名： MacBook Air M2 &gt; Z13 &gt; T14s = Lemur Pro &gt; XPS 13 Plus
</p>
</div>
</div>
<div id="outline-container-orgf718da5" class="outline-3">
<h3 id="orgf718da5">顏值</h3>
<div class="outline-text-3" id="text-orgf718da5">
<p>
我覺得 XPS 13 Plus 的顏值是最高的，當初就是被他的外觀吸引的。我很喜歡那個無邊界觸控板的設計，看起來很整潔。然後緊密排列的鍵盤加上很搭的字母字體也很吸引我，但看久有點 M$ 的設計感？ Macbook Air M2 我曾用過朋友的，我覺得像一塊滿有質感的金屬板 XD 。 T14s 和 Lemur Pro 就外型就比較粗獷一點，比較沒有什麼美感可言。
</p>

<p>
排名： XPS 13 Plus &gt; Z13 &gt; Macbook Air M2 &gt; T14s &gt; Lemur Pro
</p>
</div>
</div>
</section>
<section id="outline-container-org0c2fec5" class="outline-2">
<h2 id="org0c2fec5">其他災情</h2>
<div class="outline-text-2" id="text-org0c2fec5">
<p>
此外，有些電腦有相關的災情與問題：
</p>
</div>
<div id="outline-container-org72a3840" class="outline-3">
<h3 id="org72a3840">T14s Gen3</h3>
<div class="outline-text-3" id="text-org72a3840">
<ul class="org-ul">
<li>Gen3 沒有 S3 了 QQ
<ul class="org-ul">
<li><a href="https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3">https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3</a></li>
<li>查了很多討論但找不到直接證據，只能實機測試了</li>
<li>看來只能用 S2idle (s0ix) 了</li>
</ul></li>
<li><a href="https://www.youtube.com/watch?v=ueQwUnV0qH4">Lenovo T14s Gen 3 AMD touchpad rattle - YouTube</a></li>
</ul>
</div>
</div>
<div id="outline-container-org5c0e423" class="outline-3">
<h3 id="org5c0e423">Z13</h3>
<div class="outline-text-3" id="text-org5c0e423">
<ul class="org-ul">
<li>沒有 S3</li>
</ul>
</div>
</div>
<div id="outline-container-orge63ca02" class="outline-3">
<h3 id="orge63ca02">Lemur Pro</h3>
<div class="outline-text-3" id="text-orge63ca02">
<ul class="org-ul">
<li><a href="https://www.youtube.com/watch?v=DOWboKrhlYk">System76 Lemur Pro (lemp10) Two Year Update - YouTube</a>
<ul class="org-ul">
<li>電源線的變壓器與接頭距離太短</li>
<li>螢幕有些像素顏色異常</li>
<li>電池撐不久（不知道是不是個案）</li>
<li>電池膨脹問題</li>
<li>第二個 SSD 裝上後電池消耗量大增</li>
<li>換 System76 零件價錢高的不合理</li>
</ul></li>
<li><a href="https://www.reddit.com/r/System76/comments/u2dq0n/lemur_pro_lemp10_14ish_month_review_and_why_i/">(2) Lemur Pro (lemp10) 14ish month review and why I can't recommend System76 products. : System76</a>
<ul class="org-ul">
<li>鍵盤磨損問題</li>
<li>trackpad 有異常</li>
</ul></li>
</ul>
</div>
</div>
<div id="outline-container-orgb22ef7e" class="outline-3">
<h3 id="orgb22ef7e">Dell XPS 13 Plus</h3>
<div class="outline-text-3" id="text-orgb22ef7e">
<ul class="org-ul">
<li><a href="https://www.youtube.com/watch?v=bZpwCpubr_0&amp;list=LL&amp;index=1">Dell XPS 13 Plus: A Quality Control Disaster - YouTube</a>
<ul class="org-ul">
<li>播放影片時畫面凍結</li>
<li>喇叭偶爾會出現「啵」 (pop) 的聲音</li>
<li>重裝系統似乎可以解決以上問題</li>
</ul></li>
<li><a href="https://www.reddit.com/r/Dell/comments/wr8jxk/atrocious_experience_with_the_xps_13_plus_after_8/">Atrocious experience with the XPS 13 Plus after 8 hours&#x2026; : Dell - Reddit</a>
<ul class="org-ul">
<li>壞點問題</li>
<li>螢幕接縫沒有黏牢</li>
<li>電流的高頻雜音 (coil whine)</li>
</ul></li>
<li>OLED 螢幕直接掉下來: <a href="https://www.youtube.com/watch?v=Kos-IwRYg30&amp;t=6s">Dell XPS 15 15.6 FAIL at Best Buy - YouTube</a></li>
</ul>
</div>
</div>
</section>
<section id="outline-container-org31501e3" class="outline-2">
<h2 id="org31501e3">總結</h2>
<div class="outline-text-2" id="text-org31501e3">
<p>
排序與加權： Linux 支援性 (6) &gt; 電池 = 螢幕 = 攜帶性 (4) &gt; 擴充性 = 接口 = 鍵盤 (3) &gt; 顏值 (1) 。而價格是設定到差不多的硬體規格 (16GiB/512GiB) 的價錢。
</p>

<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col  class="org-left" />
<col  class="org-right" />
<col  class="org-right" />
<col  class="org-right" />
<col  class="org-right" />
<col  class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">

<p>
 
</p>

</th>
<th scope="col" class="org-right">

<p>
T14s
</p>

</th>
<th scope="col" class="org-right">

<p>
Z13
</p>

</th>
<th scope="col" class="org-right">

<p>
XPS 13 Plus
</p>

</th>
<th scope="col" class="org-right">

<p>
MacBook Air M2
</p>

</th>
<th scope="col" class="org-right">

<p>
Lemur Pro
</p>

</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">

<p>
Linux 支援性
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
電池
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
螢幕
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
4
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
攜帶性
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
4
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
擴充性
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
<td class="org-right">

<p>
4
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
接口
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
4
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
鍵盤
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
4
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
顏值
</p>

</td>
<td class="org-right">

<p>
4
</p>

</td>
<td class="org-right">

<p>
2
</p>

</td>
<td class="org-right">

<p>
1
</p>

</td>
<td class="org-right">

<p>
3
</p>

</td>
<td class="org-right">

<p>
5
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
價格
</p>

</td>
<td class="org-right">

<p>
$1294
</p>

</td>
<td class="org-right">

<p>
$1368
</p>

</td>
<td class="org-right">

<p>
$1699
</p>

</td>
<td class="org-right">

<p>
$1699
</p>

</td>
<td class="org-right">

<p>
$1368
</p>

</td>
</tr>
<tr>
<td class="org-left">

<p>
加權分數
</p>

</td>
<td class="org-right">

<p>
65
</p>

</td>
<td class="org-right">

<p>
69
</p>

</td>
<td class="org-right">

<p>
80
</p>

</td>
<td class="org-right">

<p>
84
</p>

</td>
<td class="org-right">

<p>
88
</p>

</td>
</tr>
</tbody>
</table>

<p>
以分數來看， T14s 和 Z13 非常接近， 但是 T14s 對我來說是真的最適合。主要是 Z13 的接口真的太少了，雖然 T14s 的攜帶性和電池雖然是排名最後，但其實兩者差距非常小。 此外，網路上也有對於這兩台比較的討論 14 , 15 , 16 ，發現選 T14s 的比較多 XD。
</p>

<p>
最終我選擇了 T14s ，稅後大約是 $1400 左右。
</p>
</div>
</section>
<section id="outline-container-org0a55420" class="outline-2">
<h2 id="org0a55420">其他</h2>
<div class="outline-text-2" id="text-org0a55420">
<p>
除了這五台之外，我也有考慮以下這些電腦：
</p>

<ul class="org-ul">
<li>ThinkPad X1 Carbon Gen 9/10
<ul class="org-ul">
<li>優點：顏值與重量體積</li>
<li>缺點：主要是沒有 AMD ，而且 T14s CP 值完勝</li>
</ul></li>
<li>ThinkPad T14 Gen 3 (AMD)
<ul class="org-ul">
<li>與 T14s 比較只多了 Ethernet 接孔 ，但重量比較重也比較大（但也比較便宜）</li>
</ul></li>
<li><a href="https://hpdevone.com/">HP Dev One</a>
<ul class="org-ul">
<li>Based on HP Elitebook 845 with PopOS installed</li>
<li>規格非常完美，而且價錢超級便宜 ($1099) ，加上優惠券甚至可以壓到 ($879) 。</li>
<li>致命傷是重量太重 (1.46kg)，也有人說螢幕不是很好 17 ，電量也沒有宣傳的來的高 18 ，因此暫時不考慮（但這價格足夠我把硬體加到 64GB/4TB 了）</li>
</ul></li>
</ul>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/2023_linux_laptop_selection.html</link>
  <guid>https://blog.staque.me/2023_linux_laptop_selection.html</guid>
  <pubDate>Fri, 20 Jan 2023 00:00:00 +0100</pubDate>
</item>
<item>
  <title><![CDATA[2023 Linux laptop selection]]></title>
  <description><![CDATA[
<div class="post-date">Jan 20, 2023</div>
<section id="outline-container-目前狀況" class="outline-2">
<h2 id="目前狀況">目前狀況</h2>
<div class="outline-text-2" id="text-目前狀況">
<p>
目前使用的筆電是 Macbook Air 2017 ，使用了約四年，相關規格為：
</p>

<ul class="org-ul">
<li>處理器： i5-5350U 1.8GHz</li>
<li>螢幕： 13.3-inch 1440 x 900</li>
<li>記憶體： 8GiB</li>
<li>硬碟： 512GiB</li>
<li>尺寸： 32.5 x 22.7 x 1.7cm</li>
<li>重量： 1.35kg</li>
</ul>

<p>
升級原因主要是電池老化，循環次數為 476 次，大約只能撐 10
分鐘不到，根本無法在沒有插座的地方使用。而且處理器和記憶體力不從心，只要
進行系統更新，開始編譯東西或者是瀏覽器開超過五十個分頁就沒辦法順暢使用。
</p>
</div>
</section>
<section id="outline-container-選購理念" class="outline-2">
<h2 id="選購理念">選購理念</h2>
<div class="outline-text-2" id="text-選購理念">
<ul class="org-ul">
<li>使用習慣：長時間待在同個地方並有插座，不太會在不固定地點（例如咖啡廳）使用</li>
<li>價格不會是一個比較因素，只要在一定範圍內就可接受
<ul class="org-ul">
<li>期望電腦是會用比較久的東西，成本相較於其他不可變因素比較不那麼重要</li>
</ul></li>
<li>日常使用 Arch Linux ，因此需要有良好的 Linux 支援度</li>
<li>重量和體積要與現在的電腦相似或更好</li>
<li>覺得目前筆電螢幕略小 (13.3-inch)，因此認為最佳尺寸是 14 inch</li>
<li>記憶體至少要 16 GiB ，硬碟至少要 512 GiB</li>
</ul>

<p>
根據這些基本的條件，我挑了五台電腦來進行深入的比較，分別為
</p>

<ul class="org-ul">
<li><a href="https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadt/thinkpad-t14s-gen-3-(14-inch-amd)/len101t0015?orgRef=https%253A%252F%252Fwww.google.com%252F">Lenovo ThinkPad T14s Gen3 (14“ AMD)</a></li>
<li><a href="https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadz/thinkpad-z13-(13-inch-amd)/len101t0036?orgRef=https%253A%252F%252Fwww.google.com%252F">Lenovo ThinkPad Z13 (13“ AMD)</a></li>
<li><a href="https://www.dell.com/en-us/shop/dell-laptops/xps-13-plus-laptop/spd/xps-13-9320-laptop">Dell XPS 13 Plus 9320</a></li>
<li><a href="https://www.apple.com/shop/buy-mac/macbook-air/midnight-apple-m2-chip-with-8-core-cpu-and-10-core-gpu-512gb">Apple MacBook Air M2</a></li>
<li><a href="https://system76.com/laptops/lemur">System76 Lemur Pro (Lemp11)</a></li>
</ul>

<p>
詳細的硬體規格可以參考<a href="https://www.notebookcheck.net/index.php?id=127065&amp;specs%5B%5D=330825&amp;specs%5B%5D=332490&amp;specs%5B%5D=331125&amp;specs%5B%5D=331063">這個網站</a>
（但目前沒有 Lemur Pro 的相關資訊，而且 Z13 為 Ryzen 5 版本、 XPS 13
Plus 為 i5 版本)。
</p>
</div>
</section>
<section id="outline-container-各項比較" class="outline-2">
<h2 id="各項比較">各項比較</h2>
<div class="outline-text-2" id="text-各項比較">
</div>
<div id="outline-container-效能" class="outline-3">
<h3 id="效能">效能</h3>
<div class="outline-text-3" id="text-效能">
<p>
我對效能的要求其實沒有很高，基本上我只要求瀏覽器分頁可以開超過 100
個不會 lag 就可以了，而記憶體有 16GiB
應該就能輕鬆達成這個需求。根據<a href="https://www.phoronix.com/review/apple-m2-linux">這個跑分結果</a>，五者對我來說體感上應該不會有差別。
</p>

<p>
排名：MacBook Air M2 &gt; T14s Gen3 = XPS 13 Plus = Lemur Pro
</p>
</div>
</div>
<div id="outline-container-螢幕" class="outline-3">
<h3 id="螢幕">螢幕</h3>
<div class="outline-text-3" id="text-螢幕">
<p>
Macbook 的螢幕肯定是最好的，不但解析度最高 (2560x1664) ，還是 Retina
螢幕。再來我的排序應該是 T14s (with 400-nits display) 、 XPS 13 Plus 、
Z13 ，最後是 Lemur Pro ，主要是按照品質與尺寸的考量。
</p>

<p>
排名： MacBook Air M2 &gt;&gt; T14s &gt; XPS 13 Plus &gt; Z13 &gt; Lemur Pro
</p>
</div>
</div>
<div id="outline-container-攜帶性" class="outline-3">
<h3 id="攜帶性">攜帶性</h3>
<div class="outline-text-3" id="text-攜帶性">
<p>
下圖是這五台的體積大小比較，而紅線畫出來的長方形代表 Lemur Pro 的長寬
(322 x 217cm)。
</p>


<figure id="org9beed48">
<img src="../assets/laptop_size_comparision.png" alt="laptop_size_comparision.png" style="text-align:center;" width="512">

<figcaption><span class="figure-number">Figure 1: </span>五款筆電的體積大小比較</figcaption>
</figure>




<p>
在這之中 Z13 是長+寬+深是最小的，但最輕的是 Lemur Pro (1.15kg) 。
</p>

<p>
排名： Z13 &gt; Dell XPS Plus 13 &gt; Lemur Pro &gt; MacBook Air M2 &gt; T14s
</p>
</div>
</div>
<div id="outline-container-接孔" class="outline-3">
<h3 id="接孔">接孔</h3>
<div class="outline-text-3" id="text-接孔">
<p>
至於接孔的部分，T14s 接孔是最多的，總共有 4 個 USB
接孔，通常情況下不需要再另外使用擴充埠。次之為 Lemur Pro ，有 3 個 USB
接孔。而 Macbook Air, Z13 和 XPS 13 Plus 都只有兩個 USB 接孔，但 Macbook
有獨立充電孔和 audio jack ， Z13 有 audio jack ，而 XPS 13 Plus
沒有任何額外接孔。
</p>

<p>
排名： T14s &gt; Lemur Pro &gt;&gt; Macbook Air M2 &gt; Z13 &gt; XPS 13 Plus
</p>
</div>
</div>
<div id="outline-container-擴充性" class="outline-3">
<h3 id="擴充性">擴充性</h3>
<div class="outline-text-3" id="text-擴充性">
<p>
T14s, Z13 和 XPS 13 Plus 都可以換 SSD 、 電池、網路卡等等的 <label id='fnr.1' for='fnr-in.1.9481302' class='margin-toggle sidenote-number'><sup class='numeral'>1</sup></label><input type='checkbox' id='fnr-in.1.9481302' class='margin-toggle'><span class='sidenote'><sup class='numeral'>1</sup>
<a href="https://www.youtube.com/watch?v=WCe8u-L3kkA">How to open Lenovo ThinkPad T14 Gen 3 - disassembly and upgrade options - YouTube</a>
</span> , <label id='fnr.2' for='fnr-in.2.8061131' class='margin-toggle sidenote-number'><sup class='numeral'>2</sup></label><input type='checkbox' id='fnr-in.2.8061131' class='margin-toggle'><span class='sidenote'><sup class='numeral'>2</sup>
<a href="https://www.youtube.com/watch?v=tygsI8-647U">Dell XPS 13 Plus 9320 - disassembly and upgrade options - YouTube</a>
</span> , <label id='fnr.3' for='fnr-in.3.852288' class='margin-toggle sidenote-number'><sup class='numeral'>3</sup></label><input type='checkbox' id='fnr-in.3.852288' class='margin-toggle'><span class='sidenote'><sup class='numeral'>3</sup>
<a href="https://www.youtube.com/watch?v=vtg9cimEOhc">Lenovo ThinkPad Z13 Gen 1 - disassembly and upgrade options - YouTube</a>
</span>
，然而三者都不能換記憶體。 T14s 和 Z13 還有提供官方手冊教你怎麼更換零件
</p>
</div>
</div>
<div id="outline-container-linux-支援性" class="outline-3">
<h3 id="linux-支援性">Linux 支援性</h3>
<div class="outline-text-3" id="text-linux-支援性">
<p>
T14s 和 XPS 13 Plus 對 Linux 的支援都不差 <label id='fnr.4' for='fnr-in.4.1471703' class='margin-toggle sidenote-number'><sup class='numeral'>4</sup></label><input type='checkbox' id='fnr-in.4.1471703' class='margin-toggle'><span class='sidenote'><sup class='numeral'>4</sup>
<a href="https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3">https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3</a>
</span> , <label id='fnr.5' for='fnr-in.5.8101394' class='margin-toggle sidenote-number'><sup class='numeral'>5</sup></label><input type='checkbox' id='fnr-in.5.8101394' class='margin-toggle'><span class='sidenote'><sup class='numeral'>5</sup>
<a href="https://wiki.archlinux.org/title/Dell_XPS_13_Plus_(9320)">https://wiki.archlinux.org/title/Dell_XPS_13_Plus_(9320)</a>
</span>
，只有有些地方可能需要手動調參數或裝套件。然而 Asahi Linux 對於 M2
的支援現在還尚未成熟。雖然早些時候宣佈了 GPU driver release <label id='fnr.6' for='fnr-in.6.8196407' class='margin-toggle sidenote-number'><sup class='numeral'>6</sup></label><input type='checkbox' id='fnr-in.6.8196407' class='margin-toggle'><span class='sidenote'><sup class='numeral'>6</sup>
<a href="https://asahilinux.org/2022/12/gpu-drivers-now-in-asahi-linux/">https://asahilinux.org/2022/12/gpu-drivers-now-in-asahi-linux/</a>
</span> ，
但根據<a href="https://github.com/AsahiLinux/docs/wiki/Feature-Support#m2-series-device-specific-support">官方目前的 Feature Support</a>
(2022/01/11)，目前前置鏡頭和喇叭都還是無法使用的狀態，外接螢幕也還不支援<label id='fnr.7' for='fnr-in.7.3252421' class='margin-toggle sidenote-number'><sup class='numeral'>7</sup></label><input type='checkbox' id='fnr-in.7.3252421' class='margin-toggle'><span class='sidenote'><sup class='numeral'>7</sup>
<a href="https://asahilinux.org/2022/11/november-2022-report/">https://asahilinux.org/2022/11/november-2022-report/</a>
</span>
。這對我來說是難以接受，因為有時會有視訊會議需要開鏡頭，也有把音樂用喇叭播出的時候。此外，由於架構是
aarch64 ，會有機率遇到軟體不相容的問題，會影響到日常的使用。
</p>

<p>
排名： Lemur Pro &gt; T14s = Z13 = XPS 13 Plus &gt;&gt; MacBook Air M2
</p>
</div>
</div>
<div id="outline-container-鍵盤" class="outline-3">
<h3 id="鍵盤">鍵盤</h3>
<div class="outline-text-3" id="text-鍵盤">
<p>
雖然網路上很多人說 ThinkPad 的鍵盤打起來很棒，我有打過 X1 Carbon
的鍵盤，是真的不錯。然而令人悲傷的是 T14s Gen3 的鍵程跟 T14s Gen1, X1
Carbon Gen6 的 1.8mm 不同，為 1.5 mm ，因此不確定鍵程少 0.3mm
會有多大的手感差異。小紅點我沒有特別愛用所以對我來說不是個加分。 XPS 13
Plus 的鍵盤看起來還行，但網路上有人說如果把手放在鍵盤上會刮手<label id='fnr.8' for='fnr-in.8.9115149' class='margin-toggle sidenote-number'><sup class='numeral'>8</sup></label><input type='checkbox' id='fnr-in.8.9115149' class='margin-toggle'><span class='sidenote'><sup class='numeral'>8</sup>
<a href="https://www.youtube.com/watch?v=ELsYC-N7hgc&amp;t=680s">https://www.youtube.com/watch?v=ELsYC-N7hgc&amp;t=680s</a>
</span> 。
MacBook Air M2 的鍵盤我體驗過覺得還不錯，手感脆脆的，比我現在的 Mac Air
2017 鍵盤還要好打。
</p>

<p>
觸控版的部分 MacBook Air M2 應該是最好的，面積大而且很滑。雖然在 Linux
環境下沒辦法像在 MacOS 原生支援的那麼好，但以我自己用 MacBook Air
的感受，其實已經很不錯了。而 T14s 有一些災情發生，說是在 tap trackpad
時也會發出聲音 (rattling) 11 ，這感覺不是很舒服 QQ 。
</p>

<p>
排名: Macbook Air M2 = T14s &gt; XPS 13 Plus &gt; Z13 &gt; Lemur Pro
</p>
</div>
</div>
<div id="outline-container-電池" class="outline-3">
<h3 id="電池">電池</h3>
<div class="outline-text-3" id="text-電池">
<p>
主要參考上方的比較， 進行 wifi surfing ， MacBook Air M2 可以撐 15
小時，而 T14s 和 Z13 的電池可以撐 14 和 12 小時，而 XPS 最差，只能撐 8
小時。Lemur Pro 找不到相關的電量測試數據，但 Lemur Pro 有最大的電池容量
(73Wh) ，相關論壇留言表示最長可以撐到 14 小時 <label id='fnr.9' for='fnr-in.9.9956131' class='margin-toggle sidenote-number'><sup class='numeral'>9</sup></label><input type='checkbox' id='fnr-in.9.9956131' class='margin-toggle'><span class='sidenote'><sup class='numeral'>9</sup>
<a href="https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3</a>
</span> , <label id='fnr.10' for='fnr-in.10.1650310' class='margin-toggle sidenote-number'><sup class='numeral'>10</sup></label><input type='checkbox' id='fnr-in.10.1650310' class='margin-toggle'><span class='sidenote'><sup class='numeral'>10</sup>
<a href="https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3</a>
</span> 。
</p>

<p>
排名： MacBook Air M2 &gt; Z13 &gt; T14s = Lemur Pro &gt; XPS 13 Plus
</p>
</div>
</div>
<div id="outline-container-顏值" class="outline-3">
<h3 id="顏值">顏值</h3>
<div class="outline-text-3" id="text-顏值">
<p>
我覺得 XPS 13 Plus
的顏值是最高的，當初就是被他的外觀吸引的。我很喜歡那個無邊界觸控板的設計，看起來很整潔。然後緊密排列的鍵盤加上很搭的字母字體也很吸引我，但看久有點
M$ 的設計感？ Macbook Air M2
我曾用過朋友的，我覺得像一塊滿有質感的金屬板 XD 。 T14s 和 Lemur Pro
就外型就比較粗獷一點，比較沒有什麼美感可言。
</p>

<p>
排名： XPS 13 Plus &gt; Z13 &gt; Macbook Air M2 &gt; T14s &gt; Lemur Pro
</p>
</div>
</div>
</section>
<section id="outline-container-其他災情" class="outline-2">
<h2 id="其他災情">其他災情</h2>
<div class="outline-text-2" id="text-其他災情">
<p>
此外，有些電腦有相關的災情與問題：
</p>
</div>
<div id="outline-container-t14s-gen3" class="outline-3">
<h3 id="t14s-gen3">T14s Gen3</h3>
<div class="outline-text-3" id="text-t14s-gen3">
<ul class="org-ul">
<li>Gen3 沒有 S3 了 QQ
<ul class="org-ul">
<li><a href="https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3">https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3</a></li>
<li>查了很多討論但找不到直接證據，只能實機測試了</li>
<li>看來只能用 S2idle (s0ix) 了</li>
</ul></li>
<li><a href="https://www.youtube.com/watch?v=ueQwUnV0qH4">Lenovo T14s Gen 3 AMD touchpad rattle - YouTube</a></li>
</ul>
</div>
</div>
<div id="outline-container-z13" class="outline-3">
<h3 id="z13">Z13</h3>
<div class="outline-text-3" id="text-z13">
<ul class="org-ul">
<li>沒有 S3</li>
</ul>
</div>
</div>
<div id="outline-container-lemur-pro" class="outline-3">
<h3 id="lemur-pro">Lemur Pro</h3>
<div class="outline-text-3" id="text-lemur-pro">
<ul class="org-ul">
<li><a href="https://www.youtube.com/watch?v=DOWboKrhlYk">System76 Lemur Pro (lemp10) Two Year Update - YouTube</a>
<ul class="org-ul">
<li>電源線的變壓器與接頭距離太短</li>
<li>螢幕有些像素顏色異常</li>
<li>電池撐不久（不知道是不是個案）</li>
<li>電池膨脹問題</li>
<li>第二個 SSD 裝上後電池消耗量大增</li>
<li>換 System76 零件價錢高的不合理</li>
</ul></li>
<li><a href="https://www.reddit.com/r/System76/comments/u2dq0n/lemur_pro_lemp10_14ish_month_review_and_why_i/">(2) Lemur Pro (lemp10) 14ish month review and why I can't recommend System76 products. : System76</a>
<ul class="org-ul">
<li>鍵盤磨損問題</li>
<li>trackpad 有異常</li>
</ul></li>
</ul>
</div>
</div>
<div id="outline-container-dell-xps-13-plus" class="outline-3">
<h3 id="dell-xps-13-plus">Dell XPS 13 Plus</h3>
<div class="outline-text-3" id="text-dell-xps-13-plus">
<ul class="org-ul">
<li><a href="https://www.youtube.com/watch?v=bZpwCpubr_0&amp;list=LL&amp;index=1">Dell XPS 13 Plus: A Quality Control Disaster - YouTube</a>
<ul class="org-ul">
<li>播放影片時畫面凍結</li>
<li>喇叭偶爾會出現「啵」 (pop) 的聲音</li>
<li>重裝系統似乎可以解決以上問題</li>
</ul></li>
<li><a href="https://www.reddit.com/r/Dell/comments/wr8jxk/atrocious_experience_with_the_xps_13_plus_after_8/">Atrocious experience with the XPS 13 Plus after 8 hours&#x2026; : Dell - Reddit</a>
<ul class="org-ul">
<li>壞點問題</li>
<li>螢幕接縫沒有黏牢</li>
<li>電流的高頻雜音 (coil whine)</li>
</ul></li>
<li>OLED 螢幕直接掉下來:
<a href="https://www.youtube.com/watch?v=Kos-IwRYg30&amp;t=6s">Dell XPS 15 15.6 FAIL at Best Buy - YouTube</a></li>
</ul>
</div>
</div>
</section>
<section id="outline-container-總結" class="outline-2">
<h2 id="總結">總結</h2>
<div class="outline-text-2" id="text-總結">
<p>
排序與加權： Linux 支援性 (6) &gt; 電池 = 螢幕 = 攜帶性 (4) &gt; 擴充性 = 接口
= 鍵盤 (3) &gt; 顏值 (1) 。而價格是設定到差不多的硬體規格 (16GiB/512GiB)
的價錢。
</p>
<table>


<colgroup>
<col  class="org-left">

<col  class="org-right">

<col  class="org-right">

<col  class="org-right">

<col  class="org-right">

<col  class="org-right">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">T14s</th>
<th scope="col" class="org-right">Z13</th>
<th scope="col" class="org-right">XPS 13 Plus</th>
<th scope="col" class="org-right">MacBook Air M2</th>
<th scope="col" class="org-right">Lemur Pro</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Linux 支援性</td>
<td class="org-right">2</td>
<td class="org-right">2</td>
<td class="org-right">2</td>
<td class="org-right">5</td>
<td class="org-right">1</td>
</tr>

<tr>
<td class="org-left">電池</td>
<td class="org-right">3</td>
<td class="org-right">2</td>
<td class="org-right">5</td>
<td class="org-right">1</td>
<td class="org-right">3</td>
</tr>

<tr>
<td class="org-left">螢幕</td>
<td class="org-right">2</td>
<td class="org-right">4</td>
<td class="org-right">3</td>
<td class="org-right">1</td>
<td class="org-right">5</td>
</tr>

<tr>
<td class="org-left">攜帶性</td>
<td class="org-right">5</td>
<td class="org-right">1</td>
<td class="org-right">2</td>
<td class="org-right">4</td>
<td class="org-right">3</td>
</tr>

<tr>
<td class="org-left">擴充性</td>
<td class="org-right">1</td>
<td class="org-right">1</td>
<td class="org-right">1</td>
<td class="org-right">5</td>
<td class="org-right">4</td>
</tr>

<tr>
<td class="org-left">接口</td>
<td class="org-right">1</td>
<td class="org-right">4</td>
<td class="org-right">5</td>
<td class="org-right">3</td>
<td class="org-right">2</td>
</tr>

<tr>
<td class="org-left">鍵盤</td>
<td class="org-right">1</td>
<td class="org-right">4</td>
<td class="org-right">3</td>
<td class="org-right">1</td>
<td class="org-right">5</td>
</tr>

<tr>
<td class="org-left">顏值</td>
<td class="org-right">4</td>
<td class="org-right">2</td>
<td class="org-right">1</td>
<td class="org-right">3</td>
<td class="org-right">5</td>
</tr>

<tr>
<td class="org-left">價格</td>
<td class="org-right">$1294</td>
<td class="org-right">$1368</td>
<td class="org-right">$1699</td>
<td class="org-right">$1699</td>
<td class="org-right">$1368</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="org-left">加權分數</td>
<td class="org-right">65</td>
<td class="org-right">69</td>
<td class="org-right">80</td>
<td class="org-right">84</td>
<td class="org-right">88</td>
</tr>
</tbody>
</table>

<p>
以分數來看， T14s 和 Z13 非常接近， 但是 T14s
對我來說是真的最適合。主要是 Z13 的接口真的太少了，雖然 T14s
的攜帶性和電池雖然是排名最後，但其實兩者差距非常小。
此外，網路上也有對於這兩台比較的討論 <label id='fnr.11' for='fnr-in.11.3919073' class='margin-toggle sidenote-number'><sup class='numeral'>11</sup></label><input type='checkbox' id='fnr-in.11.3919073' class='margin-toggle'><span class='sidenote'><sup class='numeral'>11</sup>
<a href="https://www.reddit.com/r/thinkpad/comments/w9eiub/update_on_z13_i_think_its_going_back/">Update on Z13: I think it's going back : thinkpad</a>
</span> <sup>, </sup><label id='fnr.12' for='fnr-in.12.8006679' class='margin-toggle sidenote-number'><sup class='numeral'>12</sup></label><input type='checkbox' id='fnr-in.12.8006679' class='margin-toggle'><span class='sidenote'><sup class='numeral'>12</sup>
<a href="https://www.reddit.com/r/thinkpad/comments/wldyx9/z13_t14s_slim_prox_dgpu_or_no/">z13 / t14s / Slim ProX (dGPU or no?) : thinkpad</a>
</span> <sup>, </sup><label id='fnr.13' for='fnr-in.13.3691904' class='margin-toggle sidenote-number'><sup class='numeral'>13</sup></label><input type='checkbox' id='fnr-in.13.3691904' class='margin-toggle'><span class='sidenote'><sup class='numeral'>13</sup>
<a href="https://www.reddit.com/r/thinkpad/comments/xoeadg/comparing_the_z13_vs_t14s_gen_3_amd/">Comparing the Z13 vs T14s Gen 3 (AMD) : thinkpad</a>
</span> ，發現選 T14s 的比較多
XD。
</p>

<p>
最終我選擇了 T14s ，稅後大約是 $1400 左右。
</p>
</div>
</section>
<section id="outline-container-其他" class="outline-2">
<h2 id="其他">其他</h2>
<div class="outline-text-2" id="text-其他">
<p>
除了這五台之外，我也有考慮以下這些電腦：
</p>

<ul class="org-ul">
<li>ThinkPad X1 Carbon Gen 9/10
<ul class="org-ul">
<li>優點：顏值與重量體積</li>
<li>缺點：主要是沒有 AMD ，而且 T14s CP 值完勝</li>
</ul></li>
<li>ThinkPad T14 Gen 3 (AMD)
<ul class="org-ul">
<li>與 T14s 比較只多了 Ethernet 接孔
，但重量比較重也比較大（但也比較便宜）</li>
</ul></li>
<li><a href="https://hpdevone.com/">HP Dev One</a>
<ul class="org-ul">
<li>Based on HP Elitebook 845 with PopOS installed</li>
<li>規格非常完美，而且價錢超級便宜 ($1099) ，加上優惠券甚至可以壓到
($879) 。</li>
<li>致命傷是重量太重 (1.46kg)，也有人說螢幕不是很好 <label id='fnr.14' for='fnr-in.14.5679331' class='margin-toggle sidenote-number'><sup class='numeral'>14</sup></label><input type='checkbox' id='fnr-in.14.5679331' class='margin-toggle'><span class='sidenote'><sup class='numeral'>14</sup>
<a href="https://www.reddit.com/r/System76/comments/w6nkto/my_thoughts_on_the_hp_dev_one/">My Thoughts on the HP Dev One : System76</a>
</span>
，電量也沒有宣傳的來的高 <label id='fnr.15' for='fnr-in.15.8478366' class='margin-toggle sidenote-number'><sup class='numeral'>15</sup></label><input type='checkbox' id='fnr-in.15.8478366' class='margin-toggle'><span class='sidenote'><sup class='numeral'>15</sup>
<a href="https://www.reddit.com/r/System76/comments/zbodno/comment/izc6xl9/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/System76/comments/zbodno/comment/izc6xl9/?utm_source=share&amp;utm_medium=web2x&amp;context=3</a>
</span>
，因此暫時不考慮（但這價格足夠我把硬體加到 64GB/4TB 了）</li>
</ul></li>
</ul>
</div>
</section>
<div id="footnotes">
<h2 class="footnotes">Footnotes: </h2>
<div id="text-footnotes">

<div class="footdef"><sup><a id="fn.1" class="footnum" href="#fnr.1" role="doc-backlink">1</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.youtube.com/watch?v=WCe8u-L3kkA">How to open Lenovo ThinkPad T14 Gen 3 - disassembly and upgrade options - YouTube</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.2" class="footnum" href="#fnr.2" role="doc-backlink">2</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.youtube.com/watch?v=tygsI8-647U">Dell XPS 13 Plus 9320 - disassembly and upgrade options - YouTube</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.3" class="footnum" href="#fnr.3" role="doc-backlink">3</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.youtube.com/watch?v=vtg9cimEOhc">Lenovo ThinkPad Z13 Gen 1 - disassembly and upgrade options - YouTube</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.4" class="footnum" href="#fnr.4" role="doc-backlink">4</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3">https://wiki.archlinux.org/title/Lenovo_ThinkPad_T14s_(AMD)_Gen_3</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.5" class="footnum" href="#fnr.5" role="doc-backlink">5</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://wiki.archlinux.org/title/Dell_XPS_13_Plus_(9320)">https://wiki.archlinux.org/title/Dell_XPS_13_Plus_(9320)</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.6" class="footnum" href="#fnr.6" role="doc-backlink">6</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://asahilinux.org/2022/12/gpu-drivers-now-in-asahi-linux/">https://asahilinux.org/2022/12/gpu-drivers-now-in-asahi-linux/</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.7" class="footnum" href="#fnr.7" role="doc-backlink">7</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://asahilinux.org/2022/11/november-2022-report/">https://asahilinux.org/2022/11/november-2022-report/</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.8" class="footnum" href="#fnr.8" role="doc-backlink">8</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.youtube.com/watch?v=ELsYC-N7hgc&amp;t=680s">https://www.youtube.com/watch?v=ELsYC-N7hgc&amp;t=680s</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.9" class="footnum" href="#fnr.9" role="doc-backlink">9</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.10" class="footnum" href="#fnr.10" role="doc-backlink">10</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/System76/comments/y01qgv/comment/irqe3xm/?utm_source=share&amp;utm_medium=web2x&amp;context=3</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.11" class="footnum" href="#fnr.11" role="doc-backlink">11</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/thinkpad/comments/w9eiub/update_on_z13_i_think_its_going_back/">Update on Z13: I think it's going back : thinkpad</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.12" class="footnum" href="#fnr.12" role="doc-backlink">12</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/thinkpad/comments/wldyx9/z13_t14s_slim_prox_dgpu_or_no/">z13 / t14s / Slim ProX (dGPU or no?) : thinkpad</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.13" class="footnum" href="#fnr.13" role="doc-backlink">13</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/thinkpad/comments/xoeadg/comparing_the_z13_vs_t14s_gen_3_amd/">Comparing the Z13 vs T14s Gen 3 (AMD) : thinkpad</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.14" class="footnum" href="#fnr.14" role="doc-backlink">14</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/System76/comments/w6nkto/my_thoughts_on_the_hp_dev_one/">My Thoughts on the HP Dev One : System76</a>
</p></div></div>

<div class="footdef"><sup><a id="fn.15" class="footnum" href="#fnr.15" role="doc-backlink">15</a></sup> <div class="footpara" role="doc-footnote"><p class="footpara">
<a href="https://www.reddit.com/r/System76/comments/zbodno/comment/izc6xl9/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/System76/comments/zbodno/comment/izc6xl9/?utm_source=share&amp;utm_medium=web2x&amp;context=3</a>
</p></div></div>


</div>
</div><div class="taglist">]]></description>
  <link>https://blog.staque.me/2023-01-20-2023-linux-laptop-selection.html</link>
  <guid>https://blog.staque.me/2023-01-20-2023-linux-laptop-selection.html</guid>
  <pubDate>Fri, 20 Jan 2023 00:00:00 +0100</pubDate>
</item>
<item>
  <title><![CDATA[Code section in assembly: .text or .code]]></title>
  <description><![CDATA[
<div class="post-date">May 11, 2022</div>
<section id="outline-container-org651f861" class="outline-2">
<h2 id="org651f861">Background</h2>
<div class="outline-text-2" id="text-org651f861">
<p>
前幾天我在閱讀學校開的一門課 <i>Advanced Programming in the UNIX Environment</i> 的上課投影片，其中展示了一個用 x86 assembly 寫的範例程式：
</p>

<div class="org-src-container">
<pre class="src src-asm"><span class="linenr">1: </span><span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Compile with: yasm -f elf64 -DYASM -D__x86_64__ -DPIC minimal.asm -o minimal.o
<span class="linenr">2: </span></span><span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Link with: ld -m elf_x86_64 -o minimal minimal.o
<span class="linenr">3: </span></span>
<span class="linenr">4: </span>    <span style="font-weight: bold;">global</span> _start:function
<span class="linenr">5: </span>    <span style="font-weight: bold;">section</span> .code
<span class="linenr">6: </span><span style="font-weight: bold;">_start</span>:
<span class="linenr">7: </span>    <span style="font-weight: bold;">mov</span> rax, 60
<span class="linenr">8: </span>    <span style="font-weight: bold;">xor</span> rdi, rdi
<span class="linenr">9: </span>    <span style="font-weight: bold;">syscall</span>
</pre>
</div>

<p>
我試著用投影片上面的指令編譯並執行，但一執行就跳出 segmentation fault 的錯誤：
</p>

<div class="org-src-container">
<pre class="src src-sh">zsh: segmentation fault (core dumped)  ./minimal
</pre>
</div>

<p>
接著我試著用 gdb 來除錯，卻發現它執行到 <code>_start</code> 的第一行 <code>mov rax, 60</code> 就出錯了，依然看不出什麼端倪：
</p>

<div class="org-src-container">
<pre class="src src-sh">Program received signal SIGSEGV, Segmentation fault.
0x0000000000401000<span style="font-weight: bold;"> in</span> _start ()
</pre>
</div>

<p>
這時的我很納悶，又接著編譯執行了投影片上寫的其他範例程式，但是都是一樣的狀況，發現都是執行到第一行就出錯了。
</p>

<p>
我開始上網搜尋 assembly 的範例，重複比對其他人的程式碼和我的，終於發現只要把 <code>section .code</code> 改成 <code>section .text</code> 就可以成功跑了。
</p>

<div class="org-src-container">
<pre class="src src-asm"><span class="linenr">1: </span><span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Compile with: yasm -f elf64 -DYASM -D__x86_64__ -DPIC minimal.asm -o minimal.o
<span class="linenr">2: </span></span><span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Link with: ld -m elf_x86_64 -o minimal minimal.o
<span class="linenr">3: </span></span>
<span class="linenr">4: </span>    <span style="font-weight: bold;">global</span> _start:function
<span class="linenr">5: </span>    <span style="font-weight: bold;">section</span> .text
<span class="linenr">6: </span><span style="font-weight: bold;">_start</span>:
<span class="linenr">7: </span>    <span style="font-weight: bold;">mov</span> rax, 60
<span class="linenr">8: </span>    <span style="font-weight: bold;">xor</span> rdi, rdi
<span class="linenr">9: </span>    <span style="font-weight: bold;">syscall</span>
</pre>
</div>
</div>
</section>
<section id="outline-container-org6ee8555" class="outline-2">
<h2 id="org6ee8555">Debugging</h2>
<div class="outline-text-2" id="text-org6ee8555">
<p>
我開始分析出錯的原因，既然錯誤是 segment 有關，而解法是跟 section 有關。那問題一定出在兩種寫法所編譯出來的 ELF 執行檔有差異。
</p>

<p>
我使用的是 <code>readelf</code> 這個工具來看它們各自的執行檔的 ELF 資訊， 在這邊 <code>minimal_code</code> 代表的是標示 <code>section .code</code> 所編譯出來的執行檔；而 <code>minimal_text</code> 代表的是標示 <code>section .text</code> 。
</p>
</div>
<div id="outline-container-org7e0b801" class="outline-3">
<h3 id="org7e0b801">Section</h3>
<div class="outline-text-3" id="text-org7e0b801">
<p>
指定 <code>-S</code> flag 代表觀察執行檔的 section headers 資訊。
</p>

<p>
<code>minimal_text</code>:
</p>

<pre class="example" id="org8948797">
$ readelf -S minimal_text
There are 5 section headers, starting at offset 0x10f0:

Section Headers:
    [Nr] Name              Type             Address           Offset
        Size              EntSize          Flags  Link  Info  Align
    [ 0]                   NULL             0000000000000000  00000000
        0000000000000000  0000000000000000           0     0     0
    [ 1] .text             PROGBITS         0000000000401000  00001000
        000000000000000c  0000000000000000  AX       0     0     16
# ......
Key to Flags:
    W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
# ......
</pre>

<p>
<code>minimal_code</code>:
</p>

<pre class="example" id="org94dc380">
$ readelf -S minimal_code
There are 5 section headers, starting at offset 0x10f0:

Section Headers:
    [Nr] Name              Type             Address           Offset
        Size              EntSize          Flags  Link  Info  Align
    [ 0]                   NULL             0000000000000000  00000000
        0000000000000000  0000000000000000           0     0     0
    [ 1] .code             PROGBITS         0000000000401000  00001000
        000000000000000c  0000000000000000   A       0     0     1
# ......
Key to Flags:
    W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
# ...... 
</pre>

<p>
在此我們不多介紹 Section Headers 各欄位的意義，我們只專注於 Flags 這個欄位，其代表該 section 的屬性，可以看到 <code>.text</code> 的 Flags 是 <code>AX</code> 。 <code>A</code> (<code>SHF_ALLOC</code>) 代表 <code>.text</code> 這個 section 在 runtime 時會佔據記憶體空間 ，而 <code>X</code> (<code>SHF_EXECINSTR</code>) 代表這個 section 包含了可執行的指令。
</p>

<p>
然而 <code>.code</code> 的 Flags 並沒有包含 <code>X</code> ，代表執行檔不認為 <code>.code</code> section 可以執行！
</p>
</div>
</div>
<div id="outline-container-org9c54a6f" class="outline-3">
<h3 id="org9c54a6f">Segment</h3>
<div class="outline-text-3" id="text-org9c54a6f">
<p>
再來我們來看執行檔的 segment 資訊， <code>readelf</code> 指定 <code>-l</code> flag 觀察 segments 的資訊。
</p>

<p>
<code>minimal_text</code>:
</p>

<pre class="example" id="org37a066c">
$ readelf -l minimal_text
Elf file type is EXEC (Executable file)
Entry point 0x401000
There are 2 program headers, starting at offset 64

Program Headers:
    Type           Offset             VirtAddr           PhysAddr
                    FileSiz            MemSiz              Flags  Align
    LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                    0x00000000000000b0 0x00000000000000b0  R      0x1000
    LOAD           0x0000000000001000 0x0000000000401000 0x0000000000401000
                    0x000000000000000c 0x000000000000000c  R E    0x1000

    Section to Segment mapping:
    Segment Sections...
    00
    01     .text
</pre>

<p>
<code>minimal_code</code>:
</p>

<pre class="example" id="orgc36236b">
Elf file type is EXEC (Executable file)
Entry point 0x401000
There is 1 program header, starting at offset 64

Program Headers:
    Type           Offset             VirtAddr           PhysAddr
                    FileSiz            MemSiz              Flags  Align
    LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                    0x000000000000100c 0x000000000000100c  R      0x1000

    Section to Segment mapping:
    Segment Sections...
    00     .code
</pre>

<p>
在此我們也只專注在 Segment 的 Flags 欄位以及下方的 "Section to Segment mapping" 資訊。 "Section to Segment mapping" 顧名思議就是描述了哪個 segment 包含了哪些 sections ，其中 Segment 的數字就是從上方的 Program Headers 從上數下來的第幾個 Segment。
</p>

<p>
可以看到在 <code>minimal_text</code> 中，包含 <code>.text</code> section 的是 01 segment ，也就是第二個 segment ，其 Flags 是 <code>R</code> (<code>PF_R</code>) 和 <code>E</code> (<code>PF_E</code>) ，代表此 segment 可讀可執行。
</p>

<p>
然而在包含 <code>.code</code> 的 section 中，我們卻看不到有 Flags 有包含 <code>E</code> ，因此代表著此 segment 不可執行，也難怪會有 Segmentation fault 這個錯誤！
</p>
</div>
</div>
</section>
<section id="outline-container-orgf4316c4" class="outline-2">
<h2 id="orgf4316c4">Solution</h2>
<div class="outline-text-2" id="text-orgf4316c4">
<p>
除了以上將 <code>section .code</code> 改寫成 <code>.section .text</code> 的方法之外，還有沒有其他解決方法呢？
</p>

<p>
一個最簡單的想法是：既然 <code>.code</code> section 不能執行，我們就修改他的 flags 讓他可以執行就好啦！
</p>

<p>
這方法雖然可以，但有一點點複雜（可能需要額外在 linker script 內設定屬性之類的）。這裡有一個更簡單的方法是直接將 <code>.code</code> 這個 section 的內容塞進 <code>.text</code> section 就好了！並且 <code>.text</code> 屬於 <a href="https://refspecs.linuxfoundation.org/LSB_1.1.0/gLSB/specialsections.html">Special Sections</a> 之一，因此這些屬性自然會包含 EXECUTABLE 的權限。
</p>
</div>
<div id="outline-container-org4a63c07" class="outline-3">
<h3 id="org4a63c07">Customize the linker script</h3>
<div class="outline-text-3" id="text-org4a63c07">
<p>
因此我們可以透過自訂我們的 linker script 來做這件事情：（注意：這個 linker script 只適用在此範例程式，例如 data section 根本沒有被處理）
</p>

<p>
<code>minimal_code.ld</code>:
</p>

<div class="org-src-container">
<pre class="src src-ld"><span class="linenr">1: </span>SECTIONS
<span class="linenr">2: </span>{
<span class="linenr">3: </span>  . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
<span class="linenr">4: </span>  .text :
<span class="linenr">5: </span>  {
<span class="linenr">6: </span>    *(.code)
<span class="linenr">7: </span>  }
<span class="linenr">8: </span>}
</pre>
</div>

<p>
如果你不懂 linker script ，我稍微介紹一下這個 linker script 在做的事情：
</p>

<p>
我們可以先看這段程式碼，可以看到 <code>*(.code)</code> 在 <code>.text</code> 圍起來的大括號裡面，代表將 <code>.code</code> section 的內容放入 <code>.text</code> section 中：
</p>

<div class="org-src-container">
<pre class="src src-ld"><span class="linenr">1: </span>.text :
<span class="linenr">2: </span>{
<span class="linenr">3: </span>  *(.code)
<span class="linenr">4: </span>}
</pre>
</div>

<p>
好的我們介紹完了，這段程式碼主要做的事情就是這樣，如此簡單明瞭！
</p>

<p>
其中 <code>. = SEGMENT...</code> 是我從預設的 linker script (下 <code>ld --verbose</code> 可以看到) 複製過來的，它的意思就是將程式本體放到 text-segment 的位置，預設是位址 <code>0x400000 + SIZEOF_HEADERS</code> ， <code>SIZEOF_HEADER</code> 是 program header 大小 。
</p>

<p>
接著重新做 linking ，這邊指定 <code>ld</code> 的 <code>--script</code> flag 來使用我們自己定義的 linker script （預設的的 linker script 就不會使用了） :
</p>

<div class="org-src-container">
<pre class="src src-sh">$ ld -m elf_x86_64 --script=minimal_code.ld -o minimal_code minimal_code.o
</pre>
</div>

<p>
這時嘗試跑我們的 <code>minimal_code</code> ，會發現沒有 <code>segmentation fault</code> 了！可喜可賀！
</p>

<div class="org-src-container">
<pre class="src src-sh">$ ./minimal_code 
$
</pre>
</div>

<p>
我們再次使用 <code>readelf</code> 來觀察一下新的 <code>minimal_code</code> 的 section 與 segment 資訊：
</p>

<p>
Section:
</p>

<pre class="example" id="org5dc7041">
$ readelf -S minimal_code
There are 5 section headers, starting at offset 0x148:

Section Headers:
    [Nr] Name              Type             Address           Offset
        Size              EntSize          Flags  Link  Info  Align
    [ 0]                   NULL             0000000000000000  00000000
        0000000000000000  0000000000000000           0     0     0
    [ 1] .text             PROGBITS         00000000004000b0  000000b0
        0000000000000010  0000000000000000  AX       0     0     16
</pre>

<p>
Segment:
</p>

<pre class="example" id="org9f6b9d4">
$ readelf -l minimal_code
Elf file type is EXEC (Executable file)
Entry point 0x401000
There are 2 program headers, starting at offset 64

Program Headers:
    Type           Offset             VirtAddr           PhysAddr
                    FileSiz            MemSiz              Flags  Align
    LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                    0x00000000000000b0 0x00000000000000b0  R      0x1000
    LOAD           0x0000000000001000 0x0000000000401000 0x0000000000401000
                    0x000000000000000c 0x000000000000000c  R E    0x1000

    Section to Segment mapping:
    Segment Sections...
    00
    01     .text
</pre>

<p>
可以發現已經完全看不到 <code>.code</code> section 的蹤影了！而且跟 <code>minimal_text</code> 吐出的資訊長得是幾乎一模模一樣樣！但不一樣也很正常，畢竟我們有很多額外的設定是我們的腳本沒考慮到的。（當然你也可以直接將預設的 linker script 抓來改，這樣就會保證長一樣了）
</p>
</div>
</div>
</section>
<section id="outline-container-orgac43560" class="outline-2">
<h2 id="orgac43560">Appendix</h2>
<div class="outline-text-2" id="text-orgac43560">
</div>
<div id="outline-container-org06d8357" class="outline-3">
<h3 id="org06d8357">masm</h3>
<div class="outline-text-3" id="text-org06d8357">
<p>
<code>.text</code> 或是 <code>.code</code> 等等 section 的預設屬性是由 assembler 來決定的，例如 <a href="https://www.tortall.net/projects/yasm/manual/html/manual.html#elf-standard-sections"><code>yasm</code></a> 和 <a href="https://www.nasm.us/xdoc/2.11.08/html/nasmdoc7.html#section-7.9.2"><code>nasm</code></a> 都有描述它們預設 ELF standard sections 的屬性， <code>.code</code> 在兩個 assembler 都不會特別給屬性。
</p>

<p>
然而在 <code>masm</code> 這個 assembler 中 ， <code>.code</code> 的確可以用來標示一段 code 的開始！
</p>

<p>
引用自 <a href="https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-code?view=msvc-170">.CODE | Microsoft Docs</a>:
</p>

<blockquote>
<p>
(32-bit MASM only.) When used with <a href="https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-model?view=msvc-170">.MODEL</a>, indicates the start of a code segment.
</p>
</blockquote>

<p>
<code>.code</code> 或是 <code>.data</code> 這些 directives 在 <code>masm</code> 中稱為 <i>simple segment directives</i> 。
</p>

<p>
因此我們可以大膽猜測老師用的是 <code>masm</code> 來編譯範例的程式嗎？不，在投影片上，老師的確是使用 <code>yasm</code> 編譯的。
</p>

<p>
難道真的是老師寫錯了嗎？
</p>
</div>
</div>
<div id="outline-container-org908c1c6" class="outline-3">
<h3 id="org908c1c6">Kernel</h3>
<div class="outline-text-3" id="text-org908c1c6">
<p>
後來我在<a href="https://stackoverflow.com/questions/67084048/assembly-section-code-and-text-behave-differently">這串討論</a>發現有人跟我遇到一樣的問題。下面的回答除了剛剛說的 <code>masm</code> 之外，還發現到是跟 Linux kernel 版本有關係。如果使用的 kernel 版本在 5.8 以上、64-bit 執行檔且沒有開 NX (No-eXecute) 防護，若沒有 <code>PT_GNU_STACK</code> 這個 section 時，預設就會將非 <code>.text</code> section 的屬性設成不可執行。反之如果在 5.8 以下就是可執行的。
</p>

<p>
然而我們的範例程式是用 <code>yasm</code> 編出來的，沒有 <code>gcc</code> 預設的 NX 防護，也沒有 <code>PT_GNU_STACK</code> 這個 segment ，且我的 kernel 版本高於 5.8，因此才會造成執行錯誤的狀況發生。估計老師在寫這段程式碼的時候，他的環境 kernel 版本應該沒那麼新所以才覺得這段程式碼沒問題。
</p>
</div>
</div>
</section>
<section id="outline-container-orgf77f551" class="outline-2">
<h2 id="orgf77f551">Thoughts</h2>
<div class="outline-text-2" id="text-orgf77f551">
<p>
一直以來都以為 text segment 和 code segment 這兩個名詞是 interchangable 的。也以為 code section 和 text section 是等價的，所以一開始沒有想到是 <code>section.code</code> 和 <code>section.text</code> 的問題，更何況在網路上甚至有解答分明是在誤導：
</p>

<p>
引用自 <a href="https://stackoverflow.com/questions/41814010/difference-between-text-and-code-section-name">assembly - difference between .text and .code section name - Stack Overflow</a> :
</p>

<blockquote>
<p>
There is no functional difference between the <code>.text</code> and <code>.code</code> sections of a binary.
</p>

<p>
In almost all cases, they are completely synonymous (meaning that they refer to the same section), but even when they're not ( <i>e.g.</i> due to the actual order of sections in the binary), they are <i>semantically</i> identical.
</p>
</blockquote>

<p>
但這次踩雷後也學到了很多東西，例如 ELF 格式、如何寫 linker script 等等。也體認到 ELF format 只不過是一個標準規範而已，真正實作還是要看 OS，OS 也可以完全不管，自己想怎麼設定就怎麼設定。
</p>
</div>
</section>
<section id="outline-container-org5b32323" class="outline-2">
<h2 id="org5b32323">Reference</h2>
<div class="outline-text-2" id="text-org5b32323">
<ul class="org-ul">
<li><a href="https://man7.org/linux/man-pages/man5/elf.5.html">elf(5) - Linux manual page</a></li>
<li><a href="https://www.mikrocontroller.net/attachment/450367/MASM61PROGUIDE.pdf">Microsoft MASM Programmer's Guide</a>
<ul class="org-ul">
<li>Page 33: Using Simplified Segment Directives</li>
</ul></li>
<li><a href="http://wen00072.github.io/blog/2014/03/14/study-on-the-linker-script/">Linker Script初探 - GNU Linker Ld手冊略讀 - My code works, I don't know why.</a></li>
</ul>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/code_section_in_assembly_text_or_code.html</link>
  <guid>https://blog.staque.me/code_section_in_assembly_text_or_code.html</guid>
  <pubDate>Wed, 11 May 2022 00:00:00 +0200</pubDate>
</item>
<item>
  <title><![CDATA[交大三上修課心得（二）]]></title>
  <description><![CDATA[
<div class="post-date">Jan 23, 2022</div>
<hr/>
<section id="outline-container-org72a3840" class="outline-2">
<h2 id="org72a3840">課程心得</h2>
<div class="outline-text-2" id="text-org72a3840">
</div>
<div id="outline-container-org194cf40" class="outline-3">
<h3 id="org194cf40">數值軟體開發</h3>
<div class="outline-text-3" id="text-org194cf40">
</div>
<div id="outline-container-orgee35afe" class="outline-4">
<h4 id="orgee35afe">課程資訊</h4>
<div class="outline-text-4" id="text-orgee35afe">
<ul class="org-ul">
<li>授課教師：陳永昱</li>
<li>開課單位：數據所</li>
<li>當期課號：5296</li>
<li>永久課號：IDS5008</li>
<li>學分數：3.00</li>
<li>必/選修：選修</li>
</ul>
</div>
</div>
<div id="outline-container-org7f6f53b" class="outline-4">
<h4 id="org7f6f53b">教學方式</h4>
<div class="outline-text-4" id="text-org7f6f53b">
<p>
課程網站： <a href="https://yyc.solvcon.net/en/latest/nsd/index.html">https://yyc.solvcon.net/en/latest/nsd/index.html</a>
</p>

<p>
老師上課也是講自己的投影片，雖然不會公佈投影片，但是內容基本上對應到課程網站的文件，上課漏聽了也可以看。
</p>

<p>
因為這堂課的主旨是如何設計數值軟體，所以上課涵蓋的範圍很廣，從底層知識到抽象設計都有涉略。課程內容可以分成四大類：Computer Fundamental, Performance Considerations, System Management, Design Techniques ，具體內容可以參考課程網站首頁。
</p>

<!-- - 軟體工程知識： Automatic tests, CI/CD, Build systems -->
<!-- - 基本底層知識： Memory Management, Cache optimization, SIMD -->
<!-- - 系統語言知識： Modern C++/Python, FFI bindings -->
</div>
</div>
<div id="outline-container-orgb948b55" class="outline-4">
<h4 id="orgb948b55">考試作業</h4>
<div class="outline-text-4" id="text-orgb948b55">
<p>
總共有六次作業、一個期中考和 final project 。 作業一個佔 5%，總共 30%，期中佔 30%，final project 佔 40% （proposal 也會被列為計分範圍內），不會調分。
</p>

<p>
作業會要求用 C++ 實作 functions ，然後寫 Python wrapper (<code>pybind11</code>) 與寫測試腳本 (<code>pytest</code>) ，然後有些後面的作業是為之前的作業加上一些額外的功能。
</p>

<p>
作業評分與繳交流程如下：
</p>

<ol class="org-ol">
<li>Fork 課程專案相對應的作業分支</li>
<li>寫作業</li>
<li>每個作業都會附上不同的評測腳本 (<code>validate.py</code>)，跑完會顯示拿到的分數，滿分為五分。</li>
<li>發 PR ，跑 CI (github workflows) ， 基本上如果評測腳本對了， CI 也可以跑過。 但是我也發生過因為環境不同導致跑 CI 時編譯錯誤，還要額外修改 Makefile 。</li>
<li>基本上有 CI 有成功跑過該作業就是滿分</li>
</ol>

<p>
期中考內容包括基本的 C++ 與 Python/Numpy 還有基本的計算機知識。
</p>

<p>
我印象中考了這些題目：
</p>

<ul class="org-ul">
<li>Unsigned/signed comparsions</li>
<li>C++ Operator Precedence</li>
<li>Conversions between Numpy datatypes and C type</li>
<li>IEEE-754 floating point representations of <code>1.8/-1.8</code></li>
<li>Cache access simulation （存取資料問 cache miss 類型）</li>
</ul>

<p>
Final project 在學期的前三分之一就要交 proposal ，期末要用英文報告。
</p>
</div>
</div>
<div id="outline-container-org9beed48" class="outline-4">
<h4 id="org9beed48">其他事項</h4>
<div class="outline-text-4" id="text-org9beed48">
<p>
這堂課是*早七*，但是不會點名，雖然這學期有叫我們簽到，不過似乎沒有算進去學期成績，應該只是防疫規定而已。
</p>

<p>
老師上課很熱情，也會丟很多問題給大家問大家想法。
</p>
</div>
</div>
<div id="outline-container-org7161a33" class="outline-4">
<h4 id="org7161a33">課程感想</h4>
<div class="outline-text-4" id="text-org7161a33">
<p>
這門課教了很多有關軟體工程的東西，這算是一般資工系的課比較少涉及的部分。而且老師本身背景是在職工程師，英文也非常的流利，在解釋技術細節非常的清楚明瞭，上課時偶爾也會當場 trace code 給我們看。
</p>

<p>
作業其實都不難，有些只是把前面寫過的作業做小修改而已，更何況繳交方式是在 github 發公開的 PR ，早七準時上課應該才是本門課最難的部分。
</p>

<p>
課程中最有收穫的地方應該是後面課程的 Modern C++ 和 Advanced Python ， 學到了很多實用的知識與技術，也發現之前寫的 C++ 其實很不 C++。
</p>

<p>
Final project 也做了以前一直想做的東西：中文版的 ASCII art generator (<a href="https://github.com/Cycatz/uniramp">https://github.com/Cycatz/uniramp</a>) ，但是跟數值軟體可以說完全牽扯不上關係，不知道是不是這個原因讓我的 Presentation 分數比預期還要低。
</p>


<figure id="orgfa898cb">
<img src="https://github.com/Cycatz/uniramp/blob/main/assets/octocat_image_to_text_comparasion_4.png?raw=true" alt="octocat_image_to_text_comparasion_4.png?raw=true" width="512">

<figcaption><span class="figure-number">Figure 1: </span>Unicode Art Octocat in 3 different zoom levels</figcaption>
</figure>
</div>
</div>
</div>
<div id="outline-container-orgf42ba8d" class="outline-3">
<h3 id="orgf42ba8d">微處理機系統原理與實作</h3>
<div class="outline-text-3" id="text-orgf42ba8d">
</div>
<div id="outline-container-org0043671" class="outline-4">
<h4 id="org0043671">課程資訊</h4>
<div class="outline-text-4" id="text-org0043671">
<ul class="org-ul">
<li>授課教師：蔡淳仁</li>
<li>開課單位：資工系<br></li>
<li>當期課號：1164</li>
<li>永久課號：DCP1265</li>
<li>必/選修：選修</li>
</ul>
</div>
</div>
<div id="outline-container-orga55bdd4" class="outline-4">
<h4 id="orga55bdd4">教了什麼</h4>
<div class="outline-text-4" id="text-orga55bdd4">
<p>
微處理機系統的設計與實作細節，包括介紹不同指令集的設計與差異、 I/O 子系統、作業系統與硬體的整合等等。
</p>

<p>
此外還會談到 Aquila 的架構與設計，Aquila 是教授他們實驗室 (EISL) 所開發的 open-source processor (<a href="http://github.com/eisl-nctu/aquila">http://github.com/eisl-nctu/aquila</a>) ，作業就是會以 Aquila 為基礎，修改相關電路的程式碼。
</p>
</div>
</div>
<div id="outline-container-org1520f12" class="outline-4">
<h4 id="org1520f12">教學方式</h4>
<div class="outline-text-4" id="text-org1520f12">
<p>
老師會講自己的投影片，這學期是線上和實體混合，不點名。
</p>
</div>
</div>
<div id="outline-container-orgff52af2" class="outline-4">
<h4 id="orgff52af2">評量方式</h4>
<div class="outline-text-4" id="text-orgff52af2">
<p>
作業總共有 5 個，總共佔 70%，一個上機考佔 30% 。
作業通常又會分 demo 成績和報告成績，各佔 50% 。
為什麼說通常呢？因為 hw4 只需要 demo 所以只有 demo 分數，hw5 只需要交報告所以只有報告分數。
</p>

<p>
學期最後會非線性調分。
</p>
</div>
</div>
<div id="outline-container-org0b22235" class="outline-4">
<h4 id="org0b22235">考試作業</h4>
<div class="outline-text-4" id="text-org0b22235">
<p>
這是所有的作業列表， hw0 不算分，老師說只是為了瞭解大家的狀況用：
</p>

<ul class="org-ul">
<li>hw0: Simulation of a HW-SW Platform</li>
<li>hw1: Real-time Debugging of a HW-SW Platform</li>
<li>hw2: Branch Predictor Design</li>
<li>hw3: Cache Optimization</li>
<li>hw4: AXI4-Lite Device Bus Protocol</li>
<li>hw5: RTOS Analysis</li>
</ul>

<p>
作業要求要會寫 C (SW design) 和 Verilog (HW design) ，可能還需要會寫 RISC-V Assembly (hw1 和 hw5 有機率會用到) 。
</p>

<p>
主要作業的實作都是使用 <a href="https://www.xilinx.com/products/silicon-devices/fpga/artix-7.html">Xilinx Artix-7 XC7A35T FPGA</a> 這塊板子（跟數位電路實驗用的一樣）配合 <a href="https://www.xilinx.com/products/design-tools/vivado.html">Xilinx Vivado</a> 這套軟體。
</p>

<p>
作業寫完交報告之後要去找助教 demo ，可以在 TA hour 的時候去或是跟助教約時間。
</p>

<p>
上機考有 4 題，每題佔 25% ，會給 boot rom ， 要求改電路跑模擬想辦法收集以下的數據：
</p>

<ol class="org-ol">
<li>Total number of instructions executed (excluding flushed instructions).</li>
<li>Total number of load/store instructions executed.</li>
<li>Total number of stall cycles during execution.</li>
<li>Maximal depth of stack used (in words).</li>
</ol>
</div>
</div>
<div id="outline-container-org0c2fec5" class="outline-4">
<h4 id="org0c2fec5">其他事項</h4>
<div class="outline-text-4" id="text-org0c2fec5">
<p>
這門課需要兩個人一組共用板子，學期初會叫大家寫表單，但是作業是單人獨立完成。
</p>

<p>
如果不想跟別人共用板子也可以直接到 EC22[0-2] 實驗室拿那邊的板子寫，助教會在學期初幫忙開通門禁。
</p>
</div>
</div>
<div id="outline-container-org8a1512e" class="outline-4">
<h4 id="org8a1512e">課程感想</h4>
<div class="outline-text-4" id="text-org8a1512e">
<p>
我覺得這門課是我修課以來遇到最充實最有難度的課程，可以想像成是進階版的計算機組織加上數位電路實驗。 以 HW2 與 HW3 為例子，需要有對電路分析的能力，因此要先看懂 Aquila 某功能的實作，再想辦法修改程式碼去統計各項資訊，例如說統計 branch misprediction 的次數或者是 cache miss 的 cycles 等等。再來就是要針對範例程式對機制的演算法進行修改以最佳化效能，例如說設計新的 branch prediction 的演算法或是 cache replacement 機制等等。
</p>

<p>
這門課被劃分在軟硬體整合學程裡面，這學期是第二次開課，上次是試辦。之前有門名稱相似的課叫做「微處理機系統實驗」，是之前某些組的必修。因此有些雙主修/轉系的學生如果當時沒有修到那門課，就必須要修這門課來抵，*但其實兩邊課程內容完全不同* ，想選的人看課程評價前要先注意。
</p>

<p>
寫作業的過程真是還蠻心累又困難的，因為要一直反覆燒電路，等待 bitstream 寫進板子裡面，跑出結果不如預期又要改做法然後再重燒，如此反覆。雖然這門課沒有分組，但是老師不排斥同學之間互相討論，所以我強烈建議跟其他同學分工分析電路跑實驗結果和討論實作，可以節省很多時間與心力。最後我們都有想出比原來效率還高的演算法，算是對自己有個交代了。
</p>

<p>
這五次作業的報告我都要求自己要用英文寫，雖然寫起來很痛苦，要花更多時間斟酌字詞，不過實際寫完五篇報告看起來每篇就像獨立的小論文一樣，非常有成就感。另一方面是想說可以免費練習英文寫作的機會不多了，就把老師當作免費的 Grammarly 在用，還會幫我改文法和錯字，也算值得了。
</p>

<p>
修完這門課會對計算機底層知識有更深入的瞭解，想底層功能如何實作的會變非常容易，因為作業都會要求要親手讀過和刻過程式碼。 此外我建議想修這門課的人可以先去修數位電路實驗，對 verilog 與 FPGA Design 有基本的熟悉度會少很多撞牆的時間。然後建議可以回去複習計算機組織，報告內容強烈依賴著之前學過的計組知識，有深厚的背景知識才可以知道為什麼會發生某些現象或者是要怎麼做會跑出比較好的結果。
</p>

<p>
老師很鼓勵同學自己看網路文件和動手實作，在課堂上也會分享他之前工作的經驗和趣事還有對 <i>Hacker spirit</i> 理念的看法等等。課程用到的東西大部分也都是 open-source 的，非常合我胃口。
老師也很希望同學可以找他聊聊，包括寫作業遇到的困難或者是職涯規劃等等。像我就曾經去找老師聊過，老師有給了我很多職涯方向的建議和分享他學生在不同公司的經驗等等。
</p>

<p>
這門課一開始有 32 個人修，最後有將近 <b>10</b> 個人退選， 2 個人不及格，調分後平均是 83 分。
</p>
</div>
</div>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/110-1st-semester-part2.html</link>
  <guid>https://blog.staque.me/110-1st-semester-part2.html</guid>
  <pubDate>Sun, 23 Jan 2022 00:00:00 +0100</pubDate>
</item>
<item>
  <title><![CDATA[交大三上修課心得（一）]]></title>
  <description><![CDATA[
<div class="post-date">Jan 22, 2022</div>
<hr/>
<section id="outline-container-orgff52af2" class="outline-2">
<h2 id="orgff52af2">課程心得</h2>
<div class="outline-text-2" id="text-orgff52af2">
</div>
<div id="outline-container-org2dc1f56" class="outline-3">
<h3 id="org2dc1f56">機率</h3>
<div class="outline-text-3" id="text-org2dc1f56">
</div>
<div id="outline-container-orgee35afe" class="outline-4">
<h4 id="orgee35afe">課程資訊</h4>
<div class="outline-text-4" id="text-orgee35afe">
<ul class="org-ul">
<li>授課教師：謝秉均</li>
<li>當期課號：1179</li>
<li>永久課號：DCP1206</li>
<li>學分數：3.00</li>
<li>必/選修：必修</li>
</ul>
</div>
</div>
<div id="outline-container-org0ce0959" class="outline-4">
<h4 id="org0ce0959">教了什麼</h4>
<div class="outline-text-4" id="text-org0ce0959">
<p>
機率，有時候會在開始上課前講一些與時事相關的數學或機率應用。
</p>
</div>
</div>
<div id="outline-container-org9639605" class="outline-4">
<h4 id="org9639605">教學方式</h4>
<div class="outline-text-4" id="text-org9639605">
<p>
上課講自己做的投影片（會在上課前一天發在 E3 ），基本上不會用到課本。
</p>
</div>
</div>
<div id="outline-container-org7f6f53b" class="outline-4">
<h4 id="org7f6f53b">考試作業</h4>
<div class="outline-text-4" id="text-org7f6f53b">
<p>
有四次作業，每個作業大概都有四個大題，總共題數約落在十題左右，每個作業佔 10% 。
然後期中期末各佔 30% ，考試時間為兩小時。
</p>

<p>
作業基本上跟前一年的只會有一兩題一樣，所以還是要乖乖寫作業。
至於考試方面，老師會公佈前兩年的考古與答案，然後可以帶一張 A4 雙面大抄，但是考試也會跟考古長的滿不一樣。
</p>
</div>
</div>
<div id="outline-container-orgb948b55" class="outline-4">
<h4 id="orgb948b55">其他事項</h4>
<div class="outline-text-4" id="text-orgb948b55">
<p>
這門課是英授
</p>

<p>
今年是線上課程，然後也是不點名。
</p>

<p>
作業四會用到一點點 Python ，但是其實寫到再學也沒關係。
</p>
</div>
</div>
<div id="outline-container-org9beed48" class="outline-4">
<h4 id="org9beed48">課程感想</h4>
<div class="outline-text-4" id="text-org9beed48">
<p>
老師的英文很好，聽起來跟中文一樣清楚明瞭，有問題也是可以用中文跟老師溝通。
</p>

<p>
作業因為都是老師自己設計的，所以在網路上除了歷年作業也找不到答案。雖然看起來很難，不過如果能瞭解題目在問什麼還有配合老師給的 Hint 思考一下，大部分都可以寫的出來，但是我建議寫完跟同學或朋友對一下答案會比較保險。
</p>

<p>
然後今年期中期末都大開殺戒，期中平均好像 68 分，期末平均 55 分，主要問題是看懂題目的敘述和所求就要花一段時間，光讀考古是沒有用的。
</p>

<p>
總之我覺得這門課品質非常棒，如果有心想要弄懂機率的人應該是可以收穫很多。
</p>
</div>
</div>
</div>
<div id="outline-container-org1520f12" class="outline-3">
<h3 id="org1520f12">網路程式設計概論</h3>
<div class="outline-text-3" id="text-org1520f12">
</div>
<div id="outline-container-orgde0f8b8" class="outline-4">
<h4 id="orgde0f8b8">課程資訊</h4>
<div class="outline-text-4" id="text-orgde0f8b8">
<ul class="org-ul">
<li>授課教師：黃俊穎</li>
<li>開課單位：資訊共同</li>
<li>當期課號：1184</li>
<li>永久課號：DCP2368</li>
<li>學分數：3.00</li>
<li>必/選修：選修</li>
</ul>
</div>
</div>
<div id="outline-container-orgfa898cb" class="outline-4">
<h4 id="orgfa898cb">教了什麼</h4>
<div class="outline-text-4" id="text-orgfa898cb">
<p>
基本上就是 follow <i>Unix Network Programming</i> 的章節教，包含 TCP, UDP, Advanced I/O, Non-blocking 等等，最後期末考完有教 raw sockets 。
</p>
</div>
</div>
<div id="outline-container-org7161a33" class="outline-4">
<h4 id="org7161a33">教學方式</h4>
<div class="outline-text-4" id="text-org7161a33">
<p>
老師會講解自己的投影片，投影片很多範例都是從 <i>UNIX Network Programming</i> 拿的。
</p>

<p>
老師在講完一個段落會實際跑程式範例給我們看結果，或是跑 Wireshark 看封包內容。
</p>
</div>
</div>
<div id="outline-container-org194cf40" class="outline-4">
<h4 id="org194cf40">考試作業</h4>
<div class="outline-text-4" id="text-org194cf40">
<p>
總共有三次作業，一個期中一個期末，表定寫各佔 20% 。
</p>

<p>
作業是要求做一個簡單的 BBS Server ，不同作業會要求新增一些功能，例如發文功能、支援 UDP 封包的聊天室等等。
</p>

<p>
考試是要求實作 client 端，考試時會要求連上考試主機作答，連上去主機後會開一個 container 環境供操作。
</p>

<p>
期中是要求寫出解迷宮的 client，簡單來說就是 server 吐迷宮 client 接受並給出答案。
</p>

<p>
期末也是跟期中很像，只是有些題目會用到 UDP 或是混合 TCP 與 UDP，最後一題是踩地雷。
</p>
</div>
</div>
<div id="outline-container-org0c8fbd7" class="outline-4">
<h4 id="org0c8fbd7">其他事項</h4>
<div class="outline-text-4" id="text-org0c8fbd7">
<p>
考試的時候不能帶小抄，但是會給上課投影片和<a href="https://github.com/unpbook/unpv13e">課本範例程式碼</a>
</p>

<p>
考試的時候會讓大家提早 30 分鐘入場，可以提早開始準備環境和打模板。
</p>

<p>
考試完如果有沒寫出來的題目可以開放補交，分數計算方式為當場寫完 * 1.1 、補交 * 0.7 ，所以大家考試那欄的最後分數其實都不難看。
</p>
</div>
</div>
<div id="outline-container-orga55bdd4" class="outline-4">
<h4 id="orga55bdd4">課程感想</h4>
<div class="outline-text-4" id="text-orga55bdd4">
<p>
老師上課上的很清楚，也會當場示範範例，能覺得教的東西都有實際作用，我覺得非常不錯。但是我覺得考的東西好像跟網路本身沒有非常強的關聯性，因為如果都實作好接收發送的函數之後，例如說先寫好 regex, recvline 等等 wrappers ，考試時寫起來就會輕鬆很多，變成一般的演算法考試。
</p>

<p>
此外我建議考試前可以自己寫 server 然後再實作相對應的 client 模擬考試環境，會非常有幫助，然後也建議多讀課本的範例程式碼，考試時稍微修改就可以直接拿來用了。
</p>

<p>
作業整體也不難，主要是實作一些細節功能有時候很煩而已。
</p>

<p>
最後平均學期平均分數是 75 ，這是有跟另一班進行成績同步調整過後的結果。
</p>
</div>
</div>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/110-1st-semester-part1.html</link>
  <guid>https://blog.staque.me/110-1st-semester-part1.html</guid>
  <pubDate>Sat, 22 Jan 2022 00:00:00 +0100</pubDate>
</item>
<item>
  <title><![CDATA[How I Build My Blog with Pandoc & Vimwiki (Part I)]]></title>
  <description><![CDATA[
<div class="post-date">Jan 26, 2020</div>
<hr/>
<section id="outline-container-org194cf40" class="outline-2">
<h2 id="org194cf40">Background</h2>
<div class="outline-text-2" id="text-org194cf40">
<p>
一直想用 vimwiki 架設個人的blog，網路上用 vimwiki 生成網站的幾乎都是利用 vimwiki 內建的 <code>Vimwiki2HTML</code> 將原生的 <code>.wiki</code> 檔來生成網頁，但是考慮到 <code>.wiki</code> 的支援性不佳，
所以決定用 markdown 寫作然後用 pandoc 與 vimwiki 自己打造生成環境
</p>

<p>
這是環境的文件結構：
</p>

<pre style="line-height: 1">
<code>
[cycatz@cfzfnf Blog]$ tree --dirsfirst -L 1
.
├── css
├── default
├── filter
├── fonts
├── template
├── add-timestamp.sh
├── blog-article.html -> ./template/blog-article.html
├── blog-homepage.html -> ./template/blog-homepage.html
└── Makefile

5 directories, 4 files
</code>
</pre>

<p>
我們照順序來說明每個項目
</p>
</div>
</section>
<section id="outline-container-orga55bdd4" class="outline-2">
<h2 id="orga55bdd4">Blog/css</h2>
<div class="outline-text-2" id="text-orga55bdd4">
<pre style="line-height: 1">
<code>
[cycatz@cfzfnf css]$ tree
.
├── blog-article.css
├── blog-homepage.css
└── font.css

0 directories, 3 files
</code>
</pre>

<p>
css 下主要放的是網站主頁與文章的樣式，還有字型的設定，修改自 <a href="https://gist.github.com/killercup/5917178">killercup/pandoc.css</a>
</p>
</div>
</section>
<section id="outline-container-org0b22235" class="outline-2">
<h2 id="org0b22235">Blog/default</h2>
<div class="outline-text-2" id="text-org0b22235">
<pre style="line-height: 1">
<code>
[cycatz@cfzfnf default]$ tree
.
├── blog-article.yaml
└── blog-homepage.yaml

0 directories, 2 files
</code>
</pre>

<p>
default 下放的是 pandoc 在編譯時的設定檔，省去編譯時在 pandoc 命令後接一大串參數的麻煩。
</p>

<p>
以 <code>blog-homepage.yaml</code> 為例：
</p>

<div class="org-src-container">
<pre class="src src-yaml"><span class="linenr">1: </span>from: markdown+smart+definition_lists+strikeout+superscript+subscript
<span class="linenr">2: </span>to: html
<span class="linenr">3: </span>
<span class="linenr">4: </span>metadata:
<span class="linenr">5: </span>  title: 棧列 Staque
<span class="linenr">6: </span>  author: Cycatz
<span class="linenr">7: </span>
<span class="linenr">8: </span>highlight-style: monochrome
<span class="linenr">9: </span>tab-stop: 2
</pre>
</div>

<p>
在 <code>metadata</code> 設置的參數在網頁中會以 <code>&lt;meta&gt;</code> 被設定，我 <code>metadata</code> 只使用了三個參數：
</p>

<ul class="org-ul">
<li><code>author</code> : 作者名稱</li>
<li><code>title</code> : 定義網頁名稱，我預設是網站的名稱「棧列 Staque」</li>
<li><code>date</code> : 建立文章時間，會在每篇文章檔案中定義</li>
</ul>

<p>
其他選項設定解釋可以看 <a href="https://pandoc.org/MANUAL.html">Pandoc User's Guide</a>
</p>
</div>
</section>
<section id="outline-container-org8a1512e" class="outline-2">
<h2 id="org8a1512e">Blog/filter</h2>
<div class="outline-text-2" id="text-org8a1512e">
<pre style="line-height: 1">
<code>
[cycatz@cfzfnf filter]$ tree
.
└── links-to-html.lua

0 directories, 1 files
</code>
</pre>

<p>
filter 存放的是用來處理一些特殊規則或增加功能的檔案。
</p>

<p>
裡面的 <code>links-to-html.lua</code> 是將檔案中的其他 md 連結（其他篇文章等）轉成 html 的連結，才能在網路上跳轉
</p>
</div>
</section>
<section id="outline-container-org496e461" class="outline-2">
<h2 id="org496e461">Blog/fonts</h2>
<div class="outline-text-2" id="text-org496e461">
<pre style="line-height: 1">
<code>
[cycatz@cfzfnf fonts]$ tree -L 2
.
├── CJK
│   ├── GenRyuMin
│   ├── GenWanMin
│   └── TaipeiSansTCBeta
└── Latin
    ├── EB_Garamond
    ├── Inconsolata
    └── Libre_Baskerville

8 directories, 0 files
</code>
</pre>

<p>
fonts 底下有兩個資料夾，一個存放中文字型 CJK ，另一個是拉丁語系 Latin
</p>

<p>
CJK 裡面的字型有：
</p>

<ul class="org-ul">
<li><a href="https://github.com/ButTaiwan/genryu-font">源流明體GenRyumin</a></li>
<li><a href="https://github.com/ButTaiwan/genwan-font">源雲明體GenWanMin</a></li>
<li><a href="https://sites.google.com/view/jtfoundry/">台北黑體Taipei Sans TC Beta</a></li>
</ul>

<p>
Latin 裡面的字型有：
</p>

<ul class="org-ul">
<li><a href="https://fonts.google.com/specimen/EB+Garamond">EB Garamond</a></li>
<li><a href="https://fonts.google.com/specimen/Inconsolata">Inconsolata</a></li>
<li><a href="https://fonts.google.com/specimen/Libre+Baskerville">Libre Baskerville</a></li>
</ul>

<p>
其中 CJK 裡面的字型是用 <code>font-spider</code> 分析壓縮過後的檔案，可以大大減少網頁載入中文字型的時間
</p>
</div>
</section>
<section id="outline-container-orgb22ef7e" class="outline-2">
<h2 id="orgb22ef7e">Blog/template</h2>
<div class="outline-text-2" id="text-orgb22ef7e">
<pre style="line-height: 1">
<code>
[cycatz@cfzfnf template]$ tree
.
├── blog-article.html
└── blog-homepage.html

0 directories, 2 files
</code>
</pre>

<p>
template 存放的是 pandoc 生成 html 的模版，修改自預設檔案 (<code>pandoc ---print-default-template html</code>)
</p>
</div>
</section>
<section id="outline-container-org648c2f4" class="outline-2">
<h2 id="org648c2f4">Blog/add-timestamp.sh</h2>
<div class="outline-text-2" id="text-org648c2f4">
<p>
這個 script 的功能主要是幫用 <code>font-spider</code> 優化後的字型打上時間戳，這樣才能讓瀏覽器重新載入新的字型而不是讀取 cache 裡面的
</p>

<p>
這是 <code>add-timestamp.sh</code> 的內容：
</p>

<div class="org-src-container">
<pre class="src src-sh"><span class="linenr"> 1: </span><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">!/bin/</span><span style="font-weight: bold;">bash</span><span style="font-weight: bold; font-style: italic;">
<span class="linenr"> 2: </span></span><span style="font-weight: bold; font-style: italic;">suff</span>=ttf
<span class="linenr"> 3: </span><span style="font-weight: bold; font-style: italic;">fonts</span>=$(find ./build -name <span style="font-style: italic;">\*</span>.${<span style="font-weight: bold; font-style: italic;">suff</span>})
<span class="linenr"> 4: </span><span style="font-weight: bold; font-style: italic;">timestamp</span>=$(date -Isecond)
<span class="linenr"> 5: </span>
<span class="linenr"> 6: </span><span style="font-weight: bold;">for</span> font<span style="font-weight: bold;"> in</span> ${<span style="font-weight: bold; font-style: italic;">fonts</span>};
<span class="linenr"> 7: </span><span style="font-weight: bold;">do</span>
<span class="linenr"> 8: </span>    mv ${<span style="font-weight: bold; font-style: italic;">font</span>} ${<span style="font-weight: bold; font-style: italic;">font</span>%.*}_${<span style="font-weight: bold; font-style: italic;">timestamp</span>}.${<span style="font-weight: bold; font-style: italic;">suff</span>}
<span class="linenr"> 9: </span><span style="font-weight: bold;">done</span>
<span class="linenr">10: </span>sed -i <span style="font-style: italic;">"s/.ttf/_${timestamp}&amp;/"</span> ./build/css/font.css
</pre>
</div>
</div>
</section>
<section id="outline-container-orgbec9ad4" class="outline-2">
<h2 id="orgbec9ad4">Blog/Makefile, symbolic links</h2>
<div class="outline-text-2" id="text-orgbec9ad4">
<p>
在 <code>Makefile</code> 主要是彙整pandoc的參數並編譯與壓縮字體資源
</p>

<p>
在此節錄在 <code>Makefile</code> 壓縮字型與生成文章網頁的片段：
</p>

<div class="org-src-container">
<pre class="src src-makefile"><span class="linenr"> 1: </span><span style="font-weight: bold;">$(</span><span style="font-weight: bold; font-style: italic;">OPTIMIZED_FONTS</span><span style="font-weight: bold;">)</span>: fonts/ $(<span style="font-weight: bold; font-style: italic;">BUILD_INDEX_FILE</span>) $(<span style="font-weight: bold; font-style: italic;">BUILD_HTML_FILES</span>) 
<span class="linenr"> 2: </span>    rm -rf <span style="font-weight: bold;">$</span><span style="font-weight: bold; text-decoration: underline;">@</span>
<span class="linenr"> 3: </span>    mkdir -p <span style="font-weight: bold;">$</span><span style="font-weight: bold; text-decoration: underline;">@</span>
<span class="linenr"> 4: </span>    cp -r fonts/* <span style="font-weight: bold;">$</span><span style="font-weight: bold; text-decoration: underline;">@</span>
<span class="linenr"> 5: </span>    font-spider --no-backup $(<span style="font-weight: bold; font-style: italic;">BUILD_INDEX_FILE</span>) $(<span style="font-weight: bold; font-style: italic;">BUILD_HTML_FILES</span>)
<span class="linenr"> 6: </span>    $$(bash ./add-timestamp.sh)
<span class="linenr"> 7: </span>
<span class="linenr"> 8: </span><span style="font-weight: bold;">build/%.html</span>: %.md template/$(<span style="font-weight: bold; font-style: italic;">ARTICLE</span>).html css/$(<span style="font-weight: bold; font-style: italic;">ARTICLE</span>).css css/font.css
<span class="linenr"> 9: </span>    @echo $<span style="font-weight: bold; text-decoration: underline;">&lt;</span>
<span class="linenr">10: </span>    mkdir -p $(<span style="font-weight: bold; font-style: italic;">@D</span>) $(<span style="font-weight: bold; font-style: italic;">CSS_FILES</span>)
<span class="linenr">11: </span>    cp css/font.css $(<span style="font-weight: bold; font-style: italic;">CSS_FILES</span>)
<span class="linenr">12: </span>    cp css/$(<span style="font-weight: bold; font-style: italic;">ARTICLE</span>).css $(<span style="font-weight: bold; font-style: italic;">CSS_FILES</span>)
<span class="linenr">13: </span>    pandoc -o <span style="font-weight: bold;">$</span><span style="font-weight: bold; text-decoration: underline;">@</span> \
<span class="linenr">14: </span>        --katex \
<span class="linenr">15: </span>        --toc \
<span class="linenr">16: </span>        --toc-depth 1\
<span class="linenr">17: </span>        -d default/$(<span style="font-weight: bold; font-style: italic;">ARTICLE</span>).yaml \
<span class="linenr">18: </span>        --css ../css/$(<span style="font-weight: bold; font-style: italic;">ARTICLE</span>).css \
<span class="linenr">19: </span>        --lua-filter filter/links-to-html.lua \
<span class="linenr">20: </span>        --template $(<span style="font-weight: bold; font-style: italic;">ARTICLE</span>) $<span style="font-weight: bold; text-decoration: underline;">&lt;</span>
</pre>
</div>

<p>
而那些 sybolic links 是連結到 <code>template/</code> 資料夾的檔案，原因是 <code>--template</code> 參數不給指定在資料夾裡面的檔案，只好在 Blog 目錄建立連結檔
</p>
</div>
</section>
<section id="outline-container-org94dc380" class="outline-2">
<h2 id="org94dc380">Conclusion</h2>
<div class="outline-text-2" id="text-org94dc380">
<p>
目前 pandoc 的部分就到此告一段落，下一篇是有關 vimwiki 寫作的姿勢、心得，與相關連結。
</p>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/build-blog-part1.html</link>
  <guid>https://blog.staque.me/build-blog-part1.html</guid>
  <pubDate>Sun, 26 Jan 2020 00:00:00 +0100</pubDate>
</item>
<item>
  <title><![CDATA[交大一上修課心得]]></title>
  <description><![CDATA[
<div class="post-date">Jan 26, 2020</div>
<hr/>
<section id="outline-container-org9beed48" class="outline-2">
<h2 id="org9beed48">微積分甲（一）</h2>
<div class="outline-text-2" id="text-org9beed48">
</div>
<div id="outline-container-orgee35afe" class="outline-3">
<h3 id="orgee35afe">課程資訊</h3>
<div class="outline-text-3" id="text-orgee35afe">
<ul class="org-ul">
<li>授課教師：余啟哲</li>
<li>當期課號：0414</li>
<li>永久課號：DAM1367</li>
<li>學分數：4.00</li>
<li>必/選修：必修</li>
<li>教科書：/Calculus (Early Transcendentals)/, James Stewart, 8th Edition</li>
</ul>
</div>
</div>
<div id="outline-container-org0ce0959" class="outline-3">
<h3 id="org0ce0959">教學方式</h3>
<div class="outline-text-3" id="text-org0ce0959">
<p>
主要上課內容是會帶大家講過課本範例，少數時候會補充一些更進階的題目與觀念，然後助教會檢討小考的題目。
</p>
</div>
</div>
<div id="outline-container-org9639605" class="outline-3">
<h3 id="org9639605">評量方式</h3>
<div class="outline-text-3" id="text-org9639605">
<p>
有五次小考，沒有期中期末。在我這學期是五次小考佔70%，大會考佔30%，然後出席當作加分5%（這學期總共點名9次）。
</p>
</div>
</div>
<div id="outline-container-org7f6f53b" class="outline-3">
<h3 id="org7f6f53b">考試內容</h3>
<div class="outline-text-3" id="text-org7f6f53b">
<p>
基本上與考古題有80%的相似度，所以可以考慮記起考古題的解法。然後會有一二題bonus，有些題目也會從課本後面的題目出。
</p>
</div>
</div>
<div id="outline-container-orgb948b55" class="outline-3">
<h3 id="orgb948b55">課程感想</h3>
<div class="outline-text-3" id="text-orgb948b55">
<p>
我好像沒去了三四次左右吧，然後被點到的有一次。基本上我去上課都在恍神，因為老師講的我自己都還沒唸到那裡，想說不能被劇透就索性沒專心聽，所以通常我唸的方式是要小考的前幾天才刷過這次範圍內課本的範例與微積分小組的推薦題目，然後認真寫兩年的考古題。
</p>
</div>
</div>
</section>
<section id="outline-container-org0043671" class="outline-2">
<h2 id="org0043671">物理（一）</h2>
<div class="outline-text-2" id="text-org0043671">
</div>
<div id="outline-container-org2dc1f56" class="outline-3">
<h3 id="org2dc1f56">課程資訊</h3>
<div class="outline-text-3" id="text-org2dc1f56">
<ul class="org-ul">
<li>授課教師：李威儀</li>
<li>當期課號：0517</li>
<li>永久課號：DEP1111</li>
<li>必/選修：必修</li>
<li>教科書：/Physics for Computer Science Students/ by N Garcia and A Damask（+放心，你可能學期結束都不需要也不會打開來看+）</li>
</ul>
</div>
</div>
<div id="outline-container-orgde0f8b8" class="outline-3">
<h3 id="orgde0f8b8">教學方式</h3>
<div class="outline-text-3" id="text-orgde0f8b8">
<p>
網路課程，每兩個禮拜會在e3發佈新的課程影片，內容是用投影片上課，偶爾會講一些科學家的歷史與小故事，或是有老師親手做實驗的部分（但是有時候相機好像沒有拍到）平均大概是4小時左右，然後有作業（推薦做的習題，平均七八題）。物理一大部分都只是在複習高中的內容，有時候還會比指考要考的內容還簡單。
</p>
</div>
</div>
<div id="outline-container-orgfa898cb" class="outline-3">
<h3 id="orgfa898cb">評量方式</h3>
<div class="outline-text-3" id="text-orgfa898cb">
<p>
發佈課程影片的隔週要去實體教室小考。小考大部分只有兩題，每題2.5分，滿分5分。總共考八次，會drop一次取七次，佔35%。期中佔35%，期末佔30%。（好像可以選擇口試當作學期成績，測試你是不是天才，不過我是沒試過）。
</p>
</div>
</div>
<div id="outline-container-org7161a33" class="outline-3">
<h3 id="org7161a33">考試內容</h3>
<div class="outline-text-3" id="text-org7161a33">
<p>
小考大部分都考課程影片中有提到或是從作業裡面出（數字會改，每個人的數字都會依拿到的白紙上的數字不同而不同）內容幾乎都是簡單的計算題目或者是解釋一個簡單的觀念（因為每題作答時間很短，大約在5秒到2分鐘間）。期中期末比較多花樣，有可能叫你畫圖或是出計算比較複雜或是較複雜的原理定義的題目。考古題其實三個考試都會出一些，但是也沒有到很多。
</p>
</div>
</div>
<div id="outline-container-org194cf40" class="outline-3">
<h3 id="org194cf40">課程感想</h3>
<div class="outline-text-3" id="text-org194cf40">
<p>
我都是前一天考試開1.75x看完這周的影片，然後隔天早上寫作業與考古題。雖然我每次的影片都有看完，但是有時候會沒有克制自己以至於無法真正吸收。
</p>
</div>
</div>
</section>
<section id="outline-container-orgf718da5" class="outline-2">
<h2 id="orgf718da5">線性代數</h2>
<div class="outline-text-2" id="text-orgf718da5">
</div>
<div id="outline-container-org0c8fbd7" class="outline-3">
<h3 id="org0c8fbd7">課程資訊</h3>
<div class="outline-text-3" id="text-org0c8fbd7">
<ul class="org-ul">
<li>授課教師：陳冠文</li>
<li>當期課號：1253</li>
<li>永久課號：DCP2354</li>
<li>必/選修：必修</li>
<li>課程課本：Gilbert Strang, <i>Introduction to Linear Algebra</i>, Wellesley-Cambridge Press, 4th edition.</li>
</ul>
</div>
</div>
<div id="outline-container-orga55bdd4" class="outline-3">
<h3 id="orga55bdd4">教學方式</h3>
<div class="outline-text-3" id="text-orga55bdd4">
<p>
我其實只有去過兩三次，用板書上課，據同學的說法，與清大趙啟超教授教學風格類似。
</p>
</div>
</div>
<div id="outline-container-org1520f12" class="outline-3">
<h3 id="org1520f12">評量方式</h3>
<div class="outline-text-3" id="text-org1520f12">
<ol class="org-ol">
<li>Homework: 20%</li>
<li>First Midterm Exam: 20%</li>
<li>Second Midterm Exam: 25%</li>
<li>Final Exam: 35%</li>
</ol>
</div>
</div>
<div id="outline-container-orgff52af2" class="outline-3">
<h3 id="orgff52af2">考試內容</h3>
<div class="outline-text-3" id="text-orgff52af2">
<p>
跟考古題也有80％的相似度，剩下20%很可能是比較難或是少見的證明題。裡面很多上課有證明的有很大機率考（資訊來源：同學的筆記）。
</p>
</div>
</div>
<div id="outline-container-org79c4fb7" class="outline-3">
<h3 id="org79c4fb7">課程感想</h3>
<div class="outline-text-3" id="text-org79c4fb7">
<p>
雖然說我整學期除了考試我只有去過兩次，但是我花在線性代數的時間可能是這學期必修最多的。通常我都會在出作業前幾天開始看其他學校的OCW。一開始我只有看MIT的Gilbert strang的影片與讀課本。在2nd期中過後，我發現也會考上課有講的證明，因此我後來又有多看清大線性代數的OCW，裡面講了很多的證明與課本沒有寫的補充項目。
</p>
</div>
</div>
</section>
<section id="outline-container-org5c0e423" class="outline-2">
<h2 id="org5c0e423">計算機概論與程式設計</h2>
<div class="outline-text-2" id="text-org5c0e423">
</div>
<div id="outline-container-org0b22235" class="outline-3">
<h3 id="org0b22235">課程資訊</h3>
<div class="outline-text-3" id="text-org0b22235">
<ul class="org-ul">
<li>授課教師：黃俊龍</li>
<li>當期課號：1245</li>
<li>永久課號：DCP1203</li>
<li>學分數：3.00</li>
<li>必/選修：必修</li>
<li>教科書：K. N. King, <i>C Programming: A Modern Approach</i>, W. W. Norton &amp; Company, 2nd Edition, 2008.</li>
</ul>
</div>
</div>
<div id="outline-container-org0c2fec5" class="outline-3">
<h3 id="org0c2fec5">教學方式</h3>
<div class="outline-text-3" id="text-org0c2fec5">
<p>
我也只有去過兩三次，老師是用投影片上課。據同學的說法，老師上課會講很多業界的東西。
</p>
</div>
</div>
<div id="outline-container-org8a1512e" class="outline-3">
<h3 id="org8a1512e">評量方式</h3>
<div class="outline-text-3" id="text-org8a1512e">
<p>
這學期有7次上機小考，會drop一次，沒有作業，有期中期末。
</p>
</div>
</div>
<div id="outline-container-orgf42ba8d" class="outline-3">
<h3 id="orgf42ba8d">考試內容</h3>
<div class="outline-text-3" id="text-orgf42ba8d">
<p>
期中期末有些題目是uva的，然後有時在考試（小考或大考）前助教會發補充資料，裡面有會考的。
</p>
</div>
</div>
<div id="outline-container-org72a3840" class="outline-3">
<h3 id="org72a3840">課程感想</h3>
<div class="outline-text-3" id="text-org72a3840">
<p>
我相當後悔沒有去上課。當時是認為自己對C語言已有足夠的瞭解而選擇不去上課，但是考完試考爛了才發現對指標與struct的記憶體配置之前沒有摸的很清楚。
</p>
</div>
</div>
</section>
<section id="outline-container-orgd9cd98a" class="outline-2">
<h2 id="orgd9cd98a">認識語言</h2>
<div class="outline-text-2" id="text-orgd9cd98a">
</div>
<div id="outline-container-orgaf542ca" class="outline-3">
<h3 id="orgaf542ca">課程資訊</h3>
<div class="outline-text-3" id="text-orgaf542ca">
<ul class="org-ul">
<li>授課教師：盧郁安、王逸如</li>
<li>當期課號：6609</li>
<li>永久課號：CGE1023</li>
<li>學分數：2.00</li>
<li>必/選修：通識</li>
<li>教科書：/Linguistics: an introduction to linguistic theory/ / Victoria A. Fromkin, editor.</li>
</ul>
</div>
</div>
<div id="outline-container-orgc025086" class="outline-3">
<h3 id="orgc025086">教學方式</h3>
<div class="outline-text-3" id="text-orgc025086">
<p>
用投影片上課，主要是介紹一些語言的特性，例如說：發音的位置、音節、聲調、聽覺補償、構詞現象、句型結構等。在學期的末會是電機系的王老師上課，講一些基礎的NLP，例如教大家如何用jieba來切詞，訓練詞向量(word vector)等。在課程的開頭或是最後通常會用Kahoot!來複習上次或是這次內容（其實就是間接點名）。然後會讓大家舉手發言或是用nearpod平台發表意見。
</p>
</div>
</div>
<div id="outline-container-orge63ca02" class="outline-3">
<h3 id="orge63ca02">評量方式</h3>
<div class="outline-text-3" id="text-orge63ca02">
<ol class="org-ol">
<li>participation (20%)</li>
<li>Homework (40%)</li>
<li>Midterm project (20%)</li>
<li>Final project (20%)</li>
</ol>

<p>
有時會老師會叫我們去聽演講可以額外加分。
</p>
</div>
</div>
<div id="outline-container-org819e6b8" class="outline-3">
<h3 id="org819e6b8">考試內容</h3>
<div class="outline-text-3" id="text-org819e6b8">
<ul class="org-ul">
<li>Midterm project: 製作60秒的影片介紹老師講過的一個概念、一個工具、一個現象。例：臺語聲調、中文聲調、傅立葉轉換、Praat使用等。</li>
<li>Final project: 請大家以1000字(中文)、500字(英文)為限，說明這堂語言學通識課對你的領域有什麼應用、啟發、學習。</li>
</ul>
</div>
</div>
<div id="outline-container-org496e461" class="outline-3">
<h3 id="org496e461">課程感想</h3>
<div class="outline-text-3" id="text-org496e461">
<p>
我覺得這門課的老師非常棒！老師講的很清楚，會從一些生活中的例子開始。例如會問每一個人說出「橡皮擦」的叫法，會發現會因為地域位置不同而有所差異。然後有時也會實際動手操作，例如在舌頭上塗黑色墨粉並發音，再看嘴巴裡面黑色的部位來告訴我們每個音的發音位置。但是課堂上老師問問題有時候都一片安靜，雖然我會幫忙舉手發言但是只有我一個我覺得太尷尬了所以我也不是每次都發言。然後學期末的NLP我覺得教的太淺了，只是把概念帶過一次，比較少著墨在原理的部分（因為是通識課），有點可惜。
</p>
</div>
</div>
</section>
<section id="outline-container-org3f63f7f" class="outline-2">
<h2 id="org3f63f7f">幾何造形</h2>
<div class="outline-text-2" id="text-org3f63f7f">
</div>
<div id="outline-container-orgb22ef7e" class="outline-3">
<h3 id="orgb22ef7e">課程資訊</h3>
<div class="outline-text-3" id="text-orgb22ef7e">
<ul class="org-ul">
<li>授課教師：陳明璋</li>
<li>當期課號：6329</li>
<li>永久課號：GEC8814</li>
<li>必/選修：通識</li>
<li>教科書：自編</li>
</ul>
</div>
</div>
<div id="outline-container-org0c96d26" class="outline-3">
<h3 id="org0c96d26">教學方式</h3>
<div class="outline-text-3" id="text-org0c96d26">
<p>
這網路上好像也很多了，在此不贅述。
</p>
</div>
</div>
<div id="outline-container-org8b8830a" class="outline-3">
<h3 id="org8b8830a">評量方式</h3>
<div class="outline-text-3" id="text-org8b8830a">
<p>
有7次隨堂作業，1次彙整，最後是期末專題做繪本。
</p>
</div>
</div>
<div id="outline-container-org50a2617" class="outline-3">
<h3 id="org50a2617">課程感想</h3>
<div class="outline-text-3" id="text-org50a2617">
<p>
老師節奏有時候很快，如果沒跟上的話，後面會連鎖反應都跟不上。我其實花蠻多心力在作業上的，雖然作業都是兩個禮拜出一次，但是我都要花一兩個整天來做。最主要是要想有什麼新的東西可以用本週主題教的來實現，還蠻折騰的。
</p>
</div>
</div>
</section>
<div class="taglist">]]></description>
  <link>https://blog.staque.me/108-1st-semester.html</link>
  <guid>https://blog.staque.me/108-1st-semester.html</guid>
  <pubDate>Sun, 26 Jan 2020 00:00:00 +0100</pubDate>
</item>
</channel>
</rss>
