Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Kiki Sugiaman
then we cannot unmarshal it? Thank you very much. Regards, Dat. On Wed, Jun 21, 2017 at 11:57 AM, Kiki Sugiaman <mailto:ksugia...@gmail.com>> wrote: According to the docs, the library marshals according to the following criteria: The name for the XML elements is taken from

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Kiki Sugiaman
replied it. Thanks, Dat. On Wed, Jun 21, 2017 at 10:58 AM, Kiki Sugiaman <mailto:ksugia...@gmail.com>> wrote: May I bring this email back into the mailing list so other people could refer to it? On 20/06/17 19:52, Dat Huynh wrote: No worries. It i

Re: [go-nuts] production PDF to text service

2017-06-18 Thread Kiki Sugiaman
My experience (production) consists of calling external processes (both existing open source programs and my custom c++ code) using os/exec. However, I remember evaluating https://github.com/rsc/pdf for extracting text from unencrypted pdf and it did the job fine. On 19/06/17 08:21, svj...@

Re: [go-nuts] Re: KVs store for large strings

2017-06-15 Thread Kiki Sugiaman
first level key which I thought odd. Not sure what effects that would have on things. Best, James On Thursday, June 15, 2017 at 8:17:47 AM UTC-7, ksug wrote: There were mistakes with the code I posted. Oh well, in a hurry and not the point. On 15/06/17 22:41, Kiki Sugiaman wrote:

Re: [go-nuts] Re: KVs store for large strings

2017-06-15 Thread Kiki Sugiaman
There were mistakes with the code I posted. Oh well, in a hurry and not the point. On 15/06/17 22:41, Kiki Sugiaman wrote: I think I misunderstood what you were trying to accomplish. Let me try to rephrase and see if I'm getting closer: - to accommodate template changes during develo

Re: [go-nuts] MSSQL DBMS

2017-06-15 Thread Kiki Sugiaman
Try to get the simplest sqlite example working using database/sql. This is to get config issues common with database servers out of the way. Such example has been discussed several times in the past in this very mailing list. Once you get the example with sqlite working, substitute driverName

Re: [go-nuts] Re: KVs store for large strings

2017-06-15 Thread Kiki Sugiaman
I think I misunderstood what you were trying to accomplish. Let me try to rephrase and see if I'm getting closer: - to accommodate template changes during development, you introduced read-locking to your app. - as a result, your reads in production are slow. Never mind the fact that locking is

Re: [go-nuts] KVs store for large strings

2017-06-14 Thread Kiki Sugiaman
Try boltdb. - supports disk persistence - no read lock for read-only ops - fast key iteration (only as fast as O(n) can be) - probably will translate 100MB raw into 200MB-ish actual utilization, but see for yourself - no cgo https://github.com/boltdb/bolt On 15/06/17 04:45, James Pettyjohn w

Re: [go-nuts] Re: Will database/sql leak memory if I don't call Close() and remove references to it?

2016-11-01 Thread Kiki Sugiaman
Bullet proof means a few different things and will depend on other details. It's best to run your own simulation of the edge cases. One I can think of is: what happens if the old pool / db instance opens a new connection during the split second after the credential change at the backend but bef

Re: [go-nuts] Will database/sql leak memory if I don't call Close() and remove references to it?

2016-11-01 Thread Kiki Sugiaman
database/sql does not specify what gets freed before calling Close(). If the driver or the database server happen to release resources on their own, that is incidental and should not be relied upon unless you have deep knowledge of the driver and the database behavior. You can schedule Close()

Re: [go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-10-28 Thread Kiki Sugiaman
No harm done, I've done worse with a desktop. Hah! On 29/10/16 02:47, Henrik Johansson wrote: Oh I didn't mean to direct it to you. Inbox wouldn't let me edit the recipient list without harming my phone... You make good points though so I am glad I did! ☺️ -- You received this message becau

Re: [go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-10-28 Thread Kiki Sugiaman
on his own. Seems like a much simpler and more dignified way of fixing it than escalating to an officially stamped letter. fre 28 okt. 2016 kl 15:41 skrev Kiki Sugiaman mailto:ksugia...@gmail.com>>: I'm with you on pushing back. It keeps those in controlling positions from

Re: [go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-10-28 Thread Kiki Sugiaman
I'm with you on pushing back. It keeps those in controlling positions from being too self-convenient in exercising said control. However, it is only effective when the person doing that is reasoned and does not resort to tangents, strawmans, and overreaction. - Why bring generics into this? W

Re: [go-nuts] XML parsing of simple array of tags

2016-10-25 Thread Kiki Sugiaman
Not a problem, glad it helped! Yeah, basically a code snippet leaves less room for guesses than "I have done so and so". Not that it's that big of a deal. I also solve my own problem before asking it half of the time while trying to distill, write it down for others to reproduce. -- You rece

Re: [go-nuts] XML parsing of simple array of tags

2016-10-25 Thread Kiki Sugiaman
Does either of the two results from the following code give you what you want? https://play.golang.org/p/Dh1N1xPxiw Btw, it wouldn't hurt posting what you have tried to do if you have tried them. It makes it easy for those who want to give you a suggestion :) -- You received this message be

Re: [go-nuts] A simple question - Can C++ and goLang coexist in the same ecosystem?

2016-10-23 Thread Kiki Sugiaman
On 24/10/16 11:50, Carlos Ferreira wrote: It's improper because it is not the correct way of doing things. Calling external commands usually require calling the terminal and all of the overhead that it requires. Agreed. That's why I did not say that it didn't come with any overhead. Using b

Re: [go-nuts] A simple question - Can C++ and goLang coexist in the same ecosystem?

2016-10-23 Thread Kiki Sugiaman
Don't forget os/exec. If the performance overhead of invoking an external process is acceptable, a mature application that's been around for 10-20 years beats the one we just wrote last week. There are plenty of such applications written in C/C++ in NIX world. A lot of people have this funny n

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-22 Thread Kiki Sugiaman
Gob helps with (de)serializing data structures. mapset.Set is an interface. It doesn't help that the underlying data structure that the interface points to is unexported, hence it can only be registered with gob by the package itself. If the package doesn't do that, the package user can't do th

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-17 Thread Kiki Sugiaman
On 17/10/16 23:09, Kiki Sugiaman wrote: If N out of 4 error is not nil, N > 0, expect some performance hit from reflection. If N == 0 (which should be most of the time), the code will not touch reflection. Sorry, I was referring to an earlier version that's still stuck in my head.

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-17 Thread Kiki Sugiaman
On 16/10/16 23:48, antoniosun...@gmail.com wrote: [snip] The reason that I didn't do it, is because I don't know how to do it. In essence, that "f.Close()" that you worried about is wrapped in "defer f.Close()" in SaveState, which in turn wrapped in "defer SaveState" in a function. I.e., all i

Re: [go-nuts] defer with testify/assert

2016-10-14 Thread Kiki Sugiaman
Got it now, 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/

[go-nuts] defer with testify/assert

2016-10-14 Thread Kiki Sugiaman
Suppose I have the following test file using the testify/assert framework (to be run with "go test"): https://play.golang.org/p/faJDJcI3MR Regardless of assert function's implementation details, shouldn't the output always be: inside main test goroutine foo inside dummyfunc ? But what I'm

Re: [go-nuts] Why result type is different on sql.Query()

2016-09-28 Thread Kiki Sugiaman
I don't think placeholder vs no placeholder makes a difference. Here is an example where Scan() into the same table could return values of different types (using sqlite instead of mysql). https://play.golang.org/p/rAA04pv_I_ I'm not saying that this is what's definitely happening on your end,

Re: [go-nuts] Why result type is different on sql.Query()

2016-09-28 Thread Kiki Sugiaman
In a nutshell, Scan() internally performs several nested type switches based on the type of the Scan destination and what is received from the database (in other words, the driver). As to why the two scans returned values of different types, more information is needed. But since the queries we

Re: [go-nuts] Why result type is different on sql.Query()

2016-09-28 Thread Kiki Sugiaman
Did you check your error after each call to Query()? Without an arg, what do you expect the "?" in "flg=?" to be formatted into? -- 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, sen

Re: [go-nuts] Nil interface/pointer

2016-09-11 Thread Kiki Sugiaman
When making an example to reproduce a problem, I try to be as general as possible. The specific context of the question is a type that wraps multiple errors. It implements the error interface. It's useful when individual error handling is inconvenient, such as inside a defer block. I ended u

Re: [go-nuts] Nil interface/pointer

2016-09-11 Thread Kiki Sugiaman
Thanks, Dan. Not exactly a solution for the faint hearted, hah! -- 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 mor

Re: [go-nuts] Nil interface/pointer

2016-09-10 Thread Kiki Sugiaman
Thanks, Jan. If I know every possible type (that implements the interface), I can do a type switch. But if I don't, there's no way to do this then? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivi

[go-nuts] Nil interface/pointer

2016-09-10 Thread Kiki Sugiaman
Hi experts, Please refer to the following code: https://play.golang.org/p/m1VyGnayjl Question: can I determine whether f1 is nil given only f2 to check? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rec

Re: [go-nuts] Re: godoc question

2016-08-09 Thread Kiki Sugiaman
Got it. -- 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.

Re: [go-nuts] Re: godoc question

2016-08-09 Thread Kiki Sugiaman
Thanks Dave. Could you clarify what you mean by "This is not a 1.7 blocker"? -- 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.

[go-nuts] godoc question

2016-08-08 Thread Kiki Sugiaman
Hi all, Package github.com/hashicorp/raft contains the following block of code: = const ( rpcAppendEntries uint8 = iota rpcRequestVote rpcInstallSnapshot // DefaultTimeoutScale is the default TimeoutScale in a NetworkTransport. DefaultTimeoutScale =

Re: [go-nuts] SetSafe default value in mgo session

2016-08-05 Thread Kiki Sugiaman
Then the answer to your question is the answer to the following question: Is there a difference between not calling getLastError at all and calling getLastError(0, 0)? It's now a mongodb question and not a Go question anymore. Feel free to ask that of course. But if you're not getting the ans

Re: [go-nuts] SetSafe default value in mgo session

2016-08-04 Thread Kiki Sugiaman
&Safe{} gives you a pointer to a new instance of Safe with zero value for all its fields. https://tour.golang.org/basics/12 -- 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 a

Re: [go-nuts] Reject Unknown clients

2016-08-04 Thread Kiki Sugiaman
This is not necessarily directed at the OP but anyone considering this approach: If you already know about ip spoofing attack, great. Otherwise, do proceed with that in mind. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from t

Re: [go-nuts] http.ListenAndServeTLS accepts .pem files

2016-07-27 Thread Kiki Sugiaman
On 28/07/16 09:13, viridian@gmail.com wrote: I have few questions 1. Is there a java keystore equivalent in golang? There is no built-in secrecy management for your tls private key in the standard library. Private key is stored in: https://golang.org/pkg/crypto/rsa/#PrivateKey Trusted c

Re: [go-nuts] How to print a decrypted private RSA key?

2016-07-05 Thread Kiki Sugiaman
Pretty close, you need to encode in base64 (and divide with endlines, add header, etc.) https://play.golang.org/p/zvxfiLwp3h On 05/07/16 11:22, bentonrobe...@gmail.com wrote: Hello. I am trying to write code that takes the encrypted private half of an SSH key plus its password, and output

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

2016-06-27 Thread Kiki Sugiaman
Haha! Happens to the best of us every once in a while. On 28/06/16 02:57, mark mellar wrote: ksug, you were right... I was able to replicate the error using curl by changing the -x parameter from 'GET' to 'Get' . How embarrassing, I'll go sit in the corner and think about what I've done...

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

2016-06-26 Thread Kiki Sugiaman
I know this is a bit late, so perhaps you don't care anymore... Anyway, the server may not understand the "Get" method in this line: |req, err := http.NewRequest("Get", "https://"+host+".here.com:443/rest/json/flows";, nil) | On 27/06/16 08:22, mark mellar wrote: For anyone else having simila