go

AI 告别炒作,Java 0 增长,2021 技术路在何方?

三世轮回 提交于 2021-02-05 17:03:59
【CSDN 编者按】去年,CSDN 整理了 O’Reilly 关于 2020 年技术趋势的解读 ,其中关于 Python、AI 和云平台的部分预测,在过去一年内都得到了验证。作为一个在线学习网站,O’Reilly 每年都会对开发者需要注意和探索的趋势进行解析。在最新的 2021 年的技术趋势报告中,有哪些新变化,又有哪些值得我们关注的信息,不妨通过本文来一探究竟 编译 | 李磊 责编 | 张文 出品 | CSDN(ID:CSDNnews) 受新冠疫情影响, 2020 年在线学习的使用量处于稳定增长,很多公司关闭了办公室,要求员工在家远程办公;线下教育也受到了冲击,线上教育同比增长了 96%,图书的使用量增加了 11%,教育视频的使用量增加了 24%。 疫情期间,不少公司急需在线业务的支持以维持生存,包括小型餐馆和农贸市场都增加了网上下单功能。在此之下,每个公司的开发部门成了一个非常重要的部门,为其业务提供各种技术支持。具体在技术、编程语言、工具框架层面,O’Reilly 通过数据分析发现: Python 使用量位列第一,并以 27% 的速度持续增长。 多重编程范式、并发编程、动态类型与静态类型的融合、低代码甚至无代码工具的普及将成为未来的趋势。 AI 的内容持续增长,机器学习增长了 14%,人工智能增长了 64%;数据科学增长了 16%,统计数据增长了 47%。 Web

why cannot use (type func(string)) as type func(interface{}) in assignment

五迷三道 提交于 2021-02-05 12:37:50
问题 Please first have a look at the code below. package main import "fmt" type InterfaceFunc func(interface{}) type StringFunc func(string) func stringFunc(s string) { fmt.Printf("%v", s) } func interfaceFunc(i interface{}) { fmt.Printf("%v", i) } func main() { var i = interfaceFunc var s = stringFunc i = s // I would like someone to explain why this can't be done exactly. } Run at https://play.golang.org/p/16cE4O3eb95 Why an InterfaceFunc can't hold a StringFunc while an interface{} can hold a

why cannot use (type func(string)) as type func(interface{}) in assignment

吃可爱长大的小学妹 提交于 2021-02-05 12:33:25
问题 Please first have a look at the code below. package main import "fmt" type InterfaceFunc func(interface{}) type StringFunc func(string) func stringFunc(s string) { fmt.Printf("%v", s) } func interfaceFunc(i interface{}) { fmt.Printf("%v", i) } func main() { var i = interfaceFunc var s = stringFunc i = s // I would like someone to explain why this can't be done exactly. } Run at https://play.golang.org/p/16cE4O3eb95 Why an InterfaceFunc can't hold a StringFunc while an interface{} can hold a

go-fcm: push notification critical sound [closed]

徘徊边缘 提交于 2021-02-05 12:32:51
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 days ago . Improve this question We are using this the library on our Go server. We need to send push notification with special key for sound object My code looks like: var NP fcm.NotificationPayload NP.Sound = "alert.caf" NP.Icon = "ic_alert" NP.Color = "colorAccent" NP.AndroidChannelID = "smartamsalarm" data

Uncompress gzip from byte array in golang

邮差的信 提交于 2021-02-05 12:28:37
问题 I have a bunch of files that come from some web requests, and some are gziped, i need to unpack them and print them as a string. This is the first time I try using golang, I tried some examples I found online but can't get it working. Here's the last test I was trying: package main import ( "bytes" "compress/gzip" "fmt" "io/ioutil" ) func main() { content := []byte{72,84,84,80,47,49,46,49,32,50,48,48,32,79,75,13,10,84,114,97,110,115,102,101,114,45,69,110,99,111,100,105,110,103,58,32,99,104

Reading data just written to a temp file

两盒软妹~` 提交于 2021-02-05 12:27:04
问题 In Go, I am trying to write data to a temp file that I then turn around and read but have not been successful. Below is a stripped down test program. I have verified that the data are being written to the file by inspecting the temporary file. So, at least I know that data are making it into the file. I just am then unable to read it out. Thank you for your help in advance package main import ( "bufio" "fmt" "io/ioutil" "log" "os" "path/filepath" ) func main() { tmpFile, err := ioutil

Reading data just written to a temp file

拜拜、爱过 提交于 2021-02-05 12:23:59
问题 In Go, I am trying to write data to a temp file that I then turn around and read but have not been successful. Below is a stripped down test program. I have verified that the data are being written to the file by inspecting the temporary file. So, at least I know that data are making it into the file. I just am then unable to read it out. Thank you for your help in advance package main import ( "bufio" "fmt" "io/ioutil" "log" "os" "path/filepath" ) func main() { tmpFile, err := ioutil

Ranging over map keys of array type and slicing each array gives the same array for each iteration

强颜欢笑 提交于 2021-02-05 12:16:34
问题 When trying to add int array keys of a map to a slice of int slices, ranging and using arr[:] to slice array doesn't work as expected. The resultant slice contains only duplicates of the "first" key in the map(commented out for loop). However, copying the array key to another variable and slicing the new variable works, and the resultant slice contains distinct map key values. I wonder why the copying is necessary. Isn't k , the array key, copied from the map as a new array at each iteration?

Confused about append() behavior on slices

大兔子大兔子 提交于 2021-02-05 12:15:57
问题 func main() { slice := make([]int, 10, 10) slice[0] = 0 slice[1] = 1 slice1 := slice slice1[0] = 10000 fmt.Println(slice) slice1 = append(slice1, 100) slice1[0] = 20000 fmt.Println(slice) } result: [10000 1 0 0 0 0 0 0 0 0] [10000 1 0 0 0 0 0 0 0 0] In my understanding, slice is a pointer, slice1 and slice point to the same array, and the first output also proves this. But why did slice 's value remain unchanged after the append operation changed slice1 ? 回答1: The append() didn't change

Ranging over map keys of array type and slicing each array gives the same array for each iteration

两盒软妹~` 提交于 2021-02-05 12:14:17
问题 When trying to add int array keys of a map to a slice of int slices, ranging and using arr[:] to slice array doesn't work as expected. The resultant slice contains only duplicates of the "first" key in the map(commented out for loop). However, copying the array key to another variable and slicing the new variable works, and the resultant slice contains distinct map key values. I wonder why the copying is necessary. Isn't k , the array key, copied from the map as a new array at each iteration?