Re: Error running concurrent process and storing results in array

2020-05-21 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 21 May 2020 at 07:38:45 UTC, data pulverizer wrote: Started uploading the code and writing the article for this. The code for each language can be run, see the script.x files in each folder for details and timings. https://github.com/dataPulverizer/KernelMatrixBenchmark Thanks

Re: redirect std out to a string?

2020-05-21 Thread wolframw via Digitalmars-d-learn
On Thursday, 21 May 2020 at 15:42:50 UTC, Basile B. wrote: On Thursday, 21 May 2020 at 04:29:30 UTC, Kaitlyn Emmons wrote: is there a way to redirect std out to a string or a buffer without using a temp file? yes: [snip] Alternatively, setvbuf can be used: void[1024] buf; // buffer must

Re: How to use GET_X_LPARAM in D ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 21 May 2020 at 20:12:13 UTC, Harry Gillanders wrote: On Thursday, 21 May 2020 at 18:42:47 UTC, Vinod K Chandran wrote: Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i

Re: How to use GET_X_LPARAM in D ?

2020-05-21 Thread Harry Gillanders via Digitalmars-d-learn
On Thursday, 21 May 2020 at 18:42:47 UTC, Vinod K Chandran wrote: Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i miss something ? GET_X_LPARAM isn't defined in Phobos's Windows

Re: How to use GET_X_LPARAM in D ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 21 May 2020 at 18:42:47 UTC, Vinod K Chandran wrote: Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i miss something ? I search all modules in "

How to use GET_X_LPARAM in D ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i miss something ?

Re: String interpolation

2020-05-21 Thread mw via Digitalmars-d-learn
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote: On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote: On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote: Can we do string interpolation in D now? There's an implementation in the dub package "scriptlike":

Re: String interpolation

2020-05-21 Thread ZK via Digitalmars-d-learn
On Thursday, 21 May 2020 at 17:17:49 UTC, Adam D. Ruppe wrote: On Thursday, 21 May 2020 at 17:10:31 UTC, mw wrote: BTW, is the .idup must be there? It is discussed more in the github document but basically the proposed built-in syntax returns a generic builder thing which can make more than

Re: String interpolation

2020-05-21 Thread ZK via Digitalmars-d-learn
On Thursday, 21 May 2020 at 18:12:01 UTC, ZK wrote: I love the extensibility of this, but perhaps there should be something like `ii"foo".idup` that's syntactic sugar for `i"foo".idup`. New users might get confused by the need for appending idup, and then they'll think about how other

Re: How to allocate/free memory under @nogc

2020-05-21 Thread Konstantin via Digitalmars-d-learn
On Thursday, 21 May 2020 at 15:09:57 UTC, Steven Schveighoffer wrote: On 5/20/20 10:50 PM, data pulverizer wrote: how do you allocate/free memory without using the garbage collector? Use C malloc and free. Does allocating and freeing memory using `GC.malloc` and `GC.free` avoid D's garbage

Re: String interpolation

2020-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 21 May 2020 at 17:10:31 UTC, mw wrote: BTW, is the .idup must be there? It is discussed more in the github document but basically the proposed built-in syntax returns a generic builder thing which can make more than just strings. The idup specifically asks it to make a copy

Re: String interpolation

2020-05-21 Thread mw via Digitalmars-d-learn
On Thursday, 21 May 2020 at 12:53:50 UTC, Adam D. Ruppe wrote: On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote: i.e how to write this 's'? gimme a like on the proposal to add to the language! https://github.com/dlang/DIPs/pull/186 If accepted, that would let you write i"stuff here".idup

Re: redirect std out to a string?

2020-05-21 Thread Basile B. via Digitalmars-d-learn
On Thursday, 21 May 2020 at 04:29:30 UTC, Kaitlyn Emmons wrote: is there a way to redirect std out to a string or a buffer without using a temp file? yes: --- #!dmd -betterC module runnable; extern(C) int main() { import core.sys.posix.stdio : fclose, stdout, fmemopen, printf, fflush;

Re: redirect std out to a string?

2020-05-21 Thread Dukc via Digitalmars-d-learn
On Thursday, 21 May 2020 at 04:29:30 UTC, Kaitlyn Emmons wrote: is there a way to redirect std out to a string or a buffer without using a temp file? If you want to do the redirection at startup, it's possible. Have an another program to start your program by std.process functions and

Re: How to use this forum ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 21:15:25 UTC, Dukc wrote: On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: [...] No can do :(. Well, moderators can delete posts so you could try to ask them nicely in some cases but the primary way tends to be the same as with email: send a

Re: How to use this forum ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 21:13:25 UTC, Paul Backus wrote: On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: [...] You can't. If you need to make a correction, the best you can do is to make a follow-up post. [...] Copy & paste it. [...] You can't embed images

Re: redirect std out to a string?

2020-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/20 12:29 AM, Kaitlyn Emmons wrote: is there a way to redirect std out to a string or a buffer without using a temp file? D's I/O is dependent on C's FILE * API, so if you can make that write to a string, then you could do it in D. I don't think there's a way to do it in C. So likely

Re: How to allocate/free memory under @nogc

2020-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/20/20 10:50 PM, data pulverizer wrote: how do you allocate/free memory without using the garbage collector? Use C malloc and free. Does allocating and freeing memory using `GC.malloc` and `GC.free` avoid D's garbage collector? No, an allocation can trigger a collection. D does not

Re: String interpolation

2020-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote: i.e how to write this 's'? gimme a like on the proposal to add to the language! https://github.com/dlang/DIPs/pull/186 If accepted, that would let you write i"stuff here".idup to get an interpolated string.

Re: String interpolation

2020-05-21 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote: On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote: On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote: Can we do string interpolation in D now? There's an implementation in the dub package "scriptlike":

String interpolation

2020-05-21 Thread Patrick Schluter via Digitalmars-d-learn
https://forum.dlang.org/post/prlulfqvxrgrdzxot...@forum.dlang.org On Tuesday, 10 November 2015 at 11:22:56 UTC, wobbles wrote: int a = 1; int b = 4; writefln("The number %s is less than %s", a, b); writeln("The number ",a, " is less than ",b);

Re: Template type deduction question

2020-05-21 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 21 May 2020 at 07:16:11 UTC, Basile B. wrote: The problem is that "K" is a template type parameter [1]. When the compiler deduces the parameter that ends up with a symbol, i.e not a type. To permit a symbol to be deduced you can use a template alias parameter[2] instead: ---

Re: Error running concurrent process and storing results in array

2020-05-21 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 17:31:39 UTC, Jacob Carlborg wrote: On 2020-05-06 12:23, data pulverizer wrote: Yes, I'll do a blog or something on GitHub and link it. It would be nice if you could get it published on the Dlang blog [1]. One usually get paid for that. Contact Mike Parker. [1]

Re: Template type deduction question

2020-05-21 Thread Basile B. via Digitalmars-d-learn
On Thursday, 21 May 2020 at 07:16:11 UTC, Basile B. wrote: On Thursday, 21 May 2020 at 04:46:02 UTC, data pulverizer wrote: I'd like to pass kernel functions using: ``` auto calculateKernelMatrix(K, T)(K!(T) Kernel, Matrix!(T) data) { ... } ``` and call it using

Re: Template type deduction question

2020-05-21 Thread Basile B. via Digitalmars-d-learn
On Thursday, 21 May 2020 at 04:46:02 UTC, data pulverizer wrote: I'd like to pass kernel functions using: ``` auto calculateKernelMatrix(K, T)(K!(T) Kernel, Matrix!(T) data) { ... } ``` and call it using `calculateKernelMatrix(myKernel, myData);` but I get a type deduction error and have

Re: String interpolation

2020-05-21 Thread mw via Digitalmars-d-learn
On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote: On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote: Can we do string interpolation in D now? There's an implementation in the dub package "scriptlike": https://code.dlang.org/packages/scriptlike#string-interpolation Thank you!

Re: Compile and run programs off USB drive

2020-05-21 Thread Joel via Digitalmars-d-learn
On Thursday, 21 May 2020 at 06:23:10 UTC, Joel wrote: With Windows OS. How would I use my USB drive to compile and run (with 64-bit too)? So far I made a bat file that adds D to %PATH%. There's no zip file of DMD to download, and I didn't get the 7z to work (even with the 7z program?!) -

Re: link error on Windows

2020-05-21 Thread Joel via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 09:31:38 UTC, Nathan S. wrote: On Tuesday, 19 May 2020 at 04:54:38 UTC, Joel wrote: I tried with DMD32 D Compiler v2.088.1-dirty, and it compiled and created an exe file, but not run (msvcr100.dll not found - and tried to find it on the net without success). DMD

Compile and run programs off USB drive

2020-05-21 Thread Joel via Digitalmars-d-learn
With Windows OS. How would I use my USB drive to compile and run (with 64-bit too)? So far I made a bat file that adds D to %PATH%. There's no zip file of DMD to download, and I didn't get the 7z to work (even with the 7z program?!) - last time I tried. With 64-bit, I don't see what to do