Home » 2016 » June (Page 4)

蘋果 App Store 收費模式的改變

在「APP STORE 2.0」這邊提到了正式的訪談:

In a rare pre-WWDC sit-down interview with The Verge, Phil Schiller, Apple’s senior vice president of worldwide marketing, said that Apple would soon alter its revenue-sharing model for apps.

70/30 的拆分方式有改變,並且擴大開放的範圍:

While the well-known 70 / 30 split will remain, developers who are able to maintain a subscription with a customer longer than a year will see Apple’s cut drop down to 15 percent. The option to sell subscriptions will also be available to all developers instead of just a few kinds of apps. "Now we’re going to open up to all categories," Schiller says, "and that includes games, which is a huge category."


另外在 John Gruber 跟 Phil Schiller 的電話訪談「The New App Store: Subscription Pricing, Faster Approvals, and Search Ads」提到了更多項目。

Netflix 評估影片品質的方法

Netflix 在發了一篇很長的文章,說明怎麼評估 video quality:「Toward A Practical Perceptual Video Quality Metric」,文章雖然有點長,但其實還蠻好懂的...

講的白話一點,Netflix 想要做各種壓縮方式的改善,但在超大的量的情況下 (scale) 缺乏自動化打分數的機制:

All of the challenging work described above hinges on one fundamental premise: that we can accurately and efficiently measure the perceptual quality of a video stream at scale.

如果先不考慮 scale 問題,影片的評估方式有人工處理以及常見的計算方法 (像是 MSEPSNRSSIM):

Traditionally, in video codec development and research, two methods have been extensively used to evaluate video quality: 1) Visual subjective testing and 2) Calculation of simple metrics such as PSNR, or more recently, SSIM.

前者因為牽涉到人工,所以不 scale,而後者跟「人的觀感」還是不夠正相關:

Without doubt, manual visual inspection is operationally and economically infeasible for the throughput of our production, A/B test monitoring and encoding research experiments.

Although researchers and engineers in the field are well-aware that PSNR does not consistently reflect human perception, it remains the de facto standard for codec comparisons and codec standardization work.

Netflix 的作法其實很簡單:(但是每一步都很仔細)

  • 首先先把影片依照手上有的 metadata 歸類,然後再挑出代表性的剪輯,並且產生不同 bitrate 的檔案。
  • 用人工對這些剪輯評分。
  • 用機器產生各種既有計算方法的分數 (PSNR、SSIM、...)。
  • 用數學方法把人工的與機器算的分數建立 model。
  • 然後對於未知的影片先寄算出既有方法的分數 (PSNR、SSIM、...),然後套用 model 推估人的觀感。

沒什麼特別發明出來的演算法,只是苦工 XDDD

清出一個乾淨的 Git Repository

自動化機制中,要確保可以拿到最新的 Git Repository 最保險的方法是 rm -rf 掉再重新 clone 一份,但對於稍微大一點的 repository 速度就太慢了,所以得想辦法保留 repository 加快速度。

目標是想要處理 submodule 的變更,並且仍然可以處理 force push 時的災難,避免需要人工介入... 這在建各種自動化機制時常常會用到,像是用 Fortify SCA 白箱掃描,或是 CI & CD 機制上。

git fetch --force
git reset --hard origin/"${BRANCH}"
git submodule sync --recursive
git submodule update --init --force
git clean --force --force -d -x
git checkout "${BRANCH}" --force

用了很多 --force 主要是要處理 force push 後的收拾 :o

其實如果想要處理的更好的話,可以在發生錯誤時改走 mv (保留屍體) + 重新 clone 的機制,並且發警報出來讓管理者事後研究,這樣發生問題當下還是可以先提供服務。

不過這個想法還只在腦袋裡還沒寫... XD

把主力手機從 iPhone 換到 Android

上次主力用 Android 應該是 HTC Desire 時代了,那個時候跑得是 2.2。

總算把 LG G2 (D802) 刷完機器了 (刷了半年,每次都卡關 XDDD),這次刷了 CyanogenModOpen GApps,儘量都用 command line 來刷。

adb devices # 看裝置順便打 RSA public key 進去
adb shell # 進去後可以 ls/su 看一看
adb push filename.zip /sdcard/
adb reboot recovery

Android Marshmallow (6.0) 另外多了對權限的管理,這也是想刷到 6.0 的原因之一,使用者可以隨時 revoke 掉某些權限 (沒有處理好的會 crash XD):

Android Marshmallow introduces a redesigned application permission model: there are now only eight permission categories, and applications are no longer automatically granted all of their specified permissions at installation time. An opt-in system is now used, in which users are prompted to grant or deny individual permissions (such as the ability to access the camera or microphone) to an application when they are needed for the first time. Applications remember the grants, which can be revoked by the user at any time.

其他安裝的流程主要都是苦工了,尤其是 2FA 是少數為了安全性只能一個一個換的東西 (不提供 export,都是用手機提供的 HSM 避免被盜走),剛好趁機會把自己與公司用到的 2FA 帳號分開。

Android 上的 Google Authenticator 不怎麼好用 (不能調整位置,另外不希望隨時都給密碼),測了測 Red Hat 出的 FreeOTP Authenticator 算是比較好用的,就把 FreeOTP Authenticator 拿來給個人用,Google Authenticator 拿來給公司的帳號用。

繼續熟悉現在的 Android 環境,應該會有一陣子不習慣...

在 C 裡 Concurrency 的 Library

看到「libdill: Structured Concurrency for C」這個東西,在 C 裡實作了兩個不同種類的 concurrency,一個是 proc (process-based) 一個是 go (corouting-based)。

支援的 function 算是蠻清晰的,範例也很清楚:

#include <libdill.h>
#include <stdio.h>
#include <stdlib.h>

coroutine int worker(const char *text) {
    while(1) {
        printf("%s\n", text);
        msleep(now() + random() % 500);
    return 0;

int main() {
    msleep(now() + 5000);
    return 0;

也有 channel 的觀念可以用,之後需要寫玩具的話應該是個好東西...

DVD 的發行時間差異導致盜版

MPAA 資助的報告顯示 DVD 的發行時間差異導致盜版:「DVD Release Delays Boost Piracy and Hurt Sales, Study Shows」,報告在「Windows of Opportunity: The Impact of Piracy and Delayed International Availability on DVD Sales」這邊可以看到。


"When we run our regressions on Spain and Italy alone, we observe a 10% drop in sales for every 10-day delay in legal availability, as compared to a 2% drop in sales for every 10-day delay in the entire sample," the paper reads.

"Our results suggest that an additional 10-day delay between the availability of digital piracy and the legitimate DVD release date in a particular country is correlated with a 2-3% reduction in DVD sales in that country," the researchers write.


Wal-Mart 與 Uber/Lyft 合作迎戰 Amazon

Amazon 透過各種技術整合的比較好 (像是先前發表無人機空運的技術 Amazon Prime Air),而 Wal-Mart 則是跟 Uber/Lyft 這樣的公司配合:「Wal-Mart Plans to Test Grocery Delivery Through Uber, Lyft」。


The move steps up competition with Amazon’s burgeoning grocery-delivery service and provides a potential new avenue of growth for Uber and Lyft. The idea is to let Wal-Mart customers pick out groceries online and then have employees fill the order and give it to one of the ride-hailing companies’ drivers. Shoppers will pay a $7-to-$10 delivery charge to Wal-Mart to have the groceries brought to their door.


Twitter 上看到「Efficient High-Speed WPA2 Brute Force Attacks using Scalable Low-Cost FPGA Clustering」這篇論文,講比較便宜的 FPGA 破 WPA2 的最佳化。主要的成果可以從表格看到,這是 FPGA 的:

Ztex 1.15y 應該是「USB-FPGA Module 1.15y: Quad-Spartan 6 LX150 FPGA Board with USB 2.0 Microcontroller」這組,而 Ztex 2.16 應該是「USB-FPGA Module 2.16: Artix 7 XC7A200T FPGA Board with USB 2.0」,價位 (美金) 也都標在上面了。

而這是 GPU 的效能:

可以看出來 FPGA 的速度還蠻快的,但用電相當省。不過不得不說 WPA2 用的 PBKDF2 的確讓破解的難度高了很多,讓我想到這個: