Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread frame via Digitalmars-d-learn
On Sunday, 8 November 2020 at 05:07:54 UTC, frame wrote: Something wrong with this library. Well, we need an edit function here. The library has no TCP_NODELAY flag enabled. This fix speeds it up to 10x and solves the 44ms problem to 400us

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread frame via Digitalmars-d-learn
On Saturday, 7 November 2020 at 12:29:46 UTC, Andre Pany wrote: Maybe mysql native is slower, but maybe this isn't the case, just the way performance measurements was done was incorrectly. I have tried mysql-native and it tooks way to long for simple things. My test setup is a remote linux

Re: name enum vs static named enum

2020-11-07 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 7 November 2020 at 22:12:12 UTC, Arjan wrote: What is the usage of `static` in this? : ``` static enum Status { NONE, BUSY, ... } ``` It's redundant

name enum vs static named enum

2020-11-07 Thread Arjan via Digitalmars-d-learn
What is the usage of `static` in this? : ``` static enum Status { NONE, BUSY, ... } ```

Re: Variadic function template with one inferred template argument

2020-11-07 Thread Ben Jones via Digitalmars-d-learn
On Saturday, 7 November 2020 at 21:04:19 UTC, starcanopy wrote: void main() { f!(int, float, char)("Hello, world!"); } https://run.dlang.io/is/e8FGrF Ah, I had discovered a different error when I tried that. Thanks!

Re: Return values from auto function

2020-11-07 Thread Piotr Mitana via Digitalmars-d-learn
On Friday, 6 November 2020 at 10:51:20 UTC, Andrey Zherikov wrote: struct Result(T) { struct Success { static if(!is(T == void)) { T value; } } struct Failure { string error; } Algebraic!(Success, Failure) result;

Re: Variadic function template with one inferred template argument

2020-11-07 Thread starcanopy via Digitalmars-d-learn
On Saturday, 7 November 2020 at 20:43:04 UTC, Ben Jones wrote: I'm trying to write a function template with 1 parameter whose type is inferred, but with the other parameters variadic. Basically, I want to do this: auto f(Ts..., Inferred)(Inferred inf){} and call it with f!(X,Y,Z)(w)

Variadic function template with one inferred template argument

2020-11-07 Thread Ben Jones via Digitalmars-d-learn
I'm trying to write a function template with 1 parameter whose type is inferred, but with the other parameters variadic. Basically, I want to do this: auto f(Ts..., Inferred)(Inferred inf){} and call it with f!(X,Y,Z)(w) //inferred will be typeof(w), Ts... == (X, Y, Z) which I can't do

Re: How exactly does Tuple work?

2020-11-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 November 2020 at 18:02:26 UTC, Jan Hönig wrote: I have a simple question. How exactly does Tuple work? In detail, I am interested in expand and opSlice. A Tuple is a struct whose members are generated by type sequence instantiation:

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread frame via Digitalmars-d-learn
On Saturday, 7 November 2020 at 16:37:22 UTC, Vino wrote: , Trying to improve the above code hence request your help on how to use array container instead of array, tried as per the example below but not working. I think you can just use a static array as ubyte[1024] if you want a fixed

How exactly does Tuple work?

2020-11-07 Thread Jan Hönig via Digitalmars-d-learn
I have a simple question. How exactly does Tuple work? In detail, I am interested in expand and opSlice. For expand, I have found the line: https://github.com/dlang/phobos/blob/master/std/typecons.d#L618 How does that work, where is the rest? What does it do? Similary I can access tuples

Re: Return values from auto function

2020-11-07 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 7 November 2020 at 15:49:13 UTC, James Blachly wrote: ``` return i > 0 ? cast(Result) Success!int(i) : cast(Result) Failure("Sorry"); ``` I don't know about the SumType but I would expect you could use a construction instead of cast. import std; alias Result =

Re: DMD: invalid UTF character `\U0000d800`

2020-11-07 Thread Jacob Carlborg via Digitalmars-d-learn
On Saturday, 7 November 2020 at 16:12:06 UTC, Per Nordlöw wrote: CtoLexer_parser.d 665 57 error invalid UTF character \Ud800 CtoLexer_parser.d 665 67 error invalid UTF character \Udbff CtoLexer_parser.d 666 28 error invalid UTF character

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread Vino via Digitalmars-d-learn
On Saturday, 7 November 2020 at 15:26:48 UTC, frame wrote: On Saturday, 7 November 2020 at 14:57:39 UTC, Vino wrote: After further analysis we suspect that the issue is at the package std.net.curl the flow of the program is as below Establishing a new connection may vary in duration of

DMD: invalid UTF character `\U0000d800`

2020-11-07 Thread Per Nordlöw via Digitalmars-d-learn
I'm writing a parser generator for ANTLR-grammars and have come across the rule fragment Letter : [a-zA-Z$_] // these are below 0x7F | ~[\u-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate | [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16

Re: Return values from auto function

2020-11-07 Thread Patrick Schluter via Digitalmars-d-learn
On Saturday, 7 November 2020 at 15:49:13 UTC, James Blachly wrote: ``` retval = i > 0 ? Success!int(i) : Failure("Sorry"); ``` casting each to `Result` compiles, but is verbose: ``` return i > 0 ? cast(Result) Success!int(i) : cast(Result) Failure("Sorry"); ``` ** Could someone more

Re: Return values from auto function

2020-11-07 Thread James Blachly via Digitalmars-d-learn
On 11/6/20 5:51 AM, Andrey Zherikov wrote: I have auto function 'f' that might return either an error (with some text) or a result (with some value). The problem is that the type of the error is not the same as the type of result so compilation fails. ... How can I make the original code

Re: Switch between two structs with csvreader

2020-11-07 Thread Selim Ozel via Digitalmars-d-learn
On Friday, 6 November 2020 at 19:35:47 UTC, H. S. Teoh wrote: You can use the typeof() operator to capture the type of a long, unwieldy type in an alias. This is useful if you ever need to store such a return type somewhere, e.g.: alias T = typeof(csvReader(...)); struct

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread frame via Digitalmars-d-learn
On Saturday, 7 November 2020 at 14:57:39 UTC, Vino wrote: After further analysis we suspect that the issue is at the package std.net.curl the flow of the program is as below Establishing a new connection may vary in duration of +200ms or more.

Re: Dub cmdline overrides?

2020-11-07 Thread James Blachly via Digitalmars-d-learn
On 11/7/20 7:58 AM, Arjan wrote: Is there a cmdline switch to DUB to override certain dub.sdl settings for a dependency? Like the addition or override to lib dirs or link-libs? For example once and a while I run into linking issues with symbols not found due to the `soname` being different on

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread Vino via Digitalmars-d-learn
On Saturday, 7 November 2020 at 14:38:35 UTC, Vino wrote: On Saturday, 7 November 2020 at 14:16:46 UTC, Vino wrote: On Saturday, 7 November 2020 at 12:29:46 UTC, Andre Pany wrote: On Friday, 6 November 2020 at 04:58:05 UTC, Vino wrote: [...] While doing performance measurements you should

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread Vino via Digitalmars-d-learn
On Saturday, 7 November 2020 at 14:16:46 UTC, Vino wrote: On Saturday, 7 November 2020 at 12:29:46 UTC, Andre Pany wrote: On Friday, 6 November 2020 at 04:58:05 UTC, Vino wrote: [...] While doing performance measurements you should do each test multiple time (at least 5 times). There could

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread Vino via Digitalmars-d-learn
On Saturday, 7 November 2020 at 12:29:46 UTC, Andre Pany wrote: On Friday, 6 November 2020 at 04:58:05 UTC, Vino wrote: [...] While doing performance measurements you should do each test multiple time (at least 5 times). There could be for example an effect that executing a db query the

Dub cmdline overrides?

2020-11-07 Thread Arjan via Digitalmars-d-learn
Is there a cmdline switch to DUB to override certain dub.sdl settings for a dependency? Like the addition or override to lib dirs or link-libs? For example once and a while I run into linking issues with symbols not found due to the `soname` being different on my system than specified in

Re: How to use bootstrap with vibe.d.

2020-11-07 Thread Arjan via Digitalmars-d-learn
On Thursday, 5 November 2020 at 16:22:11 UTC, Alaindevos wrote: This is from the bootstrap documentation. I think you must adapt this to .dt files. dt files are basically pugjs https://pugjs.org/ files. When you use vscode with this extension:

Re: How to use bootstrap with vibe.d.

2020-11-07 Thread Arjan via Digitalmars-d-learn
On Thursday, 5 November 2020 at 16:22:11 UTC, Alaindevos wrote: This is from the bootstrap documentation. I think you must adapt this to .dt files. ``` ... ... html( lang='nl' ) head title #{pageTitle} meta( charset="utf-8") meta( name="viewport"

Re: Comparison : mysql-native + asdf and hunt-database + asdf

2020-11-07 Thread Andre Pany via Digitalmars-d-learn
On Friday, 6 November 2020 at 04:58:05 UTC, Vino wrote: Hi All, We recently tested the below components and the test results are as below, even though hunt-database is faster than mysql-native it is hard to use this package as it lacks on documentation, non of the example provided in the

Re: Return values from auto function

2020-11-07 Thread Andrey Zherikov via Digitalmars-d-learn
On Saturday, 7 November 2020 at 01:50:15 UTC, Jesse Phillips wrote: On Friday, 6 November 2020 at 15:06:18 UTC, Andrey Zherikov wrote: On Friday, 6 November 2020 at 14:58:40 UTC, Jesse Phillips wrote: On Friday, 6 November 2020 at 14:20:40 UTC, Andrey Zherikov wrote: This issue seems hit the