Re: Convert binary to UUID from LDAP

2023-03-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Monday, 27 March 2023 at 18:39:19 UTC, Alexander Zhirov wrote: I mean get the UUID data type itself. Just using [this example](https://dlang.org/phobos/std_uuid.html#.UUID) `cast(ubyte[16])ubyte[]` will not work, conversion error. ```d writeln(toHexString(cast(ubyte[])value.attributes["objec

Re: Convert binary to UUID from LDAP

2023-03-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 00:51:43 UTC, Steven Schveighoffer wrote: auto uuid = UUID(*cast(ubyte[16]*)youruuiddata.ptr); ```d ubyte[] arr = cast(ubyte[])value.attributes["objectGUID"][0].dup; writeln(UUID(cast(ubyte[16])arr.ptr)); ``` `Error: cannot cast expression 'cast(ubyte*)arr' of type

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 28/03/2023 2:25 PM, ryuukk_ wrote: On Tuesday, 28 March 2023 at 01:06:50 UTC, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README. I did not try mago, but it shouldn't be needed as pdb is uni

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 28/03/2023 2:33 PM, ryuukk_ wrote: what is: "Manual Installation of the Concord extension in VS Code", i can't find it anywhere Extension is mago, but don't forget: cpptools-1.4.0 or later needed. what are: "MagoNatCC.dll, MagoNatCC.vsdconfig and .vsdbg-config.json"? i can only find: "Mago

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 01:21:02 UTC, Richard (Rikki) Andrew Cattermole wrote: On 28/03/2023 2:06 PM, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README. Binaries are available in the inst

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 01:06:50 UTC, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README. I did not try mago, but it shouldn't be needed as pdb is universally understood by tools It also

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 28/03/2023 2:06 PM, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README. Binaries are available in the installer of VisualD, they can be extracted by 7zip (I've checked everything is in there

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README.

Re: como eliminar los caracteres nulos de las respuestas en socket?

2023-03-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/27/23 1:13 PM, Espartan Jhon wrote: hola a todos quisiera saber como es que puedo eliminar los caracteres nulos de las respuestas de mi socket In English (via google translate): Hello everyone, I would like to know how I can remove null characters from my socket responses My response i

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
I've now waste an entire day trying to figure out what's wrong, perhaps trusted D for my projects was a bad idea, i now look like a fool

Re: Convert binary to UUID from LDAP

2023-03-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/27/23 1:56 PM, Alexander Zhirov wrote: I get `objectGUID` data from LDAP as binary data. I need to convert `ubyte[]` data into a readable `UUID`. As far as I understand, it is possible to do this via `toHexString()`, but I have reached a dead end. Is there a way to make it more elegant, li

Re: Is there a -Dmacro like option for D compilers?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
I just remembered you can do something like this! ``` import std.stdio; enum FEATURE_A_AVAILABLE() { version(FEATURE_A) return true; else return false; } void main() { static if (!FEATURE_A_AVAILABLE) { writeln("feature A not available"); } } ``` It's evaluated at

Re: Is there a -Dmacro like option for D compilers?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 27 March 2023 at 22:22:26 UTC, Jeremy wrote: Is there a way I can define a manifest constant from the compiler command-line, like the -Dmacro option for C compilers? You can do this way: ``` dmd -version=FEATURE_A ``` ```D import std.stdio; void main() { version(FEATURE_A)

Is there a -Dmacro like option for D compilers?

2023-03-27 Thread Jeremy via Digitalmars-d-learn
Is there a way I can define a manifest constant from the compiler command-line, like the -Dmacro option for C compilers?

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
Fore more clarity, all syntax i have tried: ``` type_to_tiledef kshared.defs.type_to_tiledef _D7kshared4defs15type_to_tiledef kshared:defs:type_to_tiledef kshared::defs::type_to_tiledef kshared->defs->type_to_tiledef ```

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
Two questions for the D team: Does globals have a special syntax? as you can see above i also tried the mangled name inside the PDB (using hex viewer https://github.com/WerWolv/ImHex) Walter, how do you debug your programs written in D?

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
To clarify, i tested both dmd/ldc, they both doesn't work on windows To clarify even more: I am a mere user who wants to debug its program on windows using vscode's debugger wich uses msvc I can debug a c/rust/zig executable without issue and see globals The problem only happens with dmd/ld

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 27 March 2023 at 19:31:24 UTC, Richard (Rikki) Andrew Cattermole wrote: The person you need is WebFreak and they are not online right now. On IRC earlier today ``` [6:43:29 pm] nope, I haven't gotten globals to work in debugger before [6:43:33 pm] I don't think they are emitted

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
The person you need is WebFreak and they are not online right now.

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
If anyone know what is the problem exactly, then please speak up, this problem needs to be reported to the right place fixed so it can be fixed, all languages i tested don't have this issue (c, rust, zig, odin) D is not a toy language, let's take this issue seriously, shall we? or is it?..

Re: Convert binary to UUID from LDAP

2023-03-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Monday, 27 March 2023 at 18:33:46 UTC, novice2 wrote: https://run.dlang.io/is/JP01aZ ``` void main(){ import std.stdio: writeln; import std.format: format; ubyte[] a = [159, 199, 22, 163, 13, 74, 145, 73, 158, 112, 7, 192, 12, 193, 7, 194]; string b =

Re: Convert binary to UUID from LDAP

2023-03-27 Thread novice2 via Digitalmars-d-learn
On Monday, 27 March 2023 at 17:56:22 UTC, Alexander Zhirov wrote: I get `objectGUID` data from LDAP as binary data. I need to convert `ubyte[]` data into a readable `UUID`. As far as I understand, it is possible to do this via `toHexString()`, but I have reached a dead end. Is there a way to ma

Convert binary to UUID from LDAP

2023-03-27 Thread Alexander Zhirov via Digitalmars-d-learn
I get `objectGUID` data from LDAP as binary data. I need to convert `ubyte[]` data into a readable `UUID`. As far as I understand, it is possible to do this via `toHexString()`, but I have reached a dead end. Is there a way to make it more elegant, like [this technique](https://dlang.org/phobo

Re: Traverse a DList and insert / remove in place?

2023-03-27 Thread Gary Chike via Digitalmars-d-learn
On Monday, 27 March 2023 at 15:05:16 UTC, Armando wrote: Wonderful, that works like a treat, thank you so much! For those who wonder, inserting after works too: Very cool! Thanks for asking and sharing! :)

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
Anyone got an idea? Executable built with : ``dmd -g -debug`` on windows On Visual Studio with the visuald addon i can debug the executable and inspect the globals On VSCode i can debug the executable and inspect locals, but not globals What does visuald does under the hood to be able to i

Re: what is the difference between AliasAssign and AliasReassignment

2023-03-27 Thread FabArd via Digitalmars-d-learn
On Monday, 27 March 2023 at 16:59:29 UTC, FabArd wrote: Hi, I don't understand a point in the grammar : 5.4.6 AliasAssign: Identifier = Type 5.4.7 AliasReassignment: Identifier = StorageClasses(optional) Type AliasAssign rule is included in the AliasReassignment rule.

como eliminar los caracteres nulos de las respuestas en socket?

2023-03-27 Thread Espartan Jhon via Digitalmars-d-learn
hola a todos quisiera saber como es que puedo eliminar los caracteres nulos de las respuestas de mi socket #!/usr/bin/env dmd /*+ ESTE ES EL ARCHIVO EN LIMPIO +*/ import std; import std.concurrency; import std.algorithm: countUntil; import std.system; alias print = writeln; void conexion

what is the difference between AliasAssign and AliasReassignment

2023-03-27 Thread FabArd via Digitalmars-d-learn
Hi, I don't understand a point in the grammar : 5.4.6 AliasAssign: Identifier = Type 5.4.7 AliasReassignment: Identifier = StorageClasses(optional) Type AliasAssign rule is included in the AliasReassignment rule. Why there are two rules in the grammar to describe the s

Re: Traverse a DList and insert / remove in place?

2023-03-27 Thread Armando via Digitalmars-d-learn
Wonderful, that works like a treat, thank you so much! For those who wonder, inserting after works too: ```d for (auto range = list[]; !range.empty;) { if (range.back.id == 8) list.insertAfter(range, MyType(88)); range.popBack(); } ``` which will give ``` My

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/26/23 4:41 PM, ryuukk_ wrote: On Sunday, 26 March 2023 at 19:08:32 UTC, Steven Schveighoffer wrote: On 3/26/23 2:07 PM, ryuukk_ wrote: Hi, It's common knowledge that accessing tls global is slow http://david-grs.github.io/tls_performance_overhead_cost_linux/ What i do not understand is

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: Even C does it better: https://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html Honestly I find TLS-by-default to be a bad idea, it has become a trap to be avoided, and TLS does occasionally speed up things but it should be opt-in.

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread Jacob Shtokolov via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: What i do not understand is the reasoning behind choosing tls global by default in D Because the language maintainers decided that they want to emphasize the actor model with no default shared state in the language. This is quite bene

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread z via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: ``shared`` is even more ugly since everything must be shared afterwards The limitations of `shared` can be bypassed with a "function" that removes type qualifiers. `return *cast(Unqual!T*) &foo`(example, doesn't work as is for arrays.)

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread z via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: ``shared`` is even more ugly since everything must be shared afterwards The limitations of `shared` can be bypassed with a "function" that removes type qualifiers. `return *cast(Unqual!T*) &foo`(example, doesn't work as is for arrays.)

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread z via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: ``shared`` is even more ugly since everything must be shared afterwards The limitations of `shared` can be bypassed with a "function" that removes type qualifiers. `return *cast(Unqual!T*) &foo`(example, doesn't work as is for arrays.)

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread wjoe via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: It should be the opposite Slow code ugly Fast code beautiful What's fast today may not be fast tomorrow but the language might still be relevant. e.g.: It used to be faster to ... - pre-calculate sin/cos tables, now the memory look

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-27 Thread z via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: ``shared`` is even more ugly since everything must be shared afterwards The limitations of `shared` can be bypassed with a "function" that removes type qualifiers. `return *cast(Unqual!T*) &foo`(example, doesn't work as is for arrays.)