Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread eugene via Digitalmars-d-learn
On Monday, 21 February 2022 at 04:46:53 UTC, Chris Piker wrote: On Sunday, 20 February 2022 at 18:00:26 UTC, eugene wrote: Yes, here is my engine with example (echo client/server pair): - [In D (for Linux & FreeBSD)] The code is terse and clean, thanks for sharing :) Nice to hear, thnx!

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread eugene via Digitalmars-d-learn
On Monday, 21 February 2022 at 04:48:56 UTC, Chris Piker wrote: On Sunday, 20 February 2022 at 18:36:21 UTC, eugene wrote: I often use two connections, one for perform main task (upload some data and alike) and the second for getting notifications from PG, 'cause it very incovinient to do both

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 18:36:21 UTC, eugene wrote: I often use two connections, one for perform main task (upload some data and alike) and the second for getting notifications from PG, 'cause it very incovinient to do both in a single connection. Ah, a very handy tip. It would be

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 18:00:26 UTC, eugene wrote: Yes, here is my engine with example (echo client/server pair): - [In D (for Linux & FreeBSD)](http://zed.karelia.ru/0/e/edsm-2022-02-20.tar.gz) The code is terse and clean, thanks for sharing :) I'm adverse to reading it closely

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 17:58:41 UTC, Ali Çehreli wrote: Another one is to set the message box sizes to throttle. Message sizes and rates are relatively well know so it will be easy to pick a throttle point that's unlikely to backup the source yet provide for some quick DB maintenance

Re: Is there a way to not escape slashes when parsing JSON?

2022-02-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 21 February 2022 at 03:42:55 UTC, bachmeier wrote: I tried this ```d import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/file"}`, JSONOptions.doNotEscapeSlashes)); } ``` but the output is ``` {"a":"path\/file"} ``` Is there a way to avoid the escaping

Is there a way to not escape slashes when parsing JSON?

2022-02-20 Thread bachmeier via Digitalmars-d-learn
I tried this ``` import std.json, std.stdio; void main() { writeln(parseJSON(`{"a": "path/file"}`, JSONOptions.doNotEscapeSlashes)); } ``` but the output is ``` {"a":"path\/file"} ``` Is there a way to avoid the escaping of the forward slash? Is there some reason I should want to

Crosscompiling LDC's druntime for Android on Windows

2022-02-20 Thread Fry via Digitalmars-d-learn
I'm trying to cross compile LDC's druntime to enable more debug print statements but I'm having trouble getting it built correctly for aarch64. I'm following the azure pipeline's commands for how it's being built here:

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread eugene via Digitalmars-d-learn
On Saturday, 19 February 2022 at 20:13:01 UTC, Chris Piker wrote: In general it should buffer data in RAM to avoid exerting back pressure on the input socket and to allow for dropped connections to the PG database. If I get it right you want to restore connection if it was closed by server

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread eugene via Digitalmars-d-learn
On Sunday, 20 February 2022 at 16:55:44 UTC, Chris Piker wrote: But I would like to return to your idea in a couple months so that I can try a fiber based implementation instead. I thougt about implementing my engine using fibers but... it seemed to me they are not very convinient because

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 2/19/22 12:13, Chris Piker wrote: >* gotchas you've run into in your multi-threaded (or just concurrent) > programs, I use the exact scenario that you describe: Multiple threads process data and pass the results to a "writer" thread that persist it in a file. The main gotcha is your

Re: keyword as struct field

2022-02-20 Thread partypooper via Digitalmars-d-learn
On Sunday, 20 February 2022 at 17:02:21 UTC, H. S. Teoh wrote: The D convention is to append a `_` to the identifier. From https://dlang.org/dstyle.html: But this doesn't fix the issue, because mir-ion will throw an exception that there is no version_ field that required and but json

Re: keyword as struct field

2022-02-20 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Feb 20, 2022 at 04:52:30PM +, partypooper via Digitalmars-d-learn wrote: > On Sunday, 20 February 2022 at 15:33:17 UTC, Andrey Zherikov wrote: > > On Sunday, 20 February 2022 at 11:08:55 UTC, partypooper wrote: > > > keyword as struct field > > > > I believe this is the case for the

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 15:20:17 UTC, eugene wrote: Most people will probably say this is crazy, but as to PG, one can do without libraries. I am doing so during years (in C, not D) and did not expierienced extremely complex troubles. I mean I do not use libpq - instead I implement some

Re: keyword as struct field

2022-02-20 Thread partypooper via Digitalmars-d-learn
On Sunday, 20 February 2022 at 15:33:17 UTC, Andrey Zherikov wrote: On Sunday, 20 February 2022 at 11:08:55 UTC, partypooper wrote: keyword as struct field I believe this is the case for the most languages - keyword is not allowed as a variable name. Yes, but as example in Nim you can

Re: Function Parameters without Names?

2022-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 2/19/22 22:09, Salih Dincer wrote: > The following doesn't work in a function outside the class: > ```d > TYPE foo(TYPE) { return 42; } > ``` > The compiler gives the following error: > ```undefined identifier TYPE``` I am not sure whether you are asking a question so apologies if I am

Re: keyword as struct field

2022-02-20 Thread Andrey Zherikov via Digitalmars-d-learn
On Sunday, 20 February 2022 at 11:08:55 UTC, partypooper wrote: Hello, I'm new to D. Title is self described, is it possible to use keyword as struct field? Maybe it is XYproblem, so here I will describe a little what I need. I'm parsing some json currently with

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread eugene via Digitalmars-d-learn
On Saturday, 19 February 2022 at 20:13:01 UTC, Chris Piker wrote: * general tips on which libraries to examine Most people will probably say this is crazy, but as to PG, one can do without libraries. I am doing so during years (in C, not D) and did not expierienced extremely complex

Re: keyword as struct field

2022-02-20 Thread partypooper via Digitalmars-d-learn
On Sunday, 20 February 2022 at 14:00:45 UTC, Basile B. wrote: I have a library solution based on opDispatch + __traits(getMember): Thank you, didn't know about opDispatch, so you have taught me something new today. But seems for my current need it can't be apllied (or I still don't

Re: keyword as struct field

2022-02-20 Thread Basile B. via Digitalmars-d-learn
On Sunday, 20 February 2022 at 11:08:55 UTC, partypooper wrote: Hello, I'm new to D. Title is self described, is it possible to use keyword as struct field? Maybe it is XYproblem, so here I will describe a little what I need. I'm parsing some json currently with

keyword as struct field

2022-02-20 Thread partypooper via Digitalmars-d-learn
Hello, I'm new to D. Title is self described, is it possible to use keyword as struct field? Maybe it is XYproblem, so here I will describe a little what I need. I'm parsing some json currently with [mir-ion](https://code.dlang.org/packages/mir-ion) (better/simpler suggestions for only

Re: curl error msg

2022-02-20 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 February 2022 at 13:12:32 UTC, MichaelBi wrote: when running the example in the std.net.curl on my windows, got following msg: std.net.curl.CurlException@std\net\curl.d(4239): Failed to load curl, tried "libcurl.dll", "curl.dll" does it mean i don't have those dll files?

Re: curl error msg

2022-02-20 Thread frame via Digitalmars-d-learn
On Saturday, 19 February 2022 at 13:12:32 UTC, MichaelBi wrote: when running the example in the std.net.curl on my windows, got following msg: std.net.curl.CurlException@std\net\curl.d(4239): Failed to load curl, tried "libcurl.dll", "curl.dll" does it mean i don't have those dll files?

Re: Function Parameters without Names?

2022-02-20 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 19 February 2022 at 23:37:01 UTC, Vijay Nayar wrote: What is the main motivator to allow parameters with no names? 1) `extern(C) void* malloc(size_t);` No need for parameter name at all as that is only a declaration. You don't have an implementation thus don't need a name for