Blog Post #67 - Expander

2019-09-03 Thread Ron Tarrant via Digitalmars-d-learn
Today's post covers the Expander, a widget that... well... expands to reveal things hidden within. It's not quite a TreeView, but it's also a lot easier to use. You can read all about it here: https://gtkdcoding.com/2019/09/03/0067-mvc-xii-expander.html

How stdin.readf ignore space char?

2019-09-03 Thread lili via Digitalmars-d-learn
Hi guys: input is two line, first line is a number n and second line is n float point number, e.g. 3 1.1 2.2 3.3 how use stdin.readf get all number. i code below but not work well. int n; stdin.readf!"%d\n"(n); writeln("read n:",n);

I'm fucking tired of this shit... Why doesn't Visual D install ?

2019-09-03 Thread Enjoys Math via Digitalmars-d-learn
It says right on the front page of it, that it installs in 2019. I of course have the C++ tools installed already because I was doing C++ dev in Qt and needed to. Where's the Visual D menu? Where are the project types? This fucking sucks. Every time I think oh, I could use D on that, it

Re: Linking D Runtime

2019-09-03 Thread sarn via Digitalmars-d-learn
On Saturday, 24 August 2019 at 02:10:19 UTC, Jonathan Levi wrote: I would love a more portable solution though. This should work for now. How are you building the D code? It should be possible to build a library (with -lib and/or -shared) that statically includes the runtime and Phobos.

Re: Linking D Runtime

2019-09-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-09-03 10:43, Jacob Carlborg wrote: This depends on how the compiler is installed. There are several installers that do not put the libraries in `/usr/lib`. BTW, that directory doesn't exist by default anymore on macOS, even if Xcode and the command line tools are installed. My bad.

Re: Linking D Runtime

2019-09-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-09-03 03:45, Jonathan Levi wrote: It looks like what needs to be found are "libphobos2" and "libdruntime".  They can be found where ever your system puts lib files.  Windows (as far as I know) does not have a joined place for lib files so you need to look where dmd/ldc/etc installed

Re: How stdin.readf ignore space char?

2019-09-03 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 3 September 2019 at 12:55:29 UTC, lili wrote: Hi guys: input is two line, first line is a number n and second line is n float point number, e.g. 3 1.1 2.2 3.3 how use stdin.readf get all number. https://dlang.org/library/std/stdio/readf.html see example

Re: How stdin.readf ignore space char?

2019-09-03 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 3 September 2019 at 13:25:30 UTC, lili wrote: On Tuesday, 3 September 2019 at 13:21:16 UTC, a11e99z wrote: On Tuesday, 3 September 2019 at 12:55:29 UTC, lili wrote: string d = "3.43.3 "; double a; double b; //formattedRead(d,"%f %f", , );

Re: How stdin.readf ignore space char?

2019-09-03 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 3 September 2019 at 12:55:29 UTC, lili wrote: Hi guys: input is two line, first line is a number n and second line is n float point number, e.g. 3 1.1 2.2 3.3 how use stdin.readf get all number. u can read array this way too auto darr = readln.split.map!(x

Re: Why is sformat and formattedWrite (appender) allocating GC mem here?

2019-09-03 Thread James Blachly via Digitalmars-d-learn
On 8/31/19 5:12 PM, ag0aep6g wrote: I've made a pull request to get rid of those allocations: https://github.com/dlang/phobos/pull/7163 Wonderful! For my own learning, why was a unittest to ensure no GC added to sformat instead of a @nogc annotation?

Re: How stdin.readf ignore space char?

2019-09-03 Thread lili via Digitalmars-d-learn
On Tuesday, 3 September 2019 at 13:21:16 UTC, a11e99z wrote: On Tuesday, 3 September 2019 at 12:55:29 UTC, lili wrote: Hi guys: input is two line, first line is a number n and second line is n float point number, e.g. 3 1.1 2.2 3.3 how use stdin.readf get all number.

Re: Why is sformat and formattedWrite (appender) allocating GC mem here?

2019-09-03 Thread ag0aep6g via Digitalmars-d-learn
On 03.09.19 16:03, James Blachly wrote: For my own learning, why was a unittest to ensure no GC added to sformat instead of a @nogc annotation? `sformat` uses the GC less now, but it's not @nogc. It can still throw GC-allocated exceptions, e.g. when the arguments don't match the format

Re: adding delegate to opApply

2019-09-03 Thread berni via Digitalmars-d-learn
On Monday, 2 September 2019 at 14:20:11 UTC, Paul Backus wrote: If you have an existing delegate that you want to use with opApply, the easiest way is like this: void delegate(Thing) myDelegate = ...; foreach(thing; things) { myDelegate(thing); } // Equivalent to: things.opApply((Thing

Re: Is removing elements of AA in foreach loop safe?

2019-09-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote: Iterating of some structure and removing elements thereby is always errorprone and should be avoided. But: In case of AA, I've got the feeling, that it might be safe: foreach (k,v;ways) if (v.empty) ways.remove(k); Do

Re: problems with swig generated code

2019-09-03 Thread Laeeth Isharc via Digitalmars-d-learn
On Tuesday, 3 September 2019 at 20:03:37 UTC, Martin DeMello wrote: On Sunday, 1 September 2019 at 11:19:11 UTC, DanielG wrote: Do you know whether SWIG's D generator is even being maintained? I've searched for it on the forums in the past and got the impression that it's outdated. I

Re: problems with swig generated code

2019-09-03 Thread Martin DeMello via Digitalmars-d-learn
On Sunday, 1 September 2019 at 11:19:11 UTC, DanielG wrote: Do you know whether SWIG's D generator is even being maintained? I've searched for it on the forums in the past and got the impression that it's outdated. I didn't realise that :( It was included in the current release of swig, so

Is there has an pdf document for Phobos.

2019-09-03 Thread lili via Digitalmars-d-learn
Hi: For some reason it too slow that some times i visited dlang.org, Can admin make a pdf document for download.

Re: Is there has an pdf document for Phobos.

2019-09-03 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote: Hi: For some reason it too slow that some times i visited dlang.org, Can admin make a pdf document for download. Documentation is installed with the compiler.

How to use xargs to remove whitespaces (Dub executable path)

2019-09-03 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to get the executable path from a dub package using this command: dub describe dscanner --data=target-path,target-name --data-list | xargs But the output always contains a space between target-path and target-name: /home/user/.dub/packages/dscanner-0.8.0/dscanner/bin/ dscanner