Re: Reading and wiping notes also adding more notes

2022-10-17 Thread Ali Çehreli via Digitalmars-d-learn

On 10/17/22 22:40, Joel wrote:

> I have two text fields. The one on the left has the whole text, new
> stuff being added to the bottom. The one on the right has text I've been
> wiping as I'm reading.

I think this can be modelled as a string array and an index showing 
where the active part starts:


import std;

struct Notes {
string[] whole;
size_t activeIndex;

void add(string line) {
whole ~= line;
}

string[] activeText() {
return whole[activeIndex..$];
}

void wipeText() {
++activeIndex;
}
}

void main() {
auto input = [ "I went for a walk and fell down a hole.",
   "There was a D guy on the roof.",
   "That was a tricky problem!", ];

Notes notes;

// add() to add()
input.each!(line => notes.add(line));

// activeText() will show the active part
// wipeText() will move forward
}

Ali



Reading and wiping notes also adding more notes

2022-10-17 Thread Joel via Digitalmars-d-learn
I'm trying to add a feature to my text modifying program. I take 
a lot of notes but I want to be able to both wipe what I've read 
while still adding more notes as I go.


I have two text fields. The one on the left has the whole text, 
new stuff being added to the bottom. The one on the right has 
text I've been wiping as I'm reading. I want to be able to add 
from the whole text just the new stuff at the bottom to the right 
text at the bottom. - I hope I'm making sense (good exercise, 
trying to explain it helps me work it out by itself).


Example
Whole text: [I went for a walk and fell down a hole. There was a 
D guy on the roof. That was a tricky problem!]


Read and wipe text: [There was a d guy on the roof.]

Now I want to add "That was a tricky problem!" to the wipe text 
to get: [There was a D guy on the roof. That was a tricky 
problem!]


Re: library to solve the system of linear equations

2022-10-17 Thread mw via Digitalmars-d-learn
On Monday, 17 October 2022 at 20:39:10 UTC, rikki cattermole 
wrote:

On 18/10/2022 9:37 AM, mw wrote:
Maybe Mir should add static check for supported complier 
versions, rather than let user try and error.


Dub has dependency checks for compiler/dub in it.

It doesn't need to be in code.


Not everyone use dub to build.


Re: library to solve the system of linear equations

2022-10-17 Thread rikki cattermole via Digitalmars-d-learn

On 18/10/2022 9:37 AM, mw wrote:
Maybe Mir should add static check for supported complier versions, 
rather than let user try and error.


Dub has dependency checks for compiler/dub in it.

It doesn't need to be in code.


Re: library to solve the system of linear equations

2022-10-17 Thread mw via Digitalmars-d-learn

On Monday, 17 October 2022 at 20:22:47 UTC, jmh530 wrote:


If you have a problem with support for mir, submit a bug 
report. I don't think gdc is supported, but ldc should be.


The latest version of Mir can only be compiled with latest Ldc 
1.30, 1.29 doesn't work.


Maybe Mir should add static check for supported complier 
versions, rather than let user try and error.


Re: library to solve the system of linear equations

2022-10-17 Thread jmh530 via Digitalmars-d-learn

On Monday, 17 October 2022 at 19:54:12 UTC, Yura wrote:
Dear All, Thank you so much for your replies and hints! I got 
it working today. All the libraries are properly linked and the 
Equation solver runs smoothly.


The compilers turned out to be problematic though. The "Mir" 
library does not work with the Ubuntu 18.04 gdc and ldc 
compilers. I have managed to install the latest version dmd, 
and it works. But I suspect that the dmd compiler is not 
optimal in terms of performance. The question becomes whether 
it is possible to install the most recent ldc and gdc compilers 
on Ubuntu 18.04?


[snip]


If you have a problem with support for mir, submit a bug report. 
I don't think gdc is supported, but ldc should be.


Re: library to solve the system of linear equations

2022-10-17 Thread mw via Digitalmars-d-learn

On Monday, 17 October 2022 at 19:54:12 UTC, Yura wrote:

it is possible to install the most recent ldc and gdc compilers 
on Ubuntu 18.04?


Yes, I used LDC on the same system.


Re: library to solve the system of linear equations

2022-10-17 Thread Yura via Digitalmars-d-learn
Dear All, Thank you so much for your replies and hints! I got it 
working today. All the libraries are properly linked and the 
Equation solver runs smoothly.


The compilers turned out to be problematic though. The "Mir" 
library does not work with the Ubuntu 18.04 gdc and ldc 
compilers. I have managed to install the latest version dmd, and 
it works. But I suspect that the dmd compiler is not optimal in 
terms of performance. The question becomes whether it is possible 
to install the most recent ldc and gdc compilers on Ubuntu 18.04?


The good thing is that I have also managed to get this code 
working in parallel.


Thank you again!

On Saturday, 15 October 2022 at 13:11:04 UTC, Siarhei Siamashka 
wrote:

On Friday, 14 October 2022 at 21:38:45 UTC, Yura wrote:

in the top of my el.d file I have:
```D
/+dub.sdl:
dependency "mir-algorithm" version="~>3.16.12"
+/
import std.stdio;
import std.string;
import std.conv;
import std.exception : assertThrown;
import std.math;
import mir.ndslice;
```

however, when I try to compile it (gdc el.d) it gives me the 
following error message:


el.d:11:8: error: module ndslice is in file 'mir/ndslice.d' 
which cannot be read

 import mir.ndslice;


This all looks good, except for the `"gdc el.d"` part. A small 
application contained in a single .d file can be run like a 
script via `"dub el.d"`. This is explained at 
https://dub.pm/advanced_usage.html


For compiling highly optimized final binaries you can run `"dub 
build --build=release --single --compiler=ldc2 el.d"` (to use 
LDC) or `"dub build --build=release --single --compiler=gdc 
el.d"` (to use GDC).





Re: How do I correctly install packages for use with Visual Studio?

2022-10-17 Thread Guillaume Piolat via Digitalmars-d-learn

On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:
I'm trying to set up Visual Studio 2022 with Visual D, and I'm 
running into issues trying to get my project to build correctly.



Some recommendation to use Visual Studio:

- tutorial for installation here: 
https://p0nce.github.io/d-idioms/#Installing-Dlang-on-Windows


- then generate a Visual Studio solution with:

 dub generate visuald# default
 dub generate -a x86 visuald --compiler dmd  # for DMD, 
x86 arch
 dub generate -a x86_64 visuald -c conf  # x86_64 
arch, DUB configuration "conf"
 dub generate visuald --combined # single 
VisualD project with all deps



- if you use libraries that work with DUB they should come with 
static libs, or have dynamic loaders instead. Building .lib files 
yourself is just more annoying, and you will have to do it for 
each system you want to support





Re: How do I correctly install packages for use with Visual Studio?

2022-10-17 Thread JN via Digitalmars-d-learn

On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:
It's a double whammy because I've never used Visual Studio 
before (Just an Emacs Guy), but I need to debug my D 
programming and according to the 
[documentation](https://wiki.dlang.org/Debuggers) this is my 
only option on Windows.


I am using Visual Studio Code with code-d plugin and using the 
standard C++ debugger. Seems to work well enough. Some D-specific 
constructs like AA look weird at times, but breakpoints work, 
shows me values of variables, callstacks.