Go语言中文网 为您找到相关结果 162

golang中三种定时器的实现方式及周期定时

一、定时器的创建 golang中定时器有三种实现方式,分别是time.sleep、time.after、time.Timer 其中time.after和time.Timer需要对通道进行释放才能达到定时的效果 package main import ( "fmt" "time" ) func main() { /* 用sleep实现定时器 */ fmt.Println(time.Now()) time.Sleep(time.Second) fmt.Println(time.Now()) /* 用timer实现定时器 */ timer := time.NewTimer(time.Second) fmt.Println(<-timer.C) /* 用after实现定时器 */ fmt.Print...阅读全文

博文 2019-07-23 18:32:43 七八个星天

Go channel 实现自增长ID

1 //autoInc.go 2 3 package autoInc 4 5 type AutoInc struct { 6 start, step int 7 queue chan int 8 running bool 9 } 10 11 func New(start, step int) (ai *AutoInc) { 12 ai = &AutoInc{ 13 start: start, 14 step: step, 15 running: true, 16 queue: make(chan int, 4), 17 } 18 19 go ai.process() 20 return 21 } 22 23 func (ai *AutoInc) process() { 24 defer fu...阅读全文

博文 2014-11-01 03:00:00 yumuxu

【人工智能】结合多个应用场景讲解智能语音交互技术与应用

课程介绍 智能语音交互,是基于语音识别、语音合成、自然语言理解等技术,为企业在多种实际应用场景下,赋予产品“能听、会说、懂你”式的智能人机交互体验。适用于多个应用场景中,包括智能问答、智能质检、法庭庭审实时记录、实时演讲字幕、访谈录音转写等。 本课程主要讲解智能语音相关技术,包括语音识别、人机交互、语音合成等。 课程目标 • 学习智能语音相关技术 适合人群 • 大数据、人工智能开发者 课时列表 • 课时1:人工智能与智能语音概述 • 课时2:语音识别技术及应用 • 课时3:人机自然交互平台技术及应用 • 课时4:语音合成技术及应用 • 课时5:智能语音交互产品介绍 敬请期待 • 课时6:通过SDK使用语音识...阅读全文

Go http.Get实战

``` package main import ( "fmt" "io/ioutil" "net/http" ) func main() { resp, err := http.Get("https://www.baidu.com") if err != nil { fmt.Println("http.Get err=",err) return } bytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("ioutil.ReadAll err=",err) return } fmt.Println(string(bytes)) } ``...阅读全文

博文 2019-05-07 15:26:38 commanding

快速掌握阿里云 E-MapReduce

课程介绍 E-MapReduce 是构建于阿里云 ECS 弹性虚拟机之上,利用开源大数据生态系统,包括 Hadoop、Spark、HBase,为用户提供集群、作业、数据等管理的一站式大数据处理分析服务。 本课程主要介绍阿里云 E-MapReduce 的使用方法。 学习入口:[点击这里](http://click.aliyun.com/m/27900/) 课程目标 掌握E-MapReduce的用法 适合人群 大数据工程师 阿里云大学官网(阿里云大学 - 官方网站,云生态下的创新人才工场...阅读全文

go语言中interface实现泛型编程

package main import ( “fmt” “reflect”) type GenericSlice struct { elemType reflect.Type sliceValue reflect.Value} func (self *GenericSlice) Init(sample interface{}) { value := reflect.ValueOf(sample) self.sliceValue = reflect.MakeSlice(value.Type(), 0, 0) self.elemType = reflect.TypeOf(sample).Elem()} func (self *GenericSlice) Append(e interface{})...阅读全文

博文 2015-07-03 16:00:01 webyh

用牛顿法实现开方函数