在go 的程序中调用 c 代码, golang 提供了两种方法: ? cgo, swing 。gstreamer 是开源跨平台的多媒体框架库,主要是在gnome 基础核心库 glib 之上构建。下面有一个简单的使用cgo 包装 gstreamer playbin 插件的...
分类:
其他好文 时间:
2015-02-02 18:22:12
阅读次数:
167
//?code?by?shaoyongyang
package?main
import?(
????"fmt"
????"time"
)
func?say(s?string)?{
????fmt.Println(s)
}
func?main()?{
????go?say("who?are?you?")
????go?s...
分类:
编程语言 时间:
2015-02-01 02:03:55
阅读次数:
500
继承 package?main
import?(
????"fmt"
)
type?People?struct?{
????name???string
????age????int
????weight?int
}
type?Student?struct?{
????People
????special...
分类:
其他好文 时间:
2015-01-31 23:23:00
阅读次数:
382
//?code?by?shaoyongyang
package?main
import?(
????"fmt"
)
type?People?struct?{
????name???string
????age????int
????weight?int
}
type?Student?struct?{
????...
分类:
其他好文 时间:
2015-01-31 22:01:41
阅读次数:
204
//?code?by?shaoyongyang
package?main
import?(
????"fmt"
)
var?t?int?=?1
var?fslice?[]int
func?main()?{
????doSomeThing(1,?2,?3,?4)
????return
}
func?doSomeThing(a...
分类:
其他好文 时间:
2015-01-31 19:31:40
阅读次数:
643
出于效率等原因,最近将web框架由martini切换为了beego,其他地方都很平顺,只是两个框架的handler签名不一致,需要修改,所以耗时较长,这是预计到的。但是有一个地方没有预计到,也耗费了较多时间,那就是静态文件的服务。 用过martini的tx都知道,在mairtini中如果我们设...
分类:
其他好文 时间:
2015-01-30 15:05:42
阅读次数:
146
商域无疆 (http://blog.csdn.net/omni360/)本文遵循“署名-非商业用途-保持一致”创作公用协议转载请保留此句:商域无疆 - 本博客专注于敏捷开发及移动和物联设备研究:数据可视化、GOLANG、Html5、WEBGL、THREE.JS,否则,出自本博客的文章拒绝转载或再转载...
分类:
Web程序 时间:
2015-01-29 14:29:43
阅读次数:
206
labix.org/v2/mgo/bson 包虽然是MongoDB的golang实现,其中产生唯一ID的算法是独立的,不依赖MongoDB, 提炼这部分的代码如下: package main import ( "crypto/md5" "crypto/rand" "encoding/binary" ...
分类:
其他好文 时间:
2015-01-29 12:16:44
阅读次数:
894
先看实现代码: package main import ( "crypto/md5" "encoding/hex" "fmt" ) func main() { h := md5.New() h.Write([]byte("123456")) // 需要加密的字符串为 123456 cipherStr...
分类:
其他好文 时间:
2015-01-28 17:24:01
阅读次数:
165
一. 下载官方源码?https://github.com/golang/mobile git?clone?https://github.com/golang/mobile.git 二. 将mobile目录移动到 $gopath/golang.org/x中 mkdir?-p?$gopath/golang.org/x?&&?mv?mobile?$...
分类:
移动开发 时间:
2015-01-28 11:25:22
阅读次数:
436