Probably
1. You're using connection pool in gorm
2. Gorm is using golang's connection pool
3. The connection gets cached/reused while domain's IP changes (as the
address is same but ip changes and the change can't be easily detected)
So the solution would probably be to do a lookup in a
Hi Guys, is it reasonable to publish multiple modules inside single github
repo, eg.
https://github.com/user/tools/a
https://github.com/user/tools/b
https://github.com/user/tools/c
That seems to be working, but could it create any issues in the future (eg.
with version control if I import 2
Hi Guys, writing a quick K/V caching system and have a performance related
question.
Will be operating on []byte, for the system to be thread safe we need to
create a copy of data before each SET so we're sure that the slice which
gets added to pool can't be modified. This shouldn't be
Hi Guys,
I have 2 json files, A, B. Now i want to detect changes on the root level.
File A: {"a":{"b":1, "c":2}, "x":false, ... }
File B: {"a":{"b":1, "c":2}, "x":true, ... }
I want to be able to see that x is different between A and B and a stayed
the same. What would be the easiest
UTC+2 bse...@computer.org
napisał(a):
> On Sun, Oct 9, 2022 at 5:49 AM Slawomir Pryczek
> wrote:
>
>> Hi Guys,
>> wanted to see if i making correct assumptions regarding mutexes and
>> structures
>>
>> var globalMutex sync.Mutex{}
>> type abc stru
Hi Guys,
wanted to see if i making correct assumptions regarding mutexes and
structures
var globalMutex sync.Mutex{}
type abc struct {
a int
b int
mu sync.Mutex{}
}
1. First is self explanatory, array of structures all needs to be protected
by mutex
x := []abc{}
x = append(x,
>From unmarshal doc:
1. To unmarshal JSON into a pointer, Unmarshal first handles the case
of the JSON being the JSON literal null. In that case, Unmarshal sets the
pointer to nil. Otherwise, Unmarshal unmarshals the JSON *into the value
pointed at by the pointer*. *If the pointer is nil,
o
>
> On Thu, Jul 21, 2022 at 8:10 AM Slawomir Pryczek
> wrote:
>
>> Actually this is better code for the question
>> https://gotipplay.golang.org/p/GQlB2tyyj53
>>
>> czwartek, 21 lipca 2022 o 08:08:51 UTC+2 Slawomir Pryczek napisał(a):
>>
>>> htt
Actually this is better code for the question
https://gotipplay.golang.org/p/GQlB2tyyj53
czwartek, 21 lipca 2022 o 08:08:51 UTC+2 Slawomir Pryczek napisał(a):
> https://gotipplay.golang.org/p/ojY3RRJRJgy
>
> func GenericData[T DATA, T1 any]() {
> }
>
> When DATA is interface o
https://gotipplay.golang.org/p/ojY3RRJRJgy
func GenericData[T DATA, T1 any]() {
}
When DATA is interface of pointer type, so methods can modify the
underlying structure...
// T1 <- any type, so can instantiate but can't increment as there's no
interface
var tt T1
fmt.Println(tt)
var d T
source of those
> existing functions is simple, this is left as an exercise for the reader :-)
>
> https://cs.opensource.google/go/go/+/refs/tags/go1.18.4:src/sort/search.go;l=76-103
>
> On Tuesday, 19 July 2022 at 13:53:33 UTC+1 Slawomir Pryczek wrote:
>
>> Hi Guys, is it pos
Have you tried starting a simple thread which will update some variable
every 100ms (for example), and then just get value of this variable? Using
atomic functions. I believe memcached was 'caching' calls to get time this
way and it won't probably be very accurate (as we don't have hard
Hi Guys, is it possible to implement generic, efficient binary search using
generics or interfaces. So i'll have some index, and data inside single
struct and then could just define a comparison function between 2 variables
of same type index which will return bool.
Will have 20-30 million
m/slawomir-pryczek/HSServer/go/src/handler_socket2
https://github.com/slawomir-pryczek/HSServer/tree/master/go/src/handler_socket2
1. So the first idea was just to put handler_socket2 instead of the path
inside go.mod. Everything was working correctly within the module, but it
produced issue dur
Thanks for the help, so i think i get it fully now.
@Nick: Sure works great if you're making a project with github modules.
Having local modules is possible. But so cumbersome people would be
occupied with managing files rather than writing code (if you have >20 of
them).
@Carla: Actually i
Thanks for all replies. Actually the docs are good (imo) just these
solutions proposed in docs are a horror.
Inside root folder of the module... so im unable to share packages between
projects and code structure gets horrible, because now instead of nicely
organized 2 levels of nesting i have
Hey Guys, I'm struggling with the new "modules" approach and after checking
several help files it seems it's inconvinient beyond belief. Basically i
have an app:
...src/
/myapp/main.go package main
/pool/pool.go package pool
And i can't even include package pool into main without manually
Thanks for very insightful posts. That's actually what i was interested in,
as i was wondering if x86 is so advanced to invalidate caches on its own,
or it's taken care by software/compiler or if that's just pure coincidence
that this code actually works :)
Actually as i'm doing persistent
Hi Guys, was wondering about some things related to multithread code.
1. If data that is accessed or changed - it needs to go into CPU cache
first, and AFAIK to caches whole memory block not just this single area of
memory on which we're operating. When we're doing writes without
I think what would work is declaring some number of mutexes, in array like
48. Then you can compute CRC32 of the token, and lock based on modulo. But
yes, probably best would be to change underlying code and just partitioning
the work by hash.
const concurrency = 48
type concurrentChecks
TC+2 użytkownik
jessie@rococoglobaltech.com napisał:
>
> is there a hope for generics like this?
>
> gen[A]ToStringer
> gen[string].ToString()
>
>
>
>
>
> Noong Huwebes, Hulyo 4, 2019 ng 6:02:45 PM UTC+8, si Slawomir Pryczek ay
> sumulat:
>>
>>
On Jul 5, 2019, at 6:42 AM, Slawomir Pryczek > wrote:
>
> Sure it has a race issue, because in this example you're mixing atomic
> operations with mutex, when you want your code to be thread safe you need
> to do access to the variable using mutex or using atomic in all cases
Not sure if that's a good idea. Strings are immutable so you can pass
string to function by reference, in thread safe manner. So if you pass same
string to 2 threads and one of them modify it - you'll really have
allocate+copy+modify so you're never touching the original thing so you
can't
Sure it has a race issue, because in this example you're mixing atomic
operations with mutex, when you want your code to be thread safe you need
to do access to the variable using mutex or using atomic in all cases.
Because both ways work differently and are not "interchargable" so you
can't
It seems I'm hearing that a lot. If C++/Java is so great and go is so
"primitive"... well what all these people are still doing in here? ;)
And i'd take "primitive" if err!=nil over exceptions any time of the day,
at least code is streamlined, ordered and easy maintainable this way. Then
i can
Following this group for couple years and I think that from some time the
community is in some kind of crisis, because it seems that go1 is so good
that there's a lack of some feature which will distinct go1 from go2, so
everyone's trying to invent some code breaking change which will
On one side, it's 1000x better than the other error handling specs, at
least it isn't going to turn code into unreadable, fragmented mess. On the
other, Aston seems to have a point, it's just replacing one-liner... and
it's not that great at all because with "if" you know what it's doing
Come on, open your minds a little. Once every 5 years it doesn't hurt to
learn some new, better ways of doing things. And if someone wants to write
java code untill he dies, then there's a great method of doing that called
"stick to java" ;)
That same kind of thinking already marginalized
Hi Guys, so i have this small go program which works fine under linux...
but there's some very strange issue with getting microsecond-precision time
under windows7.
https://play.golang.org/p/N9F7xpx7hEr
It won't run properly under playground so let me just paste here so you can
see the
Hi Guys,
When looking at this code below, you can see that the function will get
LAST value of i which is incremented inside the loop, but t is somehow
copied and taken inside a function so closure is created and it is bound to
current value of t, so we'll have its current value in function.
It should be very simple if you have additional 2G of memory. You divide
the data to X parts where X is power of 2 and X needs to be less than
number of cores available. Eg. for 2000MB it can be 250x8. Then you sort it
in paralell using built-in sorting function and at the end you just
I think using standard sync'ed map may be bad idea for this use case
(write-only access), especially taking into account that it's optimized for
read access and stable keys, so each write will acquire mutex anyway.
if nothing is read from that map during the threads run, it should be
probably
AB is using HTTP/1.0, so it isn't able to do keepalives and it may be the
case that you're really benchmarking your TCP stack, instead of your
webserver... as TCP connect is probably the bottleneck here :) Not sure how
it works under the hood, but enabling tcp_reuse, and tcp_recycle might
can't know if message ended
and you need to start processing it, or there are link issues and you
should return a timeout error and maybe re-try. I have project like this on
github. It's golang TCP server and php TCP
client https://github.com/slawomir-pryczek/HSServer
Writing client is much
Are you sure you have this issue on write, not on previous read?
W dniu środa, 4 stycznia 2017 16:24:13 UTC+1 użytkownik lixi...@gmail.com
napisał:
>
> I'm working on a TUN/TAP library on Windows. (
> https://github.com/lixin9311/water)
> It's basically completed, but I have encountered IO
a
>> pointer type. The unqualified type name acts as the field name.
>
>
> type xadvanced struct {
> *x
> }
> func(x *xadvanced)increment(){
>x.y ++
>fmt.Println(x.y)
> }
>
> I'd advise you do read the spec at least once, it's short and
Hi Guys,
i want to make something like this
type si struct {
s *sync_task.Sync_task
}
func (this *si) Process() {
... some code here ...
this.Process();
}
Basically i want to extend object in another package... and this works. Now
i'd just want to extend it without creating
ki/ReleaseNotes1431
Basically the memcache*d* extension for PHP was buggy and that's one of the
reason for writing my project ...
W dniu środa, 16 listopada 2016 22:52:55 UTC+1 użytkownik Jesper Louis
Andersen napisał:
>
>
>
> On Wed, Nov 16, 2016 at 3:10 PM Slawomir Pryczek
company
projects...
>
> 2016. november 16., szerda 15:10:30 UTC+1 időpontban Slawomir Pryczek a
> következőt írta:
>>
>> Hi Guys, I wrote memcached like PHP-client and GO-server, with additional
>> features,
>>
>
> Why not https://github.com/golang/groupca
If you're on a beefy machine with recent linux, maybe MTU of loopback
interface is set to 65k, setting it to default 1500 would help i think...
ifconfig lo mtu 1500 up
https://www.cyberciti.biz/faq/centos-rhel-redhat-fedora-debian-linux-mtu-size/
W dniu środa, 16 listopada 2016 06:01:50
ows and
linux, has snapshots and rebalance and doesn't require to install anything
for PHP, just the server.
https://github.com/slawomir-pryczek/FlatDB/releases
Why you should use it?
- Much better Garbage Collection mechanism, that isn't skipping items with
short TTLs like LRU, so mem
41 matches
Mail list logo