[go-nuts] Re: Who wants to use Go to process your camera's raw files?

2016-08-10 Thread Jonathan Pittman
For some reason I did not get the last 3 updates until this one.  Weird.

So, I have looked over a number of packages that parse tiff files.  While, 
at the most basic level, they all have to do the same sort of things, each 
one also approaches the situation a little differently.  And more so, the 
end result tends to be for custom use cases.

I already have code up on github 
.  You will have to excuse my 
lack of good documentation and tests.  I was originally planning to just do 
a proof of concept for how this might work.  So, it needs some cleaning up. 
 I am also in the process of making some changes to it including the 
LICENSE.  No pull requests at this time please, but do have a look if you 
like.

I would like to see some real discussion about the approach before writing 
any more code.  I am not sure the best way to go about this discussion. 
 Does email work for everyone?  Should we use the go proposal method?  A 
shared google doc?  I would like this to eventually make its way to the 
golang.org/x/image repo.  I would like to see a collection of use cases 
that we can include when trying to solve this in an appropriate and general 
way.

On Wednesday, August 10, 2016 at 6:08:00 PM UTC-4, jonathan...@gmail.com 
wrote:
>
> I would be interested in seeing this happen.
>
> On Tuesday, July 26, 2016 at 7:36:31 PM UTC-7, Jonathan Pittman wrote:
>>
>> Well me too!  I am looking to see what level of interest there is in the 
>> Go community to see this happen.  I am also looking for people who are 
>> interested in working on this.
>>
>> Figuring out how to handle this problem for one specific camera's raw 
>> files is not too difficult.  Figuring out how to do this to handle the 
>> majority of cases requires a bit more work.
>>
>> To be clear, I am wanting a pure Go solution that is better thought out, 
>> better laid out, and better to use than the existing C/C++ options.
>>
>

-- 
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] compressing long list of short strings

2016-08-10 Thread Dan Kortschak
This looks like something that is solved for genomics data. If you are
OK with decompressing m strings where m << n then the BGZF addition to
gzip would work for you. In brief, BGZF blocks gzip into 64kb chunks
which can be indexed.

The spec for BGZF is here [1] (section 4 from page 11 on) and there is a
BGZF implementation here [2] and example indexing here [3] (the indexing
would need to be modified for your use case since I have written it for
genomic data).

[1]https://samtools.github.io/hts-specs/SAMv1.pdf
[2]https://godoc.org/github.com/biogo/hts/bgzf
[3]https://godoc.org/github.com/biogo/hts/tabix

On Wed, 2016-08-10 at 22:27 +, Alex Flint wrote:
> I have long list of short strings that I want to compress, but I want
> to be
> able to decompress an arbitrary string in the list at any time without
> decompressing the entire list.
> 
> I know the list ahead of time and it doesn't matter how much
> preprocessing
> time is involved. It is also fine if there is some significant O(1)
> memory
> overhead at runtime.
> 
> Any suggestions?


-- 
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] compressing long list of short strings

2016-08-10 Thread Alex Flint
There are around 2M strings, and their total size is ~6 GB, so an average
of 3k each.

I actually looked briefly at Go's compress/flate to see whether something
like what you're describing is possible without writing my own compressor
but I couldn't see any obvious way to get at the underlying compressor
state. Or perhaps I'm looking in the wrong package - any pointers would be
appreciated.

On Wed, Aug 10, 2016 at 3:42 PM Ian Lance Taylor  wrote:

> On Wed, Aug 10, 2016 at 3:27 PM, Alex Flint  wrote:
> >
> > I have long list of short strings that I want to compress, but I want to
> be
> > able to decompress an arbitrary string in the list at any time without
> > decompressing the entire list.
> >
> > I know the list ahead of time and it doesn't matter how much
> preprocessing
> > time is involved. It is also fine if there is some significant O(1)
> memory
> > overhead at runtime.
> >
> > Any suggestions?
>
> You say the strings are "short": how short?  How many strings are
> there?  How much total data in the uncompressed strings?
>
> What is your target for the total amount of memory used by the
> compressed strings plus any data required to decompress them?
>
> One approach that comes to mind is building an optimized Huffman table
> for the full set of strings, and compressing each one separately using
> that table.  Then each string is represented by a bit offset into the
> resulting bitstream, and each can be decompressed separately.  But you
> would need storage at run time not only for the bitstream, but also
> for the Huffman table.
>
> Ian
>

-- 
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] http2 questions

2016-08-10 Thread Jeffrey Smith
I have been playing around with http2 in the latetst 1.7RC today and had a 
few questions 

I still had to import "golang.org/x/net/http2" and then set 
http2.ConfigureTransport to actually use http2 when creating a client. I 
was under the impression this was fixed or was I wrong? 
https://github.com/golang/go/issues/14391 

tr := {
TLSClientConfig: {InsecureSkipVerify: true},
}
http2.ConfigureTransport(tr)
client := {Transport: tr}


I have the below code but it appears to leak connections whenever the 20 
second timeout is hit after connecting to a client, is there anyway to 
clean up the connection for reuse rather than creating a new one until I 
hit my open file limit?

func worker(id int, jobs <-chan int, results chan<- Results) {

tr := {
TLSClientConfig: {InsecureSkipVerify: true},
MaxIdleConnsPerHost: 2,
}
http2.ConfigureTransport(tr)
PostClient := {Transport: tr, Timeout: time.Duration(20 
* time.Second)}
closeBody := false

for {
closeBody = false
t0 := time.Now()

req, err := http.NewRequest("GET", 
Url+strconv.Itoa(<-jobs), nil)
if err != nil {
results <- Results{0, err, "0"}
continue
}
resp, err := PostClient.Do(req)
if resp != nil {
closeBody = true
//defer resp.Body.Close()
}
t1 := time.Now()
if err != nil {
results <- Results{0, err, fmt.Sprintf("%v", 
t1.Sub(t0))}
if closeBody == true {
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
}
continue
}
//discard the body so we can reuse the connections
io.Copy(ioutil.Discard, resp.Body)
//Close the body so we can resuse
resp.Body.Close()

results <- Results{resp.StatusCode, err, fmt.Sprintf("%v", 
t1.Sub(t0))}
}
}

Also does anyone have any recommendations with http2 should I be creating 
one connection per server and fire all requests down that (not even sure 
how I would do this in golang) or just create a global pool and allow the 
http client deal with 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] compressing long list of short strings

2016-08-10 Thread Ian Lance Taylor
On Wed, Aug 10, 2016 at 3:27 PM, Alex Flint  wrote:
>
> I have long list of short strings that I want to compress, but I want to be
> able to decompress an arbitrary string in the list at any time without
> decompressing the entire list.
>
> I know the list ahead of time and it doesn't matter how much preprocessing
> time is involved. It is also fine if there is some significant O(1) memory
> overhead at runtime.
>
> Any suggestions?

You say the strings are "short": how short?  How many strings are
there?  How much total data in the uncompressed strings?

What is your target for the total amount of memory used by the
compressed strings plus any data required to decompress them?

One approach that comes to mind is building an optimized Huffman table
for the full set of strings, and compressing each one separately using
that table.  Then each string is represented by a bit offset into the
resulting bitstream, and each can be decompressed separately.  But you
would need storage at run time not only for the bitstream, but also
for the Huffman table.

Ian

-- 
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] compressing long list of short strings

2016-08-10 Thread Alex Flint
I have long list of short strings that I want to compress, but I want to be
able to decompress an arbitrary string in the list at any time without
decompressing the entire list.

I know the list ahead of time and it doesn't matter how much preprocessing
time is involved. It is also fine if there is some significant O(1) memory
overhead at runtime.

Any suggestions?

-- 
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: Who wants to use Go to process your camera's raw files?

2016-08-10 Thread jonathan . gaillard
I would be interested in seeing this happen.

On Tuesday, July 26, 2016 at 7:36:31 PM UTC-7, Jonathan Pittman wrote:
>
> Well me too!  I am looking to see what level of interest there is in the 
> Go community to see this happen.  I am also looking for people who are 
> interested in working on this.
>
> Figuring out how to handle this problem for one specific camera's raw 
> files is not too difficult.  Figuring out how to do this to handle the 
> majority of cases requires a bit more work.
>
> To be clear, I am wanting a pure Go solution that is better thought out, 
> better laid out, and better to use than the existing C/C++ options.
>

-- 
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] Small complete examples which show the power of Go?

2016-08-10 Thread Rob Pike
P.S. The version I first saw was of course not in Go, it was in Newsqueak,
but the first complete program ever written in Go (not first executed) was
the prime sieve in the first draft of the language specification.

-rob

On Thu, Aug 11, 2016 at 5:56 AM, Rob Pike  wrote:

> It's not really mine. Tom Cargill first showed it to me, but it started
> with Doug McIlroy and I think it originates from an idea by David Gries.
>
> -rob
>
>
> On Thu, Aug 11, 2016 at 2:27 AM, Paul Rosenzweig <
> paularosenzw...@gmail.com> wrote:
>
>> I always liked Rob Pike's concurrent prime seive: https://play.golang.org
>> /p/9U22NfrXeq
>>
>> On Wed, Aug 10, 2016 at 3:53 AM, 
>> wrote:
>>
>>> Hi,
>>>
>>> I'm giving a talk at work introducing Go and I'm looking for small
>>> examples to show Go's potential. For example, the following program
>>> demonstrates a bare-bones webserver in 13 lines:
>>>
>>> import (
>>>
>>> "fmt"
>>> "net/http"
>>> )
>>>
>>> func home(w http.ResponseWriter, r *http.Request) {
>>> fmt.Fprintf(w, "Hello, world!")
>>> }
>>>
>>> func main() {
>>> http.HandleFunc("/", home)
>>> http.ListenAndServe(":8080", nil)
>>> }
>>>
>>> Has anyone here got any more little snippets like this to show the power
>>> and potential of Go? It doesn't have to be in networking, just little a
>>> little snippet to make people think "wow, that's cool!".
>>>
>>> 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.
>>>
>>
>> --
>> 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.
>>
>
>

-- 
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] Small complete examples which show the power of Go?

2016-08-10 Thread Rob Pike
It's not really mine. Tom Cargill first showed it to me, but it started
with Doug McIlroy and I think it originates from an idea by David Gries.

-rob

On Thu, Aug 11, 2016 at 2:27 AM, Paul Rosenzweig 
wrote:

> I always liked Rob Pike's concurrent prime seive: https://play.golang.org
> /p/9U22NfrXeq
>
> On Wed, Aug 10, 2016 at 3:53 AM, 
> wrote:
>
>> Hi,
>>
>> I'm giving a talk at work introducing Go and I'm looking for small
>> examples to show Go's potential. For example, the following program
>> demonstrates a bare-bones webserver in 13 lines:
>>
>> import (
>>
>> "fmt"
>> "net/http"
>> )
>>
>> func home(w http.ResponseWriter, r *http.Request) {
>> fmt.Fprintf(w, "Hello, world!")
>> }
>>
>> func main() {
>> http.HandleFunc("/", home)
>> http.ListenAndServe(":8080", nil)
>> }
>>
>> Has anyone here got any more little snippets like this to show the power
>> and potential of Go? It doesn't have to be in networking, just little a
>> little snippet to make people think "wow, that's cool!".
>>
>> 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.
>>
>
> --
> 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.
>

-- 
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] Looking for info on how Go package developers handle breaking changes with other packages

2016-08-10 Thread Chris Bogart


Hi, I'm looking for some help from developers who write Go packages. My 
research group is interested in the different choices new package managers 
and repositories are making when designing their ecosystems. Platforms like 
Node.js/NPM, Google's go, and Rust/Cargo are making somewhat different 
design choices from each other, and they are very different from older 
packaging systems like CPAN. We'd like to know what the impact of those 
design choices are on how developers deal with breaking changes among 
packages when they depend on each other. The go ecosystem is particularly 
interesting in the way it handles versioning, and we're curious to know how 
people use it in practice.


Could I ask people to take ~20 minutes of your time and fill out our survey 
at http://breakingapis.org/survey? I'll report back to the go community 
when we've analyzed the results (or there's a sign up link to be notified 
when results are out at http://breakingapis.org).


(If you don't develop Go packages, but have experience with Node.js/NPM, 
PyPI, Hackage, or something else, we're still interested -- just make a 
different "software ecosystem" choice on the first page. The study is a 
comparison among ecosystems; Go is one point of comparison).

-- 
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: convert a given time in one Timezone to other TimeZone

2016-08-10 Thread peterGo
LV,

"Each Time has associated with it a Location, consulted when computing the 
presentation form of the time, such as in the Format, Hour, and Year 
methods. The methods Local, UTC, and In return a Time with a specific 
location. Changing the location in this way changes only the presentation; 
it does not change the instant in time being denoted and therefore does not 
affect the computations described in earlier paragraphs."

https://golang.org/pkg/time/#Time

For example, 

https://play.golang.org/p/iR7akAl4HH

Peter

On Wednesday, August 10, 2016 at 9:50:43 AM UTC-4, laxma...@gmail.com wrote:
>
> I was trying to find the solution to get a given time in timezone1 using 
> the time in timezone2.
>
> Have solution to get the time in other timezone for current time but did 
> not found a way to get time for a given time. 
>
> Thanks
> L V
>

-- 
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] convert a given time in one Timezone to other TimeZone

2016-08-10 Thread 'Axel Wagner' via golang-nuts
https://play.golang.org/p/l_bu62zuLm

On Wed, Aug 10, 2016 at 6:55 PM, Matthew Zimmerman 
wrote:

> I don't understand your question, but maybe this helps?
>
> https://github.com/mzimmerman/tt
>
> On Wed, Aug 10, 2016 at 9:50 AM  wrote:
>
>> I was trying to find the solution to get a given time in timezone1 using
>> the time in timezone2.
>>
>> Have solution to get the time in other timezone for current time but did
>> not found a way to get time for a given time.
>>
>> Thanks
>> L V
>>
>> --
>> 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.
>>
> --
> 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.
>

-- 
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] msan failures in Go 1.7 Release Candidate 6

2016-08-10 Thread Ian Lance Taylor
On Wed, Aug 10, 2016 at 7:00 AM, David Marceau
 wrote:
> when I install from sources straight from git checkout go1.7rc6
> go1.7rc6 FAILS on Asus Z97-A-USB31 motherboard with intel i5-4590,
> "../misc/cgo/testsanitizers"
> it core dumps and doesn't give me the success message to start using it as
> the previous go1.7rc[1-4] did.
> signal: segmentation fault (core dumped)
> FAIL: msan
> FAIL: msan2
> FAIL: msan3
> FAIL: msan4
> ... FAILED

Could be https://golang.org/issue/16636, which boils down to: clang
-fsanitize=memory doesn't work on some systems.  This almost certainly
has nothing to do with the motherboard or processor, but more likely
has something to do with the kernel version and the clang version.

Ian

-- 
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] Returning **C.char works with python not java jni

2016-08-10 Thread Barca
Hello,

I'm trying to figure out how to return a two dimensional string in Go (cgo) 
and be able to access this result in python and java jni.

I followed the following 

 
to make the unsafe pointers. The code works in python with ctypes.

However, the java code does not work and is returning null or zero.

The relevant go code


//export Java_com_test_TestJni_Gen
> func Java_com_test_TestJni_Gen(env *C.JNIEnv, clazz C.jclass, x int) 
> **C.char {
> gostrings:=make([]string, x)
> for i:=0;i gostrings[i]="test"
> }
> 
> //https://stackoverflow.com/questions/14833531/how-to-convert-from-byte-to-char-in-go?rq=1
> var b *C.char
> ptrSize := unsafe.Sizeof(b)
> // Allocate the char** list.
> ptr := C.malloc(C.size_t(x) * C.size_t(ptrSize))
> //defer C.free(ptr)
> // Assign each byte slice to its appropriate offset.
> for p := 0;p element := (**C.char)(unsafe.Pointer(uintptr(ptr) + 
> uintptr(p)*ptrSize))
> //*element = (*C.char)(unsafe.Pointer([i][0]))
> *element = C.CString(string(gostrings[p]))
> }
> return((**C.char)(ptr))
> }


The relevant java code

public static native byte[][] Gen(int x);
> public static void main(String argv[]) {
> TestJni api=new TestJni();
> byte[][] result=Gen(3);
> for(int x=0;x<3;x++) {
> System.out.println(result[x]);
> }
> } 



I've also made the full project with go code, python, and java code here

https://github.com/jbarca/cgojni

Thanks in advance 

-- 
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] Small complete examples which show the power of Go?

2016-08-10 Thread Paul Rosenzweig
I always liked Rob Pike's concurrent prime seive:
https://play.golang.org/p/9U22NfrXeq

On Wed, Aug 10, 2016 at 3:53 AM,  wrote:

> Hi,
>
> I'm giving a talk at work introducing Go and I'm looking for small
> examples to show Go's potential. For example, the following program
> demonstrates a bare-bones webserver in 13 lines:
>
> import (
>
> "fmt"
> "net/http"
> )
>
> func home(w http.ResponseWriter, r *http.Request) {
> fmt.Fprintf(w, "Hello, world!")
> }
>
> func main() {
> http.HandleFunc("/", home)
> http.ListenAndServe(":8080", nil)
> }
>
> Has anyone here got any more little snippets like this to show the power
> and potential of Go? It doesn't have to be in networking, just little a
> little snippet to make people think "wow, that's cool!".
>
> 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.
>

-- 
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] convert a given time in one Timezone to other TimeZone

2016-08-10 Thread Matthew Zimmerman
I don't understand your question, but maybe this helps?

https://github.com/mzimmerman/tt

On Wed, Aug 10, 2016 at 9:50 AM  wrote:

> I was trying to find the solution to get a given time in timezone1 using
> the time in timezone2.
>
> Have solution to get the time in other timezone for current time but did
> not found a way to get time for a given time.
>
> Thanks
> L V
>
> --
> 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.
>

-- 
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] [ANN] Leader Election library using Zookeeper

2016-08-10 Thread Rich Youngkin
Hi all,

go-leaderelection  (
https://github.com/Comcast/go-leaderelection) provides the capability for a 
set of distributed processes to compete for leadership for a shared 
resource. It is implemented using Zookeeper for the underlying support. It 
provides a simple, asynchronous, interface. goroutines or processes can 
create an election, compete for becoming the leader for a resource, 
asynchronously wait to become a resource, resign leadership, and delete an 
election resource.

Of note is the project's dependence on go-zookeeper 

 (https://github.com/samuel/go-zookeeper) and goint 
 (https://github.com/Comcast/goint). 
This, along with other usage information, is covered in the README.

As this is my first golang project I'd appreciate feedback, improvements, 
bug reports, etc.

Cheers,
Rich

-- 
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: Go 1.7 Release Candidate 6 is released

2016-08-10 Thread David Marceau
when I install from sources straight from git checkout go1.7rc6
go1.7rc6 FAILS on Asus Z97-A-USB31 motherboard with intel i5-4590,
"../misc/cgo/testsanitizers" 
it core dumps and doesn't give me the success message to start using it as 
the previous go1.7rc[1-4] did.
signal: segmentation fault (core dumped)
FAIL: msan
FAIL: msan2
FAIL: msan3
FAIL: msan4
... FAILED


To contrast this, Go1.7rc6 does succeed on another much older motherboard 
Dell Inc. Vostro 430/054KM3, BIOS 2.2.0.


On Monday, August 8, 2016 at 4:44:40 PM UTC-4, Chris Broadfoot wrote:
>
> Hello gophers,
>
> We have just released go1.7rc6, a release candidate for Go 1.7.
> Some say that it's the best one yet.
> It is cut from release-branch.go1.7 at the revision tagged go1.7rc6.
>
> Please help us by testing your Go programs with the release, and
> report any problems using the issue tracker:
>   https://golang.org/issue/new
>
> You can download binary and source distributions from the usual place: 
>   https://golang.org/dl/#go1.7rc6
>
> To find out what has changed in Go 1.7, read the draft release notes:
>   https://tip.golang.org/doc/go1.7
>
> Documentation for Go 1.7 is available at:
>   https://tip.golang.org/
>   
> A comprehensive list of changes since rc5 is here:
>   https://github.com/golang/go/compare/go1.7rc5...go1.7rc6
>   
> We plan to issue Go 1.7 in a week's time (August 15).
>
> Cheers,
> Chris
>

-- 
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] convert a given time in one Timezone to other TimeZone

2016-08-10 Thread laxman . ece
I was trying to find the solution to get a given time in timezone1 using 
the time in timezone2.

Have solution to get the time in other timezone for current time but did 
not found a way to get time for a given time. 

Thanks
L V

-- 
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: Small complete examples which show the power of Go?

2016-08-10 Thread Val
Iterations over slices, maps, channels are very cool, usually straight to 
the point :

func main() {
for _, a := range []int{6, 4} {
for _, b := range []int{2, 3} {
for fname, f := range map[string]func(int, int) int{
"plus":  func(x, y int) int { return x + y },
"minus": func(x, y int) int { return x - y },
"times": func(x, y int) int { return x * y },
"div":   func(x, y int) int { return x / y },
} {
fmt.Println(a, fname, b, "is", f(a, b))
}
}
}
}
Playground 

Then you may tell some specific details : why the underscores for ignored 
iteration variables, and why the map iteration order is not the same as the 
order in the code. Also, I find these iterations quite versatile in 
practice, but they work only on built-in types (you won't have java-like 
custom iterables).

Cheers
Val

On Wednesday, August 10, 2016 at 9:53:38 AM UTC+2, 
gary.wi...@victoriaplumb.com wrote:
>
> Hi,
>
> I'm giving a talk at work introducing Go and I'm looking for small 
> examples to show Go's potential. For example, the following program 
> demonstrates a bare-bones webserver in 13 lines:
>
> import (
>
> "fmt"
> "net/http"
> )
>  
> func home(w http.ResponseWriter, r *http.Request) {
> fmt.Fprintf(w, "Hello, world!")
> }
>  
> func main() {
> http.HandleFunc("/", home)
> http.ListenAndServe(":8080", nil)
> }
>
> Has anyone here got any more little snippets like this to show the power 
> and potential of Go? It doesn't have to be in networking, just little a 
> little snippet to make people think "wow, that's cool!".
>
> 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] Re: [ANN] Gomail v2: sending emails faster

2016-08-10 Thread matic
GitHub page says "Automatic encoding of special characters". Does that mean 
if I use output from (user provided input to a 
golang.org/pkg/text/template) as body input to gomail, gomail will properly 
escape any characters that could be used to insert SMTP headers or do 
anything else that could be malicious?

-- 
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: Small complete examples which show the power of Go?

2016-08-10 Thread sphilippov
Easy parallelization and concurrency:

package main 

import (
 "runtime"
)
 
func FoldParallel(data []float64, initialValue float64, op func(float64, 
float64) float64) float64 {
sliceSize := len(data) / runtime.NumCPU()
results := make(chan float64, runtime.NumCPU())
numResults := 0
for i := 0; i < len(data); i += sliceSize {
numResults++
go func(dataSlice []float64) {
result := float64(initialValue)
for _, v := range dataSlice {
op(result, v)
}
results <- result
}(data[i : i+sliceSize])
}
result := initialValue
for i := 0; i < numResults; i++ {
result = op(result, <-results)
}
return result
}

func main() {
var data [1000]float64

// parallel sum
FoldParallel(data[:], 0, func(v1, v2 float64) float64 { return v1 + v2 
})
// parallel mul
FoldParallel(data[:], 1, func(v1, v2 float64) float64 { return v1 * v2 
})
}



-- 
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] Small complete examples which show the power of Go?

2016-08-10 Thread Anmol Sethi
You can shorten that by 6 lines

package main

import "net/http"

func main() {
http.ListenAndServe(":8080", http.HandlerFunc(func(w 
http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello World!"))
}))
}

A bare bones web server in just 9 lines!

> On Aug 10, 2016, at 3:53 AM, gary.willoug...@victoriaplumb.com wrote:
> 
> Hi,
> 
> I'm giving a talk at work introducing Go and I'm looking for small examples 
> to show Go's potential. For example, the following program demonstrates a 
> bare-bones webserver in 13 lines:
> 
> import (
> 
> "fmt"
> "net/http"
> )
>  
> func home(w http.ResponseWriter, r *http.Request) {
> fmt.Fprintf(w, "Hello, world!")
> }
>  
> func main() {
> http.HandleFunc("/", home)
> http.ListenAndServe(":8080", nil)
> }
> 
> Has anyone here got any more little snippets like this to show the power and 
> potential of Go? It doesn't have to be in networking, just little a little 
> snippet to make people think "wow, that's cool!".
> 
> 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.

-- 
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] Small complete examples which show the power of Go?

2016-08-10 Thread gary . willoughby
Hi,

I'm giving a talk at work introducing Go and I'm looking for small examples 
to show Go's potential. For example, the following program demonstrates a 
bare-bones webserver in 13 lines:

import (

"fmt"
"net/http"
)
 
func home(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, world!")
}
 
func main() {
http.HandleFunc("/", home)
http.ListenAndServe(":8080", nil)
}

Has anyone here got any more little snippets like this to show the power 
and potential of Go? It doesn't have to be in networking, just little a 
little snippet to make people think "wow, that's cool!".

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.