Linux 上 fcitx5 的小麥輸入法

Twitter 上看到小麥輸入法宣佈支援 Linuxfcitx5 的消息:

專案在 GitHub 上的「fcitx5-mcbopomofo: 小麥注音輸入法 fcitx5 模組」這邊,因為我自己的 Ubuntu 20.04 桌機還是跑 fcitx 4.x (用酷音輸入法,裝的是 fcitx-chewing 這個套件),暫時先放著好了,但幫忙宣傳一下...

也許可以找機會練習包到 Ubuntu 的 PPA 上面,等有空吧...

Mac 上的小麥輸入法大改版 (2.0,不過目前已經又出 2.0.1 了)

Twitter 上看到 zonble 的推文:

整串可以看「Thread by @zonble on Thread Reader App」這邊,在 GitHub 上面的 release note 也可以參考:「Release 2.0 · openvanilla/McBopomofo」,不過要注意如果要下載的話,記得抓 bugfix 後的版本:「Release 2.0.1 · openvanilla/McBopomofo」。

對我來說最大的進步就是詞庫這塊了,可以直接加進去學習方便不少...

GET 與 POST 的差異

看到這篇在講 HTTP (& HTTPS) 裡面 GET 與 POST 的差異,剛好把一些標準的定義拿出來翻一翻,算是複習基本概念:「Get safe」。

第一個基本概念主要是 idempotence (& idempotent),重複被呼叫不會造成狀態的再次改變:

Idempotence ([...]) is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application.

數學定義是這樣跑:

An element x of a magma (M, •) is said to be idempotent if:

x • x = x.

If all elements are idempotent with respect to •, then • is called idempotent. The formula ∀x, x • x = x is called the idempotency law for •.

這點在 HTTP 標準 (RFC 7231) 裡面的定義也類似:

A request method is considered "idempotent" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.

第二個基本概念是 Safe method (也是在同樣的 RFC 裡被提到),主要的思想是 read-only,這也是文章作者的標題要講的事情:

Request methods are considered "safe" if their defined semantics are essentially read-only; i.e., the client does not request, and does not expect, any state change on the origin server as a result of applying a safe method to a target resource. Likewise, reasonable use of a safe method is not expected to cause any harm, loss of property, or unusual burden on the origin server.

然後標準的 HTTP method 是有定義的:

   +---------+------+------------+---------------+
   | Method  | Safe | Idempotent | Reference     |
   +---------+------+------------+---------------+
   | CONNECT | no   | no         | Section 4.3.6 |
   | DELETE  | no   | yes        | Section 4.3.5 |
   | GET     | yes  | yes        | Section 4.3.1 |
   | HEAD    | yes  | yes        | Section 4.3.2 |
   | OPTIONS | yes  | yes        | Section 4.3.7 |
   | POST    | no   | no         | Section 4.3.3 |
   | PUT     | no   | yes        | Section 4.3.4 |
   | TRACE   | yes  | yes        | Section 4.3.8 |
   +---------+------+------------+---------------+

不過文章裡面提到的第一個例子並沒有很好,POST 不保證 safe 沒錯,但不代表 safe operation 就不能用 POST。

這邊用 URI resource 的概念 (以及 SEO?) 或是用 Post/Redirect/Get 的概念來說明會比較好:

<form method="get" action="/search">
<input type="search" name="term">

不過文章後續提到的問題的確就是我自己都會犯錯的問題:

“Log out” links that should be forms with a “log out” button—you can always style it to look like a link if you want.

“Unsubscribe” links in emails that immediately trigger the action of unsubscribing instead of going to a form where the POST method does the unsubscribing. I realise that this turns unsubscribing into a two-step process, which is a bit annoying from a usability point of view, but a destructive action should never be baked into a GET request.

這兩個動作都會造成 server 端的狀態改變,不應該用 GET,而我自己常常忘記第一個... 這邊其實可以用 form 產生 POST 需求,並且用 css 效果包起來,達到看起來跟一般的連結一樣。

寫起來讓自己多一點印象,之後避免再犯一樣的錯誤...

在 Galera Cluster 上的 DDL 操作 (e.g. ALTER TABLE)

Percona 整理了一份關於 Galara Cluster 上 DDL 操作的一些技巧,這包括了 Percona XtraDB ClusterMariaDB 的版本:「How to Perform Compatible Schema Changes in Percona XtraDB Cluster (Advanced Alternative)?」。

在不知道這些技巧前,一般都是拿 Percona Toolkit 裡的 pt-online-schema-change 來降低影響 (可以降的非常低),所以這些技巧算是額外知識,另外在某些極端無法使用 pt-online-schema-change 的情境下也可以拿來用...

裡面的重點就是 wsrep_OSU_method 這個參數,預設的值 TOI 就是一般性的常識,所有的指令都會被傳到每一台資料庫上執行,而 RSU 則是會故意不讓 DDL 操作 (像是 ALTER TABLE) 被 replicate 到其他機器,需要由管理者自己到每台機器上執行。

利用這個設定,加上透過工具將流量導到不同後端的資料庫上,就有機會分批進行修改,而不需要透過 pt-online-schema-change 這種工具。

Tails 3.13 把注音輸入法的 bugfix 放進去了

在「Tails 裡的注音輸入法終於修好了...」這邊有提到 Tails 的注音輸入法爛掉很久的問題,以及對應的 bugfix 測的差不多了,不過當時一直還沒確定會不會在這個版本修正。

剛剛在「Tails 3.13 is out」這邊的公告裡看到把這個 bugfix 納入 Tails 3.13 了:

Add support for the Bopomofo input method for Chinese using the Chewing library and improve support for the Pinyin input method. (#11292)

後續要再來測操作順暢性的問題了...

Tails 裡的注音輸入法終於修好了...

Tails 是一個獨立的 Debian 作業系統,強調匿名性,裡面有很多環境的預設值是為了避免 IP 位置以及其他資訊洩漏而設計。另外因為是獨立完整的作業系統,可以找台電腦用 USB 開機直接跑起來,避免 OS 被埋木馬的問題 (當然如果硬體有問題的話還是沒辦法)。

大多數人用 Tails 的人應該還是拿來跑 Tor Browser,不過我在用的時候發現注音輸入法有問題 (大約三年前?),就跑去開了一張 bug ticket 回報:「Bopomofo input for Chinese is not working」,從裡面的討論可以看到中間有 ping 我,但是我忘記回應了... 直到最近動了起來剛好有看到,就抓了 snapshot ISO 幫忙測了一下,畢竟沒幾個用注音的人在上面可以確認 :o

目前看起來輸入法本身的問題修差不多了,而且有機會在下個版本看到 (或是下下個版本,要看會不會進這次的 merge window)。

想要測試的人,除了要抓這個版本的 snapshot ISO 外 (在 bug ticket 裡有連結),在 Tails 開機時,要記得要在 Language 的地方選擇台灣:

開進去後就可以看到注音輸入法了,用 Super + Space 可以切換輸入法:(Super 通常指的是微軟鍵,或是 Mac 右邊的 Command 鍵,因為左邊的 Command 可能被當 Host key 了)

還有一些小 bug 要另外再處理 (像是切換輸入法的 input focus 會跑掉),不過比以前完全不能用好多了...

在 Mac 上快速換輸入法的方法:Kawa

三月的時候在「在 Mac 上快速切換輸入法」這邊提到了 IMEShortcuts,但有時候還是不會生效...

在「GitHub 中那些不错的免费软件」這篇裡面提到了 open source 的 utatti/kawa 這個專案,裡面有針對 CJKV 輸入法的 bug 提供 workaround,就給個機會測試看看:

There is a known bug in the TIS library of macOS that switching keyboard layouts doesn't work well when done programmatically, especially between complex input sources like CJKV.

而且最近變得可以用 Homebrew 管理了,這樣之後升級比較方便。

Google 推出 iOS 上的搜尋輸入法 Gboard

Google 推出了 iOS 上的搜尋輸入法 Gboard:「Meet Gboard: Search, GIFs, emojis & more. Right from your keyboard.」,可以在 App Store 上下載「Gboard — Search. GIFs. Emojis & more. Right from your keyboard.」,目前只有英文版可以用,其他語言還要等:

Get it now in the App Store in English in the U.S., with more languages to come.

可以參考 Google 做的 GIF 動畫,把搜尋的功能結合進去了:

John Gruber 寫了一篇「Gboard」關於隱私問題的討論,看起來還頗正面的。除了搜尋結果當然會需要傳到 Google 的系統裡以外,只有 crash log 會匿名傳回去。

Amazon CloudFront 支援 POST 了...

看起來是飛出國那天發表的,Amazon CloudFront 支援 POST 了:「Amazon CloudFront - Content Uploads Via POST, PUT, other HTTP Methods」。

標題上寫了不少東西,不過看起來都是一樣的... 這次的功能是把 POST 類的 HTTP method 往後送,所以整個網站都可以丟上 CloudFront,並且只用單一 domain 就可以同時處理靜態加速與動態修改。

愈來愈接近其他商業 CDN 先驅能提供的功能了...