##雜七雜八感言: 啊… 我覺得我blog樣板好醜啊….應該要改成Patrick類似的… 本來想加回廣告的… 後來看到每天流量沒有破百…. 算了…. ##筆記: 以下是關於本週的學習筆記… ###[Golang] 一些有趣的package 跟 網站 goth: Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applications. 可以很快速地使用OAuth跟OAuth2的工具. switcher: Run SSH and HTTP(S) on the same port 可以同一個communication port 同時接受http跟https 或是ssh,透過protocol 不同, 比如說原本跑http的port 80,可以透過switcher把https的request導到另外一個process $ switcher –listen :80 –ssh 127.0.0.1:22 –default 127.0.0.1:8080 總覺得會是很有用的東西…. deck: Slide Decks 可以透過markup language來做投影片,挺有趣的. Docket - Custom docker registry that allows for deploys through bittorrent 有神人在Gopher Gala Golang 48 hour hackathon的作品.. 很特別的點子是.. 透過bittorrent來deploy go iOS.App() 一個關於如何用Go在iOS上面寫App的討論串,有不少成果可以看. goIosHelloWorld: a go ios hello world project Using Go in mobile apps: How I learned Go while integrating it into my iOS and Android app 記錄了如何用Go寫Android/iOS的App,一開始有先介紹如何使用cgo接下來就是如何寫出App. Gopher Gala 2015 hackathon 第一屆的Gopher hackathon,優勝者會在02/03揭曉,挺多有趣的專案說… ImgurGo: An open source image uploader by the Imgur team 這次Gala參賽作品.. imgur 團隊用go寫了圖片上傳網站… 還支援AWS… cool freegeoip: IP geolocation web server http://freegeoip.net 一個工具可以讓你用ip找到位址,只有第一次使用的時候會把資料庫下載下來.其他查詢都很快. Excellent Open Source Go Projects Go open source project 大排名,第一名竟然是Go-github.docker落到第十名…. : Hound: Lightning...
實在有點懶得用中文來寫了… 讓我用英文寫這篇吧… Before this.. I am learning about golang on server backend side programming via martini. I want to write a RESTful server communicate via JSON. Currently my framework as follow: Host on: Heroku DB: MongoDB Web framework: maritini Here is the note about how I add martini-secure HTTPS in martini. Working step with martini-secure 1. Create a SSL key using generate_cert.go You need create your localhost SSL key (or purchase one from CA) using generate_cert.go. I am not sure how to get this package, so I just download this source code and run it locally. go run generate_cert.go --host="localhost" You will get file “key.pem” and “cert.pem”, just put in your web side source code. 2. Apply martini-secure in martini program. It is very easy to add SSL as a plugin in martini, here is some code. At first I would like to host two services as follow: HTTP: port...
前言: 看起來每個禮拜一篇的紀錄會有點繁雜,應該要把所有文章拆開來一篇一篇儲存.但是很多部分沒辦法一次寫完又很痛苦. 再觀察看看要怎麼寫好了. 筆記: [Golang] 相關網頁與資源 EBOOK: Learn how to build and deploy web applications with Go. Golang Microsoft Version Info and Icon Resource Generato 在Windows上面可以幫你寫好版本資訊,對於之後要sign code或是其他build process會比較方便. Golang适合高并发场景的原因分析 這篇主要是講解一些Go的優點,以及Go是不是合作為大型伺服器的開發.裡面也提到所謂的C10K甚至到C10M也就是開發同時客戶超過一萬個與一百萬個的伺服器,是可以使用Go作為開發語言的.個人覺得這一篇相當適合詳細閱讀. 如何处理10000 TCP连接 千万级并发实现的秘密:内核不是解决方案,而是问题所在! Time parsing utility for Go http://godoc.org/github.com/dataence/timex Learning HTTP caching in Go 有寫Http Cache的部分滿值得看的, The Most Powerful Feature of Go Is The Least Sexy 提到很多Go的優點跟缺點,其實透過一般人所認為Go的缺點,反而會是Go最重要的優點… 比如說Go不支援 generics,可以讓速度更快.更不容易出問題. 不支援exception,但是支援multiple return卻可以讓program更容易控制,更不容易在意想不到的地方跳出去. 是不是很威? :) Provide basic charts in go Golang繪圖與畫圖工具,雖然說是basic charts但是裡面其實不論是長條圖,直方圖,條狀圖,折線圖,圓餅圖其實都有支援.看起來很實用 A compiler from Go (golang.org) to JavaScript for running Go code in a browser 把Golang一些邏輯可以完全轉到JS,也有出playground Sync MySQL data into elasticsearch 把MySql裡面的資料sync到ElasticSearch,很酷喔…. Go London User Group London的Go Group裡面有相當多的影片可以看. Mooc: Essential Go Go的線上課程,雖然一定要收費而且內容比較適合初學者. [Golang]關於JSON,如何處理敏感的資料: JSON Encoding in Go: Dealing with Sensitive Fields 這篇解決了我最近對於JSON struct tag的疑問. // 隱藏AuthToken ,在JSON中完全不會出現. type SafePerson struct { FirstName string LastName string AuthToken string `json:"-"` } // 如果沒有值,就不會出現在JSON裡面. type PrettySafePerson struct { FirstName string LastName string AuthToken string `json:",omitempty"` } [Go Boston] 2015-01 Meetup講稿 Go/Gorilla for MEAN Stack...
前言: 這個禮拜,總算有點時間可以去參加GTG.也順便多花了點時間研究Go…. 筆記: [Golang] 一些網址與資料 golang port of Google’s libphonenumber Go (Golang) code and table generator for CRUD functionality StreetCRUD is a code and table generation command-line utility for people who aren’t fans of ORMs, but appreciate a kick start creating struct methods, tables, and queries for basic CRUD functionality. Type-driven code generation for Go Code Generation using go-codec - for 2-20X performance improvement Using Go to improve your Ruby application’s performance Tango: Microkernel & pluggable web framework for Go Server Public Key Pinning in Go Decoding JSON streams with some garbage and slice/array garbage collection question 持續追蹤看看有沒有比較好的方式可以處理JSON的source如果有garbage Build dashboards using ascii/ansi art and javascript 用ascii跟ansi來顯示一些條狀圖跟線圖,而且是動畫. [Golang] 關於Golang的基礎執行環境 由於Go是compile只要用go win 版本compile成執行擋 (xxx.exe),最小大小為 2mb.可以在乾淨的Win7環境下直接執行. 就算有一些基本的fmt的函數也約為2mb左右. 可見執行環境相當的小. [Golang] 關於Golang與 C++的比較 (由dl.google.com為範例來比較) 主要是從這張slide擷取過來.內容是Google的人把dl.google.com從C++轉移到Go.優點如下: less than half the code more testable, tests same CPU usage for same bandwidth … but can do much more bandwidth … and more than one CPU less memory (!)...
前言: 本來還在思考要不要參加,但是剛好gtg slack上面有人願意把票讓出來.就趕快來聽聽.此次的相關資料在這裡. 研討會筆記: [POGA]Go Generate, trick to write Ruby 適合拿來寫 DSL Stirng/HASH Anywhere lack of “syntax eror” GO sort 不支援int64 sort, 其實只是多寫成4 lines :). 參考這篇 Because it’s four lines of code: type int64arr []int64 func (a int64arr) Len() int { return len(a) } func (a int64arr) Swap(i, j int} { a[i], a[j] = a[j], a[i] } func (a int64arr) Less(i, j int) bool { return a[i] < a[j] } Float64 is the more common float, int is the more common it, so both have predefined versions of this. self-refererencial function struct tag using reflect is slow, don’t use it in DSL. go generate 僅僅是regex來替換而非parser “go get” don’t run “go generate” for you slide: http://www.slideshare.net/poga/gtg12 與講者額外的談話: struct tag 可能會發生問題.. 由於json tag 是會被go compiler skip,但是極有可能會發生一些錯誤 tag 內名稱寫錯而永遠讀不到json的內容 不小心把一些語法寫在雙影號外面.(e.g. omit…) 寫錯不會造成整筆資料都是空的,而是某個欄位會變成空的.這就比較麻煩. 關於go generate 使用實例: 把他當成shell script 自我檢查,比如slide裡面的auto error [HAWK]miicasa etcd for IoT What is IoT? 物聯網 - 蒐集狀態機 透過簡單的 AND OR NOT的來控制....