Re: Problem Computing Dot Product with mir

2021-02-22 Thread 9il via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 03:48:15 UTC, Max Haughton wrote: On Monday, 22 February 2021 at 07:14:26 UTC, 9il wrote: On Sunday, 21 February 2021 at 16:18:05 UTC, Kyle Ingraham wrote: I am trying to convert sRGB pixel values to XYZ with mir using the following guide:

Re: Problem Computing Dot Product with mir

2021-02-22 Thread Kyle Ingraham via Digitalmars-d-learn
On Monday, 22 February 2021 at 07:14:26 UTC, 9il wrote: On Sunday, 21 February 2021 at 16:18:05 UTC, Kyle Ingraham wrote: I am trying to convert sRGB pixel values to XYZ with mir using the following guide: http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html [...] mir-glas is

Re: Trying to reduce memory usage

2021-02-22 Thread Jon Degenhardt via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 00:08:40 UTC, tsbockman wrote: On Friday, 19 February 2021 at 00:13:19 UTC, Jon Degenhardt wrote: It would be interesting to see how the performance compares to tsv-uniq (https://github.com/eBay/tsv-utils/tree/master/tsv-uniq). The prebuilt binaries turn on all

Re: Class instance alignment

2021-02-22 Thread tsbockman via Digitalmars-d-learn
On Monday, 22 February 2021 at 02:23:27 UTC, Steven Schveighoffer wrote: Hm... but does TypeInfo detail alignment? If so, we can make this work anyway, just bump up the size needed to a power-of-2 pool. It doesn't even need to be a power-of-2, assuming the pools themselves are properly

Re: Class instance alignment

2021-02-22 Thread tsbockman via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 03:53:00 UTC, tsbockman wrote: size_t alignedSize(size_t typeSize, size_t typeAlignment) pure @safe nothrow @nogc { version(assert) { import core.bitop : bsr; assert(typeAlignment == (size_t(1) << bsr(typeAlignment))); } size_t ret =

Re: Problem Computing Dot Product with mir

2021-02-22 Thread Max Haughton via Digitalmars-d-learn
On Monday, 22 February 2021 at 07:14:26 UTC, 9il wrote: On Sunday, 21 February 2021 at 16:18:05 UTC, Kyle Ingraham wrote: I am trying to convert sRGB pixel values to XYZ with mir using the following guide: http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html [...] mir-glas is

Re: Restricting D applications to a single instance

2021-02-22 Thread Preetpal via Digitalmars-d-learn
On Monday, 22 February 2021 at 08:00:06 UTC, Ali Çehreli wrote: I achieve it with 'flock' (man 2 flock) on Linux. My case is different thoug: It allows me to have single writer and many readers of program data, which is kept inside a cache directory. All instances start with read permissionss

Re: Restricting D applications to a single instance

2021-02-22 Thread Ali Çehreli via Digitalmars-d-learn
On 2/21/21 7:28 PM, Preetpal wrote: > I decided to implement what I meant (single application (executable) > instance restriction) using the Windows API (since my application only > runs on Windows currently anyways): I achieve it with 'flock' (man 2 flock) on Linux. My case is different

Re: Class instance alignment

2021-02-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 February 2021 at 02:23:27 UTC, Steven Schveighoffer wrote: Hm... but does TypeInfo detail alignment? Apparently not for TypeInfo_Class; .talign() returns the alignment of a class *ref*, i.e., pointer size. TypeInfo_Struct.talign() does return the struct alignment though and

Re: How add png image to zip file using std.zip?

2021-02-22 Thread Marcone via Digitalmars-d-learn
On Sunday, 21 February 2021 at 18:10:43 UTC, JN wrote: On Sunday, 21 February 2021 at 17:17:56 UTC, Marcone wrote: ZipArchive zip = new ZipArchive(); std.file.write("foo.zip", zip.build()); ArchiveMember f = new ArchiveMember(); f.name = "Wallpaper_001.png";

Re: How to get output of piped process?

2021-02-22 Thread Danny Arends via Digitalmars-d-learn
On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: On Friday, 19 February 2021 at 13:42:46 UTC, Steven Schveighoffer wrote: [...] [...] Sure. [...] As application programmer I don't want to check any error codes. Thankfully I don't have to in D. There is a nice off-topic

Re: How to get output of piped process?

2021-02-22 Thread frame via Digitalmars-d-learn
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: https://github.com/DannyArends/DaNode/blob/master/danode/process.d Danny This example shows how easy it is to implement a non-blocking stream. Phobos knows this for sockets but not for pipes?

How to get Laptop battery level

2021-02-22 Thread Greatsam4sure via Digitalmars-d-learn
Dlang is a system programming language. How do I access the battery level of my system using code in dlang? I will appreciate vide sample

Re: How to get Laptop battery level

2021-02-22 Thread Dukc via Digitalmars-d-learn
On Monday, 22 February 2021 at 21:14:48 UTC, Dukc wrote: Note that DGame seems to be currently unmaintained - it might have some bits that do not compile anymore. SDL2 is a commonly used library though - you should be able to find more examples about it if you need to. Plus, the example I

Re: How to get Laptop battery level

2021-02-22 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Feb 22, 2021 at 08:59:01PM +, Greatsam4sure via Digitalmars-d-learn wrote: > Dlang is a system programming language. How do I access the battery > level of my system using code in dlang? I will appreciate vide sample There is no universal API for this. It depends on which OS you're

Re: How to get Laptop battery level

2021-02-22 Thread Greatsam4sure via Digitalmars-d-learn
On Monday, 22 February 2021 at 20:59:01 UTC, Greatsam4sure wrote: Dlang is a system programming language. How do I access the battery level of my system using code in dlang? I will appreciate code sample Sorry I mean to say code sample

Re: How to get Laptop battery level

2021-02-22 Thread Dukc via Digitalmars-d-learn
On Monday, 22 February 2021 at 20:59:01 UTC, Greatsam4sure wrote: Dlang is a system programming language. How do I access the battery level of my system using code in dlang? As a systems language, D could access the hardware interface directly, if you knew it and loaded your program as a

Is this a good way to do lazy evaluation?

2021-02-22 Thread Jack via Digitalmars-d-learn
I have a base class that loads a value and if it isn't net, load a default value. Since the value can be set, I'd like to do lazy evaluation of this default value until it's really needed. So rather have a C defValue = xxx, that makes xxx to be loaded even if defValue doesn't get used. So I

Re: Is this the proper way to do it?

2021-02-22 Thread Jack via Digitalmars-d-learn
On Saturday, 13 February 2021 at 09:54:28 UTC, Rumbu wrote: On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote: I have a base class A, where I make specific operator depending on the derived class type. Currently I'm using something like this: c is a class derived from A bool

Re: Is this the proper way to do it?

2021-02-22 Thread Jack via Digitalmars-d-learn
On Saturday, 13 February 2021 at 07:08:58 UTC, mw wrote: On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote: I have a base class A, where I make specific operator depending on the derived class type. Currently I'm using something like this: c is a class derived from A bool shouldDoX =

Re: Is this the proper way to do it?

2021-02-22 Thread Jack via Digitalmars-d-learn
On Saturday, 13 February 2021 at 19:40:43 UTC, frame wrote: On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote: I have a base class A, where I make specific operator depending on the derived class type. Currently I'm using something like this: c is a class derived from A bool

Re: Trying to reduce memory usage

2021-02-22 Thread tsbockman via Digitalmars-d-learn
On Friday, 19 February 2021 at 00:13:19 UTC, Jon Degenhardt wrote: On Wednesday, 17 February 2021 at 04:10:24 UTC, tsbockman wrote: I spent some time experimenting with this problem, and here is the best solution I found, assuming that perfect de-duplication is required. (I'll put the code up

Re: how to make this function nothrow?

2021-02-22 Thread Jack via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 00:39:33 UTC, Steven Schveighoffer wrote: On 2/15/21 4:04 PM, Jack wrote: I have to make my function nothrow because the function that calls it (not written by me) is nothrow. So I need to wrap my code in a try-catch() but how will I report the error message,