[go-nuts] Re: Rendering fonts in Go

2024-01-03 Thread Egon
There's also https://github.com/go-text/typesetting and github.com/go-text/render. But, I'm not sure whether it covers your needs. On Saturday 23 December 2023 at 00:10:13 UTC+2 Howard C. Shaw III wrote: > I think Freetype may still be your best bet - but rather than the Freetype > port, you

Re: [go-nuts] Stop triggering firewall on Windows? Preset build path?

2020-11-07 Thread Egon
ll Settings > Advanced Settings > Inbound Rules > New Rule > > By Port. > > On Wednesday, 11 February 2015 at 15:38:53 UTC+1 ni...@craig-wood.com > wrote: > >> On 11/02/15 10:13, Mateusz Czapliński wrote: >> > Or, I believe "go build && myap

[go-nuts] Re: Unlinked temporary files

2020-01-07 Thread Egon
You are not checking return value of os.Remove in https://github.com/eikenb/pipeat/blob/master/pipeat.go#L51. That will fail on windows. You can take look at https://github.com/calebcase/tmpfile, which works on Windows. + Egon On Friday, 3 January 2020 19:50:20 UTC+2, drakk...@gmail.com wrote

Re: [go-nuts] Help with Go channels and select talk

2019-12-11 Thread Egon Kocjan
unmotivated, and so > the use of the channels seems inappropriate — I suspect that that is why > you aren't finding a satisfactory solution. > > > Stepping up a level: Egon, you say that you “want to show what not to do.” > That is pretty much the premise of my GopherCon 2018 talk, Rethi

[go-nuts] Re: Help with Go channels and select talk

2019-12-11 Thread Egon Kocjan
Interesting suggestion, but I added the implementation with buffer = 1 here and it still deadlocks: https://github.com/egonk/chandemo/blob/master/2_3.go#L5 It stopped deadlocking when buffer = 5, so I think it will be a nice lesson about hiding design problems with buffers. Did you have

Re: [go-nuts] Help with Go channels and select talk

2019-12-07 Thread Egon Kocjan
est) but that is > not what you are attempting here... you are using async processing - these > are completely different things. Using async in Go is an anti-pattern IMO. > > On Dec 8, 2019, at 12:11 AM, Egon Kocjan > > wrote: > >  > I'll cite myself: > "I'm preparing

Re: [go-nuts] Help with Go channels and select talk

2019-12-07 Thread Egon Kocjan
tried) but why??? > > It’s like saying I’d really like my plane to float - you can do that -but > most likely you want a boat instead of a plane. > > On Dec 7, 2019, at 2:38 AM, Egon Kocjan > > wrote: > >  > I'll try to clarify as best as I can, thanks again to a

Re: [go-nuts] Help with Go channels and select talk

2019-12-07 Thread Egon Kocjan
e encountering a deadlock because the producer on one > end is not also reading the incoming - so either restructure, or use 2 more > threads for the producers. > > > > On Dec 6, 2019, at 10:38 PM, Egon Kocjan > > wrote: > > Agreed, I see goroutines in general as

Re: [go-nuts] Help with Go channels and select talk

2019-12-06 Thread Egon Kocjan
te: > > A channel is much closer to a pipe. There are producers and consumers and > these are typically different threads of execution unless you have an event > based (async) system - that is not Go. > > On Dec 6, 2019, at 9:30 AM, Egon Kocjan > > wrote: > >  > There ar

Re: [go-nuts] Help with Go channels and select talk

2019-12-06 Thread Egon Kocjan
annels are designed to be used with multiple go routines - if you’re not > you are doing something wrong. > > On Dec 6, 2019, at 8:32 AM, Egon Kocjan > > wrote: > >  > Hello > > I'm preparing a short talk about Go channels and select. More > specifically, I want to show

[go-nuts] Help with Go channels and select talk

2019-12-06 Thread Egon Kocjan
faster but still ugly (1.8s for million ints) So my question: is there a better way of doing it with just nested for and select and no goroutines? Basically, what would 2_5.go look like? Thank you Egon -- You received this message because you are subscribed to the Google Groups "golang

[go-nuts] Re: Weekend question: Idiomatic way of handling >millions of objects (structs ;))

2019-02-16 Thread Egon
Yeah, mmap is a valid solution. Of course, you end up with code that works less reliably on all platforms. And, depending on what kinds of operations you are doing you might not get a perf benefit. On Friday, 15 February 2019 19:34:55 UTC+2, Jeroen Massar wrote: > > Hi folks, > > Silly

Re: [go-nuts] Re: [golang-dev] go doesn't need generics, but if they do...

2018-09-12 Thread Egon
s and not worrying about the performance overhead - the really > performance critical coders can always write non-generic/interface > containers if they absolutely think they need it, but most likely they > don’t... > I tend to agree, but having specializing generics makes some of that code

Re: [go-nuts] Re: [golang-dev] go doesn't need generics, but if they do...

2018-09-11 Thread Egon
On Tuesday, 11 September 2018 18:28:29 UTC+3, Robert Engels wrote: > > > On Sep 11, 2018, at 9:55 AM, 'Axel Wagner' via golang-nuts < > golan...@googlegroups.com > wrote: > > [golang-nuts to CC, golang-dev to BCC] > > On Mon, Sep 10, 2018 at 5:33 PM robert engels > wrote: > >> In the entire

[go-nuts] Re: Checking IP against CIDR ranges

2018-05-16 Thread Egon
See https://github.com/Kentik/patricia/ On Wednesday, 16 May 2018 03:38:26 UTC+3, XXX ZZZ wrote: > > Hello, > > I'm trying to check an IP against a list of several CIDR ranges, so far > the most obvious way to do it seems to parse both the IP and the cidr > ranges (ParseCIDR) and then do a

[go-nuts] Re: parallel array processing question

2018-04-19 Thread Egon
-0ze3RdDt The slice calculations has bugs as well, e.g. try running with 64 goroutines. + Egon On Thursday, 19 April 2018 14:35:20 UTC+3, l vic wrote: > > I have a program that calculates max value in integer array by breaking > the array into number of slices and calculating max in ev

[go-nuts] Re: Windows cgo complier

2018-03-29 Thread Egon
installing Go. If it works with tdm-gcc, then it will work in mingw64 and msys2. But not necessarily the other way around. + Egon On Wednesday, 28 March 2018 16:17:32 UTC+3, Luke Mauldin wrote: > > Can someone please tell me what the golang team uses as the reference > windows x64 co

[go-nuts] Re: Mac OS Bluetooth Gamepad

2018-03-27 Thread Egon
t; abstraction, but I was curious what it was because I don't see any gamepad > config or listing in the Mac OS Settings panels. > > Sounds like I'm going to be reading some source code… :-) > > Thanks again, > > Zellyn > > > On Tuesday, March 27, 2018 at 8:31:23 AM UTC

[go-nuts] Re: Mac OS Bluetooth Gamepad

2018-03-27 Thread Egon
... however there might be one. On Tuesday, 27 March 2018 15:02:10 UTC+3, Egon wrote: > > Usually controllers don't speak directly to your application nor browser. > > Usually there is a driver that the controller has, this talks with the > appropriate protocol to the device. Th

[go-nuts] Re: Mac OS Bluetooth Gamepad

2018-03-27 Thread Egon
about the existing package, but it shouldn't be difficult to switch when you do encounter problems with the pure Go libs. + Egon On Tuesday, 27 March 2018 05:19:24 UTC+3, Zellyn wrote: > > Inspired by a Wired article > <https://www.wired.com/story/xbox-one-x-and-xbox-one-deals/

Re: [go-nuts] Re: Experience report on coming to Go from a C perspective

2018-02-24 Thread Egon
Few additional possible solutions: 1. use something similar to https://github.com/awalterschulze/goderive create appropriate func. 2. some IDE / tool should be able to figure these refactorings out... or at least find the places that need to be changed. Changing a field or method name is quite

[go-nuts] Re: Go Programming Language Course

2018-02-21 Thread Egon
The main value is not adding complexity in your learning setup. As value points you can show examples how to cross-compile from Windows to Linux. Of course, as Jonathan mentioned compiling with C is bit annoying. If you just need to use CGO, then TDM-GCC does a decent job. If you need to link

[go-nuts] Re: All Forms of Wishful Generics

2018-02-20 Thread Egon
On Monday, 19 February 2018 12:06:09 UTC+2, RickyS wrote: > > Back when I first learned about the diamond problem with multiple > inheritance, I've known we need someone to invent the next and better thing > after inheritance. I do hope somebody smarter than me is somewhere trying. > Or even

Re: [go-nuts] “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Egon
In practice it's seen together with two problems: 1. Emulating multiple dispatch with overloading: technically, it doesn't really solve the same problem as GoF described, but it looks a lot like it. Example: https://en.wikipedia.org/wiki/Visitor_pattern#C++_example 2. Navigate a complex

[go-nuts] Re: “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-05 Thread Egon
I recommend re-writing them using real-world examples, where they really are the "best solution", rather than a facilitated example. Often beginners learn from such facilitated examples and end-up misusing and getting the wrong idea about them. Using realistic examples helps to avoid those

[go-nuts] Re: golang compiler warning idea

2018-01-31 Thread Egon
Use govet and see https://golang.org/cmd/vet/#hdr-Shadowed_variables... Of course, there are more tools that can help you https://github.com/alecthomas/gometalinter + Egon On Wednesday, 31 January 2018 02:05:57 UTC+2, Jacob Lancaster wrote: > > So, I'm new to Go, but I wanted to make a c

[go-nuts] Re: Experience Report building OCR in Go

2018-01-16 Thread Egon
mingw-w64-x86_64-toolchain But, yeah... it could be much, much easier. On Tuesday, 16 January 2018 10:41:23 UTC+2, Egon wrote: > > Not sure why you had to build a GUI separately, there are already a few > libs, although some of them are still barebones... > > https://github.com/l

[go-nuts] Re: Experience Report building OCR in Go

2018-01-16 Thread Egon
Not sure why you had to build a GUI separately, there are already a few libs, although some of them are still barebones... https://github.com/lxn/walk https://github.com/andlabs/ui Of course there are also bindings for gtk and qt. On Monday, 15 January 2018 22:32:33 UTC+2, Tad Vizbaras wrote:

[go-nuts] Re: Interest in implementing dual-pivot or 3-pivot quicksort for faster sorting?

2017-11-23 Thread Egon
based version is ~20% slower than std lib. The specialized version for int is ~20% faster than the std lib. *The implemented specialized version tries to use similar style as the stdlib, which can be optimized further.* + Egon On Wednesday, 22 November 2017 20:03:18 UTC+2, David McManamon wrote

[go-nuts] Re: Bulky (Payload) Structs in API

2017-11-13 Thread Egon
ot;generic-bot". In the end -- you will either have some shared artifact or a translation layer. I see no way of escaping it. + Egon On Monday, 13 November 2017 09:48:07 UTC+2, dc0d wrote: > > Thanks! > > That's what I do, though not happy with it. I had to write some helper > apps

[go-nuts] Re: Bulky (Payload) Structs in API

2017-11-12 Thread Egon
One possibility is copy-paste the structure and convert at call boundaries. https://play.golang.org/p/5LFw6U3yi6 But, can you show a real-world example to ground the conversation? + Egon On Monday, 13 November 2017 08:48:18 UTC+2, dc0d wrote: > > It is a Go best practice to "accept

[go-nuts] Re: append to a stem racy?

2017-11-06 Thread Egon
Yes, that is indeed a race: https://play.golang.org/p/JH6dx9UNxm But it only happens when there are multiple cases where: len(stem) + len(tail) < cap(stem) race-detector detects unsynchronized write-then-(write|read)-s to a memory location For example when there is only one case for

[go-nuts] Re: Released sting 1.0.0

2017-10-03 Thread Egon
:= sting.NewContainer( UsefulStruct{"Very useful"}, sting.NamedTransient("alsoUseful", {"More useful"}), ) But, I don't know how usable it would be in your use cases. + Egon On Monday, 2 October 2017 11:44:10 UTC+3, snmed wrote: > > Hi all > > I released

[go-nuts] Re: Graphing libraries in golang

2017-09-28 Thread Egon
On Friday, 29 September 2017 08:42:50 UTC+3, Vikram Rawat wrote: > > By graphing I actually meant *data visualization libraries* > > SVGO would be so hard to pass a data to and design even the basic and > simple *BARCHART* > > other ones don't have enough documentation to understand how it

[go-nuts] Re: Scope/Context in struct and interfaces design questions

2017-09-27 Thread Egon
} ``` This means when you do repo := db.ForUser(admin), it will return a specific implementation for administrator or user; it implements specific access checks and audit log, or whatever is needed. This has a benefit that any page/thing that uses ListRepo can handle either. + Egon On Tuesday, 26

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-13 Thread Egon
f the >> developer isn't aware of possible security issues. There is no difference >> if some unchecked user content is injected into > id="not-so-secure-blogpost>{{blogpost}} or > id="not-so-secure-blogpost>. So I really don't see where >> "html/tem

[go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-13 Thread Egon
but that should be some other package imho. > > Kind regards > Karv > > Am Mittwoch, 13. September 2017 21:58:47 UTC+2 schrieb Egon: >> >> If you want to manipulate HTML files then there is >> https://godoc.org/golang.org/x/net/html, >> but it come

[go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-13 Thread Egon
mikesamuel/sanitized-jquery-templates/trunk/safetemplate.html#problem_definition) Anyways it's unclear what you are proposing or needing: in general standard libraries shouldn't do everything and probably this, whatever it is, should belong to a 3-rd party package. + Egon On Wednesday, 13 Septemb

[go-nuts] Re: One way - Unexported json field

2017-09-05 Thread Egon
Make a method that creates a copy of the Player with erasing the relevant fields: type Player struct { Id bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"` CustomField string`json:"customField,omitempty" bson:"customField,omitempty"` } func (player Player)

[go-nuts] Re: can list.List.Push* or Get return nil?

2017-08-30 Thread Egon
handle millions of entries. I > will dome some benchmarks, but in theory slices should be slower (all that > allocating/reallocating arrays behind the scenes). I don't know the size of > the structures and I only need the first/last element. > > On Tuesday, August 29, 2017 at 8:24:58

[go-nuts] Re: can list.List.Push* or Get return nil?

2017-08-29 Thread Egon
Is there a reason you are using `container/list`, in most cases it's the wrong solution. Slices in most cases are faster and use less resources and easier to work with. + Egon On Tuesday, 29 August 2017 01:50:10 UTC+3, BeaT Adrian wrote: > > Hello, I just started to learn golang and

Re: [go-nuts] Sort 3 pointers?

2017-08-28 Thread Egon
all the existing triangles, which is too slow because we have 1M+ > triangles. This is because we can't use Triangle as a map key when equality > is computed by a func instead of ==. > > @Egon those are nice workarounds, thanks. X,Y,Z are weak, they change all > the time. > > I w

Re: [go-nuts] Sort 3 pointers?

2017-08-28 Thread Egon
y would be interesting but it would make the program really super > slow: instead of a O(1) map lookup, each existence check would cost O(n) to > traverse all the existing triangles, which is too slow because we have 1M+ > triangles. This is because we can't use Triangle as a map key w

[go-nuts] Re: Sort 3 pointers?

2017-08-28 Thread Egon
When are two vertices considered equal? If by X, Y, Z, then what is the precision of if? How often does Vertex position change? How often are new Triangles created? Anyways: 1. if you can use unsafe: https://play.golang.org/p/6cMS6aMCz7 2. if you cannot use unsafe and can add 1 field to

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Egon
Try to find the first place where the processes diverge: 1. maybe find lists files in different order 2. maybe something read input does things in different order 3. maybe some processing uses maps --> hence random order 4. etc... (of course run with -race, if you already haven't) On Friday, 25

[go-nuts] Re: Generics and readability

2017-08-25 Thread Egon
package tree type Node<$Entry> struct { Value $Entry Left *Node<$Entry> Right *Node<$Entry> } func (node *Node) Insert(value node.$Entry) { var side **Node if node.Value.Less(value) { side = } else { side = } if *side == nil { *side = {Value: value} } else {

Re: [go-nuts] Re: Gathering Ideas for Go 2.

2017-08-22 Thread Egon
oroughly explained my position and understanding... and will distance from the discussion for the time being. + Egon Still this is not about generics but how what goes into Go 2. > > On Tue, 22 Aug 2017, 11:17 Egon <egon...@gmail.com > wrote: > >> On Tuesday, 22 August 2017 1

Re: [go-nuts] Re: Gathering Ideas for Go 2.

2017-08-22 Thread Egon
opment 3. Business Intelligence 4. Statistical Analysis 5. Web Developers 6. Bioinformatics 7. Numerical Analysis 8. Audio Processing 9. GIS 10. Teaching 11. Image Processing 12. Business Processes 13. Databases . Now, all their needs to be condensed into one or two features that is

Re: [go-nuts] Re: Gathering Ideas for Go 2.

2017-08-22 Thread Egon
On Tuesday, 22 August 2017 09:12:45 UTC+3, Henrik Johansson wrote: > > I am sorry Dave but you can ignore the needs of the many few as much as > you want but the tiny things won't go away. > > There probably won't be any _written_ experience reports for most of the > little things. The things

[go-nuts] Re: Gathering Ideas for Go 2.

2017-08-21 Thread Egon
solution" and disagreements and long-winded discussions, where people do not understand each other and try to convince each other. tl;dr; try to include your problem-domain and real-world-examples in discussions, so people can understand you. + Egon On Monday, 21 August 2017 20:03:15 UTC+3, Juc

[go-nuts] Re: Go ordered map

2017-08-16 Thread Egon
Do you mean ordered map or sorted map... either way, as long as the N is small, then you can use a slice to provide the extra functionality: 1. sorted map https://play.golang.org/p/oLM4u5HwQ6 2. ordered map https://play.golang.org/p/OFXhFyyrmZ On Wednesday, 16 August 2017 03:17:29 UTC+3, Tong

[go-nuts] Re: Calling Once (in the code)

2017-08-11 Thread Egon
Note, this can fragment the code and make it harder to understand... (http://number-none.com/blow/john_carmack_on_inlined_code.html) As for the tool: guru can give you the callers of a function, so you might be able to derive something from it. + Egon On Friday, 11 August 2017 10:39:16 UTC+3

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-08-11 Thread Egon
!= nil { return err } out.String(participant) out.Float64(finish - start) return nil } + Egon On Thursday, 10 August 2017 19:17:04 UTC+3, Sofiane Cherchalli wrote: > > Hi Medina, > > Sorry I was on vacations. > > So do you mean the way to do it i

[go-nuts] Re: Trying to understand Go benchmarking

2017-08-10 Thread Egon
ng after this obvious oversight :D + Egon On Thursday, 10 August 2017 10:10:07 UTC+3, peterGo wrote: > > Egon, > > Obviously I ran the race detector. No races were detected. Therefore, > since it wasn't germane, I omitted it from the posted results. > > Here's my results. > >

[go-nuts] Re: Trying to understand Go benchmarking

2017-08-10 Thread Egon
Note, you also have a race in your code. Use `-race` to detect. + Egon On Thursday, 10 August 2017 06:43:34 UTC+3, d...@dgraph.io wrote: > > Hi > > I am trying to benchmark a key-value store written in Go. I have the code > as shown below. There are a few lines that are specif

[go-nuts] Re: Go channels overused and hyped?

2017-08-08 Thread Egon
-offs and pick the one that is most suitable in a certain situation.* + Egon On Tuesday, 8 August 2017 09:01:12 UTC+3, snmed wrote: > > Hi Gophers > > I stumbled over a nice and very interesting Blog entry "Go channels are > bad and you should feel bad > <http://www.jto

Re: [go-nuts] How to optimize as with -O2 from Gcc? (50x speedup)

2017-08-04 Thread Egon
)) } Step 3: compute constant function Pow res := 0.0 for n := 0; n < NMAX; n++ { res += 1.0 res += 2.5 res += 6.25 res += 15.625 } On Friday, 4 August 2017 11:35:43 UTC+3, Egon wrote: > > Use the Assembly Luke. > > https://godbolt.org/g/nGFMbf > > It looks like clang manages

Re: [go-nuts] How to optimize as with -O2 from Gcc? (50x speedup)

2017-08-04 Thread Egon
Use the Assembly Luke. https://godbolt.org/g/nGFMbf It looks like clang manages to compute a table of powers of x. Which, is very very impressive. Which is roughly https://play.golang.org/p/CZkiJKfe7s -- except clang, also does inner loop unrolling. + Egon On Friday, 4 August 2017 11:16:10

[go-nuts] Re: GO Vs D

2017-08-02 Thread Egon
of the language. So you can write more complex and complected code in D -- for better and worse. + Egon On Wednesday, 2 August 2017 13:25:06 UTC+3, ecstati...@gmail.com wrote: > > Ok I understand you now. Maybe I'm biased because I like both languages, > but I'm not convinced that thi

[go-nuts] Re: GO Vs D

2017-08-02 Thread Egon
find > such an example > > But maybe I'm wrong, I don't know... > > On Wednesday, August 2, 2017 at 9:33:48 AM UTC+1, Egon wrote: >> >> On Wednesday, 2 August 2017 10:51:43 UTC+3, ecstati...@gmail.com wrote: >>> >>> For all the common pa

[go-nuts] Re: GO Vs D

2017-08-02 Thread Egon
On Wednesday, 2 August 2017 10:51:43 UTC+3, ecstati...@gmail.com wrote: > > For all the common parts with Go (functions, methods, reference classes, > strings, arrays, slices, ranges, foreach, etc), honestly I don't know why > you say it's simpler in Go. > > Can you show me two examples of code

[go-nuts] Re: Bitwise operators applications

2017-07-22 Thread Egon
/~lecroq/string/node6.html + Egon On Saturday, 22 July 2017 20:36:14 UTC-7, Alexey Dvoretskiy wrote: > > Hello golang-nuts. > > I'm new to Go language and have no solid experience with C/C++. > I was a database programmer with some Python and I was able to get around > without

[go-nuts] Re: Code Review - Applying functions on custom types

2017-07-22 Thread Egon
not sure whether this is sufficient or whether there are better designs. + Egon On Wednesday, 19 July 2017 13:48:07 UTC-7, Sofiane Cherchalli wrote: > > Hi! > > I'm a noob in Go and I need some guidance/help on this: > https://play.golang.org/p/0TGzKiYQZn > > Basically I

[go-nuts] Re: [Bug Report] Cannot run GO in Windows Server 2016

2017-07-17 Thread Egon
Have you tried go1.9beta2? Maybe it's already fixed? https://golang.org/dl/#unstable If not then make a bug report to: https://github.com/golang/go/issues + Egon On Monday, 17 July 2017 06:27:38 UTC-7, yanfeizh...@gmail.com wrote: > > [Issue] > When running go, a problem is en

[go-nuts] Re: Programming paradigm.

2017-07-17 Thread Egon
I suggest reading: https://medium.com/@egonelbre/paradigm-is-not-the-implementation-af4c1489c073 + Egon On Sunday, 16 July 2017 20:42:34 UTC-7, Mayank Acharya wrote: > > Dear all, > I am new to Go language. > > I searched a lot to understand it's paradigm structure but still

[go-nuts] Re: Structuring a Go Application based on domain areas

2017-07-06 Thread Egon
nal/outer models reduces cohesion... controller, view, model (and different layers) work quite tightly together, hence they should be close to each. Also, recommend reading wrt. MVC: https://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html http://wiki.c2.com/?ModelViewControllerHistory + Eg

[go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-06-19 Thread Egon
w, "Invalid request.", http.StatusBadRequest) retun case rr{http.MethodGet, "/"}: // handle index case rr{http.MethodGet, "/favicon.ico"}: // serve icon case rr{http.MethodGet, "/list"}: // serve list case rr{http.MethodPost, "/save"}: // .. } }

Re: [go-nuts] Re: How fast can gopacket handles?

2017-06-09 Thread Egon
SYxS7UeC0PQ-NRTQw> > > I am wondering what further optimization can I do to speed this up? > > Thanks, > Chun > > > > > > On Tuesday, May 30, 2017 at 10:50:50 AM UTC-4, Chun Zhang wrote: >> >> Thank you Rajanikanth, Kevin and Egon! I will explore the ide

[go-nuts] Re: Copy map with empty interfaces

2017-06-05 Thread Egon
s) 3. try sanitizers - search `go build -msan`... I've never used it, but you can see some tests for it in https://github.com/golang/go/tree/master/misc/cgo/testsanitizers Other than that, yeah... try to get the example as small as possible and so that you can show it. + Egon > Thanks, > Chun

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread Egon
urpose set, if I had one. *Depending on the situation the actual approach may vary..* + Egon On Monday, June 5, 2017 at 12:52:47 AM UTC-4, Egon wrote: >> >> >> >> On Monday, 5 June 2017 06:59:46 UTC+3, utyug...@mail.com wrote: >>> >>> >>> >>

[go-nuts] Re: Need some help on my basic "Backup size" calculator

2017-06-05 Thread Egon
See filepath.Walk (https://golang.org/pkg/path/filepath/#Walk) If you wish to recurse with ioutil.ReadDir or File.Readdir (https://golang.org/pkg/os/#File.Readdir), you have to do it manually. Nested structs -- it depends what you are doing. I would simplify it to: type Stat struct {

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-04 Thread Egon
On Monday, 5 June 2017 06:59:46 UTC+3, utyug...@mail.com wrote: > > > > On Sunday, June 4, 2017 at 12:25:17 PM UTC-4, Egon wrote: >> >> I think you are missing the point of my comment. >> >> I'm all for generics, but I also can survive without them with

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-03 Thread Egon
On Saturday, 3 June 2017 13:11:04 UTC+3, mhh...@gmail.com wrote: > > Hi, > > yes generics / not generics. > > That is, in what i proposed, only the consumer is enhanced, thus generics > are not required anymore on the declarer, except for this conv method, > indeed. > > also as the declarer can

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-02 Thread Egon
ound 1-3 paragraphs.* This has a good basis for a good discussion, whereas random thoughts often don't. Also there's always room for a middle-ground. Thinking aloud and random thoughts work somewhat in chats, but often doesn't end-up in something tangible that can be used later on. + Egon >

Re: [go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Egon Elbre
mpletion on each, serially. I've spent the last couple hours examining the text/template implementation. -- Michael On Wednesday, May 31, 2017 at 8:59:20 AM UTC-5, Egon wrote: > > The best idea I can think of (without digging and modifying text/template) > is to use special tokens an

[go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Egon
The best idea I can think of (without digging and modifying text/template) is to use special tokens and replace them afterwards... Of course this approach has limitations in what it can do. *// note: code untested and incomplete* type Token string type Queries struct { pending

[go-nuts] Re: Generic service via interfaces...

2017-05-29 Thread Egon
user storage and a pointer to a > (mongo)model.User > In > https://github.com/dalu/forum/blob/6bb47c27c606b30f91412b48b1af561abe0f5558/server/storage/mongo/service/user.go#L21 > I copy the pointer for the lack of better means to create a new copy, > shallow copy (a := *b) doesn't work because i

[go-nuts] Re: Generic service via interfaces...

2017-05-29 Thread Egon
. Lots of interfaces will disappear. For storage.ID, it can be implemented as *interface{ Set(v string); String() string }* or *struct { I uint64; B bson.ObjectId }* (with custom marshalers)... + Egon On Sunday, 28 May 2017 21:40:01 UTC+3, Darko Luketic wrote: > > I'm stuck and I hoped it would

Re: [go-nuts] Re: How fast can gopacket handles?

2017-05-28 Thread Egon
On Saturday, 27 May 2017 14:05:11 UTC+3, Chun Zhang wrote: > > Thanks Kevin and Egon! > > With a few experiments, I found that the logging, even to a file, is quite > time consuming, so turning off logging helps, resulting in 500Mbps-ish no > drop rate; however, still not

[go-nuts] Re: Go Socket vs C Socket for single-threaded/single CPU socket programming

2017-05-26 Thread Egon
t what exactly you want to learn and use the best tool for the job... + Egon -- 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...@googl

[go-nuts] Re: How fast can gopacket handles?

2017-05-26 Thread Egon
napshot_len, promiscuous, timeout) // ... for { data, ci, err := handle.ZeroCopyReadPacketData() // ... This should remove allocations from critical path. *PS: code untested and may contain typos :P* > > > Thanks, > Chun > > On Friday, May 26, 2017 at 12:37:55 PM UTC-4, Ego

[go-nuts] Re: How fast can gopacket handles?

2017-05-26 Thread Egon
As a baseline measurement I suggest writing the same code in C; this shows how much your VM / config / machine can handle. With gopacket -- use src.NextPacket instead of Packets. There are also: https://github.com/akrennmair/gopcap and https://github.com/miekg/pcap + Egon On Friday, 26 May

[go-nuts] Re: Concurrent access to map

2017-05-16 Thread Egon
ee to optimize watch function as: func watch() { var x int data["running"] = true tmp := data["running"] for tmp { x++ } } + Egon > HTH > Val > > On Tuesday, May 16, 2017 at 7:10:56 AM UTC+2, Yan Tang wrote: >> >> Hi, >> >> I am

[go-nuts] Re: Concurrent access to map

2017-05-16 Thread Egon
1/06/benign-data-races-what-could-possibly-go-wrong for more information. + Egon -- 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+unsubsc

[go-nuts] Re: Proposal: Tags on Interface types

2017-05-07 Thread Egon
This doesn't sound like a real world problem, which means it's really difficult to comment on the problem. Currently the marshaling would work, but not unmarshaling. Also, you can achieve the similar effect with: https://play.golang.org/p/dmFCRT-D1h On Sunday, 7 May 2017 02:56:35 UTC+3, Glen

[go-nuts] Re: iota with gaps

2017-05-03 Thread Egon
starting from 100 E ) // 0, 1, 2, 100, 101 + Egon -- 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

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread Egon
there is > a lot of throughput onto this map. > > Egon: Can you explain what to and why this would help? > There are several ways of implementing a map and there are also offheap implementations (https://godoc.org/github.com/glycerine/offheap) that avoid GC completely -- at the

[go-nuts] Re: OpenGL Fonts

2017-04-21 Thread Egon
when you are using asian text I suspect you will fill up the atlas rather quickly. On Thursday, April 20, 2017 at 2:52:53 PM UTC+8, Egon wrote: >> >> On Tuesday, 18 April 2017 08:02:02 UTC+3, saif wrote: >>> >>> Hi, >>> >>> I like to ask for your

[go-nuts] Re: Large GC pauses with large map

2017-04-20 Thread Egon
Use a custom map implementation. On Thursday, 20 April 2017 16:49:49 UTC+3, Lee Armstrong wrote: > > See attached graph which shows the GC pauses of an application we have. > > I am frequently seeing pauses of 1-1.5 seconds. This is using Go 1.8.1 and > have a large map that is frequently

[go-nuts] Re: OpenGL Fonts

2017-04-20 Thread Egon
On Tuesday, 18 April 2017 08:02:02 UTC+3, saif wrote: > > Hi, > > I like to ask for your suggestions. > > I found a nice project, and was trying to modify them but got stuck with > fonts. > (github.com/dskinner/material) > > I like the fonts to be configurable, but when I tried to parse the fonts

[go-nuts] Re: Use Specific json.Unmarshaler for a dynamic JSON

2017-04-04 Thread Egon
On Tuesday, 4 April 2017 15:33:19 UTC+3, Egon wrote: > > On Tuesday, 4 April 2017 13:54:34 UTC+3, dc0d wrote: >> >> Target: Assuming we want to deserialize some JSON dynamically and we want >> to unmarshal some fields using specific unmarshaling code (a >> certa

[go-nuts] Re: Use Specific json.Unmarshaler for a dynamic JSON

2017-04-04 Thread Egon
On Tuesday, 4 April 2017 13:54:34 UTC+3, dc0d wrote: > > Target: Assuming we want to deserialize some JSON dynamically and we want > to unmarshal some fields using specific unmarshaling code (a > certain UnmarshalJSON). The problem is using something like > map[string]interface{} there is no

[go-nuts] Re: Use Specific json.Unmarshaler for a dynamic JSON

2017-04-04 Thread Egon
What is the JSON input that you need to parse? + Egon On Tuesday, 4 April 2017 13:54:34 UTC+3, dc0d wrote: > > Target: Assuming we want to deserialize some JSON dynamically and we want > to unmarshal some fields using specific unmarshaling code (a > certain UnmarshalJSON). The prob

Re: [go-nuts] Re: Algorithm Club

2017-03-31 Thread Egon
ation for > the first kind use path A and the second kind use path B. That would have > made the code truly general. > > I fear this pedantry will make Russ suspicious of slowing compilation AND > programmers. :-) > > Michael > > On Fri, Mar 31, 2017 at 2:46 AM, Egon <

Re: [go-nuts] Re: Algorithm Club

2017-03-31 Thread Egon
without solving some of the problems that generics intends to solve. Mainly, implementing highly performant data-structures would still require code-generation/copy-paste. And that is a pretty big downside. > > On Wednesday, March 29, 2017 at 9:18:01 PM UTC-7, Egon wrote: >> >> On

Re: [go-nuts] Re: Algorithm Club

2017-03-29 Thread Egon
On Thursday, 30 March 2017 03:15:33 UTC+3, Will Faught wrote: > > Egon: > > >See > https://docs.google.com/document/d/1vrAy9gMpMoS3uaVphB32uVXX4pi-HnNjkMEgyAHX4N4/edit#heading=h.j8r1gvdb6qg9 > > I don't see the Implicit Boxing section point out that this is what > ha

[go-nuts] Re: Algorithm Club

2017-03-28 Thread Egon
On Tuesday, 28 March 2017 07:56:57 UTC+3, Will Faught wrote: > > Something I've never seen addressed in the generics tradeoffs debate (not > saying it hasn't been, but I haven't see it personally) > See

Re: [go-nuts] Re: Algorithm Club

2017-03-27 Thread Egon
into this camp. So > with the above restrictions, count me in favor of slow and bloated :-) > Not necessarily. I suspect it will be faster to compile than most generics packages and similarly dealing with bloat will be easier. > On Sunday, March 26, 2017 at 9:08:20 AM UTC-4, Egon w

Re: [go-nuts] Re: Algorithm Club

2017-03-26 Thread Egon
On Sunday, 26 March 2017 05:15:10 UTC+3, Bakul Shah wrote: > > The simplest design I can think of (that does what you seem to > want) is to add parameterized packages. Here's a > stereotypical example: > > > package stack(T)// parameterized on stack element type > import

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-15 Thread Egon
create an interface somehow to mock > rand.Intn(), but this seems like overkill and I don't know enough about > interfaces to know if this is inadvisable. > Write tests for the intended behavior. It seems you are over-specifying the test. If something needs to return something random

  1   2   >