[go-nuts] Re: Trouble querying REST API with net/http (api verified working with curl)

2016-06-23 Thread mark mellar
Good tip on using httputil to inspect the request! Unfortunately I'm not seeing anything obviously wrong... Using curl -v * Trying ... * Connected to host.here.com () port 443 (#0) * TLS 1.0 connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA * Server certificate: host > GET /rest/json/flows

[go-nuts] Trouble querying REST API with net/http (api verified working with curl)

2016-06-23 Thread Tamás Gulácsi
Just a blind shoot into the darkness: try to use one (global) http.Client! Also, you can ask curl to dump the request, and net/http/httputil also to compare them. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group an

Re: [go-nuts] How to init a global map

2016-06-23 Thread Tamás Gulácsi
No penalty - a map is already a pointer. -- 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:/

Re: [go-nuts] undefined: syscall.LoadLibrary

2016-06-23 Thread Ian Lance Taylor
On Thu, Jun 23, 2016 at 6:16 PM, wrote: > On https://github.com/golang/go/wiki/WindowsDLLs it says: > >> First way: Dynamically load a dll, then call a method on it. You can call >> the method via "syscallXX" (the XX is number of parameters, but if it has >> few than that, like if you need seven

[go-nuts] undefined: syscall.LoadLibrary

2016-06-23 Thread andre
On https://github.com/golang/go/wiki/WindowsDLLs it says: > First way: Dynamically load a dll, then call a method on it. You can call the method via "syscallXX" (the XX is number of parameters, but if it has few than that, like if you need seven parameter, then syscall9 will still work, you jus

[go-nuts] Re: windows gamepad access

2016-06-23 Thread rbirac
On Tuesday, June 21, 2016 at 9:36:56 PM UTC-7, rbi...@cox.net wrote: > > Hi all, > I'm just getting started with Go and, for various reasons, want to run > under Windows 10. I need to read a gamepad (x360) which is read by a > Windows hid driver. I can't find any posts here or elsewhere

[go-nuts] Trouble querying REST API with net/http (api verified working with curl)

2016-06-23 Thread mark mellar
Hi folks, We have a REST API in our organisation which I'd like my Go program to query. I'm able to get the data using curl curl -c ./cookies -k -H "Content-Type: application/json" -X POST -d '{"user":"admin","password":"admin"}' "https://hostmane.here.com:443/rest/json/login"; curl -k -s -b

Re: [go-nuts] Does pprof enabled in production gives a significant impact in performance?

2016-06-23 Thread Marcos Oliveira
Ian, Thank you for the answer. It will be bound to localhost so only engineers and SREs will have access. -- Marcos > On Jun 23, 2016, at 5:34 PM, Ian Lance Taylor wrote: > >> On Thu, Jun 23, 2016 at 12:41 PM, Marcos Oliveira wrote: >> >> We are to deploy a service in production and there

Re: [go-nuts] How to be safe in Go?

2016-06-23 Thread Caleb Spare
> To see if the the > race detector would find this potential bug for me, I ran the code with the > mutex(s) commented out with the -race flag on and didn't get a warning. Did you make some concurrent requests? The race detector only tells you about races that happen, so you need to excercise the

Re: [go-nuts] Does pprof enabled in production gives a significant impact in performance?

2016-06-23 Thread Ian Lance Taylor
On Thu, Jun 23, 2016 at 12:41 PM, Marcos Oliveira wrote: > > We are to deploy a service in production and there's the question if we > should keep pprof and its HTTP handlers enabled by default in the service or > if we should have a flag that enables them when needed, but that would > require a r

[go-nuts] How to be safe in Go?

2016-06-23 Thread Nick Pavlica
All, While learning Go from the book "The Go Programming Language", by Addison-Wesley I was working through an example and was taken back by how easy it is to cause a data race. The book states that each incoming request is run in a separate goroutine by the server so that it can handle mult

Re: [go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
On Thu, Jun 23, 2016 at 6:54 PM, Val wrote: Even in OO style (e.g. java), you would not be able to write > Set s = null; > s.init( list(1,2,3) ); > > This is (more or less) the same problem with value receiver... the > "constructor-like" idiom in go is a function NewSet, not a method : https:

Fwd: [go-nuts] How to init a global map

2016-06-23 Thread Val
Sorry, last link should be: https://play.golang.org/p/_n56yMhlRt Writing all this on smartphone is possible but tedious and error-prone! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fro

Fwd: [go-nuts] How to init a global map

2016-06-23 Thread Val
Even in OO style (e.g. java), you would not be able to write Set s = null; s.init( list(1,2,3) ); This is (more or less) the same problem with value receiver. However, map is a reference type, so once the map has been created you really can use value receiver : https://play.golang.org/p/FePU2I-

Re: [go-nuts] How to init a global map

2016-06-23 Thread andrey mirtchovski
line 17 can become: *s = make(set, len(slice)) -- 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, v

Re: [go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
wow, that way. Thanks! On Thu, Jun 23, 2016 at 6:28 PM, Val wrote: > https://play.golang.org/p/DTtGs3FiwZ > > -- > You received this message because you are subscribed to a topic in the > Google Groups "golang-nuts" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/top

Re: [go-nuts] How to init a global map

2016-06-23 Thread Val
https://play.golang.org/p/DTtGs3FiwZ -- 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://gro

Fwd: [go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
Is it possible to fix and make the *validSub.Init*([]string{"aa", "bb", "cc"}) works instead? Coming from the OO world, this is a form that I feel more comfort with. Thx. -- Forwarded message -- From: andrey mirtchovski Date: Thu, Jun 23, 2016 at 6:16 PM Subject: Re: [go-nuts]

Re: [go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
I did tried to change to, func (s *set) Init(slice []string) { but that gave loads of errors that I can't fix, hence the question. On Thu, Jun 23, 2016 at 6:19 PM, Val wrote: > Assigning a value to the receiver will only affect local variable. > Try pointer receiver. > > -- > You received thi

[go-nuts] How to init a global map

2016-06-23 Thread Val
Assigning a value to the receiver will only affect local variable. Try pointer receiver. -- 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...@g

[go-nuts] can't get Content-Type and Content-Disposition to force browser to display "file->save..." dialog in the web browser

2016-06-23 Thread Val
The commented line seems to have typo strconv.Ito Maybe the typo prevents proper recompilation, and server goes on with old code? -- 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, s

[go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
My mind is not working and I can't find how to fix the following program (https://play.golang.org/p/oXxUndUSye): package main import ( "fmt" ) type set map[string]struct{} var validSub set func init() { validSub.Init([]string{"aa", "bb", "cc"}) fmt.Printf("%+v\n", validSub) } func (

[go-nuts] Re: can't get Content-Type and Content-Disposition to force browser to display "file->save..." dialog in the web browser

2016-06-23 Thread Dave Cheney
All the examples I find online have a space after attachment; most also quote the filename parameter, filename="foo.txt", although the RFC does not. Hopefully its something as simple as this. On Friday, 24 June 2016 07:35:34 UTC+10, David Marceau wrote: > > I'm using TLS/http/gorillamux golang w

[go-nuts] can't get Content-Type and Content-Disposition to force browser to display "file->save..." dialog in the web browser

2016-06-23 Thread David Marceau
I'm using TLS/http/gorillamux golang web server. strSomeFileName := "blah.json" //"blah.txt" // "blah.bin" w.Header().Set("Content-Type","application/octet-stream") w.Header().Set("Content-Disposition", "attachment;filename=" + strSomeFileName) myCmdOutput, _ := cmd.Output() //with or without f

Re: [go-nuts] GitHub Squash

2016-06-23 Thread Jakob Borg
The GitHub pull request code review system (what you use to stare at diffs and comment on them) is still distinctly subpar for anything more than casual usage. I very much doubt it would fulfill most of the Go teams requirements on code review. //jb 2016-06-23 19:38 GMT+02:00 Erik Aigner : > Sinc

Re: [go-nuts] Re: Golang Grep

2016-06-23 Thread Steven Blenkinsop
Sorry for the late reply, I've been having a busy week. Hopefully you've figured it out by now. If not, I'll point out that the "grep" function doesn't return its results, it prints them out. I've restructured it to make it more general purpose, so that you can use the results in other code: https

Re: [go-nuts] Automatic type assertion

2016-06-23 Thread Jose Luis Aracil
I use my own "automatic" type assertion library: https://github.com/jaracil/ei El jueves, 9 de junio de 2016, 22:39:46 (UTC+2), Pablo Rozas-Larraondo escribió: > > Sorry I should have been more clear exposing the problem. What I meant by > "automatic type assertion" was something like: > > If

[go-nuts] Why is Errorf() in the fmt packages and not in the errors package?

2016-06-23 Thread Tamás Gulácsi
Formatting? Tuning the question around: fmt.Errorf = errors.New(fmt.Sprintf) - just a convenience function. GMT is quite heavy, errors is light. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

Re: [go-nuts] Why is Errorf() in the fmt packages and not in the errors package?

2016-06-23 Thread Rob Pike
To avoid a dependency cycle. fmt depends on errors, so errors can't call functions in fmt. -rob On Thu, Jun 23, 2016 at 1:15 PM, wrote: > The title. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and st

[go-nuts] GitHub Squash

2016-06-23 Thread Erik Aigner
Since GitHub now supports squash merging branches, wouldn't it be possible to switch the Review/CL system over to GitHub? I think this would lower the entry barrier considerably for new contributors. Cheers, Erik -- You received this message because you are subscribed to the Google Groups "g

[go-nuts] Why is Errorf() in the fmt packages and not in the errors package?

2016-06-23 Thread jamalsmith95 . bc
The title. -- 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] Re: [?] emulating an opengl shader in cpu bound functions

2016-06-23 Thread blueblank
On Wednesday, June 22, 2016 at 5:06:38 PM UTC-4, blue...@gmail.com wrote: > > > > > > Thanks for all the suggestions especially Egon, that put me ahead of my > learnin

[go-nuts] Does pprof enabled in production gives a significant impact in performance?

2016-06-23 Thread Marcos Oliveira
Gophers, We are to deploy a service in production and there's the question if we should keep pprof and its HTTP handlers enabled by default in the service or if we should have a flag that enables them when needed, but that would require a restart of the service. Is a significant performance im

Re: [go-nuts] Urlwatch

2016-06-23 Thread Shawn Milochik
What do you need it to do, specifically? Doing an http.Get on a page and storing and comparing the bytes or a hash is something you could write in under a minute. Why not just do that? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscrib

Re: [go-nuts] [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-23 Thread Michael Jones
Just so. I believed the computation…just not the printing. ;-) Michael Jones michael.jo...@gmail.com > On Jun 23, 2016, at 4:53 AM, gordonbg...@gmail.com wrote: > > By your timing results, I'm guessing that you have an almost top-of the line > late model 15" MacBook Pro with the 2.5 GHz i7-4770

Re: [go-nuts] How to hide command line argument from ps

2016-06-23 Thread Sean Russell
> On Jun 23, 2016, at 8:00 AM, Nick Craig-Wood wrote: > > Environment variables are quite insecure too. On linux you can read any > processes environment variables using /proc/PID/environ, eg Env variables are more secure than ps, which is what your question asked. Maybe a linux forum would

Re: [go-nuts] Re: Any keyboard players here?

2016-06-23 Thread Daniel Skinner
Yes, the Android app is a toy app. Touchscreen or not, the hardware latency alone makes that a fact. But that's why it's an example, not the root project. I've been using the gui example as a playground to work out further improvements to a separate project and I realize this is in disarray. I nee

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-23 Thread gordonbgood
On Friday, 17 June 2016 09:23:18 UTC+7, Keith Randall wrote: > > Looks like something is wrong with immediate loading for the 1 << ... > operation. Could you open a bug with repro instructions? I can look at it > when 1.8 opens. >> >> @Keith, now that I have found a combination that makes the

Re: [go-nuts] How to hide command line argument from ps

2016-06-23 Thread Nick Craig-Wood
On 22/06/16 14:32, Sean Russell wrote: > On Tuesday, June 21, 2016 at 9:56:21 PM UTC-4, Lazytiger wrote: >> Thanks for all the replies. I agree that there is a better way to do the >> security jobs. I ask this question just for curiosity, to find out if there >> is a equivalence way to do this in

Re: [go-nuts] [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-23 Thread gordonbgood
On Monday, 20 June 2016 16:35:09 UTC+7, Michael Jones wrote: > > Your code (with slightly changed print formatting) on my MacBook Pro: > > $ go install > $ time fasterEratspeed > Init: 2.885352ms > Search: 284.849689ms, found 8621475 primes up to 1018429650 > Total: 287.735041ms > > real 0m

[go-nuts] Re: A proposal for generic in go

2016-06-23 Thread Egon
On Thursday, 23 June 2016 07:59:16 UTC+3, Henry wrote: > > > Having completed an earlier project, my colleagues and I sat down to > review the team performance and what we could do better next. My colleague > proposed an intriguing idea and we decided to randomly pick two components > of our p

Re: [go-nuts] Re: A proposal for generic in go

2016-06-23 Thread Egon
On Thursday, 23 June 2016 06:41:07 UTC+3, Thomas Bushnell, BSG wrote: > > This is why I like this example. Generics induce people to write the wrong > thing instead of thinking about the right thing. When you start thinking of > the right thing, you often discover better solutions. > *It's also

Re: [go-nuts] golang.org/x/text/transform.Chain is not thread safe

2016-06-23 Thread mpvl
On Tue, Jun 21, 2016 at 5:56 AM, Ian Lance Taylor wrote: > On Mon, Jun 20, 2016 at 5:57 PM, Bryan Reynaert wrote: > > > > the following code panics with: runtime error: slice bounds out of range > > > > > > var testTransform = transform.Chain(norm.NFD, norm.NFC) > > > > func main() { > > for i :

[go-nuts] Urlwatch

2016-06-23 Thread Johann Höchtl
Is there any app, library etc. available which will monitor changes to web resources and perform actions afterwards? Something like https://thp.io/2008/urlwatch/ I found https://github.com/dustin/urlwatch but it seems to be broken and not very involved. https://golanglibs.com/top?q=broken Tha

Re: [go-nuts] Re: upx / darwin support

2016-06-23 Thread Peter Waller
On 23 June 2016 at 04:49, Miki Tebeka wrote: > Which version of Go are you using? According to > https://github.com/pwaller/goupx upx should work well with go 1.6 > (didn't check) > goupx only ever worked with Linux binaries, not OSX (darwin) binaries. I (author of goupx) don't know the state of

[go-nuts] Re: Any keyboard players here?

2016-06-23 Thread wboe73
Hi Daniel, I already investigated your piano and snd projects at github, but could not get them working: too much unknown libraries. Anyhow, it seemed to be aiming at the Android platform, with an on-screen piano keyboard and no MIDI interface. For Android this is a sensible project, but for a