HarrySun

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2014年12月6日

摘要: 今天试着按照上一篇博客的设计自己实现自己的crawler, 踩了一路坑。有些找到了答案,有些没有。我先将这些坑记录下来,然后divide and conquer。code snippet 1 package util 2 3 import ( 4 "math" 5 "sync" 6... 阅读全文
posted @ 2014-12-06 18:31 HarrySun 阅读(2533) 评论(1) 推荐(0) 编辑

2014年12月4日

摘要: 最近看了《Go并发编程实战》,学了最后一章的crawler。这是一个很好的demo, 设计功能完备,同时具有可扩展性。根据学到的思路简单总结一下,同时重复发明一下轮子。Version 01:比如:我们想爬一下一个外贸网站所有的 商品。其中,有三个component,(1) Downloader, 用... 阅读全文
posted @ 2014-12-04 23:52 HarrySun 阅读(673) 评论(0) 推荐(0) 编辑

2014年11月6日

摘要: 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... 阅读全文
posted @ 2014-11-06 21:31 HarrySun 阅读(477) 评论(0) 推荐(0) 编辑

2014年10月12日

摘要: 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 ... 阅读全文
posted @ 2014-10-12 00:29 HarrySun 阅读(264) 评论(0) 推荐(0) 编辑

2014年9月19日

摘要: 断断续续理了一下关于channel的一些概念,现在可以把下面的程序理清楚了。1. source code这个程序来自于《Go语言程序设计》 7.2.2 并发的Grep, 程序如下。package mainimport ( "bufio" "bytes" "fmt" "io" ... 阅读全文
posted @ 2014-09-19 02:37 HarrySun 阅读(865) 评论(0) 推荐(0) 编辑

摘要: I spent several hours to figure out some conceptions about channel tonight1. buffered channel and non-buffered channelbuffered channelbufferedchan := ... 阅读全文
posted @ 2014-09-19 00:45 HarrySun 阅读(151) 评论(0) 推荐(0) 编辑

2014年8月30日

摘要: 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... 阅读全文
posted @ 2014-08-30 00:19 HarrySun 阅读(392) 评论(0) 推荐(0) 编辑

2014年8月24日

摘要: 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... 阅读全文
posted @ 2014-08-24 23:04 HarrySun 阅读(1407) 评论(0) 推荐(0) 编辑

2014年8月20日

摘要: 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... 阅读全文
posted @ 2014-08-20 01:31 HarrySun 阅读(227) 评论(0) 推荐(0) 编辑

2014年7月7日

摘要: 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... 阅读全文
posted @ 2014-07-07 00:31 HarrySun 阅读(323) 评论(0) 推荐(0) 编辑