go

Get a tree like structure out of path string

只谈情不闲聊 提交于 2020-12-26 06:43:30
问题 I am stuck since 2 days, as I am not to firm with pointers and recursion. I have an array of path like structures, lets say: s:=[]string { "a/b/c", "a/b/g", "a/d", } With a data structure like this: type Node struct { Name string `json:"name"` Children []Node `json:"children"` } I would like to end up with something like this: { "name": "a", "children": [ { "name": "b", "children": [ { "name": "c", "children": [] }, { "name": "g", "children": [] } ] }, { "name": "d", "children": [] } ] } I

How to connect kafka to external server.ip

筅森魡賤 提交于 2020-12-26 04:59:12
问题 I have Kafka set up on my local machine, and I'm using github.com/segmentio/kafka-go to implement consumer producer model and working fine with localhost. But wanted to connect to an external server that is running on EC2. ip:= X_XXX_XXX_XXX func CreateTopic() { _, err := kafka.DialLeader(context.Background(), "tcp", "ip:9092", "indicator", 0) if err != nil { fmt.Println("error in creating topic: " + err.Error()) } } func ListofTopics() { conn, err := kafka.Dial("tcp", "ip:9092") if err !=

金蝶K3 WISE BOM多级展开_BOM成本表

微笑、不失礼 提交于 2020-12-26 03:44:39
/* ***** Object: StoredProcedure [dbo].[pro_bobang_BOMCost] Script Date: 07/29/2015 16:09:11 ***** */ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON drop proc pro_bobang_BOMCost GO create PROC [ dbo ] . [ pro_bobang_BOMCost ] @FBomNumber1 varchar ( 50 ), -- bom单号 @FBomNumber2 varchar ( 50 ) -- bom单号 as begin SET ANSI_WARNINGS OFF set nocount on -- 1.--业务员查找某个BOM单,包含所有BOM(已使用,未使用,已审核,未审核) with cte as ( select convert ( varchar ( 100 ), '' ) as cen,Finterid,FBOMNumber as fppbomnumber, convert ( varchar ( 50 ), '' ) as fpbomnumber,Fbomnumber AS FCbomnumber,fitemid,fitemid as fpitemid, 0 as

金蝶K3 WISE BOM多级展开_物料齐套表

一世执手 提交于 2020-12-26 02:01:35
/* ***** Object: StoredProcedure [dbo].[pro_bobang_ICItemQiTao] Script Date: 07/29/2015 16:12:10 ***** */ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO alter PROC [ dbo ] . [ pro_bobang_ICItemQiTao ] @FBomNumber1 varchar ( 50 ), -- bom单号 @FBomNumber2 varchar ( 50 ) -- bom单号 as begin set nocount on -- 1.--业务员查找某个BOM单,包含所有BOM(已使用,未使用,已审核,未审核) with cte as ( select convert ( varchar ( 100 ), '' ) as cen,Finterid, convert ( varchar ( 50 ), '' ) as fpbomnumber,Fbomnumber AS FCbomnumber,fitemid,fitemid as fpitemid, 0 as fpinterid, convert ( decimal ( 18 , 4 ), 1 ) as FBomQty, convert ( varchar (

document.referrer和history.go(-1)退回上一页区别

我是研究僧i 提交于 2020-12-25 18:16:22
javascript:location=document.referrer;和javascript:history.go(-1);区别: 返回上一页,在PC端我们可以使用: history.go(-1) 或者 history.back(),可以正常返回第一层。这样,我们不需要上一页的 url 具体是什么,只要使用 history 一般都没啥问题。 但是在移动端,如果想要返回上一页。比如从A页面跳到B页面,如果B页面想返回A页面,为了防止不会跳错,必须要有一个 < 按钮,给它加 history.go(-1) ,返回上一层。 <a href="javascript:history.go(-1)" class="header-back jsBack">返回</a> 那如果我们没有返回上一页的 < 的按钮,在手机上怎么操作才会返回上一页,比如:从微信分享进来的,进入的是微信内页,此时,内页就是第一页,它没有上一页,要怎么返回?这时点返回按钮是没有反应的,不是一个好的用户体验,十有八九的人会误以为是BUG,这绝对是个坑爸的问题。 移动端无论是原生app还是传统的网页,返回上页是一个比较强烈的需求。 javascript 有一个可以获取前一页面的URL地址的方法: document.referrer document.referrer 的来源 referrer 属性可返回载入当前文档的文档的

How to check if a file is executable in go?

久未见 提交于 2020-12-25 15:35:51
问题 How would I write a function to check whether a file is executable in Go? Given an os.FileInfo , I can get os.FileInfo.Mode() , but I stall out trying to parse the permission bits. Test case: #!/usr/bin/env bash function setup() { mkdir -p test/foo/bar touch test/foo/bar/{baz.txt,quux.sh} chmod +x test/foo/bar/quux.sh } function teardown() { rm -r ./test } setup import ( "os" "path/filepath" "fmt" ) func IsExectuable(mode os.FileMode) bool { // ??? } func main() { filepath.Walk("test", func

How to check if a file is executable in go?

我与影子孤独终老i 提交于 2020-12-25 15:32:22
问题 How would I write a function to check whether a file is executable in Go? Given an os.FileInfo , I can get os.FileInfo.Mode() , but I stall out trying to parse the permission bits. Test case: #!/usr/bin/env bash function setup() { mkdir -p test/foo/bar touch test/foo/bar/{baz.txt,quux.sh} chmod +x test/foo/bar/quux.sh } function teardown() { rm -r ./test } setup import ( "os" "path/filepath" "fmt" ) func IsExectuable(mode os.FileMode) bool { // ??? } func main() { filepath.Walk("test", func

How to check if a file is executable in go?

烈酒焚心 提交于 2020-12-25 15:28:13
问题 How would I write a function to check whether a file is executable in Go? Given an os.FileInfo , I can get os.FileInfo.Mode() , but I stall out trying to parse the permission bits. Test case: #!/usr/bin/env bash function setup() { mkdir -p test/foo/bar touch test/foo/bar/{baz.txt,quux.sh} chmod +x test/foo/bar/quux.sh } function teardown() { rm -r ./test } setup import ( "os" "path/filepath" "fmt" ) func IsExectuable(mode os.FileMode) bool { // ??? } func main() { filepath.Walk("test", func

How to check if a file is executable in go?

天大地大妈咪最大 提交于 2020-12-25 15:25:21
问题 How would I write a function to check whether a file is executable in Go? Given an os.FileInfo , I can get os.FileInfo.Mode() , but I stall out trying to parse the permission bits. Test case: #!/usr/bin/env bash function setup() { mkdir -p test/foo/bar touch test/foo/bar/{baz.txt,quux.sh} chmod +x test/foo/bar/quux.sh } function teardown() { rm -r ./test } setup import ( "os" "path/filepath" "fmt" ) func IsExectuable(mode os.FileMode) bool { // ??? } func main() { filepath.Walk("test", func

How to check if a file is executable in go?

断了今生、忘了曾经 提交于 2020-12-25 15:24:47
问题 How would I write a function to check whether a file is executable in Go? Given an os.FileInfo , I can get os.FileInfo.Mode() , but I stall out trying to parse the permission bits. Test case: #!/usr/bin/env bash function setup() { mkdir -p test/foo/bar touch test/foo/bar/{baz.txt,quux.sh} chmod +x test/foo/bar/quux.sh } function teardown() { rm -r ./test } setup import ( "os" "path/filepath" "fmt" ) func IsExectuable(mode os.FileMode) bool { // ??? } func main() { filepath.Walk("test", func