Re: Feedback request from production of the usage of DWT

2024-06-13 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 13 June 2024 at 06:59:49 UTC, Menjanahary R. R. wrote: How important is its adoption? Is GUI App in D frequent? There are quite few D GUI projects we are aware of, Tilix being one of the popular ones. I have few personal projects that are based, like Tilix, on GtkD (https://gtk

Re: What's the latest GDC stable release version?

2024-06-17 Thread Dejan Lekic via Digitalmars-d-learn
On Sunday, 16 June 2024 at 16:26:08 UTC, mw wrote: Hi, What's the latest GDC stable release version? Stable release version is the same as stable GCC release version. Find it here: https://gcc.gnu.org/ (GDC is part of the GCC project for years)

Re: Writing a simple text editor in D using a C tutorial

2023-08-29 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 29 August 2023 at 16:17:56 UTC, Răzvan Birișan wrote: Is there a better way to use `termios.h` inside D? Am I missing the point and there is a way to set these flags in D without using C libraries? I would try to use termios from druntime instead. Try: import core.sys.posix.termio

Re: C to D: please help translate this weird macro

2023-09-20 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:55:14 UTC, Ki Rill wrote: On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm

Re: C to D: please help translate this weird macro

2023-09-20 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:55:14 UTC, Ki Rill wrote: On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm

Re: How to use eventcore write an echo server?

2024-03-14 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 12 March 2024 at 05:13:26 UTC, zoujiaqing wrote: How to fix it? than you ;) Try the following: ``` class Connection { StreamSocketFD client; ubyte[1024] buf = void; // Add these two lines before the constructor: nothrow: @safe: thi

Re: dmd memory usage

2019-11-18 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 18 November 2019 at 00:20:12 UTC, Steven Schveighoffer wrote: I'm fighting some out of memory problems using DMD and some super-template heavy code. I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it incrementall

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote: Yes, I know this is a question lacking a straightforward answer. Requirements: [...] I humbly believe the most complete one is GtKD. https://gtkdcoding.com/ https://gtkd.org We all wish there was a STANDARD D GUI library out there, bu

Re: Singleton in Action?

2019-02-03 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote: Hi guys, I ran into another snag this morning while trying to implement a singleton. I found all kinds of examples of singleton definitions, but nothing about how to put them into practice. Can someone show me a code example fo

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 11:06:54 UTC, Dejan Lekic wrote: std.utf module has all encoding/decoding you need (in this case UTF-16). I guess You need to convert your string using toUTF16 ( https://dlang.org/phobos/std_utf.html#toUTF16 ). I do not do Windows programming so I am not 100% sure w

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: I'm quite new to the programming, and I'm getting unsure how to make SendMessageTimeoutW to work with D lang. Most of my attention right now resides around the Argument of the SendMessageTimeoutW function: "Environment", It seems that Se

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: All I know that there was toString16z function from tango project, that made it all work. Now that I browsed the std.utf more, I realised what fits your need best is the https://dlang.org/phobos/std_utf.html#toUTF16z

Re: Optional parameters?

2018-04-04 Thread Dejan Lekic via Digitalmars-d-learn
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer wrote: I currently have a situation where I want to have a function that accepts a parameter optionally. This is what function overloading and/or default values are for, right?

Re: Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Dejan Lekic via Digitalmars-d-learn
Arun, isn't that what the 'name' property is there for?

Re: print function

2016-02-04 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote: It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print. There are many implementations of string interpolation in D (that is what you want, basically). One of t

Re: improve concurrent queue

2016-06-03 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 27 August 2013 at 17:35:13 UTC, qznc wrote: I can recommand this paper (paywalled though): http://dl.acm.org/citation.cfm?id=248106 The research paper can actually be freely downloaded from http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA309412 . Good article, thanks!

Re: What's the secret to static class members

2016-06-30 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 30 June 2016 at 01:11:09 UTC, Mike Parker wrote: I think it's safe to say this guy is just trolling and we can ignore him. I was about to say the same, Mike. He is either trolling, or genuinely did not even bother to learn some language basics...

Re: Build a SysTime from a string

2016-07-06 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 6 July 2016 at 14:15:22 UTC, Andrea Fontana wrote: My problem is that from documentation I can't understand how to set +01:00 timezone on systime. I guess I'm missing something... As far as I know, you can't do that. Quote from the documentation: """ Unlike DateTime, the time zon

Re: DFL is the best UIcontrols for D,compare it to dwt, tkd,dtk,dlangui,anchovy......

2014-05-14 Thread Dejan Lekic via Digitalmars-d-learn
Although DFL not use on Linux or Mac os X,it's easy to do for high level Software Engineer. Well, go ahead and do it!

Re: Any chance to avoid monitor field in my class?

2014-05-14 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 17:41:42 UTC, Yuriy wrote: On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote: What exactly is the mangling problem with extern(C++) classes? Can't use D arrays (and strings) as function argument types. Can't use D array types as template arguments. extern

Re: dmd with shared lib

2014-05-26 Thread Dejan Lekic via Digitalmars-d-learn
bioinfornatics wrote: > Hi, after building and installing dmd i fail to use generated > executable because they are an undefined symbol. > > > $ /opt/dmd/bin/dmd -L-lcurl testDelegate.d > > $ ./testDelegate > ./testDelegate: symbol lookup error: > /opt/dmd/lib/libphobos2.so.0.66: undefined symb

Re: Allowing Expressions such as (low < value < high)

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: Are there any programming languages that extend the behaviour of comparison operators to allow expressions such as if (low < value < high) ? This syntax is currently disallowed by DMD. I'm aware of the risk of a programmer mis

Re: ini library in OSX

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 8 September 2014 at 06:32:52 UTC, Joel wrote: Is there any ini library that works in OSX? I've tried the ones I found. I think they have the same issue. Joels-MacBook-Pro:ChrisMill joelcnz$ dmd ini -unittest ini.d(330): Error: cannot pass dynamic arrays to extern(C) vararg functions

Re: ini library in OSX

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
Or this one: http://dpaste.dzfl.pl/1b29ef20#

Re: Installing LDC on Windows

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 6 September 2014 at 11:13:20 UTC, Russel Winder via Digitalmars-d-learn wrote: OK I installed LDC pre-built on MinGW for Windows on Windows and then Installed MinGW for Windows but when I run ldc2 it tells me libgcc_s_dw2-1.dll is missing. Is this problem soluble by any means other

Re: Beginner ?. Why does D suggest to learn java

2014-10-22 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks l

Re: How to use Fiber?

2015-02-25 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 24 February 2015 at 10:15:29 UTC, FrankLike wrote: There is a int[] ,how to use the Fiber execute it ? Such as : import std.stdio; import core.thread; class DerivedFiber : Fiber { this() { super( &run ); } private : void run() { printf( "Derived

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread Dejan Lekic via Digitalmars-d-learn
Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not).

Re: __traits(allMembers) and aliases

2015-08-25 Thread Dejan Lekic via Digitalmars-d-learn
It is off-topic (sorry for that), but how you grab only those (say functions) in a module that are annotated with @ChoseMe ?? allMembers trait gives bunch of strings, and I could not find a way to use them with hasUDA template...

Re: [Semi-OT] I don't want to leave this language!

2016-12-07 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko wrote: Good D code should be nothrow, @nogc, and betterC. BetterC means that it must not require DRuntime to link and to start. I started Mir as scientific/numeric project, but it is going to be a replacement for Phobos to use D instea

Re: Using Dub

2017-01-16 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 16 January 2017 at 09:40:55 UTC, Russel Winder wrote: On the one hand Cargo works wonderfully with Rust so I had hoped Dub would work wonderfully with D. Sadly I am finding it doesn't. Possibly my fault, but still annoying. Cargo does not have multiple Rust compilers as an option.

Re: ndslice summary please

2017-04-13 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 13 April 2017 at 10:00:43 UTC, 9il wrote: On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is Ilya or someone els

Re: Gtkd questions

2024-09-22 Thread Dejan Lekic via Digitalmars-d-learn
On Sunday, 22 September 2024 at 15:44:17 UTC, Ian wrote: Ron Tarrant for gtkcoding.com by the way!) Is there a place where I can ask specific Gtkd questions? I came across some For many years this has been the main place to ask GtkD-related questions: https://forum.gtkd.org/groups/GtkD/

Re: AES in dlang?

2025-02-18 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 12 February 2025 at 00:20:02 UTC, Andy Valencia wrote: I was wondering about an @safe dlang version of AES, and just couldn't find one. (Well, there was one, but without any of I am guessing you probably saw the "crypto" package and it does not work the way you want it, right? L

Re: String Interpolation support in VS Code

2025-02-23 Thread Dejan Lekic via Digitalmars-d-learn
On Sunday, 23 February 2025 at 14:10:09 UTC, Arredondo wrote: Has anyone encountered this issue? I'm also open to suggestions for other tooling options if there's something better than VS Code for D programming in Windows. All you can do is to make a [new issue](https://github.com/Pure-D/code

Re: Intro to calling C libraries

2025-02-23 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 20 February 2025 at 20:09:29 UTC, Ian wrote: What is the recommended documentation or introductory material on how to call C libraries from D? I've seen it done in GtkD (for GTK3) and I have heard of -betterC, but it's all a little overwhelming. (I'm an experienced C programmer but

Re: Gtkd questions

2025-02-22 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 20 February 2025 at 19:57:43 UTC, Ian wrote: I just tried to post a GtkD question in that forum and got an authorization error. Is there a cooling time for new accounts? It does not work for quite some time, unfortunately. I could be wrong but it seems like Mike Way has given up o

Re: string from C function

2025-05-07 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 7 May 2025 at 22:23:36 UTC, Andy Valencia wrote: Now I want it to be a D string. What's the right way to do this? Performance and memory use are not important; I just want a simple and idiomatic way to get from point A to point B. https://dlang.org/library/std/string/from_strin

Re: Does D have a way to get and pass sturct information at runtime?

2025-06-16 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 16 June 2025 at 07:30:31 UTC, rempas wrote: So, I wanted to create a library to allow D to be used a scripting language, in order to allow it to be used to configure programs. Now, the design of everything is rather simple. However, I do have one problem. Is there a way to pass I a

Re: What is gdmd?

2025-06-22 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 21 June 2025 at 18:21:21 UTC, Neto wrote: What is gdmd? googling doesn't give useful results I forgot to mention - If I put `dlang gdmd` on Ecosia, it yields the link I gave you as the first link... I assume it would be the same with Google search. Rule of thumb - when you are se

Re: What is gdmd?

2025-06-21 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 21 June 2025 at 18:21:21 UTC, Neto wrote: What is gdmd? googling doesn't give useful results Most likely this -> https://github.com/D-Programming-GDC/gdmd

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread Dejan Lekic via Digitalmars-d-learn
On Friday, 27 June 2025 at 19:55:30 UTC, WraithGlade wrote: orthogonal to what I'm asking about. The Andrei book says that D automatically rearranges members of `class`s in memory to avoid wasting memory due to padding between members whose width is less than the native CPU word size alignment,

Re: Is there a way to tell D to rearrange struct members or to not rearrange class members?

2025-06-27 Thread Dejan Lekic via Digitalmars-d-learn
On Friday, 27 June 2025 at 11:23:56 UTC, WraithGlade wrote: I've read both of the available printed D books in their entirety (Ali's and Andrei's) and I noticed Andrei's book (circa ~2010) mentions that the D compiler rearranges the members of `class` objects to be more optimal by reducing ali

Re: stdInputRange

2025-07-20 Thread Dejan Lekic via Digitalmars-d-learn
I've tested your code on the source code itself and it works as expected: ``` » ./salih2 < salih2.d import std; struct StdinByChar { @property bool empty() { if(isEmpty) return true; if(!hasChar) { auto buff = new char[1]; stdin.rawRead(buff); if (buff[

Re: How do I pass a variables as data with gtkd signals ?

2025-07-25 Thread Dejan Lekic via Digitalmars-d-learn
On Friday, 25 July 2025 at 16:44:13 UTC, huangyy wrote: I want to write a small program with gtkd. I need to use Signals.connectData to transfer an int type parameter to the callback function. I don't know how to write it. I hope someone can help me. It would be best if you can provide a sample