Hello World
CodeTengu Weekly 碼天狗週刊
@vinta - I failed the Turing Test
@saiday - Imnotyourson
@tzangms - Oceanic / 人生海海
@vinta
10 awesome features of Python that you can't use because you refuse to upgrade to Python 3
Python 3 已經是大勢所趨,從 Python 3 Wall of Superpowers 可以看到絕大部分的熱門 packages 都已經支援 Python 3,即使沒有,你多半也可以在 GitHub 上找到 Python 3 fork。
我前陣子才把一個公司的專案和兩個個人的 side projects 升級到 Python 3.4,利用 caniusepython3、2to3 和這一份 cheat sheet 可以解決大部份的瑣碎工作。不過,即使升級到 Python 3,終究還是擺脫不了 UnicodeDecodeError 吶。
MySQL 索引原理及慢查询优化
中國的「美团网」的工程師分享針對 MySQL queries / indexes optimization 的實戰經驗。如果想要更有系統地學習相關知識,當然還是要讀一下聖經 High Performance MySQL。
延伸閱讀: MySQL Performance Blog
如何使用 Redis
關於 Redis 的科普文章,介紹了基本的資料操作指令與 Redis 的使用情境。
Redis 可能是應用範圍最廣的 NoSQL 資料庫了,可以用在 cache、session、counter、message queue、排行榜統計、計算共同好友等等,因為支援各種常用的資料結構,甚至被稱為 data structure server。根據 Redis 作者 @antirez 的推文,Redis 也快要有 GEO API 了。
延伸閱讀:
How to take advantage of Redis just adding it to your stack
Sourcegraph
Sourcegraph 是王垠(中國知名程序員、技術評論界的戰鬥機、語言設計界的天煞孤星)之前待過的公司所開發的程式碼靜態分析服務,用來做 code review 的神器,支援 Go、Haskell、Java、JavaScript、Python、Ruby 這幾種語言。可惜的是目前只開放託管在 GitHub 上的 open source 專案免費使用,還不支援 private repositories。
延伸閱讀:
Sourcegraph: Better code reviews - YouTube
Sourcegraph - Chrome Web Store
数字时代的劳动与剥削
作者提出了一個很有趣的論點,對於依靠 UGC (User-Generated Content) 而壯大的企業的反思。比如說你在 Facebook、Instagram 或 Twitter 上產生了有價值的內容,吸引了更多的用戶或廣告主,為這些公司帶來了利益與財富,而你並沒有拿到任何實質的報酬,其實你就是被剝削了。當然,你可以說你在這些平台上獲得了某些金錢無法比擬的東西,比如說知識、名聲或歸屬感。
延伸閱讀:
Digital Labor: The Internet as Playground and Factory - Amazon.com
@saiday
NSOprationQueue 與 GCD 的區別與選用
最近開始慢慢將一些 GCD 轉換成 NSOperationQueue。心得是需要可以取消、設定優先級、執行狀態就使用 NSOperationQueue,反之則繼續使用 GCD。
延伸閱讀:
NSOperation by NSHipster
Advanced NSOperations talk at WWDC
Objective-C Runtime
在 Objective C Runtime 比較常用到的是 Associated Objects 跟 Method Swizzling,但是可以在本文瞭解一下 Runtime 幫我們處理的 messages 轉發跟 @dynamic, @property 實作。
Xcode: One Weird Debugging Trick That Will Save Your Life
Swift 發展至今在 Debug 上一直被大家抱怨,在它更完善之前這個 po $arg1 小技巧是蠻實用的啊。
Adaptive Auto Layout
PureLayout 的作者的 Talk,主要是針對 Auto Layout 在螢幕旋轉時的 best practice,即使你沒有要支援旋轉也可以看一下關於 Auto Layout performance considerations 的部分,節錄「Activating multiple constraints at once can be more effcient than one-by-one」。
Slides from the talk (PDF):
https://tiny.cc/AdaptiveAutoLayoutSlides
Should I use a Swift struct or a class?
雖然說 struct 跟 class 在選擇的時候都沒什麼猶豫過,但是仔細想想是蠻有學問的,節錄自 tl;dr:
- If you find yourself talking to "something else" inside your struct code, where "something else" is the file system, the network, the GPS, you have made a wrong turn somewhere.
- If you find yourself with structs that contain structs that contain structs that contain structs, you have probably made a wrong turn somewhere. You'll discover that way the hell down there somewhere you forgot a mutating, and now you have to mark mutating for all the things.
- Most types don't need to be threadsafe. Most instances do. Use struct for the 10% of your types that make 90% of the instances. Use class for the 90% of your types that make up 10% of your instances.
- If overloading == to compare two things elementwise sounds like a great idea, use a struct. If you hesitate, use a class.
Mastering "Product Flavors" on Android
無論是切 debug 或 production 環境、 free 或 paid 版本,這都是 Gradle 的 Product Flavors 適合拿來做的事情。
@tzangms
Building Analytics at 500px
500px 的 Analytics Lead 說明 500px 的數據分析, 從一開始用 Splunk 跟 MySQL, 後來採用 Luigi 搭配 Redshift 的做法, 一直到最後採用 Periscope 的歷程。 數據分析是我最近在研究的方向, 本文值得一看、學習。
Technical onboarding at Hootsuite
Hootsuite 說明他們技術人員如何 onboard, 技術上除了開發人員所熟知的 technical debt 之外, 當團隊成長也會有所謂的 team debt。
文中提到的, 他們在 HipChat 當中開一個頻道叫 "Who Owns It?" 用來發問誰負責某件事, 的確是個很棒的創意。 是當公司人多的時候, 像是是非技術人員會不知道技術問題要找誰, 例如: 誰要幫新進的行銷人員開帳號? 以往可能會問技術部門負責人, 再分配下去, 但公司成長到一個狀態的時候, 技術負責人往往很容易變成瓶頸。
另外還有提到 Hootsuite 新人 onboard 從 Day One 開始的系統化流程, 當中的 Welcome email 也是個很棒的主意。
mycli
Mycli is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.
用 pip 或是 brew 都可以裝, 我最愛這種安裝簡便的工具了啊。
