[go-nuts] Jobs

2022-01-12 Thread Alex Dvoretskiy
What is a good way to find Go developers and Go jobs nowadays? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view

Re: [go-nuts] Very long API call

2019-03-27 Thread Alex Dvoretskiy
Yes, it's weird question... It's a POST request. The request passes search query to a graph database. Information about DNA sequences. List of Ids from database is expected. The question is, is it common for one API call like this to be 10Mb long? Or something completely wrong here, and API

Re: [go-nuts] Very long API call

2019-03-27 Thread Alex Dvoretskiy
It's length in characters. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

[go-nuts] Very long API call

2019-03-27 Thread Alex Dvoretskiy
I ran into a huge API call. 160 * 60. Can it be normal? Or something should be changed here for sure? Alex. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] pkg folder

2019-01-27 Thread Alex Dvoretskiy
Hi, do I have to have "$GOPATH/pkg" folder in Go v1.11.5? Looks like go modules save versions of pakages in this folder. But where packages stored if I use $GO111MODULE=on? $GOPATH should be ignored in this case so do pkg folder. Or I'm missing something? -- You received this message because

Re: [go-nuts] Why is this code runs sequentially?

2018-12-08 Thread Alex Dvoretskiy
ck: > https://play.golang.org/p/lMI8rmEBJ-d > > On Thu, 6 Dec 2018 at 23:40, Alex Dvoretskiy > wrote: > >> Hi Golangnuts, >> >> I'm trying to run SignerCrc32() concurently, but instead it runs >> sequentially. Can you explain why? >> >> https://play.golang.o

[go-nuts] Why is this code runs sequentially?

2018-12-06 Thread Alex Dvoretskiy
Hi Golangnuts, I'm trying to run SignerCrc32() concurently, but instead it runs sequentially. Can you explain why? https://play.golang.org/p/l5A3tBSqfs1 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: keep working on concurent pipe

2018-12-04 Thread Alex Dvoretskiy
Thanks. One question, we do "defer close(out)", but we don't close "in" channel. Why garbage collector don't remove "out" channel? We don't write nothing to it in function 3. So it should be empty. On Tuesday, December 4, 2018 at 3:52:45 PM UTC-8, Alex Dvoretskiy

[go-nuts] keep working on concurent pipe

2018-12-04 Thread Alex Dvoretskiy
I'm getting "fatal error: all goroutines are asleep - deadlock! on this code. Why? https://play.golang.org/p/KgJKu96PF7Q -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send

[go-nuts] Re: concurent pipe

2018-12-04 Thread Alex Dvoretskiy
Thanks, Burak. Great explanation! On Tuesday, December 4, 2018 at 10:57:03 AM UTC-8, Alex Dvoretskiy wrote: > > Hi Golangnuts, > > I'm trying to implement kind of pipe function, using channels > > Do you think this would be a correct conception: > > func Pipe(fs ...task

[go-nuts] concurent pipe

2018-12-04 Thread Alex Dvoretskiy
Hi Golangnuts, I'm trying to implement kind of pipe function, using channels Do you think this would be a correct conception: func Pipe(fs ...task) { ch1 := make(chan interface{}) ch2 := make(chan interface{}) for _, f := range fs { ch1, ch2 = ch2, ch1 go f(ch1, ch2) } } Can you also

Re: [go-nuts] recursion plus goroutines

2018-11-30 Thread Alex Dvoretskiy
Yes! This is perfect! On Friday, November 30, 2018 at 2:52:57 PM UTC-8, Justin Israel wrote: > > > > On Sat, Dec 1, 2018, 10:43 AM Alex Dvoretskiy > wrote: > >> Here is recursion. I d'ont know when its end. >> > > Do you mean that you want to wait for all 3

Re: [go-nuts] recursion plus goroutines

2018-11-30 Thread Alex Dvoretskiy
Here is recursion. I d'ont know when its end. On Friday, November 30, 2018 at 12:04:42 PM UTC-8, Burak Serdar wrote: > > On Fri, Nov 30, 2018 at 12:44 PM Alex Dvoretskiy > > wrote: > > > > Hi, > > > > How should I modify my code if I want to run thre

[go-nuts] recursion plus goroutines

2018-11-30 Thread Alex Dvoretskiy
Hi, How should I modify my code if I want to run three recursive functions in parallel? go inOrderTr(root) go preOrderTr(root) go postOrderTr(root) https://play.golang.org/p/n-QLR7V0H49 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Re: google civic api

2018-11-21 Thread Alex Dvoretskiy
gardless of the state field. > > On Tue, Nov 20, 2018 at 10:27 PM Alex Dvoretskiy > wrote: > >> I need the other states, CA, IL... and the other districts 3, 5, 15...: >> >> "ocd-division/country:us/state:wi/cd:3" >> "ocd-division/country:us/state:ca

[go-nuts] Re: google civic api

2018-11-20 Thread Alex Dvoretskiy
functions to get congressional district number? I can get the state from address. On Tuesday, November 20, 2018 at 4:38:26 PM UTC-8, Alex Dvoretskiy wrote: > > Hello, > > I'm writing a tool for extracting congressional district. Getting http > JSON response from google civic api.

[go-nuts] Re: go language sensitive editor?

2018-11-20 Thread Alex Dvoretskiy
If you using vim: https://github.com/fatih/vim-go On Tuesday, November 20, 2018 at 12:52:11 PM UTC-8, Pat Farrell wrote: > > I know, this is both a FAQ and an unanswerable question. I'm an old > programmer who has used nearly every editor known to man. I am not a fan of > whole-universe IDEs,

[go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
If you using vim, keep using it: https://github.com/fatih/vim-go On Tuesday, November 20, 2018 at 11:28:03 AM UTC-8, Alex Dvoretskiy wrote: > > > > file, err := os.Open(inputFile) > if err != nil { > log.Fatal(err) > } > defer file.Close() > scanner := bufio

[go-nuts] google civic api

2018-11-20 Thread Alex Dvoretskiy
Hello, I'm writing a tool for extracting congressional district. Getting http JSON response from google civic api. I need only one line *"name": "Wisconsin's 3rd congressional district" *How web developers usually proceed with such task? { "normalizedInput": { "line1": "9732 570th Avenue",

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
Yes, it's encoded in UCS-2, UTF-16. Should I just change encoding to UTF-8? What if I can't change encoding? On Tuesday, November 20, 2018 at 11:36:24 AM UTC-8, Ian Lance Taylor wrote: > > On Tue, Nov 20, 2018 at 11:30 AM, Alex Dvoretskiy > > wrote: > > go version

[go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
go version go1.10 windows/386 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

[go-nuts] scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
file, err := os.Open(inputFile) if err != nil { log.Fatal(err) } defer file.Close() scanner := bufio.NewScanner(file) address := "" scanner.Scan() scanner.Scan() address = scanner.Text() fmt.Println([]byte(address)) I'm reading string from file, but getting null value inserted as every other

[go-nuts] top N values

2018-11-06 Thread Alex Dvoretskiy
I'm working on algorithm to get top N values from int slice. This one is the best I can do. Heap structure. Is it possible to make it better? https://play.golang.org/p/Gz00Njz-54s -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] struct type assertion

2018-11-01 Thread Alex Dvoretskiy
Is it possible to implement type assertion from interface to struct?: https://play.golang.org/p/xK4mlF32_NR -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Heap of structs

2018-11-01 Thread Alex Dvoretskiy
nt it sorted by the fields you can implement the sort > interface[1] on either or both fields. > > 1 - https://godoc.org/sort#Interface > On Thu, Nov 1, 2018 at 15:57, Alex Dvoretskiy > wrote: > >> How can I rewrite this code to use a heap of structs instead of a heap of

[go-nuts] Heap of structs

2018-11-01 Thread Alex Dvoretskiy
How can I rewrite this code to use a heap of structs instead of a heap of ints? Have: type IntHeap []int Need: type str struct { num int, val string } type Heap []str https://play.golang.org/p/KHhIvKMkNMy -- You received this message because you are subscribed to the Google Groups

[go-nuts] non-standard json

2018-11-01 Thread Alex Dvoretskiy
Is there is a way to read a file line by line and extract JSON data from it? Example: file: ` value1: {"field1": "123, "field2": "123"} value2: {"field1": "456", "field2": "879"} ` I need to extract the struct in a loop: type s struct { field1 string field2 string } --

Re: [go-nuts] json.Marshal

2018-11-01 Thread Alex Dvoretskiy
; ``` > Struct values encode as JSON objects. Each exported struct field > becomes a member of the object, using the field name as the object key, > unless the field is omitted for one of the reasons given below. > ``` > > On Wed, 2018-10-31 at 23:07 -0700, Alex Dvoretskiy wr

[go-nuts] json.Marshal

2018-11-01 Thread Alex Dvoretskiy
11:07 PM (less than a minute ago) How can I get this json in output? [ { "s": 123, "id": "adsfasdf" }, { "s": 123, "id": "sefascss" } ] https://play.golang.org/p/cQNIKuGXRmj -- You received this message because you are subscribed to the

[go-nuts] json.Marshal

2018-11-01 Thread Alex Dvoretskiy
How can I get this json in output? [ { "s": 123, "id": "adsfasdf" }, { "s": 123, "id": "sefascss" } ] https://play.golang.org/p/AHcUO5IuByf -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Directory Structure in Markdown Synax

2018-10-29 Thread Alex Dvoretskiy
Looking for a Go code or algorithm, in general, to print out directory structure. Example: https://jekyllrb.com/docs/structure/ . ├── _config.yml ├── _data | └── members.yml ├── _drafts | ├── begin-with-the-crazy-ideas.md | └── on-simplicity-in-technology.md ├── _includes | ├── footer.html |

[go-nuts] Re: tests for variadic functions

2018-05-23 Thread Alex Dvoretskiy
I got it! max(test.vals...) On Wednesday, May 23, 2018 at 4:09:01 PM UTC-7, Alex Dvoretskiy wrote: > > How do you write test for variadic functions? > > For example I have function: > > func max(vals ...int) int { > m := 0 > for _, v := range vals { > if v &

[go-nuts] tests for variadic functions

2018-05-23 Thread Alex Dvoretskiy
How do you write test for variadic functions? For example I have function: func max(vals ...int) int { m := 0 for _, v := range vals { if v > m { m = v } return m } and how to write a few tests for it? I can't put vals ...int in struct package main import ( "testing" ) func TestMax(t

[go-nuts] Re: dynamic programming or something else

2018-05-14 Thread Alex Dvoretskiy
Just noticed. Even restructuring the code the way kjk did improved runing time, without caching. Amazing. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Re: dynamic programming or something else

2018-05-14 Thread Alex Dvoretskiy
Thanks! Cashing improved things dramatically. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

[go-nuts] Re: dynamic programming or something else

2018-05-14 Thread Alex Dvoretskiy
Thanks! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.

[go-nuts] dynamic programming or something else

2018-05-14 Thread Alex Dvoretskiy
Hello Golang Nuts I'm trying to solve a problem. Algorithm is correct, but too slow. Perhaps you can give me some ideas on how to improve running time? https://play.golang.org/p/XsXwT8EHtwC Thanks Alex -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] binary tree. different results on linux 64 and windows 32 machines.

2018-04-19 Thread Alex Dvoretskiy
Thanks a lot!!! On Thursday, April 19, 2018 at 11:55:49 AM UTC-7, Bakul Shah wrote: > > Terminate Scanf format strings with \n. To see why, do "go doc fmt.Scanf". > Always check the result of (at least) any input operation such as Scanf. > > On Apr 19, 2018, at 10:31 AM

[go-nuts] Re: binary tree. different results on linux 64 and windows 32 machines.

2018-04-19 Thread Alex Dvoretskiy
separator to the > input such as a semicolon? > > On Thursday, 19 April 2018 20:31:56 UTC+3, Alex Dvoretskiy wrote: >> >> Hello Golang-nuts, >> >> Following code reads data from file and creates binary tree structure: >> >> ' >> // go run main.go <

[go-nuts] binary tree. different results on linux 64 and windows 32 machines.

2018-04-19 Thread Alex Dvoretskiy
Hello Golang-nuts, Following code reads data from file and creates binary tree structure: ' // go run main.go < input package main import "fmt" type TreeNode struct { Value int Left *TreeNode Right *TreeNode } func main () { nodes := read() for i, node := range(nodes) { fmt.Printf("%p\n",

[go-nuts] formatting question/issue

2018-04-09 Thread Alex Dvoretskiy
Hello Golangnuts, Why there is no difference if the last comma exists? {'A', 'B', 'C', 'E'} or {'A', 'B', 'C', 'E',} both are valid. Sometimes it causes little troubles. For example, the second snippet wouldn't compile, because of different formatting. But these two snippets are identical

[go-nuts] Copy a slice to new memory adresses

2018-03-23 Thread Alex Dvoretskiy
Hello Golang nuts, For example, I have a multidimensional slice, which I want to modify, but keep an original slice untouched. Do I need to do this all the time or there is another convenient way to do this?: https://play.golang.org/p/YDn6ii52oOt Thanks Alex -- You received this message

[go-nuts] int int32 int64

2018-03-16 Thread Alex Dvoretskiy
Hello Golangnuts, I'm experiencing unexpected behavior. Trying to reverse integer. This code works on 64-bit machine, but working wrong on 32-bit: https://play.golang.org/p/p4Ptu8cx-b7 How can I generate an error in this case? Thanks -- You received this message because you are subscribed

[go-nuts] w, x += i, i+i

2018-02-28 Thread Alex Dvoretskiy
Hello Golang-nuts, When I'm doing assignments to multiple variables in one line, there is a limitation. You can do it in this way: w, x = w+i, x+i+i But can't in this one: w, x += i, i+i What do you think, it was done on purpose or this is something worth for change proposal?

[go-nuts] multiple-value f1() in single-value context

2018-02-27 Thread Alex Dvoretskiy
Hello Golang-nuts Why it is not allowed to pass function result like this to return?: https://play.golang.org/p/YPeaeW_4WZ6 Or it is allowed without declaring temporary variables i3, i4? Thanks Alex -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] json -> struct -> html template

2018-02-20 Thread Alex Dvoretskiy
Thanks, Burak! On Tuesday, February 20, 2018 at 4:29:44 PM UTC-8, Burak Serdar wrote: > > On Tue, Feb 20, 2018 at 5:23 PM, Alex Dvoretskiy > <advore...@gmail.com > wrote: > > Hello golang-nuts, > > > > https://play.golang.org/p/Lib9EfWcsjG > >

[go-nuts] json -> struct -> html template

2018-02-20 Thread Alex Dvoretskiy
Hello golang-nuts, https://play.golang.org/p/Lib9EfWcsjG If you run this code it works fine. But if you remove one "Actor" key - template stops executing: "template: movielist:10:14: executing "movielist" at <.Actor.Name>: can't evaluate field Name in type *main.Actor" Modified version:

Re: [go-nuts] time.AddDate() odd behavior

2017-10-31 Thread Alex Dvoretskiy
Go understanding. On Tuesday, October 31, 2017 at 1:32:47 PM UTC-7, Ian Lance Taylor wrote: > > On Tue, Oct 31, 2017 at 10:53 AM, Alex Dvoretskiy > <advore...@gmail.com > wrote: > > > > package main > > > > import ( > > "fmt" > &

[go-nuts] time.AddDate() odd behavior

2017-10-31 Thread Alex Dvoretskiy
Hello Golang-nuts, *package main* *import (* * "fmt"* * "time"* *)* *func main() {* * t := time.Date(2009, time.December, 31, 23, 0, 0, 0, time.UTC)* * fmt.Println(t)* * fmt.Println(t.AddDate(0, -1, 0))* *}* https://play.golang.org/p/hZ7nhnkepK The result is 2009-12-31 23:00:00 + UTC

Re: [go-nuts] nil maps

2017-10-27 Thread Alex Dvoretskiy
wow, super impressed! On Thursday, October 19, 2017 at 10:22:26 AM UTC-7, rog wrote: > > Or taking it a bit further: https://play.golang.org/p/g4uF2QjiJQ > > > On 18 October 2017 at 23:38, Alex Dvoretskiy <advore...@gmail.com > > wrote: > > Looks fun!: https:

Re: [go-nuts] nil maps

2017-10-18 Thread Alex Dvoretskiy
> t[x] = make(map[string]string) > } > t[x][y] = z > } > > func (t table) get(x, y string) string { > return t[x][y] > } > > The fact that t[x] can be indexed even if it hasn't been created makes > this much simpler. > > On Tue, Oct 17, 2017

[go-nuts] nil maps

2017-10-16 Thread Alex Dvoretskiy
Hello, Golang Nuts! I have an interesting question about maps. What is the possible usage of nil maps, which can be declared like "var m map[string]int"? You can't write to nil map but have an option to create it. Perhaps there is no use at all and this is just language specific feature?

[go-nuts] Re: math/big

2017-08-28 Thread Alex Dvoretskiy
Thanks, Michael! On Monday, August 28, 2017 at 3:33:52 PM UTC-7, Alex Dvoretskiy wrote: > > Does anyone uses package "math/big"? And what purpose? > > It looks like hard package to work with. At least at the beggining. > Even simple line of code takes some efforts to co

[go-nuts] math/big

2017-08-28 Thread Alex Dvoretskiy
Does anyone uses package "math/big"? And what purpose? It looks like hard package to work with. At least at the beggining. Even simple line of code takes some efforts to convert to big.Float: y := float64(py) / float64(heightP) * (ymax - ymin) + ymin -- You received this message because you