Re: How to embed static strings to a D program?

2017-10-16 Thread evilrat via Digitalmars-d-learn
On Monday, 16 October 2017 at 05:34:13 UTC, Ky-Anh Huynh wrote: Hello, I want to use some static contents in my program, e.g, a CSS file, a long listing. To help deployment process I'd like to have them embedded in the final binary file. Is there any convenient way to support this? Maybe I

Range tee()?

2017-10-16 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Does Phobos have a way to "tee" a range? For example, suppose you had something like this: - // Do something with each file in a dir dirEntries(selectedDir, SpanMode.shallow) .filter!someFilterCriteria .doSomethingWithFile;

Re: Range tee()?

2017-10-16 Thread lobo via Digitalmars-d-learn
On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: Does Phobos have a way to "tee" a range? For example, suppose you had something like this: [...] https://dlang.org/phobos/std_range.html#tee ?

Re: Range tee()?

2017-10-16 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 10/16/2017 03:30 AM, lobo wrote: On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: Does Phobos have a way to "tee" a range? For example, suppose you had something like this: [...] https://dlang.org/phobos/std_range.html#tee ? Ahh, thanks, I was only looking

what operator(s) should I overload to prevent this?

2017-10-16 Thread drug via Digitalmars-d-learn
I refactored `MyStructure` added own implementation of malloced array based on pureRealloc/pureFree instead of dynamic array I used before and now I have error: Error: cannot implicitly convert expression get(msg.getData()) of type const(MyStructure) to MyStructure. What operators should I

Re: what operator(s) should I overload to prevent this?

2017-10-16 Thread Biotronic via Digitalmars-d-learn
On Monday, 16 October 2017 at 12:00:13 UTC, drug wrote: I refactored `MyStructure` added own implementation of malloced array based on pureRealloc/pureFree instead of dynamic array I used before and now I have error: Error: cannot implicitly convert expression get(msg.getData()) of type

Re: what operator(s) should I overload to prevent this?

2017-10-16 Thread drug via Digitalmars-d-learn
16.10.2017 15:18, Biotronic пишет: On Monday, 16 October 2017 at 12:00:13 UTC, drug wrote: I refactored `MyStructure` added own implementation of malloced array based on pureRealloc/pureFree instead of dynamic array I used before and now I have error: Error: cannot implicitly convert

What's the best way to programmatically detect the most recent release of DMD and others?

2017-10-16 Thread Andrew Edwards via Digitalmars-d-learn
The best way I know to determine the latest DMD release is http://ftp.digitalmars.com/LATEST. I'm not aware that such a file exists for LDC and GDC so I'm currently doing: string latest(string url) { return executeShell("git ls-remote --tags " ~ url ~ " | cut -d 'v' -f 2 | cut -d '-' -f 1

Re: what operator(s) should I overload to prevent this?

2017-10-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/16/17 8:00 AM, drug wrote: I refactored `MyStructure` added own implementation of malloced array based on pureRealloc/pureFree instead of dynamic array I used before and now I have error: Error: cannot implicitly convert expression get(msg.getData()) of type const(MyStructure) to

Re: Why isn't IID_ITaskbarList3 defined?

2017-10-16 Thread Nieto via Digitalmars-d-learn
On Monday, 16 October 2017 at 05:06:26 UTC, evilrat wrote: On Sunday, 15 October 2017 at 15:13:09 UTC, Nieto wrote: I'm trying to write a blinding and I found both IID_ITaskbarList and IID_ITaskbarList2 are defined but IID_ITaskbarList3 isn't. Any reason why it isn't defined? sorry if it

Re: What's the best way to programmatically detect the most recent release of DMD and others?

2017-10-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-10-16 17:13, Andrew Edwards wrote: The best way I know to determine the latest DMD release is http://ftp.digitalmars.com/LATEST. I'm not aware that such a file exists for LDC and GDC so I'm currently doing: string latest(string url) {     return executeShell("git ls-remote --tags " ~

Re: What's the best way to programmatically detect the most recent release of DMD and others?

2017-10-16 Thread Andrew Edwards via Digitalmars-d-learn
On Monday, 16 October 2017 at 18:21:46 UTC, Jacob Carlborg wrote: On 2017-10-16 17:13, Andrew Edwards wrote: Is there a better way? The official download script [1] is using the following: You're a godsend. Thank you very much.

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-16 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 16 October 2017 at 03:49:18 UTC, ketmar wrote: Michael V. Franklin wrote: [...] judging from my several decades of expirience, bounties almost never works. there are alot of reasons for that, but the fact still stands: it is *almost* impossible to make something happen with

How do I convert a LPVOID (void*) to string?

2017-10-16 Thread Nieto via Digitalmars-d-learn
How do I convert/create a D string from LPVOID (void*)? string GetLastErrorMessage() { LPVOID lpMsgBuf; DWORD errorMessageID = GetLastError(); FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |

Re: How do I convert a LPVOID (void*) to string?

2017-10-16 Thread Nieto via Digitalmars-d-learn
On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote: How do I convert/create a D string from LPVOID (void*)? string GetLastErrorMessage() { LPVOID lpMsgBuf; DWORD errorMessageID = GetLastError(); FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER |

Re: How do I convert a LPVOID (void*) to string?

2017-10-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote: How do I convert/create a D string from LPVOID (void*)? There is no one answer to this, but for the specific function are are looking at, the ALLOCATE_BUFFER argument means it puts the pointer in the pointer. So the way I'd do it is:

partiallyQualifiedName?

2017-10-16 Thread Nicholas Wilson via Digitalmars-d-learn
using fullyQualifiedName [here] (https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl/util.d#L120) leads to a large compilation slowdown, but I only need it to disambiguate up to the module level i.e. so that struct Context { enum Properties {} static struct Info

Re: Tango + D2 + Mac

2017-10-16 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 02:52:41 UTC, Fat_Umpalumpa wrote: I am having a lot of trouble trying to install Tango to use with D2 on my mac os Sierra. Is this even possible? Thanks! I take it you're using https://github.com/SiegeLord/Tango-D2 ? I tried it out about a year ago and it

Re: Tango + D2 + Mac

2017-10-16 Thread Fat_Umpalumpa via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 03:25:53 UTC, Neia Neutuladh wrote: I take it you're using https://github.com/SiegeLord/Tango-D2 ? I tried it out about a year ago and it worked, but your mileage may vary. For the most part, Phobos and various Dub packages have superseded it. Tango's main

Re: debugging in vs code on Windows

2017-10-16 Thread Domain via Digitalmars-d-learn
On Sunday, 15 October 2017 at 13:54:49 UTC, Dmitry wrote: On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote: Has anyone been able to debug in VS code on Windows? What am I doing wrong? Yep, it work for me. How do you start debugging? I noticed that the bottom button (small bug) at

Tango + D2 + Mac

2017-10-16 Thread Fat_Umpalumpa via Digitalmars-d-learn
I am having a lot of trouble trying to install Tango to use with D2 on my mac os Sierra. Is this even possible? Thanks!

Re: debugging in vs code on Windows

2017-10-16 Thread Dmitry via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote: Can you share your tasks.json and launch.json? tasks.json - I don't have this file. launch.json: { "version": "0.2.0", "configurations": [ { "name": "(Windows) Launch", "type": "cppvsdbg",

Re: Range tee()?

2017-10-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: Does Phobos have a way to "tee" a range? use my dpldocs search engine http://dpldocs.info/tee std.range pops right up!

Re: How to embed static strings to a D program?

2017-10-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 16 October 2017 at 06:03:40 UTC, evilrat wrote: can cast to ubyte[] for binary too, be careful with enums though, because enum arrays will allocate every time you access it Arrays yes, but not strings. So you can do `enum data = import("strings.txt");`.

How to modify process environment variables

2017-10-16 Thread Ky-Anh Huynh via Digitalmars-d-learn
Hi, Is it possible to change the current process's environment variables? I have looked at `std/process.d` source code, and there is only a private method `createEnv` used when new (sub)process is created. In C `putEnv` the answer is positive:

Re: How to modify process environment variables

2017-10-16 Thread ketmar via Digitalmars-d-learn
Ky-Anh Huynh wrote: Hi, Is it possible to change the current process's environment variables? I have looked at `std/process.d` source code, and there is only a private method `createEnv` used when new (sub)process is created. In C `putEnv` the answer is positive: