Re: Get memory used by current process at specific point in time

2020-01-16 Thread Boris Carvajal via Digitalmars-d-learn
On Sunday, 12 January 2020 at 13:58:18 UTC, Per Nordlöw wrote: Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process? At least for the GC I remember using GC.stats and GC.profileStats to get some info.

Re: Some comments on learning D using the tour

2020-01-16 Thread mark via Digitalmars-d-learn
On Thursday, 16 January 2020 at 01:02:46 UTC, Mike Parker wrote: On Wednesday, 15 January 2020 at 20:06:01 UTC, mark wrote: However, what I really miss is a contents page so that I can look at each topic and jump back when I want to recap something. Please submit an enhancement request:

Re: Some comments on learning D using the tour

2020-01-16 Thread mark via Digitalmars-d-learn
On Thursday, 16 January 2020 at 02:32:07 UTC, Adam D. Ruppe wrote: On Wednesday, 15 January 2020 at 20:06:01 UTC, mark wrote: For example, I haven't found one definitive place in the docs that document D's strings. My unofficial docs are built from the same source, so not perfect, but at

Re: Reading a file of words line by line

2020-01-16 Thread dwdv via Digitalmars-d-learn
On 2020-01-16 04:54, Jesse Phillips via Digitalmars-d-learn wrote: [...] .map!(word => word.to!string.toUpper) .array .sort .uniq .map!(x => tuple (x, 0)) .assocArray ; .each!(word => words[word.to!string.toUpper] = 0); isn't far off, but could also be (sans imports): return

Information about the 'magic' field in object.Object class

2020-01-16 Thread realhet via Digitalmars-d-learn
Hello, I'm try to figure out the contents od the base class instance in D, LDC Windows 64bit. I'm sure that there is a 8 byte VMT pointer. But unable to fund information about the remaining 8 byte. I guess it must be a unique 8byte (void* ?) identifier that is useful for Monitor. In a video

Re: Information about the 'magic' field in object.Object class

2020-01-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 16 January 2020 at 14:30:04 UTC, realhet wrote: Is there a documentation about that 'magic' field? I'm pretty sure the only fields in there are pointer to vtable and pointer to monitor object... I have a really small object, only 32 bytes. At this point if I want to add a flag

Re: Information about the 'magic' field in object.Object class

2020-01-16 Thread realhet via Digitalmars-d-learn
On Thursday, 16 January 2020 at 14:32:24 UTC, Adam D. Ruppe wrote: On Thursday, 16 January 2020 at 14:30:04 UTC, realhet wrote: Is there a documentation about that 'magic' field? I'm pretty sure the only fields in there are pointer to vtable and pointer to monitor object... I have a really

Re: confused about string and lambda args

2020-01-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 16 January 2020 at 17:03:33 UTC, mark wrote: auto wordCharCounts = words // I added this and it works fine .map!"a.length"; writeln(wordCharCounts); The string thing probably shouldn't be used anymore. I suggest you always use the => form instead. The string

Re: Information about the 'magic' field in object.Object class

2020-01-16 Thread Petar via Digitalmars-d-learn
On Thursday, 16 January 2020 at 14:32:24 UTC, Adam D. Ruppe wrote: On Thursday, 16 January 2020 at 14:30:04 UTC, realhet wrote: Is there a documentation about that 'magic' field? I'm pretty sure the only fields in there are pointer to vtable and pointer to monitor object... I have a really

confused about string and lambda args

2020-01-16 Thread mark via Digitalmars-d-learn
I'm looking at https://tour.dlang.org/tour/en/gems/range-algorithms (IMO the example code is far too long and complicated.) But here's the thing: auto wordCharCounts = words // I added this and it works fine .map!"a.length"; writeln(wordCharCounts); auto wordCharCounts2 =

Re: sdl 2 - text is not displayed correctly

2020-01-16 Thread TodNaz via Digitalmars-d-learn
On Wednesday, 15 January 2020 at 16:28:58 UTC, drug wrote: On 1/15/20 6:26 PM, TodNaz wrote: Hello! Maybe someone came across ... I use sdl 2 derelcit, and wanted to draw text (not English, but Russian, for example). And when called in TTF_RenderUTF8_Blended, the text is drawn with incorrect

sdl 2 - text is not displayed correctly

2020-01-16 Thread TodNaz via Digitalmars-d-learn
Maybe I made a mistake? Sorry, I'm new to this business ... [https://pastebin.com/Yyzg4iZf]

How to remove whitespace from a string

2020-01-16 Thread Namal via Digitalmars-d-learn
Hello, what is the way to remove whitespace from a string (not only at the beginning and end)..

Re: How to remove whitespace from a string

2020-01-16 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 16 January 2020 at 13:36:10 UTC, Namal wrote: Hello, what is the way to remove whitespace from a string (not only at the beginning and end).. import std.algorithm: filter; import std.uni: isWhite; import std.stdio: writeln; void main() { string s = " hello world ! ";

Re: sdl 2 - text is not displayed correctly

2020-01-16 Thread TodNaz via Digitalmars-d-learn
On Wednesday, 15 January 2020 at 16:28:58 UTC, drug wrote: On 1/15/20 6:26 PM, TodNaz wrote: Hello! Maybe someone came across ... I use sdl 2 derelcit, and wanted to draw text (not English, but Russian, for example). And when called in TTF_RenderUTF8_Blended, the text is drawn with incorrect

Re: confused about string and lambda args

2020-01-16 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 16, 2020 at 05:03:33PM +, mark via Digitalmars-d-learn wrote: [...] > auto wordCharCounts4 = words // I added this and it won't compile > .map!(a => a.count); // Error: no property count for type string > writeln(wordCharCounts4); You need to import std.algorithm to

Re: Information about the 'magic' field in object.Object class

2020-01-16 Thread kinke via Digitalmars-d-learn
On Thursday, 16 January 2020 at 15:28:06 UTC, realhet wrote: Update: - All of the child classes needed to be marked with extern(C++) - static class members are not supported, only __gshared static. - passing a delegate to a constructor of this class expects a (extern(C++) delegate) too. -

Re: Some comments on learning D using the tour

2020-01-16 Thread James Blachly via Digitalmars-d-learn
On 1/15/20 3:06 PM, mark wrote: I am learning D for the first time. While I wait for Mike Parker's "Learning D" book to arrive, I have started using the tour. I really like the tour, especially the fact that you can run and tweak the code as well as read the explanations. However, ...

Historical Data

2020-01-16 Thread ish via Digitalmars-d-learn
Which site is good to find up to 3 years of historical data through CSV?

Re: Reading a file of words line by line

2020-01-16 Thread mark via Digitalmars-d-learn
On Thursday, 16 January 2020 at 10:10:02 UTC, dwdv wrote: On 2020-01-16 04:54, Jesse Phillips via Digitalmars-d-learn wrote: [...] [...] isn't far off, but could also be (sans imports): return File(filename).byLine .map!(line => line.until!(not!isAlpha)) .filter!(word => word.count