Re: array index out of bound may not throw exception?

2023-07-22 Thread Andrew via Digitalmars-d-learn
On Friday, 21 July 2023 at 23:40:44 UTC, mw wrote: Is there a way to let it report on the spot when it happens? The best way is to wrap your thread's main function in a try-catch block and just print whatever error/exception is caught.

Re: Advice on debugging possible exception or crash

2023-07-06 Thread Andrew via Digitalmars-d-learn
On Thursday, 6 July 2023 at 06:00:04 UTC, Cecil Ward wrote: My program is instrumented with a load of writeflns. At one point it looks as though it suddenly quits prematurely because the expected writeflns are not seen in the output. It could be that I am just reading the flow of control wrong

Options for Cross-Platform 3D Game Development

2023-07-05 Thread Andrew via Digitalmars-d-learn
So, I've gotten the itch to have a go at game development in D, after doing a bit of it in Java last year. I've previously used LWJGL, which is a java wrapper for OpenGL, OpenAL, GLFW, and some other useful libs. The problem is, apparently OpenGL is deprecated for apple devices, so I don't re

Re: How does D’s ‘import’ work?

2023-06-02 Thread Andrew via Digitalmars-d-learn
On Thursday, 1 June 2023 at 03:47:00 UTC, Cecil Ward wrote: I have another question if I may, what do we do about getting makefiles right given that we have imports ? Others can correct me if I'm wrong, but I don't think that it is a priority for D to be specially compatible with makefiles in

Re: Log rotation in std.logger.filelogger

2023-05-23 Thread Andrew via Digitalmars-d-learn
On Tuesday, 23 May 2023 at 11:21:07 UTC, apz28 wrote: On Wednesday, 17 May 2023 at 21:11:41 UTC, Vitalii wrote: Hello! Please tell me how to enable log rotation in std.logger.filelogger? Without log rotation, it seems that the std.logger.filelogger is useless, because it will quickly take up

Re: iopipe code to count lines in gzipped file works with v 0.1.7 but fails with 0.2.1

2020-08-08 Thread Andrew via Digitalmars-d-learn
On Saturday, 8 August 2020 at 02:06:36 UTC, Steven Schveighoffer wrote: On 8/7/20 9:31 PM, Steven Schveighoffer wrote: On 8/7/20 8:57 PM, Steven Schveighoffer wrote: I think this is an issue with dub when using an inline recipe file, but I don't know? ugh. This is an issue with iopipe specify

iopipe code to count lines in gzipped file works with v 0.1.7 but fails with 0.2.1

2020-08-07 Thread Andrew via Digitalmars-d-learn
Hi, This code to count lines in a gzipped file exits with "Program exited with code -9" when run with the latest version of the library, I guess because I am doing unsafe things. Could someone tell me how to change it to make it work? The actual program I'm writing processes a file line by li

Good examples for dmd.frontend?

2019-11-15 Thread Doc Andrew via Digitalmars-d-learn
Hello, I'm doing some experiments trying to use the DMD front-end as a library to generate code (Why3ML) that can be used in a formal verification tool. However, documentation is a little sparse. I've looked through the examples in dmd/src/examples, and they were a fine starting point but no

curl: can't send email?

2019-06-10 Thread Andrew via Digitalmars-d-learn
What wrong? ``` import std.net.curl; void main() { auto smtp = SMTP("smtps://smtp.gmail.com:465"); smtp.setAuthentication("qwe...@gmail.com", "password"); smtp.mailTo = ["std.net.curl.CurlException@std/net/curl.d(4364): Failed sending data to the peer on handle 55FACCB58AC0 ---

Re: D threading and shared variables

2019-04-07 Thread Doc Andrew via Digitalmars-d-learn
On Sunday, 7 April 2019 at 14:08:07 UTC, Archie Allison wrote: I have written an industrial control program which uses serial ports to communicate with hardware but am having problems, perhaps with shared memory, on Windows. The SerialPort class calls C object-file functions. Transmits are on

Re: countUntil to print all the index of a given string.

2018-02-25 Thread Andrew via Digitalmars-d-learn
On Sunday, 25 February 2018 at 13:25:56 UTC, Vino wrote: On Sunday, 25 February 2018 at 03:41:27 UTC, Jonathan M Davis wrote: On Sunday, February 25, 2018 02:58:33 Seb via Digitalmars-d-learn wrote: [...] That will help eventually, but it requires a compiler flag, so it's really not going to

Re: Using iopipe to stream a gzipped file

2018-01-04 Thread Andrew via Digitalmars-d-learn
On Thursday, 4 January 2018 at 15:48:21 UTC, Steven Schveighoffer wrote: It's now been updated, see version 0.0.3. Note, the performance isn't something I focused on. I'll note that gzcat | wc -l is 2x faster than your simple example on that file. I can think of a couple reasons for this:

Re: Using iopipe to stream a gzipped file

2018-01-04 Thread Andrew via Digitalmars-d-learn
On Thursday, 4 January 2018 at 12:15:27 UTC, Steven Schveighoffer wrote: On 1/4/18 7:01 AM, Andrew wrote: Ah thank you, that makes sense. These types of files are compressed using the bgzip utility so that the file can be indexed meaning specific rows extracted quickly (there's more details o

Re: Using iopipe to stream a gzipped file

2018-01-04 Thread Andrew via Digitalmars-d-learn
On Thursday, 4 January 2018 at 02:44:09 UTC, Steven Schveighoffer wrote: On 1/3/18 12:03 PM, Andrew wrote: Thanks for looking into this. So it looks like the file you have is a concatenated gzip file. If I gunzip the file and recompress it, it works properly. Looking at the docs of zlib i

Re: Using iopipe to stream a gzipped file

2018-01-03 Thread Andrew via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 16:09:19 UTC, Steven Schveighoffer wrote: On 1/3/18 9:45 AM, Andrew wrote: Hi, I have a very large gziped text file (all ASCII characters and ~500GB) that I want to stream and process line-by-line, and I thought the iopipe library would be perfect for this, but

Using iopipe to stream a gzipped file

2018-01-03 Thread Andrew via Digitalmars-d-learn
Hi, I have a very large gziped text file (all ASCII characters and ~500GB) that I want to stream and process line-by-line, and I thought the iopipe library would be perfect for this, but I can't seem to get it to work. So far, this is the closest I have to getting it to work: import iopipe.

Re: static array internal & dangling reference

2016-11-12 Thread Andrew via Digitalmars-d-learn
On Saturday, 12 November 2016 at 11:03:31 UTC, Mike Parker wrote: [...] You *have* created a dangling pointer. It's just that for such a simple little program, the part of the stack where the original array was allocated isn't stomped at the point where you access it after the function call.

Re: Get date at compile time

2016-10-01 Thread Andrew via Digitalmars-d-learn
On Saturday, 1 October 2016 at 14:43:31 UTC, Adam D. Ruppe wrote: On Saturday, 1 October 2016 at 14:41:22 UTC, Andrew wrote: Is there any way to get the system date at compile time. Not exactly, but the special symbol __TIMESTAMP__ gets a string out of the compiler at build time. http://dla

Get date at compile time

2016-10-01 Thread Andrew via Digitalmars-d-learn
Hi, Is there any way to get the system date at compile time. I want something like: static string compileDate = Clock.currTime.toString; but that fails. Thanks very much Andrew

Re: Configuring of dub for the application reading enviroment variable

2016-09-30 Thread Andrew via Digitalmars-d-learn
On Friday, 30 September 2016 at 10:31:52 UTC, MGW wrote: My STARTING application shall read the enviroment variable. For example MY_VARIABLE= "I'm Gena". The MY_VARIABLE variable needs to be set in dub.json so what she would be visible in case of start of my application. Purpose: to set LD_LIBRAR

Re: Pipe one shell command into another

2016-01-30 Thread Andrew via Digitalmars-d-learn
On Saturday, 30 January 2016 at 15:57:49 UTC, Griffon26 wrote: On Saturday, 30 January 2016 at 15:12:26 UTC, Andrew wrote: foreach(line; pipesLs.stdout.byLine) pipesSort.stdin.writeln(line); Because you write sort's input first and read its output later, it might end up blocking if ls g

Pipe one shell command into another

2016-01-30 Thread Andrew via Digitalmars-d-learn
Hi, I'd like to run a shell command which involves piping one thing into another and then processes the output line by line, i.e. something like "ls -l | sort -k5,5n" What I've come up so far with is: import std.process; import std.stdio; void main(){ auto pipesLs = pipeProcess(["ls", "-l

demangle()

2015-12-02 Thread Andrew via Digitalmars-d-learn
When I run the DMD profile, the "overview" at the end of the trace.log contains some mangles names (such as: _D3std5stdio4File17LockingTextWriter12__T3putTAyaZ3putMFAyaZ13trustedFwriteFNbNiNexPvmmPOS4core4stdc5stdio7__sFILEZm When I call demangle() on those mangled names it returns the mangled

Re: Binding to GSL library

2015-11-26 Thread Andrew via Digitalmars-d-learn
On Wednesday, 25 November 2015 at 16:45:51 UTC, Radek wrote: i have found bug. It shoul be alias gsl_complex = _gsl_complex; not alias gsl_complex = _gsl_complex*; On Wednesday, 25 November 2015 at 16:35:06 UTC, drug wrote: A little bit offtopic but do you know about https://github.com/abrown25

Arty of Constructor

2015-11-18 Thread Andrew via Digitalmars-d-learn
The documentation gives plenty of examples of how to use a static if with the arity trait, but how do I specify the constructor of an object as the parameter to arity? Thanks

Re: Efficiency of immutable vs mutable

2015-11-03 Thread Andrew via Digitalmars-d-learn
This: On Tuesday, 3 November 2015 at 04:08:09 UTC, TheFlyingFiddle wrote: __gshared char[4] lookup = ['a', 't', 'g', 'c]; Has the same efficiency gain as immutable, so it looks like a thread-local vs global difference and the extra cost is going through the thread-local lookup. Thanks

Efficiency of immutable vs mutable

2015-11-02 Thread Andrew via Digitalmars-d-learn
I've written a short D program that involves many lookups into a static array. When I make the array immutable the program runs faster. This must mean that immutable is more than a restriction on access, it must affect the compiler output. But why and how? Thanks Andrew