##雜七雜八感言: 開始把一些內容分成別篇文章,最近多花了很多時間讀XMPP Spec挺有趣的. ##筆記: [Golang] 關於Golang 有趣的網頁與小工具 GRPC: Go Project 支援HTTP/2之外,還支援九種以上的語言.並且可以擺脫net/rpc原本需要管理gob的痛苦. Gore: Yet another Go REPL that works nicely. Featured with line editing, code completion, and more. 另外一個Go REPL的工具,支援許多shortcut跟即時顯示… Viper: A configuration tool of Go 用來讀取與使用Config的工具,開發者是spf13 Hugo的開發者.當然,Hugo也有使用Viper Wide: A Web-based IDE for Teams using Golang. https://wide.b3log.org 相當酷的網站,可以online 寫go而且有資料夾的概念.並且有syntax highlighter的. [Golang] Meetup Youtube Playlist: London Go Gathering February 2015 FOSDEM 2015 Video list Go at CoreOS by +Kelsey Hightower This session will discuss using Go to build products that make distributed computing as stress-free as installing a Linux distribution. Finding Bad Needles in Worldwide Haystacks by Dmitry Savintsev Experience of using Go for a large-scale web security scanner Moving MongoDB components to Go by +Norberto Leite We love Go and this train is unstoppable! CockroachDB by +Tobias Schottdorf Towards an Open-Source Spanner HTTP/2 for Go by +Brad Fitzpatrick Overview of HTTP/2 and the design of Go’s support for it Go and...
前言: 原本的問題是出現在Stackoverflow,有人發問template.HTML(“test”) == “test” 可以過,但是template.HTML(“test”) == some_str 卻不能成 功compiler. 原因: 主要的原因是由於Go 本身是static typing的程式語言,而constant本身的型別是未定,並且對於constant在compiler的狀態下是會有一些型別轉換的. // 型別尚未確定 const hello_string = "Hello, 世界" // 型別確定為字串 fmt.Printf(" type is %T \n", hello_string) //type is string 範例程式碼: 根據The Go Blog: Constants 裡面有詳細提到關於Go 是 statical typing的一些問題. 接下來用幾個範例解釋: package main import ( "fmt" ) func main() { // hello Type is not define for now. const hello = "Hello, 世界" // Type is String const typedHello string = "Hello, 世界" // hello type is cast to string fmt.Printf("Type of hello is=%T, typedHello is=%T \n", hello, typedHello) // hello is non-type it convert to string and compare fmt.Println(hello == typedHello) //Another sample. Define MyString as a string type type MyString string var m MyString // m is non-type for now. m = "Hello, 世界" // It will introduce error, because m type is MyString and typeHello is string. //fmt.Println(m == typedHello) // hello is non-type until compare with...
Preface After some study about mongodb in some web server usage, I occur some question and need to resolve it. Here is three major questions I found here. Question 1: Auto increase number Question 2: Check field(column Auto increase number This question comes from the usage of MySQL auto increase sequence number. I am wondering if there is similiar mechanism in MongoDB. There is a official article about MongoDB implement auto-increasementing Sequence Field. The simple idea, is to add extra record in your database to storage this field. It might impact as follow: Your index might need to refere this field. Your query all need filter(ignore) the sequence record. (refer to “check field if exist”) For the FindAndModify mechanism in MongoDB, the mgo has similar implement about “Apply”. type DBSequence struct { ID string `json:"id"` // ID is a string ID, in this case I will use collection.Name as it...
##雜七雜八感言: 最近工作都在弄Go的Server,應該之後會把心得整理一下. 發現用Go 來處理網路的相關封包,其實相當的方便又好用啊. ##筆記: ###[Golang] 一些有趣的package 跟 網站 pt: A path tracer written in Go. 一個用Goy做的光影追蹤程式,透過gopher 3D來繪圖. Dave Cheney: Visualising the Go garbage collector 一個工具可以使覺化Go GC的狀態圖.. Go Challenge: Learn Go by solving problems and getting feedback from Go experts! 怎麼快速學習程式語言?最好的方式就是拿它來解決問題,這邊每個月有一個問題提供出來~讓大家用Go來解決…. Fucking Go Date Format 列出一些讓人很困擾的Go Date format… Go concurrency is not parallelism: Real world lessons with Monte Carlo simulations 透過一些取樣方式來證明其實Goroutine並沒有那麼的並行…. JSON, interfaces, and go generate 關於Go裡面Json資料的處理方式….. Go: Socket-level Programming 教學文章… 用Go處理TCP或是UDP server/client其實相當簡單,可以處理的事情也幾乎都包好了.. 許多的細節.. 等我弄的差不多在整理文章….. Cockroachdb 大部份使用go完成的資料庫系統…. Githut: A SMALL PLACE TO DISCOVER LANGUAGES IN GITHUB 用圖形表示在Github觀察的現象,包含做多repostories 還有最多commit跟最多issue,也有最近最多人關注的部分…. A curated list of awesome Go frameworks, libraries and software http://awesome-go.com/ 有人記錄他覺得很棒的Go toolkit list根據他的分類.常常有忽然想到要什麼 toolkit 卻又想不到名字的窘境.. 看來maintain 自己一份toolkit list 也不錯…之前放 bookmark 後來放blog 還是一樣… 似乎有份list 比較重要.. 分門別類… tag Go-kit Peter 另外的list for morden enterprise. Go-kit.io 也是一份list gosms-Your own local SMS gateway Self host SMS system, sounds good, but I am using twilio for now. ###[Golang] 關於JSONRPC 心得筆記 利用JSONRPC package 可以很快速地建立一個JSON RPC Server/Client架構. 這裏有一個簡單的example可以參考,主要要注意的事情如下:...