Re: How do I use libraries manually?

2019-02-05 Thread Murilo via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 19:46:32 UTC, H. S. Teoh wrote: Thank you very much, I will try what you just explained. And yes I would really appreciate it if people would make single file libraries that I can just import as if it were any other .d file.

Re: std.container.rbtree as Interval Tree?

2019-02-05 Thread James Blachly via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 10:10:44 UTC, RazvanN wrote: On Monday, 4 February 2019 at 22:54:01 UTC, James Blachly wrote: I tried to implement an interval tree backed by std.container.rbtree today and fell flat. [...] You can use alias this [1] in your interval element type: struct

Re: std.container.rbtree as Interval Tree?

2019-02-05 Thread James Blachly via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 16:24:03 UTC, Eduard Staniloiu wrote: I think you are making a slight confusion. Your `Interval` struct and the `Elem` type that `lowerBound` takes, are the same type. You can define your RBTree and Interval as follows ``` struct Interval { int start;

Re: Converting a type to a char

2019-02-05 Thread Murilo via Digitalmars-d-learn
On Friday, 25 January 2019 at 15:53:10 UTC, Thomas Gregory wrote: I would like to check that a char (unknown at compile time) matches a particular type but I would like to do so without if statements or a hash map as I would like it to be as fast as possible. Ideally I would choose something

Re: Easiest way to display images

2019-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 21:11:52 UTC, Murilo wrote: What would be the easiest way to simply display a jpg or png image on the screen for a few seconds in Windows? That's a little more complex than playing a sound, there's no one function to do it. You can in... oh about 50 lines, but I

Easiest way to display images

2019-02-05 Thread Murilo via Digitalmars-d-learn
What would be the easiest way to simply display a jpg or png image on the screen for a few seconds in Windows?

How do I use libraries manually?

2019-02-05 Thread Murilo via Digitalmars-d-learn
Can anyone teach me how to download and use a library manually without having to use DUB?

Re: How do I use libraries manually?

2019-02-05 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Feb 05, 2019 at 07:06:24PM +, Murilo via Digitalmars-d-learn wrote: > Can anyone teach me how to download and use a library manually without > having to use DUB? 1) Locate the source code. There should be a link from the code.dlang.org page of the library, usually pointing to

Re: How do I use libraries manually?

2019-02-05 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Feb 05, 2019 at 08:39:50PM +, Murilo via Digitalmars-d-learn wrote: [...] > Thank you very much, I will try what you just explained. And yes I > would really appreciate it if people would make single file libraries > that I can just import as if it were any other .d file. That only

Re: Easiest way to display images

2019-02-05 Thread Murilo via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 21:25:54 UTC, Adam D. Ruppe wrote: On Tuesday, 5 February 2019 at 21:11:52 UTC, Murilo wrote: What would be the easiest way to simply display a jpg or png image on the screen for a few seconds in Windows? That's a little more complex than playing a sound,

Re: Easiest way to display images

2019-02-05 Thread Murilo via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 21:25:54 UTC, Adam D. Ruppe wrote: On Tuesday, 5 February 2019 at 21:11:52 UTC, Murilo wrote: What would be the easiest way to simply display a jpg or png image on the screen for a few seconds in Windows? That's a little more complex than playing a sound,

Re: C++ base class needs at least one virtual method

2019-02-05 Thread evilrat via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 14:23:00 UTC, ezneh wrote: Hello While trying to make a 1:1 binding to a C/C++ lib, I got the following issue: I only have access to the .h header file, and in there I have this: class someclass {}; class otherclass : public someclass {}; When trying to

Re: Easiest way to display images

2019-02-05 Thread DanielG via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 01:04:43 UTC, Murilo wrote: You should later joing the facebook group Programming in D. The D community is small enough that it's unlikely anybody in that Facebook group, isn't already using the newsgroups / IRC / etc to discuss D. Even the official subreddit

Using Async task with timer

2019-02-05 Thread Sudhi via Digitalmars-d-learn
Hi All, I am trying to use an Async task which would run at every interval of time. I could not find any example for this. Can some one enlighten me on this. I did not find much documentation on timers also. Thanks, Sudhi

Re: Easiest way to display images

2019-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 01:04:43 UTC, Murilo wrote: You should later joing the facebook group Programming in D. Eh, I don't really like facebook groups. With my libraries too, I don't really care if anyone uses them. I make them for myself and put them online because it is easy for

Public private key encryption using existing key in dlang

2019-02-05 Thread Sudhi via Digitalmars-d-learn
Hi All, I have tried encrypting a message using public key and sending message to client, who decrypts using private key. I have tried with openssl d package. Below is my code. However it always fails in creating the context and exits by throwing exception. Key that i am using is RSA key.

Re: Using Async task with timer

2019-02-05 Thread Heromyth via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 05:03:26 UTC, Sudhi wrote: Hi All, I am trying to use an Async task which would run at every interval of time. I could not find any example for this. Can some one enlighten me on this. I did not find much documentation on timers also. Thanks, Sudhi Here

Re: C++ base class needs at least one virtual method

2019-02-05 Thread ezneh via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 02:36:33 UTC, evilrat wrote: No surprises here, D can only inherit from virtual C++ classes and that message says exactly that(class must have at least one virtual method). This someclass looks for me as just a strange design decision, if it's not just a

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 4 February 2019 at 18:34:55 UTC, Ron Tarrant wrote: I posted about this over on the GtkD site, but I suspect no one's home until later in the day. [...] works fine here, can't reproduce with your example code. Maybe some GTK configuration of your system?

Re: Singleton in Action?

2019-02-05 Thread kdevel via Digitalmars-d-learn
On Monday, 4 February 2019 at 10:17:53 UTC, bauss wrote: On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote: [...] Here's the singleton code I've been playing with: [...] static bool instantiated_; // Thread global __gshared DSingleton instance_;

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread Antonio Corbi via Digitalmars-d-learn
On Monday, 4 February 2019 at 18:34:55 UTC, Ron Tarrant wrote: I posted about this over on the GtkD site, but I suspect no one's home until later in the day. [...] And it still does the same thing. First click, blue line. Second click, menu drops. Hi Ron: It's working OK for me (gtkd

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 08:43:21 UTC, WebFreak001 wrote: works fine here, can't reproduce with your example code. Maybe some GTK configuration of your system? From the questions you guys asked, I just realized I should have said I'm running on Windows 10.

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 08:51:49 UTC, Antonio Corbi wrote: Have you tweaked your gtk theme? If so, could you try with the default (Adwaita) gtk theme? This is a Linux/Gnome thing, I'm assuming? Still, I'll look into other configuration stuff and see where it leads. Thanks, Antonio.

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 09:31:01 UTC, Ron Tarrant wrote: On Tuesday, 5 February 2019 at 08:51:49 UTC, Antonio Corbi wrote: Have you tweaked your gtk theme? If so, could you try with the default (Adwaita) gtk theme? This is a Linux/Gnome thing, I'm assuming? Still, I'll look into

Re: std.container.rbtree as Interval Tree?

2019-02-05 Thread RazvanN via Digitalmars-d-learn
On Monday, 4 February 2019 at 22:54:01 UTC, James Blachly wrote: I tried to implement an interval tree backed by std.container.rbtree today and fell flat. [...] You can use alias this [1] in your interval element type: struct IntervalElem { size_t start, end; /* ... other

Re: static arrays at runtime with templates ?

2019-02-05 Thread Emil via Digitalmars-d-learn
On Monday, 4 February 2019 at 22:48:10 UTC, XavierAP wrote: ... If there is something you want to solve in a program of yours, there may be another way, as H.S. Teoh suggests. If you're just trying out stuff it's also fine, :) there's still more. Since August last year I try to read or write

Re: static arrays at runtime with templates ?

2019-02-05 Thread Paul Backus via Digitalmars-d-learn
On Monday, 4 February 2019 at 22:48:10 UTC, XavierAP wrote: However one of the possibilities of D is the ability to generate and execute quite some code at compile time by means of meta-programming; and I guess here's where staticArray() may end up being useful enough to have merited

C++ base class needs at least one virtual method

2019-02-05 Thread ezneh via Digitalmars-d-learn
Hello While trying to make a 1:1 binding to a C/C++ lib, I got the following issue: I only have access to the .h header file, and in there I have this: class someclass {}; class otherclass : public someclass {}; When trying to translate that header file to D, I ended with the following

Re: Simple way to play sounds using D

2019-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 17:09:10 UTC, Murilo wrote: When I compile the code above the compiler says Error: linker exited with status 1 What should I do? It might have to be "shoot.wav"w, notice the w on the end. But I am guessing the main problem is not linking in the winmm lib and

Re: Simple way to play sounds using D

2019-02-05 Thread Murilo via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 17:14:05 UTC, Adam D. Ruppe wrote: On Tuesday, 5 February 2019 at 17:09:10 UTC, Murilo wrote: When I compile the code above the compiler says Error: linker exited with status 1 What should I do? It might have to be "shoot.wav"w, notice the w on the end. But I

Re: std.container.rbtree as Interval Tree?

2019-02-05 Thread Eduard Staniloiu via Digitalmars-d-learn
On Monday, 4 February 2019 at 22:54:01 UTC, James Blachly wrote: I tried to implement an interval tree backed by std.container.rbtree today and fell flat. A standard way to make an interval tree is to make an augmented tree; I supposed since rbtree was a generic container and because I could

Simple way to play sounds using D

2019-02-05 Thread Murilo via Digitalmars-d-learn
Hi guys, I would like to play simple sounds but I want something easy to use, can you show me the simplest way to do that? Like a function that just loads a .wav and plays it.

Re: Simple way to play sounds using D

2019-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 16:50:36 UTC, Murilo wrote: Hi guys, I would like to play simple sounds but I want something easy to use, can you show me the simplest way to do that? Like a function that just loads a .wav and plays it. If you are on Windows, the OS has a nice function for

Re: Simple way to play sounds using D

2019-02-05 Thread Murilo via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 17:01:54 UTC, Adam D. Ruppe wrote: On Tuesday, 5 February 2019 at 16:50:36 UTC, Murilo wrote: Hi guys, I would like to play simple sounds but I want something easy to use, can you show me the simplest way to do that? Like a function that just loads a .wav and