Re: Function to get the current hostname for both Windows and Posix

2023-08-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 27, 2023 10:02:35 AM MDT vino via Digitalmars-d-learn wrote:
> Hi All,
>
>   May i know whether these is function to find the current
> hostname both in windows and Posix.
>
> From,
> Vino

It looks like std.socket's Socket.hostName will do the trick.

https://dlang.org/phobos/std_socket.html#.Socket.hostName

- Jonathan M Davis





Re: Visual Studio 2022 no longer debugs D program, need an alternative debugger for Windows

2023-08-27 Thread evilrat666 via Digitalmars-d-learn

On Saturday, 26 August 2023 at 18:47:44 UTC, solidstate1991 wrote:

On Saturday, 26 August 2023 at 17:57:22 UTC, jmh530 wrote:

You should report this to bugzilla.


I'm using it in an unusual way. Since VisualD does not support 
dub, I have to rely on VSCode as my main editor, then load the 
executable in an empty C++ project in VS. This worked so far.


On the other hand, I'm having some good results with x64dbg, 
except I don't know how can I get locals to be displayed (which 
is the x64dbg is capable of, except all tutorials for it is 
about reverse engineering).


IIRC you can just drop(or open) the exe file directly on top of 
empty visual studio window and it is ready to debug.


Also VisualD with a dub project is not a problem, dub can 
generate VisualD project for you - "dub generate visuald"
("dub generate <:somesubpackage> visuald such as -ax64>")


Re: Finding duplicate elements

2023-08-27 Thread vino via Digitalmars-d-learn
On Wednesday, 16 August 2023 at 12:51:31 UTC, FeepingCreature 
wrote:

On Tuesday, 15 August 2023 at 17:59:27 UTC, vino wrote:

[...]


```
import std;
void main() {
string[] args = [" test3", "test2 ", " test1 ", " test1 ", 
" "];

findDuplicates(args);
}
void findDuplicates(string[] args) {
bool[string] dupes;
foreach (arg; args) {
if (arg in dupes) {
writefln!"Duplicate element found: %s"(arg);
return;
}
dupes[arg] = true;
}
writefln!"%s"(dupes.keys);
}
```


Thank you very much