摘要:断断续续学习golang 已经有大半年了。几次涉猎过golang net package, 去年也用过Beego,但是总觉得自己只知皮毛,不能精通。所以,这次誓将其一举拿下。达到知道其宏观组织结构,又了解实现细节,甚至设计时各种考虑以及折中。目标树立好了,后面的就靠实践了。学习也要有计划,有条理。规...
阅读全文
随笔分类 - go
摘要:学习java的时候,“设计模式”这个概念到处可见。比如java.io里面的 decorated pattern,Object.Clone(Object)原生态支持Prototype pattern,Swing事件响应的Observer pattern, io.util和Event中的Adapte...
阅读全文
摘要:Let's make some fun to simulation Server - Client.1. socketI implement a echo server and use telnet to simulate the socket client.in this way, we don'...
阅读全文
摘要:1. install and config 1). install ubuntu use samba to enable win7 users accessing ubuntu share folder. refer tohttp://www.7tutorials.com/how-cha...
阅读全文
摘要:0. create a string two ways to create a string 1) string([]byte) 2) str := "abc"1. Kinds of operation1) string converting to other and other conver...
阅读全文
摘要:1. kinds of operationIn general, there are several kinds of file operations as bellow.(1) Create file/folder, Open file, Close file, Remove file/folde...
阅读全文
摘要:今天试着按照上一篇博客的设计自己实现自己的crawler, 踩了一路坑。有些找到了答案,有些没有。我先将这些坑记录下来,然后divide and conquer。code snippet 1 package util 2 3 import ( 4 "math" 5 "sync" 6...
阅读全文
摘要:最近看了《Go并发编程实战》,学了最后一章的crawler。这是一个很好的demo, 设计功能完备,同时具有可扩展性。根据学到的思路简单总结一下,同时重复发明一下轮子。Version 01:比如:我们想爬一下一个外贸网站所有的 商品。其中,有三个component,(1) Downloader, 用...
阅读全文
摘要:1. router in golang1). sample code 1 package main 2 3 import ( 4 "fmt" 5 "net/http" 6 ) 7 8 func main() { 9 10 http.HandleFunc("/handlef...
阅读全文
摘要:1. environment for gowe don't need to set GOROOT, seehttp://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-reallyJust add the following lines ...
阅读全文
摘要:断断续续理了一下关于channel的一些概念,现在可以把下面的程序理清楚了。1. source code这个程序来自于《Go语言程序设计》 7.2.2 并发的Grep, 程序如下。package mainimport ( "bufio" "bytes" "fmt" "io" ...
阅读全文
摘要:I spent several hours to figure out some conceptions about channel tonight1. buffered channel and non-buffered channelbuffered channelbufferedchan := ...
阅读全文
摘要:I am focusing on this project: http://www.goinggo.net/2013/12/sample-web-application-using-beego-and.html this weekend.see: http://docs.mongodb.org/ma...
阅读全文
摘要:Recently, I study the package net/url of Golang.I was puzzled about the escape and unescape of url string.then I find a clear and accurate answer at:h...
阅读全文
摘要:from 《Go语言.云动力》 1 package main 2 3 import ( 4 "io" 5 "log" 6 "net/http" 7 "os" 8 "os/exec" 9 "strconv" 10 ) 11 12 v...
阅读全文
摘要:I list some questions in Go in my daily life and the corresponding answer.QA 1.the reader <-channel will be blocked until the writer write the channel...
阅读全文
摘要:1. gocrawl 类结构 1 // The crawler itself, the master of the whole process 2 type Crawler struct { 3 Options *Options 4 5 // Internal fields 6 ...
阅读全文
摘要:1. install beegoFirstly, I have installed Go and set the enviroment and set PATH.However, I fail to download github.com/astaxie/beego.solution: install git and set the PATH asC:\Program Files (x86)\Git\binthen rund:>go get github.com/astaxie/beegothen the files are created as 2.install bee and ad
阅读全文
摘要:1. install go2. configure sublimehttp://blog.csdn.net/cyxcw1/article/details/103294813.io package1) io.Reader 1 // io.Reader 接口示例 2 package main 3 4 import ( 5 "fmt" 6 "io" 7 "os" 8 "strings" 9 )10 11 func main() {12 FOREND:13 for {14 readerMenu()15 16 var ch
阅读全文

浙公网安备 33010602011771号