2013年9月11日
摘要:
1 package main 2 3 import ( 4 "net" 5 "os" 6 "fmt" 7 "io/ioutil" 8 ) 9 10 func Clear() {11 //以下的打印语句不会执行12 //使用os.Exit()作为程序的退出方式时,会跳过defer的执行;13 fmt.Println("===========[Exit function execute]===========")14 fmt.Println("Clear() is executing.&q
阅读全文
posted @ 2013-09-11 16:21
笔记吧... 可能只有自己看得懂
阅读(441)
推荐(0)
2013年9月10日
摘要:
1 package main 2 3 import "fmt" 4 5 type Vector []float64 6 7 func (v Vector) DoSome(i,n int, u Vector, c chan float64) { 8 var sum float64 9 for ; i<n; i++ {10 sum += u[i]11 }12 c <- sum 13 }14 15 const NCPU = 216 17 func (v *Vector) DoAll(u Vector) {18 c := make(chan float64, NC...
阅读全文
posted @ 2013-09-10 18:10
笔记吧... 可能只有自己看得懂
阅读(842)
推荐(0)
摘要:
|------ |------- |-------manager.go |-------manager_test.go |------- |-------play.go |-------mp3.go |-------wav.go |-------- |-------mplayer.go |------ |-----------------------------------------------------------...
阅读全文
posted @ 2013-09-10 13:54
笔记吧... 可能只有自己看得懂
阅读(1371)
推荐(0)
2013年9月9日
摘要:
|------(手动添加,代码存放处) |------sorter.go |------ |-------- |-------qsort.go |-------qsort_test.go |-------- |-------bubblesort.go |-------bubblesort_test.go|------ (自动生成,保存静态编译文件) |--...
阅读全文
posted @ 2013-09-09 17:35
笔记吧... 可能只有自己看得懂
阅读(1105)
推荐(0)
2013年9月2日
摘要:
1 package main 2 3 import "fmt" 4 5 func fibon(c,quit chan int) { 6 x,y := 1,1 7 for { 8 select { 9 case c <- x: //给主线程写数据10 x,y = y, x+y11 case <- quit: //给主线程写数据12 fmt.Println("quit")13 return14 }15 }16 }17 18 func main() {19 c := make(chan ...
阅读全文
posted @ 2013-09-02 20:34
笔记吧... 可能只有自己看得懂
阅读(1598)
推荐(0)
摘要:
1 package main 2 3 import( 4 "fmt" 5 "reflect" 6 ) 7 8 func main(){ 9 // iterate through the attributes of a Data Model instance10 for name, mtype := range attributes(&Dish{}) {11 fmt.Printf("Name: %s, Type %s\n", name, mtype.Name())12 }13 }14 15 // Data Model16 typ
阅读全文
posted @ 2013-09-02 17:35
笔记吧... 可能只有自己看得懂
阅读(922)
推荐(0)
摘要:
继承 1 package main 2 3 import "fmt" 4 5 type Skills []string 6 7 type person struct { 8 name string 9 age int10 weight int11 }12 13 type Student struct {14 person //继承15 Skills16 int17 spe string18 }19 20 func init() {21 22 }23 24 func main() {25 xuxu := Student{person{"xuxu",...
阅读全文
posted @ 2013-09-02 15:09
笔记吧... 可能只有自己看得懂
阅读(6064)
推荐(0)
摘要:
1 package main 2 3 import . "fmt" //notice 1 4 5 type testInt func(uint32) bool 6 7 func isOdd(integer uint32) bool { 8 if integer%2 == 0 { 9 return false10 }11 return true12 }13 14 func isEven(integer uint32) bool {15 if integer%2 == 0 {16 return true17 }18 return false19 }...
阅读全文
posted @ 2013-09-02 13:33
笔记吧... 可能只有自己看得懂
阅读(1083)
推荐(0)
2013年8月6日
posted @ 2013-08-06 17:19
笔记吧... 可能只有自己看得懂
阅读(279)
推荐(0)
摘要:
hiredis是redis开源库对外发布的客户端API包。当redis-server配置启动后,可以通过hiredis操作redis资源。主要分为: strings、hash、lists、sets、sort setshiredis使用较为简单,下面是几个主要的函数和对象: /*作用:用于连接redis服务器 ip : 为redis的ip地址; port: 端口地址; tv:连接超时的参数;*/ redisContext *redisConnectWithTimeout(const char *ip, int port, struct timeval tv);/*作用:执行命令c:redisC.
阅读全文
posted @ 2013-08-06 17:18
笔记吧... 可能只有自己看得懂
阅读(8422)
推荐(0)