Done function returns a channel which is closed when our context is done,
i.e., it is either timed out, its deadline is exceeded, or explicitly
canceled.
This channel closing is a pattern used for broadcasting a signal to
multiple goroutines that are receiving from it. Let's say we have 2
goro
See: https://blog.golang.org/pipelines (in which Go computes MD5 sums of
files under a dir)
A machine K has:
- M total memory in bytes
- C number of (logical) CPUs
and a workload W consisting in MD5'ing some files under directory d/:
- N total number of files
- m bytes per file (all files are
Consider:
func HandleFunc(pattern string, handler func(ResponseWriter, *Request))
and:
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { ...
Could this be made to work?
http.HandleFunc("/", func(w, r) { ...
in an "auto" kind of way?
--
You received this message
Yes, there could be ways to do it. I could have used Javascript to access
the JSON data values. But couldn't get that to work either. So the easier
thing for me to do was to unmarshal the string again into a
map([string]interface{}) type which is what I finally did to get the code
to work.
Thanks f
On Sat, 2017-02-18 at 23:15 +, Matt Harden wrote:
> They didn't say ; they said r2 := *r. Also read the example.
> They
> returned &r2 instead of r2. The code is equivalent to but shorter
> than the
> original.
After I read the example I realised that. However the text shows up on
a text-only
Hi,
Instead of starting them from an http handler, I would store in the
database the locations and their users. Then, from main() I would start
just one go routine that will check the db for any pending location that
needs to be fetched, if found, then go do work, sleep for x seconds, then
check t
Looks like you have a pretty good list already, depending on how much they
love Scala, they may/may not invalidate some of your points but you know
them better.
On Sun, Feb 19, 2017 at 2:37 AM, Will Faught wrote:
> Thanks to the two replies so far! Very helpful.
>
> Here are the reasons I'd thou
Done does not need to be called unless you want to detect when the context
is either canceled or times out. It doesn't have any effect on the context
itself.
On Sun, Feb 19, 2017 at 2:57 PM wrote:
> Thanks, I see you build it up with decorators on a standard prototype.
> For example: https://pla
Thanks, I see you build it up with decorators on a standard prototype.
For example: https://play.golang.org/p/PJy5lE9QqF
So context.Done is a convenience function for those that require it?
Otherwise a context will expire after it leaves scope, so Done does not
need to be called?
On Friday,
if using fixed precision then don't use floats, just use int's with a fixed
multiplier.
--
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
On Sun, Feb 19, 2017 at 9:41 AM Marwan abdel moneim
wrote:
> i wanted to do it without a Mutex
> but there still something not clear to me, but i don't know what it is
> and i don't understand what "trigger" synchronization means
>
>
Modern CPUs achieve much of their speed by running instructions
Hi Everyone,
With the release of GoBot 1.2 I thought I would try and put together a
"metal bot" for the PiGlow on a Raspberry Pi 1.
The PiGlow is based around a SN3218 IC that drives the 18 leds on the
board. The SN3218 communication with the Pi is via 12c.
GoBot 1.2 rewrote the i2c subsystem, b
On Sun, Feb 19, 2017 at 5:39 PM, Jason E. Aten wrote:
> I'd like to play with the 9p protocol (plan9's "everything is a filesystem"
> IPC protocol; I guess the updated 9p2000 version is the one everyone
> actually uses) ...
>
> ...but the implementations I can find in Go seem
> half-done/incomplet
It's not abandoned; it's resting :)
On Sun, Feb 19, 2017 at 10:08 AM Dave MacFarlane wrote:
> Sure, but I'm not the one using plan9/client: plumb.Open is. So in
> order to do it and keep supporting p9p, I still need to fork
> 9fans.net/go and vendor my changes to the plumb package, which brings
Sure, but I'm not the one using plan9/client: plumb.Open is. So in
order to do it and keep supporting p9p, I still need to fork
9fans.net/go and vendor my changes to the plumb package, which brings
me back to where I started: needing to maintain my own fork of a
seemingly abandoned package.
(I jus
I'd like to play with the 9p protocol (plan9's "everything is a filesystem"
IPC protocol; I guess the updated 9p2000 version is the one everyone
actually uses) ...
...but the implementations I can find in Go seem
half-done/incomplete/unmaintained.
http://9p.cat-v.org/implementations + other
Doing it in C would also require a mutex or other synchronization primitive.
On Sun, Feb 19, 2017 at 7:11 AM Marwan abdel moneim
wrote:
> i didn't want to use Mutex because i wanted to learn the topic from the
> beginning, and see how it could be done without channels or Mutex
>
> like how you c
The devil sitting on my shoulder tempts me to say "Of course, there is" and
walk away. That said, by now there must exist code to read JSON (YAML,
Windows config files, etc.) from a string. It's just a matter of finding
it.
- https://gobyexample.com/json
- https://blog.golang.org/json-and-go
I am retrieving a set of field values from the Database into an interface
type object. One of the field values is a JSON string (say Order detail). I
am retrieving it as a string as passing it on to a template and referencing
it using {{.orderdetail}}
this is the output I get on the client which
On Thursday, July 7, 2016 at 12:50:02 AM UTC+3, chris...@gmail.com wrote:
>
> Hi,
>
> I'm trying to hook up a Go application to a URL protocol handler in Mac OS
> X. I want a user to be able to click on a link such as myapp://foo/bar and
> have that launch myapp and be able to access the full
Hi, I tried to run an then to install (go install) a package (freetype.go).
I got this error on Linux, but I found that this is not a main package ('go
run' showed it). My $GOBIN is set, but 'go install' shows 'GOBIN not set'.
Install only works with func main() in the source.
May be, your prob
When will Texture.Fill be implemented in Shiny gldriver?
golang.org/x/exp/shiny/driver/gldriver/texture.go :
func (t *textureImpl) Fill(dr image.Rectangle, src color.Color, op draw.Op) {
t.w.glctxMu.Lock()
defer t.w.glctxMu.Unlock()
// TODO.
}
--
You received this message
Ayan,
It's not idiomatic because you are setting and using GOROOT. Leave that to
the compiler. For example, with no GOROOT,
$ cd $HOME
$ git clone https://go.googlesource.com/go
$ cd go/src
$ ./make.bash
Peter
On Saturday, February 18, 2017 at 5:51:09 PM UTC-5, Ayan George wrote:
>
> I'm some
i didn't want to use Mutex because i wanted to learn the topic from the
beginning, and see how it could be done without channels or Mutex
like how you could do it in C for example
On Sunday, February 19, 2017 at 3:32:52 PM UTC+2, jmont...@dyn.com wrote:
>
>
> On Sunday, February 19, 2017 at 3:41
good.
On Sat, Feb 18, 2017 at 11:08 PM, wrote:
> After some testing I just decided to instead round the numbers to 2
> decimals instead. Thank you for the heads up though.
>
> On Sunday, February 19, 2017 at 5:42:15 PM UTC+11, Michael Jones wrote:
>>
>> This feels unlikely.
>>
>> You might want
On Sunday, February 19, 2017 at 3:41:13 AM UTC-5, Marwan abdel moneim wrote:
>
> i wanted to do it without a Mutex
> but there still something not clear to me, but i don't know what it is
> and i don't understand what "trigger" synchronization means
>
> i will keep reading, and go back to it later
>
>
>
> Did get it working (1.8) on windows though a side note on Docs for Fedora
> that putting the path in $HOME/.profile does not work and for me anyway I
> needed to put it in .bashrc
> https://golang.org/doc/install?download=go1.8.linux-amd64.tar.gz
>
>
Great to know you got it working!
re
I know a lot of work has been put into this release cycle. So, I just want
to thank everyone involved.
In my job we are already using 1.8 in production code with great results.
In particular, the speed improvements are noticeable (10% in some process I
did a benchmark).
Congratulations.
--
Yo
Thanks for your answer!
Am I right, when starting goroutine like this? (With infinite loop inside
goroutine function)
func (ctl *Controller) startWatchUserLocation(username, location string) {
for {
data, err := ctl.ScrapeRoomsWithLocation(username, location) <-
scraping info f
if want to run those utilities in Plan 9 you don't need to worry about
speaking 9P with the underlying services -- i.e. no need for plan9/client
package. the file hierarchies for plumber, acme, draw, etc. are mounted
into the process' namespace. for example, acme's namespace is mounted on
"/mnt/a
i wanted to do it without a Mutex
but there still something not clear to me, but i don't know what it is
and i don't understand what "trigger" synchronization means
i will keep reading, and go back to it later and see it i get it
thanks for your help
On Sunday, February 19, 2017 at 9:32:28 AM UT
31 matches
Mail list logo