Re: Finding duplicate elements

2023-08-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 17:59:27 UTC, vino wrote: Hi All, Request your help in finding duplicate element without sorting as per the below example ``` Example: string[] args = [" test3", "test2 ", " test1 ", " test1 ", " "]; Output Required: If duplicate element found then print

Re: Allocate a string via the GC

2022-05-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote: Hi, Is there any more standard way to achieve something to the effect of: ```d import std.experimental.allocator; string* name = theAllocator.make!string; ``` Pointers are not used for strings in d. string is an alias for

Re: Graphical progressive fill

2022-12-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 11 December 2022 at 06:50:44 UTC, Joel wrote: I've been trying to fill in areas with a colour but can't work it out. I want something like the effect where it fills with diamonds. Not all at once but building up in the main program loop. # # # #

Re: better video rendering in d

2023-03-21 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 21 March 2023 at 17:46:00 UTC, H. S. Teoh wrote: On Tue, Mar 21, 2023 at 05:29:22PM +, monkyyy via Digitalmars-d-learn wrote: On Tuesday, 21 March 2023 at 17:18:15 UTC, H. S. Teoh wrote: > [...] I vaguely remember an hour and half for 5 minutes of video when its extremely

Re: Getting a total from a user defined variable

2023-04-20 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 20 April 2023 at 19:41:21 UTC, Joel wrote: ```d import std; struct Person { string name; ulong age; } void main() { auto p=[Person("Joel", 43), Person("Timothy", 40)]; writeln("Total: ", p.reduce!((a,b) => a.age+b.age)(0UL)); // how do I get the total of ages

Re: Variable length arrays under -betterC?

2023-04-18 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 18 April 2023 at 06:20:43 UTC, Richard (Rikki) Andrew Cattermole wrote: On 18/04/2023 1:33 PM, Salih Dincer wrote: I understand from the thread this: D gives us -betterC but nothing from the Phobos.  So he says, see what you have, do what the hell you want! Am I wrong about this?

Re: What do you think about using Chat GPT to create functions in D?

2023-04-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 3 April 2023 at 23:38:52 UTC, Marcone wrote: What do you think about using Chat GPT to create functions in D? I asked Chat-GPT to create a function in D that was similar to the rsplit() function in Python. It returned this code to me: import std.algorithm; import std.array; import

Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I could not find a thing doing this. And I don't want to write it from scratch. Getting a range as output is ok too. What I need is the following: ```c++ const std::vector v1{1, 2, 5, 5, 5, 9}; const std::vector v2{2, 5, 7}; std::vector diff; std::set_difference(v1.begin(),

Re: Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

2023-02-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 3 February 2023 at 15:53:35 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d import std.stdio, std.algorithm.setops, std.array; void main() { int[] v1 = [1, 2, 5, 5, 5, 9]; int[] v2 = [2, 5, 7]; int[] v3 = setDifference(v1, v2).array; writefln!"%s \\ %s = %s"(v1,

Re: compile: link dynamic OR static library in Windows

2023-02-04 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 4 February 2023 at 15:52:33 UTC, Alexander Zhirov wrote: PS C:\sources\pxe-restore\source> dmd -i app.d -LC:\msys64\home\user\postgresql-15.1\installed\mingw64\lib\libpq.dll lld-link: error: C:\msys64\home\user\postgresql-15.1\installed\mingw64\lib\libpq.dll: bad file type. Did

Re: pregunta preguntona, acerca de el resultado de remoteAddress()

2023-06-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 14 June 2023 at 19:50:21 UTC, Danico wrote: que significa los ultimos numeros de 192.168.0.13:50732 , cuando hago un remoteAddress() y en un servidor socket? Es un numero de puerto. No estoy seguro que preguntar en un idioma otra que ingles es un buena idea aqui. Lee esto por

Re: What's dxml DOMEntity(R) type ?

2023-06-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 5 June 2023 at 10:01:01 UTC, John Xu wrote: The parseDOM returns a DOMEntity(R) type, how do I write a xmlRoot as global variable? I need its detailed type (auto / Variant doesn't work). import dxml.dom; ?? xmlRoot; int main() { string xml =

Re: What's dxml DOMEntity(R) type ?

2023-06-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 6 June 2023 at 14:16:37 UTC, Steven Schveighoffer wrote: On 6/5/23 6:43 AM, Ferhat Kurtulmuş wrote: On Monday, 5 June 2023 at 10:01:01 UTC, John Xu wrote: [...] ```d import dxml.dom; import std.stdio;     DOMEntity!string xmlRoot;     int main()     {     string xml = "";

Re: Loading Textures in OpenGL

2023-07-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 23 July 2023 at 16:21:05 UTC, Ruby The Roobster wrote: I'm currently trying to load two textures and apply them to a rectangle, following [this](https://learnopengl.com/Getting-started/Textures) which is linked to from the README file of the bindbc OpenGL bindings. [...] DCV uses

Re: Loading Textures in OpenGL

2023-07-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 23 July 2023 at 17:35:03 UTC, Ruby The Roobster wrote: On Sunday, 23 July 2023 at 17:02:40 UTC, Ferhat Kurtulmuş wrote: On Sunday, 23 July 2023 at 16:21:05 UTC, Ruby The Roobster wrote: I'm currently trying to load two textures and apply them to a rectangle, following

Re: Loading Textures in OpenGL

2023-07-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 23 July 2023 at 18:06:46 UTC, Ruby The Roobster wrote: On Sunday, 23 July 2023 at 17:45:53 UTC, Ferhat Kurtulmuş wrote: On Sunday, 23 July 2023 at 17:35:03 UTC, Ruby The Roobster [SNIP] Thank you. I'm still trying to work out how it works. It seems as if the creator tried the

Re: How to setup dub project for contributing to a dub package?

2023-06-24 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 23 June 2023 at 15:22:33 UTC, Ki Rill wrote: Recently, I tried to set up `dcv` with `dub` to improve a few things in the library, but I faced some strange issues. [...] I recommend adding DCV sub packages separately. Don't add the entire thing to your dub dependencies. Just only

Re: How to setup dub project for contributing to a dub package?

2023-06-24 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 23 June 2023 at 15:52:44 UTC, Richard (Rikki) Andrew Cattermole wrote: First things first, dcv is added to the dub-registry, so use this. https://code.dlang.org/packages/dcv ```json "dependencies": { "dcv": "~>0.3.0" } ``` For ffmpeg the binding tells you what to add for

Re: How to read live output from another process ?

2023-06-29 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 23 June 2023 at 23:37:29 UTC, Vinod K Chandran wrote: Hi all, I am trying to create a program which burns time codes to a video. I am using ffmpeg for this. So far, I can successfully start ffmpeg in another thread and stop it when I need. But I can't read the live outputs from

Re: what is the aftermath of dip74

2023-05-10 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 10 May 2023 at 18:15:36 UTC, Richard (Rikki) Andrew Cattermole wrote: We do not, no. Reference counting is not currently in the language, although you can fake it with structs. Its a huge shame, but it should be added at some point because the compiler would tell the backend

Are exceptions caught in unittests?

2024-02-15 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
When I tried to catch exceptions in my unit test, I found that exceptions were not thrown or caught in the unit test blocks. So, I cannot use assertThrown at all. Is this a bug or expected behavior that I don't know? Using LDC 1.36.0 on Windows.

Re: Are exceptions caught in unittests?

2024-02-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 16 February 2024 at 07:54:01 UTC, Richard (Rikki) Andrew Cattermole wrote: This should be working. I don't know what is going on. All I can suggest is to use a debugger to see if it is indeed throwing and then catching. A test code like this works, but unittest doesn't. This is

Re: Are exceptions caught in unittests?

2024-02-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 16 February 2024 at 07:43:24 UTC, Ferhat Kurtulmuş wrote: When I tried to catch exceptions in my unit test, I found that exceptions were not thrown or caught in the unit test blocks. So, I cannot use assertThrown at all. Is this a bug or expected behavior that I don't know? Using

Re: Are exceptions caught in unittests?

2024-02-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 16 February 2024 at 08:48:08 UTC, Jonathan M Davis wrote: On Friday, February 16, 2024 1:06:26 AM MST Ferhat Kurtulmuş via Digitalmars- d-learn wrote: [...] 1. assertThrown does not test whether something somewhere in what you called threw an exception. It asserts that it catches

Re: D: Convert/parse uint integer to string. (@nogc)

2023-11-24 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote: I tried to look into https://dlang.org/phobos/std_conv.html Most of the functions inside `std.conv` seem to be dependant on [Garbage Collection](https://dlang.org/spec/garbage.html). And I couldn't find a straightforward way to

Re: How to set include paths of a c source in dub when using importc

2024-04-17 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 17 April 2024 at 00:40:28 UTC, Alex Bryan wrote: If you're not using gdc exclusively, you'll want to take a look at this: https://github.com/dlang/dub/pull/2818 I knew there was something wrong there.

Re: How to set include paths of a c source in dub when using importc

2024-04-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 13 April 2024 at 22:00:16 UTC, Ferhat Kurtulmuş wrote: On Saturday, 13 April 2024 at 21:41:41 UTC, Ferhat Kurtulmuş wrote: On Saturday, 13 April 2024 at 21:39:10 UTC, Ferhat Kurtulmuş wrote: On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki) Andrew Cattermole wrote:

Re: How to set include paths of a c source in dub when using importc

2024-04-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 13 April 2024 at 21:39:10 UTC, Ferhat Kurtulmuş wrote: On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote: These don't work for me: "dflags": ["-Iinclude"] "importPaths": [     "include" ], The

How to set include paths of a c source in dub when using importc

2024-04-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
These don't work for me: "dflags": ["-Iinclude"] "importPaths": [ "include" ], The importc docs do not help either.

Re: How to set include paths of a c source in dub when using importc

2024-04-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote: These don't work for me: "dflags": ["-Iinclude"] "importPaths": [     "include" ], The importc docs do not help either. Appears it hasn't been documented in

Re: How to set include paths of a c source in dub when using importc

2024-04-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote: These don't work for me: "dflags": ["-Iinclude"] "importPaths": [     "include" ], The importc docs do not help either. Appears it hasn't been documented in

Re: How to set include paths of a c source in dub when using importc

2024-04-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 13 April 2024 at 21:41:41 UTC, Ferhat Kurtulmuş wrote: On Saturday, 13 April 2024 at 21:39:10 UTC, Ferhat Kurtulmuş wrote: On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote: These don't work for me:

Re: Statically compiled binary with C interop crashes.

2024-04-17 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote: I'm using [dray](https://code.dlang.org/packages/dray) in my project with dub, here's the relevant parts of the dub.json: [...] İt seems your issue is related to the raylib itself, neither the binding you use nor the d programming

Re: Find homography in D?

2024-04-21 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 21 April 2024 at 14:57:33 UTC, Paolo Invernizzi wrote: Hi, Someone can point me to a D implementation of the classical OpenCV find homography matrix? Thank you, Paolo Kinda some work but it should be doable using DCV and mir.lubeck in theory DCV can compute, not sift or surf

Re: Find homography in D?

2024-04-30 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 21 April 2024 at 14:57:33 UTC, Paolo Invernizzi wrote: Hi, Someone can point me to a D implementation of the classical OpenCV find homography matrix? Thank you, Paolo Just for future records in the forum. //

Re: Find homography in D?

2024-05-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 21 April 2024 at 14:57:33 UTC, Paolo Invernizzi wrote: Hi, Someone can point me to a D implementation of the classical OpenCV find homography matrix? Thank you, Paolo Now, we can do image stitching using DCV. It needs improvements though.

Re: FIFO

2024-05-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! [...] I don't know your use case, maybe you

Re: FIFO

2024-05-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 13 May 2024 at 15:07:39 UTC, Andy Valencia wrote: On Sunday, 12 May 2024 at 22:03:21 UTC, Ferhat Kurtulmuş wrote: https://dlang.org/phobos/std_container_slist.html This is a stack, isn't it? LIFO? Ahh yes. Then use dlist Thank you. I read its source, and was curious so I wrote

Re: FIFO

2024-05-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! [...] "next" is not a usual range primitive

Re: FIFO

2024-05-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 12 May 2024 at 21:08:24 UTC, Andy Valencia wrote: On Sunday, 12 May 2024 at 19:45:44 UTC, Ferhat Kurtulmuş wrote: On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. ...

Re: FIFO

2024-05-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 11 May 2024 at 23:44:28 UTC, Andy Valencia wrote: I need a FIFO for a work scheduler, and nothing suitable jumped out at me. I wrote the following, but as a newbie, would be happy to receive any suggestions or observations. TIA! [...]

Re: Alguien me dice como podria conectarme a una base de datos en SQL server?

2024-03-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 14 March 2024 at 16:42:04 UTC, dany wrote: Hola a todos necesito conectarme a una base de datos sql y ps no me sale :'( quisiera saber como podria porfis, ayuda :') import std.stdio; import std.json; //import std.database.mysql; //import raylib; import ddbc; void main() {

Re: Recommendation about templating engine library

2024-03-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 11 March 2024 at 14:26:01 UTC, Andrea wrote: Hi folks, Working on a side project I have the need to generate text files (mainly D source code) via a templating system. My use case is to have some JSON data populated at runtime from an API and fill-in placeholders in the text with

Re: How to add a character literal to a string without ~ operator?

2024-04-04 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 4 April 2024 at 21:23:00 UTC, user1234 wrote: On Thursday, 4 April 2024 at 19:56:50 UTC, Ferhat Kurtulmuş wrote: [...] ```d module runnable; import std.stdio : writeln; import std.range : chain; void main() @nogc { auto s = chain("as ", "df ", "j"); // s is lazy

Re: How to add a character literal to a string without ~ operator?

2024-04-04 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 4 April 2024 at 18:14:54 UTC, BoQsc wrote: I'm looking for more readable standard function to add a **character** literal to a **string**. The `~` operator is clearly not great while reading a source code. I'm not here to discuss that. I'm looking for a function inside standard

Re: How does one attach a manifest file to a D executable on Windows?

2024-05-24 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 24 May 2024 at 19:07:24 UTC, solidstate1991 wrote: I have tried resource compiling, then using `dflags` in dug to add the resulting obj file, but I still get the issue of the old GUI style. I did that before, but I don't remember now. Probably you will figure that out based on

Re: How does one attach a manifest file to a D executable on Windows?

2024-05-24 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 24 May 2024 at 21:04:53 UTC, Ferhat Kurtulmuş wrote: On Friday, 24 May 2024 at 19:07:24 UTC, solidstate1991 wrote: I have tried resource compiling, then using `dflags` in dug to add the resulting obj file, but I still get the issue of the old GUI style. I did that before, but I

Re: Get milliseconds from time and construct time based on milliseconds

2024-05-28 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 28 May 2024 at 17:37:42 UTC, bauss wrote: I have two questions that I can't seem to find a solution to after looking at std.datetime. First question is how do I get the current time but in milliseconds? Second is how do I construct a time ex. systime or datetime based on

Re: Feedback request from production of the usage of DWT

2024-06-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 14 June 2024 at 17:27:20 UTC, Menjanahary R. R. wrote: On Thursday, 13 June 2024 at 11:31:31 UTC, Ferhat Kurtulmuş wrote: 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? ...

Re: Feedback request from production of the usage of DWT

2024-06-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 14 June 2024 at 17:39:00 UTC, Ferhat Kurtulmuş wrote: On Friday, 14 June 2024 at 17:27:20 UTC, Menjanahary R. R. wrote: On Thursday, 13 June 2024 at 11:31:31 UTC, Ferhat Kurtulmuş wrote: On Thursday, 13 June 2024 at 06:59:49 UTC, Menjanahary R. R. wrote: How important is its

Re: How to use D without the GC ?

2024-06-12 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 12 June 2024 at 18:58:49 UTC, evilrat wrote: On Wednesday, 12 June 2024 at 17:00:14 UTC, Vinod K Chandran wrote: [...] It is probably not that well maintained, but it definitely works with python 3.10 and maybe even 3.11, i use it to interface with pytorch and numpy and PIL,

Re: Feedback request from production of the usage of DWT

2024-06-13 Thread Ferhat Kurtulmuş 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? I am not sure if this is a known usage scenario with DWT. Once I wanted to use DWT. Since it is a port to SWT of Java. You can use existing GUI designers of SWT.

<    1   2   3