R's Workshop

Terminal-based Offline Dictionary

最近嫌查單字還要開 browser 或 app 查太麻煩了, 上網找了一個支援 terminal 的 offline 字典 – sdcv. 紀錄一下安裝和使用. Read more

Define LaTeX Command with More than One Optional Arguments

以前自訂 LaTeX command 的時候, 通常是用 \newcommand 來做. \newcommand 的缺點是只能定義一個 optional argument, 要定義兩個以上的 optional arguments 就要用 command relaying 的方法, 很不直覺. Google 了一下, 幾個常見的解決方式有 twoopt, optparams, xargs, x... Read more

Push Part of Commits to Remote

紀錄一下 push 部份 commit(s) 到 remote 的方法. 以免再發生因為沒有把未完成的文章 git add 到 staging area 而被 git clean 誤刪的憾事 QQ. Read more

Data Model and Size of Data Types

上一篇討論 struct net_device_stats 時有提到在 32-bit 和 64-bit Linux 上的 unsigned long 長度是不同的. 前者是 32 bits, 後者是 64 bits. 然而, 在 Win32 和 Win64 上, unsigned ling 卻都是 32 bits. 造成這些差異的原因在於: 從 32-bit CPU 演進到 64-bit C... Read more

Network Device Counter Wrapping Around

前陣子遇到了一個很妙的 bug: 在 32-bit CPU 的 Linux 平台上透過 wifi 下載一個超過 4GB 的檔案後, ifconfig 看到的 Rx bytes coutner 發生了 wrapping around (溢位). 但神奇的是, 相同的 wifi driver 在另一個 64-bit CPU 的 Linux 平台上跑同樣的測試, 卻不會有溢位問題. Read more