<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"><channel><title>MagicLen</title><link>https://magiclen.org/2020/09/</link><description>多元化原創文章，內容包羅萬象，有程式語言、網站應用、軟體介紹、硬體介紹、作業系統、旅行遊記、專題採訪、益智問題、文學創作，以及作者們的知識分享和作品分享。</description><language>zh-TW</language><lastBuildDate>Mon, 23 Nov 2026 03:13:50 +0800</lastBuildDate><atom:link href="https://magiclen.org/2020/09/feed/" rel="self" type="application/rss+xml"/><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>8</sy:updateFrequency><sy:updateBase>1970-01-01T00:00+00:00</sy:updateBase><item><title>Rust 程式語言如何處理動態歌詞(LyRiCs)？</title><link>https://magiclen.org/lrc/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
LyRiCs (LRC)是一種資料格式，藉由在每行歌詞上加上時間戳記(timestamp)，來讓音樂播放器可以在播放音樂的同時，同步將該時間點的歌詞顯示出來。筆者以前用 Java 實作過 MP3 標籤格式 ID3 和 APE 的函式庫，主要就是為了能夠處理動態歌詞。雖然現在沒什麼在用，但還是整理了以前寫過的程式碼，將動態歌詞的部份重新用 Rust 程式語言獨立實作出來。]]></description><category>Rust</category><category>歌詞</category><category>Rust</category><category>lrc</category><guid>https://magiclen.org/lrc</guid><pubDate>Tue, 29 Sep 2020 20:00:17 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>Rust 程式語言如何執行系統的指令或是外部可執行檔案？</title><link>https://magiclen.org/execute/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
在設計程式的時候偶爾會需要依靠系統指令或是其它的程式來取得一些相關的訊息，或是進行一些特殊的處理，如查看系統的網卡介面，或是呼叫 FFmpeg 來實現影音編碼的格式轉換。雖然這些工作基本上都可以靠 Rust 原生程式來自行實作，或是引用其它 C/C++ 函式庫，但既然有已存在的指令和執行檔可以用，能省下許多開發時間，何不去用呢？]]></description><category>研究分享</category><category>Rust</category><category>Rust</category><category>execute</category><guid>https://magiclen.org/execute</guid><pubDate>Thu, 24 Sep 2020 20:00:24 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>Rust 程式語言如何在「trim」一個字串的同時去改變該字串？</title><link>https://magiclen.org/trim-in-place/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
Rust 程式語言的 String 物件有提供「trim」方法，可以用來去除字串頭尾的空白字元，不過這個方法會回傳字串切片(&#38;str)，而不會去更動到原來的 String 物件。不過在少數情況下，我們還是希望原來的 String 物件可以真正被「trim」。]]></description><category>Rust</category><category>Rust</category><category>trim-in-place</category><guid>https://magiclen.org/trim-in-place</guid><pubDate>Tue, 22 Sep 2020 20:00:00 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>用「async / .await」撰寫 Rust 並發程式</title><link>https://magiclen.org/rust-async-await/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
用「async / await」語法來撰寫並發與並行程式是現代程式語言流行的方式，比起傳統開啟新的執行緒來完成並發處理工作的目的，「async / await」可以在同一個執行緒下達到同樣的目的，非常適用於當並發處理的工作並不重的時候，能夠省下建立執行緒所產生的開支(overhead)。]]></description><category>研究分享</category><category>Rust</category><category>Rust</category><category>async/await</category><category>smol</category><category>async-std</category><category>tokio</category><guid>https://magiclen.org/rust-async-await</guid><pubDate>Thu, 17 Sep 2020 20:00:14 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何用 FFmpeg 將連續的圖片轉成影片？</title><link>https://magiclen.org/ffmpeg-image-sequence-encode/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2016/01/shot-06-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/01/shot-06-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/01/shot-06-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/01/shot-06-660x486.png 3x" alt>
用 FFmpeg 將連續的圖片轉成影片時，要依圖片檔名是連續編號、經過字典排序還是完全無順序，分別使用「%d」檔名格式、「-pattern_type glob」或「-f concat」參數來串接。這篇文章也會說明「-r」參數放在「-i」參數前後對影片長度與幀率的影響。]]></description><category>研究分享</category><category>軟體介紹</category><category>FFmpeg</category><category>影音</category><category>影像處理</category><guid>https://magiclen.org/ffmpeg-image-sequence-encode</guid><pubDate>Tue, 15 Sep 2020 12:00:25 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何清除 Nginx 的反向代理快取和 FastCGI 快取？</title><link>https://magiclen.org/nginx-cache-purge/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2020/09/sweep-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2020/09/sweep-220x162.png 1x, https://magiclen.org/wp-content/uploads/2020/09/sweep-440x324.png 2x, https://magiclen.org/wp-content/uploads/2020/09/sweep-660x486.png 3x" alt>
Nginx 是一個免費開源且穩定高效的 Web 伺服器程式，擁有反向代理以及負載平衡的功能，經常作為最前端的伺服器。當它用作反向代理伺服器或是 PHP 網頁伺服器時，無論是「proxy_pass」還是「fastcgi_pass」，均有提供快取的功能。然而，免費版本的 Nginx 並沒有內建刪除快取的機制（官方的「proxy_cache_purge」、「fastcgi_cache_purge」命令可...]]></description><category>作品分享</category><category>網路相關</category><category>軟體介紹</category><category>Linux</category><category>Lua</category><category>Nginx</category><category>Rust</category><category>nginx-cache-purge</category><category>curl</category><guid>https://magiclen.org/nginx-cache-purge</guid><pubDate>Thu, 10 Sep 2020 12:00:44 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>如何用 Rust 程式語言取得 Linux 的系統資訊？</title><link>https://magiclen.org/m-prober-lib/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
取得執行環境的作業系統資訊是開發軟體時經常會需要被實作的功能，Rust 作為一個系統級的程式語言，對於這部份自然會有許多解決方案。不過也由於 Rust 程式語言跨作業系統，因此許多取得系統資訊的套件也會以跨平台支援為主，這就導致取得到的資訊可能過於低階、不夠充份或是不統一，使得開發者還需要自行撰寫程式將零散的資訊處理為一般人習慣閱讀的格式。又或者取得系統資訊的方式是依靠系統中提供的指令工具，使得程...]]></description><category>研究分享</category><category>Rust</category><category>Rust</category><category>mprober</category><category>探針</category><category>mprober-lib</category><guid>https://magiclen.org/m-prober-lib</guid><pubDate>Tue, 8 Sep 2020 20:00:16 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>Rust 程式語言如何將定數於編譯階段時串接成字串？</title><link>https://magiclen.org/concat-with/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
Rust 程式語言強大的編譯器可以讓它在編譯階段時就去做完許多其它程式語言在執行階段才能進行的工作，像是 Rust 的標準函式庫，就有提供一個「concat」巨集，可以將任意數量定數(literal)直接串接成生命周期為「&#39;static」的字串切片(&#38;&#39;static str)]]></description><category>Rust</category><category>Rust</category><category>concat-with</category><guid>https://magiclen.org/concat-with</guid><pubDate>Thu, 3 Sep 2020 20:00:02 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>使用 Ubuntu Server 架設 FTP 伺服器(vsftpd + xinetd + PAM + SSL/TLS)</title><link>https://magiclen.org/ubuntu-server-vsftpd/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2020/09/ball-63527_1920-220x162.jpg" srcset="https://magiclen.org/wp-content/uploads/2020/09/ball-63527_1920-220x162.jpg 1x, https://magiclen.org/wp-content/uploads/2020/09/ball-63527_1920-440x324.jpg 2x, https://magiclen.org/wp-content/uploads/2020/09/ball-63527_1920-660x486.jpg 3x" alt>
FTP（檔案傳輸協定，File Transfer Protocol）顧名思義，是專門用來傳輸檔案的通訊協定，並且這個檔案傳輸的方向是雙向的，換句話說，FTP 伺服器可以提供檔案給客戶端，客戶端也可以上傳檔案到 FTP 伺服器上。vsftpd、pureftpd、proftpd 都是在 Linux 作業系統上很流行的 FTP 伺服器軟體，其中的 vsftpd 最輕巧，並以安全和效能為重。]]></description><category>Linux</category><category>研究分享</category><category>網路相關</category><category>FTP</category><category>Linux</category><category>SSL</category><category>Ubuntu</category><category>Ubuntu Server</category><category>vsftpd</category><category>xinetd</category><category>ss（指令）</category><guid>https://magiclen.org/ubuntu-server-vsftpd</guid><pubDate>Tue, 1 Sep 2020 12:00:02 +0800</pubDate><dc:creator>Magic Len</dc:creator></item></channel></rss>