Desiring bool any_key_pressed()

2023-03-02 Thread Daren Scot Wilson via Digitalmars-d-learn
Here is a very simple version of the program I'm working on. Is there a way to write is_any_key_pressed() that doesn't block, doesn't require the Enter key, and doesn't require dragging in any complex libraries or dealing with low-level stuff like ioctl()? Is there nothing in Phobos that provi

Re: stdin.readln line editing and recall with up arrow

2023-02-28 Thread Daren Scot Wilson via Digitalmars-d-learn
On Saturday, 25 February 2023 at 08:47:42 UTC, Richard (Rikki) Andrew Cattermole wrote: On 25/02/2023 9:45 PM, Daren Scot Wilson wrote: I went with readline.  Left/right arrows work, but up arrow still does not recall earlier commands. Maybe I need also a separate input history thing? https:/

Re: stdin.readln line editing and recall with up arrow

2023-02-25 Thread Daren Scot Wilson via Digitalmars-d-learn
On Saturday, 25 February 2023 at 05:41:48 UTC, Richard (Rikki) Andrew Cattermole wrote: On 25/02/2023 6:36 PM, Daren Scot Wilson wrote: stdin.readln() works fine until I, out of habit, use the up arrow to recall an earlier input and the left/right to move around and change a character.   How do

stdin.readln line editing and recall with up arrow

2023-02-24 Thread Daren Scot Wilson via Digitalmars-d-learn
stdin.readln() works fine until I, out of habit, use the up arrow to recall an earlier input and the left/right to move around and change a character. How do I get that to work?

Re: Which TOML package, or SDLang?

2023-01-30 Thread Daren Scot Wilson via Digitalmars-d-learn
On Monday, 30 January 2023 at 17:54:15 UTC, H. S. Teoh wrote: XML is evil. Agreed! I'm going with TOML, community package. It's working, so far.

Which TOML package, or SDLang?

2023-01-29 Thread Daren Scot Wilson via Digitalmars-d-learn
So, which package do I use for TOML? I find these three: * toml-foolery (Andrej Petrović) * toml-d, or toml.d (oglu on github) at ver 0.3.0 * toml, (dlang community on github) at ver 2.0.1 I'm guessing from version numbers that the third one, toml, is officially good for real world use. But I

Re: Handling CheckBox state changes in DLangUI

2022-12-30 Thread Daren Scot Wilson via Digitalmars-d-learn
On Saturday, 31 December 2022 at 03:05:45 UTC, brianush1 wrote: On Saturday, 31 December 2022 at 02:40:49 UTC, Daren Scot Wilson wrote: The compiler errors I get are, for no '&' and with '&': Error: function `app.checkbox_b_clicked(Widget source, bool checked)` is not callable using argument t

Handling CheckBox state changes in DLangUI

2022-12-30 Thread Daren Scot Wilson via Digitalmars-d-learn
I'm writing a GUI program using dlangui. It has some checkboxes. I'm trying to figure out how to invoke a callback function when the user clicks the box. What are the valid ways of doing that? I can copy from dlangide's source, where a delegate is defined in-line and assigned. That seems to wo

Re: How to do same as 'nmap' command from within a D program?

2022-01-24 Thread Daren Scot Wilson via Digitalmars-d-learn
On Sunday, 23 January 2022 at 06:30:11 UTC, frame wrote: On Saturday, 22 January 2022 at 20:55:38 UTC, Daren Scot Wilson wrote: I don't see any D std.* libraries that do this. Are there a Dub packages I should look at? If you really want to this in D without any external app or OS API you c

How to do same as 'nmap' command from within a D program?

2022-01-22 Thread Daren Scot Wilson via Digitalmars-d-learn
I'm writing a command line program to control certain hardware devices. I can hardcode or have in a config file the IP addresses for the devices, if I know that info. If I don't? Then I run an 'nmap' command and look for the devices. But why should I, a human, have to do any work like that? B

Re: Simple BeamUI project won't link

2020-12-18 Thread Daren Scot Wilson via Digitalmars-d-learn
On Wednesday, 16 December 2020 at 07:45:50 UTC, Ferhat Kurtulmuş wrote: On Wednesday, 16 December 2020 at 07:40:45 UTC, Ferhat Kurtulmuş wrote: This may be not your issue, but I could manage it to work by adding this line: subPackage "examples/myproject" to the dub.sdl of the beamui. I simp

Re: Simple BeamUI project won't link

2020-12-18 Thread Daren Scot Wilson via Digitalmars-d-learn
On Wednesday, 16 December 2020 at 07:40:45 UTC, Ferhat Kurtulmuş wrote: On Wednesday, 16 December 2020 at 07:02:11 UTC, Daren Scot Wilson wrote: Trying out the beamui GUI package, obtained by git clone from github. The "basic" example builds and runs. I'm working on an Arch Linux machine with

Simple BeamUI project won't link

2020-12-15 Thread Daren Scot Wilson via Digitalmars-d-learn
Trying out the beamui GUI package, obtained by git clone from github. The "basic" example builds and runs. So I create a new project from scratch, with "dub init beamy beamui" (ircc) in a directory outside beamui's, sibling to it in fact. This builds and runs, but does not make use of beamui

Re: Thread to watch keyboard during main's infinite loop

2020-05-06 Thread Daren Scot Wilson via Digitalmars-d-learn
On Thursday, 7 May 2020 at 01:02:57 UTC, ag0aep6g wrote: Thank you, this is 110% helpful. Actually, I'd like to return the excess 10%. My dmd compiler does not like: import core.thread: sleep; so I put the code back the way I had, just to get on with work. Use `shared` so that all thr

Thread to watch keyboard during main's infinite loop

2020-05-06 Thread Daren Scot Wilson via Digitalmars-d-learn
I'm writing a simple command line tool to send data by UDP once per second forever, to test some software on another machine. Not actually forever, of course, but until ^C or I hit 'Q'. I want to tap keys to make other things happen, like change the data or rate of sending. Not sure of the b

Re: Finding position of a value in an array

2019-12-31 Thread Daren Scot Wilson via Digitalmars-d-learn
On Tuesday, 31 December 2019 at 06:01:36 UTC, Paul Backus wrote: countUntil operates on ranges, and static arrays aren't ranges. To get a range from a static array, you have to slice it with the `[]` operator: int i = info.doos[].countUntil(important_d); (Why can't static arrays be range

Re: Finding position of a value in an array

2019-12-30 Thread Daren Scot Wilson via Digitalmars-d-learn
On Monday, 30 December 2019 at 23:15:48 UTC, JN wrote: On Sunday, 29 December 2019 at 08:31:13 UTC, mipri wrote: int i = a.countUntil!(v => v == 55); assert(i == 2); I also had to ask because I couldn't find it. In other languages it's named "index()", "indexOf()" or "find()". D is the only

Finding position of a value in an array

2019-12-29 Thread Daren Scot Wilson via Digitalmars-d-learn
Reading documentation... Array, Algorithms, ... maybe I've been up too late... how does one obtain the index of, say, 55 in an array like this int[] a = [77,66,55,44]; I want to do something like: int i = a.find_value_returning_its_index(55); assert(i==2) I'm sure it's obvious bu

Signs by which to recognize D1

2015-05-06 Thread Daren Scot Wilson via Digitalmars-d-learn
Someone looks at a chunk of D code of murky origin. Possibly, it is old, maybe D1 not D2. Inadequately commented, believe it or not, and not other information. What are some easy to spot details in the syntax by which the onlooker can know it's D1 not D2?

Audio file read/write?

2014-11-06 Thread Daren Scot Wilson via Digitalmars-d-learn
What's the current recommended way to read and write audio files? I don't need to play it on the speakers or deal with anything real time - just read a file's data into an array, fiddle with it, and write it out to a file. I found some other threads about audio files, but none recent, mentio