Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-21 Thread Daniel Kozak via Digitalmars-d-learn
Dne so 20. 1. 2024 21:21 uživatel Renato via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: > On Saturday, 20 January 2024 at 19:45:19 UTC, Daniel Kozak wrote: > > On Sat, Jan 20, 2024 at 2:11 PM Renato via Digitalmars-d-learn > > < digitalmars-d-learn@puremagic.com> wrote: > > >

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-20 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Jan 20, 2024 at 2:11 PM Renato via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Wow, fantastic feedback from lots of people, thanks so much! > ... > > > evilrat: > > There is another important difference, i quickly looked up D > > associative array implementation and t

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-19 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Jan 19, 2024 at 4:44 PM H. S. Teoh via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Taking a look at this code: > ... > Try addressing the points I wrote above and see if it makes a > difference. > > I have tried it (all of it) even before you wrote it here, because

Re: vibe.d community/forum/whatever ?

2021-08-30 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 30, 2021 at 8:20 AM bauss via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 30 August 2021 at 02:39:06 UTC, someone wrote: > > https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/ > > > > I've been reading vibe.d tour and some documentation t

Re: Performance issue with fiber

2021-07-30 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Jul 28, 2021 at 11:41 PM hanabi1224 via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Wednesday, 28 July 2021 at 16:26:49 UTC, drug wrote: > > I profiled the provided example (not `FiberScheduler`) using > > perf. Both dmd and ldc2 gave the same result - `void > > fi

Re: How can I allocate a int[] array on stack?

2021-03-26 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Mar 26, 2021 at 7:31 AM Daniel Kozak wrote: > On Fri, Mar 26, 2021 at 6:50 AM Jack via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> What's the equivalent of C's VLA in D? scoped from std.typecons >> doesn't seem to work with arrays. Should I use alloca() for my >

Re: How can I allocate a int[] array on stack?

2021-03-25 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Mar 26, 2021 at 7:36 AM Daniel Kozak wrote: > On Fri, Mar 26, 2021 at 7:31 AM Daniel Kozak wrote: > >> On Fri, Mar 26, 2021 at 6:50 AM Jack via Digitalmars-d-learn < >> digitalmars-d-learn@puremagic.com> wrote: >> >>> What's the equivalent of C's VLA in D? scoped from std.typecons >>> do

Re: How can I allocate a int[] array on stack?

2021-03-25 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Mar 26, 2021 at 6:50 AM Jack via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > What's the equivalent of C's VLA in D? scoped from std.typecons > doesn't seem to work with arrays. Should I use alloca() for my > array or is there something else? > https://dlang.org/libra

Re: which free operating systems have a gtkd package?

2021-01-23 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Jan 23, 2021 at 7:15 AM dan via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > ... > So debian 10 and ubuntu 20.4 are candidates, but i'm wondering if > there are others. (I tried to find gtkd on linux mint but did > not see a package for it, but man i could sure be wro

Re: Directory recursive walking

2021-01-15 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Jan 15, 2021 at 10:30 AM dog2002 via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > ... > Okay, the reason is incredibly stupid: using WinMain instead of > main causes high memory usage. I don't know why, I use the same > code. If I replace WinMain with main, the memory

Re: Directory recursive walking

2021-01-14 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Jan 15, 2021 at 8:20 AM dog2002 via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Friday, 15 January 2021 at 06:56:36 UTC, dog2002 wrote: > > On Friday, 15 January 2021 at 06:33:55 UTC, Paul Backus wrote: > >> On Friday, 15 January 2021 at 06:31:18 UTC, Paul Backus w

Re: Directory recursive walking

2021-01-14 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Jan 15, 2021 at 8:00 AM dog2002 via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Friday, 15 January 2021 at 06:33:55 UTC, Paul Backus wrote: > > On Friday, 15 January 2021 at 06:31:18 UTC, Paul Backus wrote: > >> > >> You can save a little bit of memory here by allo

Re: How to debug D on Linux

2021-01-13 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Jan 13, 2021 at 4:10 PM Roguish via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Wednesday, 13 January 2021 at 14:17:51 UTC, Rikki Cattermole > wrote: > > > > Same thing. > > Clear, thanks. > > I'm just discovering today that DMD and LDC are two different > compiler

Re: Why is (int[int] s = int[int].init) not allowed

2020-12-22 Thread Daniel Kozak via Digitalmars-d-learn
Dne st 23. 12. 2020 1:00 uživatel Steven Schveighoffer via Digitalmars-d-learn napsal: > On 12/22/20 5:44 PM, Daniel Kozak wrote: > > On Tue, Dec 22, 2020 at 10:15 PM Andre Pany via Digitalmars-d-learn > > > > wrote: > > > > Hi, > > > > I am real

Re: Why is (int[int] s = int[int].init) not allowed

2020-12-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Dec 22, 2020 at 10:15 PM Andre Pany via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi, > > I am really confused, why is this valid: > void sample(string[string] s = string[string].init){} > > while this causes syntax errors? > > void sample_invalid1(double[string] s

Re: why is "hello".writeln considered bad?

2020-11-20 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Nov 20, 2020 at 8:55 AM Mike Parker via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > ... > Eh, I wouldn't quite put it that way. If we're thinking of the > same thread, one person said he thought it was a bad idea. That > doesn't make it bad practice. It's just his opi

Re: Task when used on a function that takes parameters doesnt work.

2020-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Nov 12, 2020 at 4:12 PM Daniel Kozak wrote: > On Thu, Nov 12, 2020 at 4:05 PM Ruby The Roobster via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> Here is a test that I did: >> >> void func(int i) >> { >> Thread.sleep(i.seconds); >> } >> void main() { >> auto test

Re: Task when used on a function that takes parameters doesnt work.

2020-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Nov 12, 2020 at 4:05 PM Ruby The Roobster via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Here is a test that I did: > > void func(int i) > { > Thread.sleep(i.seconds); > } > void main() { > auto test = Task!func(3); > test.executeInNewThread(); > test.yeildForce(); >

Re: How to get address of a nested function?

2020-11-10 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 10, 2020 at 11:55 AM Max Samukha via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > We can get the compile time equivalent of a member function's > address by applying '&' to the function in a static context: > > struct S { > void foo() {} > } > > enum pfoo = &S

Re: How to get address of a nested function?

2020-11-10 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 10, 2020 at 8:50 PM Max Samukha via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Tuesday, 10 November 2020 at 14:36:04 UTC, Steven > Schveighoffer wrote: > > >> > >> Is there a way to get a pointer to a non-static nested > >> function? > > > > I don't think you

Re: std.net.curl : Performance

2020-11-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 9, 2020 at 9:50 PM rinfz via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 9 November 2020 at 20:40:59 UTC, rinfz wrote: > > On Monday, 9 November 2020 at 19:55:07 UTC, Vino wrote: > >> ... > > > > The only curl option you need to set within the loop is t

Re: std.net.curl : Performance

2020-11-09 Thread Daniel Kozak via Digitalmars-d-learn
Just delete it On Mon, Nov 9, 2020 at 9:00 PM Vino via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi All, > >Request your help to on how to improve the performance of the > below code. > > import std.conv: to; > import std.net.curl : get, HTTP, CurlOption; > import std.

Re: What is the difference between enum and shared immutable?

2020-10-30 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 29, 2020 at 4:13 PM H. S. Teoh via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > But why can't that be treated differently from explicitly writing @safe > on a declaration? I mean, yeah, it's easier to implement the compiler > that way, but ease of implementation

Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-15 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Oct 14, 2020 at 10:30 PM Jack via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > What was the reasoning behind this decision? > https://dlang.org/deprecate.html#Class allocators and deallocators

Re: question on dub and postgresql

2020-10-05 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Oct 5, 2020 at 10:25 AM Alaindevos via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Can I say python has pip, ruby has bundle and D has dub. > Meaning they perform the same function ? > Or am I wrong? > Yes and no. Dub is Dlang dependency solution but it is not instal

Re: Whats going on with this?

2020-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Oct 3, 2020 at 11:30 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > > > "StructMemberInitializers with the NonVoidInitializer syntax appear in > the lexical order of the fields in the StructDeclaration" seems to > suggest it will not call the constructor, but instead initialize

Re: Whats going on with this?

2020-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Oct 3, 2020 at 10:40 PM Daniel Kozak wrote: > I would say it is here you just need to read it carefully: > > https://dlang.org/spec/struct.html#static_struct_init > > For case specification is change I will paste it here: ''' If a StructInitializer is supplied, the fields are initialized

Re: Whats going on with this?

2020-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Oct 3, 2020 at 4:45 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > On 10/3/20 6:52 AM, claptrap wrote: > > On Saturday, 3 October 2020 at 00:15:02 UTC, Steven Schveighoffer wrote: > >> On 10/2/20 7:28 PM, claptrap wrote: > >> > >>> Why would putting in the writeln cause it to fa

Re: vibe.de multiple ports.

2020-09-30 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 30, 2020 at 2:40 PM seany via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Wednesday, 30 September 2020 at 12:29:06 UTC, Daniel Kozak > wrote: > > to separate the messages from the IoT responses quickly and > forward them to different programs, and to have the c

Re: vibe.de multiple ports.

2020-09-30 Thread Daniel Kozak via Digitalmars-d-learn
Dne st 30. 9. 2020 13:25 uživatel seany via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: > Hello > > I am trying to use this example for a iot application: > https://aberba.com/2018/using-vibe-d-web-interface/ > > The code i use is: > > ushort port = 5504; >

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 3:05 PM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > The thread title is... > > "Why private methods cant be virtual?" > > IE Not... > > "how do I override private functions in a non-polymorphic manner." > > And what you suggest wont work

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 1:30 PM ShadoLight via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > > This is not really "overriding", it is more akin to "overloading" > No it is not overloading, overloading is when you have more methods with same name and differents params. It is

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 11:06 AM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > "Functions marked as final may not be overridden in a derived > class, unless they are also private" > > So final private functions can be overriden? It seems not, but > the sentence i

Re: Why private methods cant be virtual?

2020-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Sep 22, 2020 at 12:23 PM Daniel Kozak wrote: > ... > void main(string[] args) > { > B b = new B; > b.overrideFun; > } > You can have A and B in one module too of course

Re: Why does compose from std.functional return a templated function

2020-09-16 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 16, 2020 at 12:50 PM Daniel Kozak wrote: > > > On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> ... >> >> My main question is why? Is there something, which I am missing, >> that explains, why it is beneficial to ret

Re: Why does compose from std.functional return a templated function

2020-09-16 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > ... > > My main question is why? Is there something, which I am missing, > that explains, why it is beneficial to return a templated > function? > > (maybe, because I might want to comp

Re: Vibe-D File Question

2020-09-11 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Sep 11, 2020 at 1:15 PM Daniel Kozak wrote: > On Fri, Sep 11, 2020 at 1:10 PM Selim Ozel via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > >> It seems like rejected-software forum is flooded with spam, so I >> decided to ask it here. Is there a way to generate a file

Re: Vibe-D File Question

2020-09-11 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Sep 11, 2020 at 1:10 PM Selim Ozel via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > It seems like rejected-software forum is flooded with spam, so I > decided to ask it here. Is there a way to generate a file -csv > for example- on the back-end and serve it to the fron

Re: vibe.d and my first web service

2020-08-12 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Aug 12, 2020 at 3:51 PM James Blachly via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Unfortunately the problem still occurs with Vibe.d 0.9.0 > > IMO **this is the single most important problem to fix** for vibe.d -- > if the most basic of examples (indeed, supplied

Re: LDC cross-module-inlining

2020-08-10 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 1:15 PM Per Nordlöw via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote: > > I am not sure but last time I checked ldc does not do cross > > module inlinig by default, and LTO only help if your

Re: LDC cross-module-inlining

2020-08-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 12:50 AM claptrap via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Sunday, 9 August 2020 at 22:18:13 UTC, Per Nordlöw wrote: > > ... > If you enable link time optimisation you get cross module > inlining, > > -flto=full > > I'm not 100% sure but I th

Re: LDC cross-module-inlining

2020-08-09 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 12:20 AM Per Nordlöw via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > Is cross-module-inlining enabled by default in LDC when compiling > in release mode or do I have to use explicitly flag for it? I > can't find any such flag from the output of neithe

Re: vibe / CTRL+C not terminating server

2020-06-13 Thread Daniel Kozak via Digitalmars-d-learn
On Sat, Jun 13, 2020 at 9:20 PM Robert M. Münch via Digitalmars-d-learn wrote: > > After a CTRL+C I still have the server process running on OSX. Any idea? > > [main() INF] Listening for requests on http://[::1]:8080/ > [main() INF] Listening for requests on http://127.0.0.1:8080/ > [main(

Re: Using Vibe.d for not HTTP

2020-05-25 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, May 24, 2020 at 10:10 AM Russel Winder via Digitalmars-d-learn wrote: > > Hi, > > Clearly Vibe.d is mostly for people doing HTTP and HTTPS stuff. Yet it claims > to be able to support TCP and UDP working with other protocols. However, all > the serious examples are HTTP/HTTPS related. All

Re: Learning Vibe.d

2020-05-25 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, May 24, 2020 at 10:06 AM Russel Winder via Digitalmars-d-learn wrote: > > For my purposes switching to using SIGKILL rather than SIGTERM in my tests > seems to work with 1.9.1, so I'll go with that till 1.9.2 or 1.10.0 produces a > fix rather than revert to 1.8.1. > You can use VibeHighEv

Re: gzip and vibe.d

2020-05-20 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: > > Is it possible to have vibe.d gzip responses? > > I cannot find anything in the documentation about it. > > I am not talking about gzipping ex. files/streams but ALL > responses as a whole. > > Is there a configuration or so

Re: gzip and vibe.d

2020-05-20 Thread Daniel Kozak via Digitalmars-d-learn
https://vibed.org/api/vibe.http.server/HTTPServerSettings.useCompressionIfPossible On Wed, May 20, 2020 at 9:45 AM Atwork via Digitalmars-d-learn wrote: > > Is it possible to have vibe.d gzip responses? > > I cannot find anything in the documentation about it. > > I am not talking about gzipping

Re: D and Async I/O

2020-05-11 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, May 11, 2020 at 4:03 PM Russel Winder via Digitalmars-d-learn wrote: > > ... > I notice that Hunt uses it's own library eschewing all of Phobos. Is this an > indicator that Phobos is not suitable for networking activity? Vibe-d do that too, But https://code.dlang.org/packages/async use pho

Re: Rust, D, GTK+, and asynchronous working

2020-04-27 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Apr 27, 2020 at 11:56 AM Russel Winder via Digitalmars-d-learn wrote: > > Hi, > > Background: I chose to rewrite a Python/PySide2/Qt application in > X/GTK+. After much dithering I was pushed to Rust/gtk-rs/GTK+ and set > to it. Then I decided to do D/GtkD/GTK+ as well. > > Totally unscien

Re: Using LDC2 on ARM

2020-03-02 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Mar 2, 2020 at 6:50 PM Severin Teona via Digitalmars-d-learn wrote: > > Hello, > > I am working on a project that uses a Raspberry Pi (armv7l) and > the latest LDC version I found for this architecture is 1.13.0. > Can you help me install the latest version(1.20.0)? > > Also, I'm having pr

Re: Using LDC2 on ARM

2020-03-02 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Mar 2, 2020 at 7:40 PM Daniel Kozak wrote: > > On Mon, Mar 2, 2020 at 6:50 PM Severin Teona via Digitalmars-d-learn > Do you really need to build you app on arm, could not you use crosscompiling? https://wiki.dlang.org/Cross-compiling_with_LDC

Re: Using LDC2 on ARM

2020-03-02 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Mar 2, 2020 at 7:40 PM Daniel Kozak wrote: > > On Mon, Mar 2, 2020 at 6:50 PM Severin Teona via Digitalmars-d-learn > wrote: > > > > Hello, > > > > I am working on a project that uses a Raspberry Pi (armv7l) and > > the latest LDC version I found for this architecture is 1.13.0. > > Can y

Re: GtkD on Windows: notes + question

2020-02-09 Thread Daniel Kozak via Digitalmars-d-learn
"lflags-windows": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"], On Sun, Feb 9, 2020 at 2:30 PM mark via Digitalmars-d-learn wrote: > > I found a much easier way to get GtkD working on windows than > that described in > https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html > >

Re: ints.choice vs. chars.choice

2019-11-18 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 18, 2019 at 7:25 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > > > You could also use cast(dchar[]), and avoid the cast back to char. > > -Steve or use byCodeUnit writeln(['a', 'b', 'c'].byCodeUnit.choice);

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 12, 2019 at 11:50 PM Marcone via Digitalmars-d-learn wrote: > > > Can you make Alias for: > task!func().executeInNewThread(); > > Thank you! AFAIK that is not possible without some wrapper because executeInNewThread is member function of Task so it will need this reference for object

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds")( seconds )); } sleep(1); // Using function. You can do this:

Re: Hum humm, build latest release with ldc

2019-11-04 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 4, 2019 at 10:45 AM Treebeard via Digitalmars-d-learn wrote: > > Hoom, hum, can you tell me some nice instructions to compile the > latest release of DMD using LDC? > > I walk slowly, but I love fast compilers. > > --- > But I spoke hastily. We must not be hasty. I have become too hot.

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn > wrote: > > > > D calculation: > >mport std.stdio; import std.math : pow; import core.stdc.math; void main() { writefln("%12.3F",log(1-0.)/log(1-(1-0.6)^^20)); } > >

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: > > > If you use gdc or ldc you will get same results as c++, or you can use > C log directly: > > import std.stdio; > import std.math : pow; > import core.stdc.math; > > void main() > { > writefln("%12.3F",log(1-0.)/log(1-(1-0.6)^^20));

Re: Accuracy of floating point calculations

2019-10-29 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 29, 2019 at 4:45 PM Twilight via Digitalmars-d-learn wrote: > > D calculation: > >writefln("%12.2F",log(1-0.)/log(1-(1-0.6)^^20)); > > 837675572.38 > > C++ calculation: > >cout< <<'\n'; > > 837675573.587 > > As a second data point, changing 0. to 0.75 yields > 126082736

Re: Running unittests of a module with -betterC

2019-10-28 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Oct 28, 2019 at 9:40 AM Per Nordlöw via Digitalmars-d-learn wrote: > > Is it possible to run the unittests of a module with -betterC like > > dmd -D -g -main -unittest -betterC f.d > > ? > > This currently errors as > > /usr/include/dmd/druntime/import/core/internal/entrypoint.d:34: >

Re: Converting a ulong to a byte array and constructing a ulong from it

2019-10-24 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 24, 2019 at 3:35 PM 9898287 via Digitalmars-d-learn wrote: > > What's the function for converting a ulong to a native-endian > byte array? > For example, > > auto bytes = 0x1234567890123456u64.to_ne_bytes(); > // should yield > // [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56] in big

Re: Differences between two dates (in days...)

2019-10-24 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 24, 2019 at 1:55 PM Mil58 via Digitalmars-d-learn wrote: > > Hi All... > I am desperate for the answer to the following problem: > to obtain the difference between the date of today and an older > date (results in days...) > > See my script below, where I would like to do: > "date of t

Re: How to use classes from another d files

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 8:30 PM Vinod K Chandran via Digitalmars-d-learn wrote: > > On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote: > > On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran > > wrote: > >> Hi all, > >> I am new to D. But some fair experience with vb.net.

Re: undefined symbol: _D3std7variant...

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 2:20 PM Andrey via Digitalmars-d-learn wrote: > > Hello, > During compilation on linking stage I get strange errors (LDC): > lld-link: error: undefined symbol: > _D3std7variant__T8VariantNVmi56TSQBf8typecons__T5TupleTAyuTSQCgQCf__TQCaVmi32TSQCzQBu__TQBoTAQBmTQBqZQCbTQnTQCbZ

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 10:25 AM Prokop Hapala via Digitalmars-d-learn wrote: > > ... > > Also where is RDMD in the equation? I really like the idea run > binary programs like: > > #!/usr/bin/env rdmd > import std.stdio; > void main(){ > writeln("Hello, world!"); > } > > But I cannot find any

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via Digitalmars-d-learn wrote: > > I'm examining the possibility to move from Python+C/C++ to D or > Python+D. I read > (https://wiki.dlang.org/Programming_in_D_for_Python_Programmers) > and > (https://jackstouffer.com/blog/nd_slice.html), where is men

Re: How can I make a program which uses all cores and 100% of cpu power?

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Oct 11, 2019 at 6:58 AM Daniel Kozak wrote: > > so can stress your CPU. can't

Re: How can I make a program which uses all cores and 100% of cpu power?

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Oct 11, 2019 at 2:45 AM Murilo via Digitalmars-d-learn wrote: > > I have started working with neural networks and for that I need a > lot of computing power but the programs I make only use around > 30% of the cpu, or at least that is what Task Manager tells me. > How can I make it use all

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:26:36 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:25:22 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:21:06 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 a

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:21:06 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:16 UTC, Adam D. Ruppe wrote: [...] Hello, thanks for reply. Thi

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:25:22 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:21:06 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 19:19:42 UTC, Daniel Kozak wrote: On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:16 UTC, Adam D. Ruppe wrote: [...] Hello, thanks for reply. This is my first dlang work: import std.stdio; import std.conv; import

Re: D man pages

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 10 October 2019 at 18:52:32 UTC, Jarek wrote: On Monday, 23 September 2019 at 12:31:16 UTC, Adam D. Ruppe wrote: [...] Hello, thanks for reply. This is my first dlang work: import std.stdio; import std.conv; import core.sys.posix.dirent; [...] You should use fromStringZ: https

Re: Undefined symbol: _dyld_enumerate_tlv_storage (OSX)

2019-10-10 Thread Daniel Kozak via Digitalmars-d-learn
What dmd version? https://issues.dlang.org/show_bug.cgi?id=20019 On Thu, Oct 10, 2019 at 8:15 PM Robert M. Münch via Digitalmars-d-learn wrote: > > I have two project I want to compile and both times get this error: > > Undefined symbols for architecture x86_64: > "_dyld_enumerate_tlv_storage"

Re: DUB mysql-native

2019-10-08 Thread Daniel Kozak via Digitalmars-d-learn
On Tuesday, 8 October 2019 at 14:19:10 UTC, Vino wrote: On Tuesday, 8 October 2019 at 14:02:03 UTC, Vino wrote: On Tuesday, 8 October 2019 at 11:26:24 UTC, Daniel Kozak wrote: [...] Hi Daniel, As stated I have removed those line and ran the below command [...] Hi Daniel, Was able

Re: DUB mysql-native

2019-10-08 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 8, 2019 at 1:15 PM Daniel Kozak wrote: > ... > It is known issue, you can not use mysql-native right now with > anything else than libevent > > https://github.com/mysql-d/mysql-native/issues/199 > > Or you can just remove > > "subConfigurations": { > "vibe-d:core": "libevent" > }, > >

Re: DUB mysql-native

2019-10-08 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Oct 8, 2019 at 10:55 AM Vino via Digitalmars-d-learn wrote: > > Could not resolve configuration for package hub > > From, > Vino.B It is known issue, you can not use mysql-native right now with anything else than libevent https://github.com/mysql-d/mysql-native/issues/199 Or you can jus

Re: must scope for delegates restrict compilation?

2019-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 3, 2019 at 2:00 PM Oleg B via Digitalmars-d-learn wrote: > > Hello all > > I think this code must get compilation error, but it didn't, > furthermore result program get UB. > > https://run.dlang.io/is/Qpr278 > > Is this correct behavior and why? when you change it a litle it seems wor

Re: Why is the fPIC switch missing?

2019-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 3:35 AM Emmanuelle via Digitalmars-d-learn wrote: > > Forgot to say: dmd v2.088.0. Also, weirdly enough, `dmd > --version` outputs `DMD32 D Compiler v2.088.0-dirty`. Why is > "dirty" there? https://forum.dlang.org/post/qqxmnoshytmzflviw...@forum.dlang.org

Re: Why is the fPIC switch missing?

2019-09-22 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 3:35 AM Emmanuelle via Digitalmars-d-learn wrote: > > Hello. My problem is exactly what it says on the title: my dmd > (windows 7, x64) doesn't seem to have -fPIC: > > --- > > dmd -fPIC > Error: unrecognized switch '-fPIC' > run `dmd` to print the compiler manual >

Re: The biggest issue in Dlang

2019-09-19 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 19 September 2019 at 20:50:30 UTC, Daniel Kozak wrote: auto main() { return int(0); } for some reasons does not work WOW :-D this works ok: void main() { return other(); } auto other() { return; } so I believe even this should work: auto main() { return; } I am

The biggest issue in Dlang

2019-09-19 Thread Daniel Kozak via Digitalmars-d-learn
auto main() { return int(0); } for some reasons does not work WOW :-D this works ok: void main() { return other(); } auto other() { return; } so I believe even this should work: auto main() { return; }

Re: Problem with using std.math: abs and std.complex: abs at the same time

2019-09-18 Thread Daniel Kozak via Digitalmars-d-learn
On Wed, Sep 18, 2019 at 2:05 PM berni via Digitalmars-d-learn wrote: > > The following code doesn't compile: > > >import std.stdio; > > > >void main() > >{ > >import std.complex: abs, complex; > >import std.math: abs; > > > >auto a = complex(1.0,1.0); > >auto b = 1.0; > > > >wr

DUB WTF?

2019-09-18 Thread Daniel Kozak via Digitalmars-d-learn
Why is dub automaticaly changing dub.sdl from packages to dub.json?

Re: getting rid of immutable (or const)

2019-09-05 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Sep 5, 2019 at 9:55 AM berni via Digitalmars-d-learn wrote: > > I still struggle with the concept of immutable and const: > > > import std.stdio; > > > > void main() > > { > > auto p = Point(3); > > auto q = p.x; > > writeln(typeof(q).stringof); > > } > > > > struct Point > > {

Re: What is "dmd" Internal API, can I use it just like std Library Reference?

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 2:55 PM BoQsc via Digitalmars-d-learn wrote: > > Hello everyone, again, > > I had an idea that I want some colors in the output of Command > Line (For Windows) and > the Terminal (For Linux) > > I found https://dlang.org/phobos/dmd_console.html and wanted to > use it. > But

Re: Downloading a file and showing progress via curl.

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 1:40 PM BoQsc via Digitalmars-d-learn wrote: > > Hello everyone, > I found this snippet on > https://dlang.org/phobos/std_net_curl.html#.HTTP > > > import std.net.curl : HTTP; > > import std.stdio : writeln; > > > > void main() > > { > > auto http = HTTP(); > > // T

Re: Downloading a file and showing progress via curl.

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 1:46 PM Daniel Kozak wrote: > > On Tue, Aug 20, 2019 at 1:40 PM BoQsc via Digitalmars-d-learn > wrote: > > > > Hello everyone, > > I found this snippet on > > https://dlang.org/phobos/std_net_curl.html#.HTTP > > > > > import std.net.curl : HTTP; > > > import std.stdio : wr

Re: Can't add a const ubyte to a dynamic array of ubyte?

2019-08-20 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 20, 2019 at 11:30 AM ads via Digitalmars-d-learn wrote: > > > How can I get around this? I want to ensure that the array is not > mutated in the function in the signature too. > https://run.dlang.io/is/tehp3j import std.stdio; ubyte[] extend(in uint[] arr) { ubyte[] result;

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Aug 15, 2019 at 9:44 AM Daniel Kozak wrote: > > On Tue, Aug 13, 2019 at 10:47 AM ijet via Digitalmars-d-learn > wrote: > > > > How to use #pragma omp parallel for collapse(n) in dlang? > > There is no OMP for de as I know, but you can just use > https://dlang.org/phobos/std_parallelism.ht

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 13, 2019 at 10:47 AM ijet via Digitalmars-d-learn wrote: > > How to use #pragma omp parallel for collapse(n) in dlang? There is no OMP for de as I know, but you can just use https://dlang.org/phobos/std_parallelism.html#.parallel for each 'foreach'

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Daniel Kozak via Digitalmars-d-learn
You can make an array from it On Tue, Aug 13, 2019 at 12:05 PM Mirjam Akkersdijk via Digitalmars-d-learn wrote: > > On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk > wrote: > > Hello there, > > If I had a DLL, how would I sort it judging by the node > > contents, the D way? > > > >

Re: Speed of Random Numbers

2019-08-04 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, Aug 4, 2019 at 11:49 AM Daniel Kozak wrote: > > You can try http://code.dlang.org/packages/mir-random > > I am using theme here: > https://github.com/TechEmpower/FrameworkBenchmarks/blob/b9cc153dcd1c20e78197b0191536f0d11b8ca554/frameworks/D/vibed/source/postgresql.d#L49 > > On Sun, Aug 4,

Re: Speed of Random Numbers

2019-08-04 Thread Daniel Kozak via Digitalmars-d-learn
You can try http://code.dlang.org/packages/mir-random I am using theme here: https://github.com/TechEmpower/FrameworkBenchmarks/blob/b9cc153dcd1c20e78197b0191536f0d11b8ca554/frameworks/D/vibed/source/postgresql.d#L49 On Sun, Aug 4, 2019 at 12:20 AM Giovanni Di Maria via Digitalmars-d-learn wrote

Re: Help me decide D or C

2019-08-02 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Aug 2, 2019 at 2:30 PM berni via Digitalmars-d-learn wrote: > ... > I would even go further and state, that learning C first will > become a burden instead of a help. > Yes, I agree with this. It is same as with C++. Many people starts with C and then learn C++. Which is really not a good

Re: DUB and ddoc - howto?

2019-06-28 Thread Daniel Kozak via Digitalmars-d-learn
But I am using this one: https://github.com/adamdruppe/adrdox On Fri, Jun 28, 2019 at 2:45 PM Martin Tschierschke via Digitalmars-d-learn wrote: > A very simple question, is there an example how to generate > documentation with dub? > (like dmd -D) > > My internet search was not successful. > >

Re: DUB and ddoc - howto?

2019-06-28 Thread Daniel Kozak via Digitalmars-d-learn
Did you try dub build --help? -b --build=VALUE Specifies the type of build to perform. Note that setting the DFLAGS environment variable will override the build type with custom flags. Possible names:

Re: Where can find fix length array memory layout document

2019-06-18 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Jun 18, 2019 at 2:30 PM lili via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi guys: > Is the Dlang fix-length array alloc on stack? when a test > writeln([1]).sizeof //16 > writeln([2]).sizeof //16 > Why, What is the fix-length array memory layou

Re: Where can find fix length array memory layout document

2019-06-18 Thread Daniel Kozak via Digitalmars-d-learn
import std.stdio; import std.array : staticArray; void main() { writeln([1].staticArray.sizeof); //4 writeln([2,5].staticArray.sizeof); //8 } On Tue, Jun 18, 2019 at 2:30 PM lili via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi guys: > Is the Dlang fix-length

  1   2   3   4   5   >