Re: [go-nuts] How to conv [3]int to []int ?

2016-11-11 Thread Dan Kortschak
That's not necessary. https://play.golang.org/p/_iHnithuxz What a[:] does is create a slice header with the address pointing to the zeroth element of a. The code that is generated is exactly the same for both (you can check this with go tool compile -S). On Thu, 2016-11-10 at 23:46 -0800, steve

Re: [go-nuts] How to conv [3]int to []int ?

2016-11-11 Thread steve tang
great, many thanks:) On Friday, November 11, 2016 at 4:06:01 PM UTC+8, kortschak wrote: > > That's not necessary. > > https://play.golang.org/p/_iHnithuxz > > What a[:] does is create a slice header with the address pointing to > the zeroth element of a. > > The code that is generated is exact

[go-nuts] html/template modifies template outside of actions

2016-11-11 Thread Marvin Renich
In this code (at https://play.golang.org/p/HVxzsn0_eC) package main import ( "fmt" "html/template" "os" ) var tmpl = ` {{range .}} {{.}}{{end}} ` var items = []string{"one", "two", "three"} func main() { var t, err = template.New("").Parse(tmpl) if err == nil { e

[go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-11 Thread atd...@gmail.com
I haven't thought too much about it but there is possibly an alternative logic by having the wrappers add a Wrap() http.ResponseWriter that would return the wrappee. So first, one would test for that Wrapper interface, then return the wrappee if the test turns out to be positive. Then one could

Re: [go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-11 Thread Felix Geisendörfer
> I haven't thought too much about it but there is possibly an alternative > logic by having the wrappers add a Wrap() http.ResponseWriter that would > return the wrappee. > > So first, one would test for that Wrapper interface, then return the wrappee > if the test turns out to be positive. Th

Re: [go-nuts] html/template modifies template outside of actions

2016-11-11 Thread Ian Davis
On Fri, Nov 11, 2016, at 09:21 AM, Marvin Renich wrote: > the Execute method escapes the first character ('<' in " "<". This seems wrong to me, both logically and according to the > documentation, which states in the fourth paragraph under Overview for > text/template: > > all text outside act

[go-nuts] FPDF question (jung-kurt)

2016-11-11 Thread Arie van Wingerden
Hi, when I use AddFont I need a font specification in JSON format. But I really have no idea what should go in such a JSON file. I had this: pdf.AddFont("Ravie", "B", "c:\\windows\\fonts\\RAVIE.TTF") which is obviously wrong, since it only points to the font location in Windows. Any help ap

Re: [go-nuts] FPDF question (jung-kurt)

2016-11-11 Thread Konstantin Khomoutov
On Fri, 11 Nov 2016 12:27:25 +0100 Arie van Wingerden wrote: > when I use AddFont I need a font specification in JSON format. > But I really have no idea what should go in such a JSON file. > > I had this: > > pdf.AddFont("Ravie", "B", "c:\\windows\\fonts\\RAVIE.TTF") > > which is obviously

Re: [go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-11 Thread atd...@gmail.com
The goal is to check whether a http.ResponseWriter is a wrapper around another http.ResponseWriter. If so, we can check what the wrappee implements besides ServeHTTP(...). Maybe it is itself a wrapper. Maybe it is a Hijacker or ReadCloser... If this wrappee is itself a wrapper, the logic is rec

[go-nuts] Re: JSON parser

2016-11-11 Thread Sergio Hunter
Thanks so much all who help me, I appreciate it! Ok, for example: first row achieve: xÚ –Ûjã0 E ¥èÙ.:GWûWJ 2 e ¦} ù÷êb7Ú; yñòÖ> )º˜×Ÿoï?^ÿ ÿü5«Q+a ­{²yUY­>Í6[k&ónÖ‹9ŸÍ*b­ Œ¶çòX þ›Õ?/Ëu Éò¼äB~›õåRŸm{ êÛ_=˜Ì¶ü¼¹N—ÏW]x „Ym h " QÛ§oe?½ÜÚ Ì¤§i‘€X ÎL À3H 2 3EÊŠ Å àLu %õC BêÔ ˆ`Z@ñ #¨Õ‚iÙ Ši à

Re: [go-nuts] html/template modifies template outside of actions

2016-11-11 Thread Marvin Renich
* Ian Davis [16 06:04]: > On Fri, Nov 11, 2016, at 09:21 AM, Marvin Renich wrote: > > > the Execute method escapes the first character ('<' in " > "<". This seems wrong to me, both logically and according to the > > documentation, which states in the fourth paragraph under Overview for > > t

[go-nuts] time.Truncate output is _slightly_ different than expected

2016-11-11 Thread Brian Picciano
Here's a test case to show what I mean: func TestWat(t *T) { now := time.Now() trunc := rand.Int63n(int64(time.Second)) t.Logf("trunc: %v", trunc) t1 := now.Truncate(time.Duration(trunc)) t2 := time.Unix(0, trunc*(now.UnixNano()/trunc)) // this fails for some reason assert.Equal(t, t1, t2) } Fo

[go-nuts] Re: Concurrency and order of execution

2016-11-11 Thread mspaulding06
Okay, that makes sense. I've updated my solution so that in the case that the channel only has a capacity of 1 the processing will be done without goroutines to ensure that it is done in serial. In the case that the channel capacity is larger then I don't care about how processing is ordered.

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-11 Thread Felix Geisendörfer
> On 11 Nov 2016, at 12:57, atd...@gmail.com wrote: > > Now, I don't know if it solves your issue but that's a quick thought. No, as explained in my previous e-mail, this doesn’t fit my requirements. Anyway, thanks for your input. :) -- You received this message because you are subscribed to

Re: [go-nuts] go generate "pipelines"

2016-11-11 Thread Paul Jolly
Thanks for the feedback. > You would need to write the programs go generate is calling to be > idempotent, and have the second one exit quietly if the first hasn't run. > You would then either run go generate twice or have the first program run > go generate once it had completed. > Regarding su

Re: [go-nuts] go generate "pipelines"

2016-11-11 Thread Paul Jolly
> > Why not just run all those generate commands in a single go generate call, > such as a shell script or a go run? > >From go generate --help: *... Within a package, generate processes the source files in a package in > file name order, one at a time. **Within **a source file, generate runs > g

Re: [go-nuts] Why google cloud vision api cause memory issue when it is failed to detect

2016-11-11 Thread jba via golang-nuts
Please file an issue at https://github.com/GoogleCloudPlatform/google-cloud-java/issues. -- 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...@

[go-nuts] Re: [ANN] (GUI) Qt binding which supports Windows / macOS / Linux / Android / iOS / Sailfish OS / Raspberry Pi

2016-11-11 Thread therecipe
Thank you, I appreciate it :) Am Donnerstag, 10. November 2016 23:42:41 UTC+1 schrieb Rusco: > > Good to see some progress on the GUI front - I think you are up to > something ! > Rusco > > > > On Thursday, 10 November 2016 20:34:36 UTC, therecipe wrote: >> >> Hey everyone, >> >> I would like to

[go-nuts] Re: FPDF question (jung-kurt)

2016-11-11 Thread Kurt Jung
> > when I use AddFont I need a font specification in JSON format.But I really > have no idea what should go in such a JSON file. The JSON files in question contain metrics for the specified font. They are generated with the makefont utility that is included in the gofpdf package. See Nonsta

[go-nuts] Re: [ANN] (GUI) Qt binding which supports Windows / macOS / Linux / Android / iOS / Sailfish OS / Raspberry Pi

2016-11-11 Thread Tong Sun
Cool! Does it support the declarative QML ? On Thursday, November 10, 2016 at 3:34:36 PM UTC-5, therecipe wrote: > > Hey everyone, > > I would like to officially announce the project I'm working on for

[go-nuts] Partial Variable Assignment

2016-11-11 Thread so . query
I thought it was possible to do partial assignment where, if one variable is already declared and a new one is not. https://stackoverflow.com/questions/39028645/golang-variable-assignment In the below example ok has been declared prior, but v has not. Trying to run the below results in an error

Re: [go-nuts] Partial Variable Assignment

2016-11-11 Thread Gautam Dey
I think what is happening when you do the := is that the ok in there is getting shadowed (the for loop is creating a new block) and so the compiler see it as a new variable that is not being used. Sent from my iPhone > On Nov 11, 2016, at 18:49, so.qu...@gmail.com wrote: > > > I thought i

[go-nuts] Re: Partial Variable Assignment

2016-11-11 Thread paraiso . marc
No way, it only works in the same block : https://golang.org/ref/spec#Short_variable_declarations the for statement creates a new block . Le samedi 12 novembre 2016 03:49:35 UTC+1, so.q...@gmail.com a écrit : > > > I thought it was possible to do partial assignment where, if one variable > is

Re: [go-nuts] time.Truncate output is _slightly_ different than expected

2016-11-11 Thread Jakob Borg
You are dividing the number of nanoseconds since the Unix epoch by some random number of nanoseconds and chopping off the remainder. But a time.Time internally is an interval since another, much earlier, reference time. The remainder in that division will be different. //jb > On 11 Nov 2016,