[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 wo

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

2020-11-07 Thread Egon
irewall 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 &&

[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-12 Thread Egon Kocjan
On Thursday, December 12, 2019 at 3:53:07 PM UTC+1, Bryan C. Mills wrote: > > This is a bit off-topic now, but coincidentally we will have another talk >> (probably by my work colleague) that is related to one of your approaches >> from the talk: >> >> // Glob finds all items with names matching

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

2019-12-11 Thread Egon Kocjan
nmotivated, 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 t

[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 somethi

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

2019-12-07 Thread Egon Kocjan
ency-test) 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: > &quo

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

2019-12-07 Thread Egon Kocjan
t; (which it looks like you’ve 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

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

2019-12-07 Thread Egon Kocjan
I think you might be 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 goro

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

2019-12-06 Thread Egon Kocjan
e: > > 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: > >  >

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

2019-12-06 Thread Egon Kocjan
hannels 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 wan

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

2019-12-06 Thread Egon Kocjan
a bit 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 "g

[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 question

[go-nuts] Re: Go2 Error Handling Feedback

2018-11-02 Thread Egon
Your example code is missing 4 error checks that should additionally be handled. On Thursday, 1 November 2018 11:17:37 UTC+2, Henry wrote: > > Hi, > > I am concerned with the direction Go2 is going. If anything, Go2 should > reduce and consolidate features from Go1 rather than adding new ones.

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

2018-09-12 Thread Egon
t; generics 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 t

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 code

[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 net.c

[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
OS-specific > 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 2

[go-nuts] Re: Mac OS Bluetooth Gamepad

2018-03-27 Thread Egon
mplementation for Mac... 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 p

[go-nuts] Re: Mac OS Bluetooth Gamepad

2018-03-27 Thread Egon
#x27;m not sure 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

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 t

[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 has

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 structu

[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 prob

[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 mak

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

2018-01-16 Thread Egon
h, when targeting only Windows and controls are sufficient, then, yes, there's no point in introducing the complexity. > On Tuesday, January 16, 2018 at 3:45:22 AM UTC-5, Egon wrote: >> >> As for getting andlabs/ui compiling the easiest I've found is to use >>

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

2018-01-16 Thread Egon
chain 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.

[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
e "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 he

[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 "len(stem)

[go-nuts] Re: Released sting 1.0.0

2017-10-03 Thread Egon
ace: container := sting.NewContainer( UsefulStruct{"Very useful"}, sting.NamedTransient("alsoUseful", &UsefulStruct{"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

[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 works

[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
urity Model. If someone uses Golang to create a >> comment section in the web, the same could happen with Templates, if the >> developer isn't aware of possible security issues. There is no difference >> if some unchecked user content is injected into > id="not-s

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

2017-09-13 Thread Egon
rity features) > can be implemented too, yes - 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.o

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

2017-09-13 Thread Egon
awgit.com/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 W

[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) Front

[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:

[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 a

[go-nuts] Re: Loading assets with gomobile bind in a webview app

2017-08-29 Thread Egon
AFAIR asset.Open doesn't support folders. On Tuesday, 29 August 2017 20:06:34 UTC+3, Lantos István wrote: > > I created a gomobile app with the bind command. The `Main.java` app > embedding the go webserver into webview. > > I placed my css file in `./src/main/assets/css/main.css` location. I >

Re: [go-nuts] Sort 3 pointers?

2017-08-28 Thread Egon
verse 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. > &g

Re: [go-nuts] Sort 3 pointers?

2017-08-28 Thread Egon
uality 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

[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 vertex:

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 = &node.Right } else { side = &node.Left } if *side == nil { *side = &Node{Value: value} } else { (*side)

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

2017-08-22 Thread Egon
at any serious proposer can meet. I think I've thoroughly 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 > wrote: > >

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

2017-08-22 Thread Egon
cs covers: 1. Machine Learning 2. Game Development 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 cond

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 tha

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

2017-08-21 Thread Egon
anguages -- even better... it helps people to compare solutions* *and maybe they can come up with a solution Z that solves more problems and is more elegant.* > > > mån 21 aug. 2017 kl 20:47 skrev Egon >: > >> I must add these here: >> >> 1. https://www.youtube.

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

2017-08-21 Thread Egon
o different "optimal 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 2

[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 Su

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

2017-08-11 Thread Egon
ng, it makes code more clear, otherwise, > yes, it makes code more unclear - in my experience. In times it's not an > easy task. But having a long function too, is not a good thing (IMHO). > > On Friday, August 11, 2017 at 6:02:31 PM UTC+4:30, Egon wrote: >> >> Note, th

[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
; err != 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

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

2017-08-10 Thread Egon
mising 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 m

[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
trade-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://ww

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

2017-08-04 Thread Egon
5, float(3)) } 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 clan

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
lexibility 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 no

[go-nuts] Re: GO Vs D

2017-08-02 Thread Egon
think you couldn't manage to 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: &g

[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 s

[go-nuts] Re: Proposal: Blank types instead of Generics for Go 2

2017-07-23 Thread Egon
mention all the cons your proposed methods has 3. You didn't mention prior art of golang proposals, i.e. how it fixes the problems in them. 4. You are missing demonstrations of what problems exactly you are targeting with this proposal. + Egon -- You received this message because you are

[go-nuts] Re: Bitwise operators applications

2017-07-22 Thread Egon
lv.fr/~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 &g

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

2017-07-22 Thread Egon
, I'm 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 > &

[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

[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

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

2017-07-06 Thread Egon
ackages for internal/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/?ModelViewController

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

2017-06-18 Thread Egon
lt: http.Error(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
=D&sntz=1&usg=AFQjCNEjTqyKHKawVSYxS7UeC0PQ-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 a

[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, >

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

2017-06-05 Thread Egon
would have used for searching the general purpose 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: &g

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

2017-06-05 Thread Egon
On Monday, 5 June 2017 12:30:33 UTC+3, mhh...@gmail.com wrote: > > just to add, > > https://www.youtube.com/watch?v=gHCtEjzZ-rY > > I could not agree more on the end, > i could argue about some arguments ;) > > btw, is there a channel that gathers all talks about go ? > https://gophervids.appspot.

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

2017-06-04 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 { FileCount

[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

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

2017-06-04 Thread Egon
the other... without one, this discussion doesn't lead to anywhere. + Egon On Sunday, 4 June 2017 19:09:17 UTC+3, mhh...@gmail.com wrote: > > given the fact that actually everybody disagrees on that idea, > or even something similar according to some feedback. > > I want to put th

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

2017-06-03 Thread Egon
Does race detector say something useful? On Friday, 2 June 2017 21:18:31 UTC+3, Chun Zhang wrote: > > I am trying to store some complicated data structure with a map, and > eventually search and use it. > Since the structure can change with different applications, and it has to > work with mult

[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 r

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

2017-06-02 Thread Egon
to the principle. > > On Friday, 2 June 2017 14:26:47 UTC+1, Egon wrote: >> >> On Friday, 2 June 2017 15:59:41 UTC+3, gary.wi...@victoriaplumb.com >> wrote: >>> >>> Generics enable more than just replacing loops. For example, they can >>> enab

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

2017-06-02 Thread Egon
On Friday, 2 June 2017 15:59:41 UTC+3, gary.wi...@victoriaplumb.com wrote: > > Generics enable more than just replacing loops. For example, they can > enable libraries of generic algorithms to be used with any type of array. > Here's an example: > > foo := GetArray() > result := foo.Take(10).map(

[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.

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

2017-05-31 Thread Egon
> straight to a fully templatized system, which according to my initial > analysis, would be considerably less code and would not really be abusing > the template system (most of the function calls are very straightforward > and there is no heavy processing of the output). > > -- > Mich

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

2017-05-31 Thread Egon Elbre
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 and replace them afterwards... >

[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 sync.WaitGroup

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

2017-05-29 Thread Egon
means to create a new copy, > shallow copy (a := *b) doesn't work because it's an interface > > So I think I'll just call it quits and go concrete up to the service level. > Yeah Egon ID is the lowest common denominator (that brainfart moment on > reddit was me ;) )

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

2017-05-29 Thread Egon
much nicer and clearer. 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&#

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

2017-05-27 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
ta 4. something else ... i.e. figure out 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

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

2017-05-26 Thread Egon
ce, snapshot_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

[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
e the compiler is free 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, &g

[go-nuts] Re: Concurrent access to map

2017-05-15 Thread Egon
ogs/2013/01/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-nu

[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 N

[go-nuts] Re: iota with gaps

2017-05-03 Thread Egon
/ new iota 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

Re: [go-nuts] Re: Assign a string representation to an enum/const

2017-04-25 Thread Egon
On Tuesday, 25 April 2017 23:25:14 UTC+3, Tong Sun wrote: > > > On Tue, Apr 25, 2017 at 3:42 PM, Egon wrote: > > I think the extra "enum" package would reduce readability. The code you >> are putting into package is ~10 lines of code... so the extra package >

  1   2   3   >