Re: How to tell DMD to use lld-link?

2023-07-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 18 July 2023 at 07:19:44 UTC, Vladimir Panteleev wrote: Seeing this link failure on Windows: https://github.com/CyberShadow/ae/actions/runs/5574489393/jobs/10184021009#step:8:30 Looks like an MS link SNAFU. lld-link also fails, so this looks like a DMDBE bug... probably

How to tell DMD to use lld-link?

2023-07-18 Thread Vladimir Panteleev via Digitalmars-d-learn
Seeing this link failure on Windows: https://github.com/CyberShadow/ae/actions/runs/5574489393/jobs/10184021009#step:8:30 Looks like an MS link SNAFU. Is there any way I can tell DMD to ignore the presence of MS link and use the bundled lld-link anyway?

Re: How to use Dub and Digger to build Pull Requests?

2023-05-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 23 May 2023 at 13:50:09 UTC, Quirin Schroll wrote: ``` object.Exception@%LOCALAPPDATA%\dub\packages\ae-0.0.3236\ae\sys\d\manager.d(898): Command ["make", "-f", "win32.mak", "MODEL=32",

Re: Bug in DMD?

2023-03-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:21:52 UTC, ryuukk_ wrote: I have some questions: 1. why does it work with LDC? 2. why does it work with DMD when build/link in 2 step? 3. why it doesn't work when DMD is invoked once for build/link I think these are probably coincidences and the answer can be

Re: Bug in DMD?

2023-03-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:07:07 UTC, ryuukk_ wrote: I couldn't figure out dustmite, so i started from 0 and managed to hit something: https://github.com/ryuukk/dmd_bug ``Assertion failed: array index out of bounds, file game\app.d, line 5`` Wich indicates probably TLS problem?

Re: Thinking about the difference between fixed and 'dynamic' arrays.

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 01:53:10 UTC, Siarhei Siamashka wrote: Rust also appears to be picky about the order of operations: ```Rust fn main() { let mut a = [1, 2, 3, 4, 5]; let c = a; let b = a; b[1] = 99; println!("{:?}", b); // [1, 99, 3, 4, 5]

Re: How do I _really_ implement opApply?

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 01:30:03 UTC, Steven Schveighoffer wrote: On 11/29/22 7:50 PM, WebFreak001 wrote: (note: I don't want to use a template, this way of writing it has the advantage that the compiler checks all different code paths for errors, so the errors aren't delayed until

Re: dirEntries removes entire branches of empty directories

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 10 November 2022 at 21:27:28 UTC, Ali Çehreli wrote: However, ftw performs about twice as fast as dirEntries Yes, `dirEntries` isn't as fast as it could be. Here is a directory iterator which tries to strictly not do more work than what it must:

Re: Thinking about the difference between fixed and 'dynamic' arrays.

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 00:40:57 UTC, Vladimir Panteleev wrote: On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote: Suggestion: it would be clearer if the two concepts were separated: 1. Convert 'int[] VarArr;' so it produces a straightforward _value-type_ variable array,

Re: Thinking about the difference between fixed and 'dynamic' arrays.

2022-11-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote: Suggestion: it would be clearer if the two concepts were separated: 1. Convert 'int[] VarArr;' so it produces a straightforward _value-type_ variable array, called 'VarArr'; 2. Implement a new concept 'int slice Window;' to produce

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: Running the program shows no output; 'a' is not visited as a directory entry. That's not what happens for me: ```d import std.exception; import std.file; import std.path; import std.stdio; void ls() { foreach (e;

Re: dustmite and Windows file access errors

2022-01-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 24 January 2022 at 17:17:28 UTC, Anonymouse wrote: Indexing is off for the parent directory. What else can I do? Disable anti-virus. If that doesn't help, you could try using Sysinternals Process Monitor to check what is accessing the file.

Re: Dustmite and linking error

2021-09-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 4 September 2021 at 07:38:34 UTC, Andre Pany wrote: The Dustmite condition you are using seems very generic, therefore this error message can be triggered by various code constellations. This might be the reasons why Dustmite is running so long. Overly generic test conditions

Re: Dustmite and linking error

2021-09-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 4 September 2021 at 06:18:52 UTC, JG wrote: I tried again. What am I doing wrong? cp source ~/tmp/source cd ~/tmp/source dub build --config prog1 2>&1 | grep "collect2: error: ld returned 1 exit status" echo $? #produces 0 find . -name *.o -delete ~/d/DustMite/dustmite -j ./ 'dub

Re: Dustmite and linking error

2021-09-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 2 September 2021 at 11:20:18 UTC, Vladimir Panteleev wrote: One way to get a very rough estimate is to take the square of the current reduction (.reduced directory), and divide it by the square of the original source. I meant the square of the size of the respective directory.

Re: Dustmite and linking error

2021-09-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 2 September 2021 at 11:04:12 UTC, JG wrote: Hi, We hit a linking error (after upgrading to dub 1.26.0). I thought I would try to use dustmite to create a reduced error test case. One week later it is still running (depth 22). I don't suppose there is anyway of determining when

Re: How to profile compile times of a source code?

2021-08-08 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: I'm looking for ways to figure out what parts of the code slows down the compiler other than brute force trial. You could try some of the tools listed on the wiki for build time profiling:

Re: Build time

2021-08-08 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote: Any suggestion on how to try and improve the build time. You could try some of the tools listed on the wiki for build time profiling: https://wiki.dlang.org/Development_tools#Build_time_profiling (intentional bump to aid search results, as

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-06-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 03:52:51 UTC, someone wrote: One of the things I do not like with D, and it causes me to shoot me on the foot over and over, is the lack of null for *every* data type. Things like: If you want to give any type a "null" value, you could use

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-06-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 03:15:46 UTC, someone wrote: Is the following code block valid ? Comparison with `nan` always results in `false`: See section 10.11.5: https://dlang.org/spec/expression.html#equality_expressions You can use the `is` operator to perform bitwise comparison, or

Re: Internal Server Error on reload of dfeed.js

2021-06-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 16 June 2021 at 06:28:40 UTC, guest wrote: STR: 1. open http://forum.dlang.org/static-bundle/637528586548394375/dlang.org/js/dlang.js+js/dfeed.js 2. press reload (F5 or ctrl+R) Noticed this too and fixed it a bit ago. It was sending 500 instead of 304, so actually the only

Re: Unpacking Slices

2021-06-14 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 14 June 2021 at 18:08:27 UTC, Justin Choi wrote: Is there any shortcut for unpacking slices like I'd want to do in a scenario like this? `info = readln.strip.split;` `string a = info[0], b = info[1], c = info[2];` I tried to implement PHP's "list" language construct here, which

Re: How to unit-test a phobos module?

2020-11-27 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 27 November 2020 at 04:08:33 UTC, Q. Schroll wrote: I think using digger in principle works and I assume the problems I got aren't Digger's fault, but ae's. Building DMD + DRuntime failed. Sorry about this. It was caused by a breaking change in Druntime's build script:

Re: Function Pointer Not Working

2020-11-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 19 November 2020 at 04:23:13 UTC, Marcone wrote: // Function threadingw() void threadingw(HWND hwn, void delegate() fun) nothrow { try { // Function _fun() extern(Windows) uint _fun(void * arg){ (*(cast(void delegate()*)

Re: Renaming Flag!"" in API

2020-10-12 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 12 October 2020 at 10:24:44 UTC, FreeSlave wrote: Can this issue overcome somehow? Why not add a deprecated overload for your function which takes the old Flag value?

Re: std.process - avoid interaction with parent shell

2020-07-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 20 July 2020 at 20:55:52 UTC, Steven Schveighoffer wrote: I tried redirecting /dev/null to stdin when executing my application (and I assumed that would pass onto the process child), but it still asks. What am I doing wrong? Generically, I think you want to detach the program from

Re: Allocating an empty non null associative arary

2020-03-31 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 02:51:11 UTC, Superstar64 wrote: How do I generically create an empty associative array? If you can't pass it by ref, then adding and then removing an element is the only way I know. /// Ensure that arr is non-null if empty. V[K] nonNull(K, V)(V[K] aa) {

Re: Convert program to 2020: replace foreach loop with map, filter and friends

2020-03-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 04:00:28 UTC, User wrote: I'd like to convert the following program to 2020 standards (i.e, replace the foreach block with a one-line code). I've tried much and I failed. Here is how I'd do it. Because the program downloads and then reads the local file

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 22:01:18 UTC, Anonymouse wrote: No, C:\Temp\work\dl\git does not exist. :o OK, that makes sense. Please try the latest Digger version (24cd4168956dad382d05984b4b8d37d9e8ebe3ae).

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:44:20 UTC, Anonymouse wrote: New log: https://pastebin.com/raw/uUMNQjEN It looks like it fails to execute git (to get the current version for the build). I don't know why that fails, as I see C:\Temp\work\dl\git\cmd is in PATH in the environment that

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:30:57 UTC, Anonymouse wrote: I was on beta 8. I forced dub to download the latest now (3.0.0-alpha-9), wiped the work directory and retried, but to similar results. The latest is v3.0.0-alpha-11. Oh, I guess that's not how semantic versioning works. Probably

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:41:00 UTC, Anonymouse wrote: It doesn't seem to include debugging symbols. Is your Digger version up-to-date? https://github.com/CyberShadow/ae/commit/48ee31a3b0d47e52769ee87b0e673034abe4add5

Re: wstring comparison is failing

2019-09-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 24 September 2019 at 21:40:47 UTC, Brett wrote: The only issue is that buggy dynamic code can result if someone compares the two and it will fail silently. But, you don't know if the static array actually contains a null-terminated string (in which case the comparison is a bug) or

Re: wstring comparison is failing

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 23:22:14 UTC, Brett wrote: I guess you are probably right... I was thinking that it would compare up to a null terminator. Seems kinda buggy... maybe the compiler needs to give a warning? After all, compared a fixed size array with a dynamic array then will

Re: Single D app entered multiple times from command line

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 19:14:15 UTC, Brett wrote: I imagine I could potentially create a separate process that has a communication layer between it and the D program but I'm hoping it would be less work. You're pretty much describing a client-server design. A lot of software does

Re: wstring comparison is failing

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 20:38:03 UTC, Brett wrote: cast(wstring)entry.szExeFile == Name to!wstring(entry.szExeFile) == Name These all fail. The strings are clearly the same. I can compare char by char and it works. latest D 2.088. The only thing is that szExeFile is a static wchar

Re: Why is the fPIC switch missing?

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 08:19:35 UTC, Boris Carvajal wrote: On Monday, 23 September 2019 at 01:31:03 UTC, Emmanuelle wrote: Hello. My problem is exactly what it says on the title: my dmd (windows 7, x64) doesn't seem to have -fPIC: I think it's not needed. The generated code on

Re: Simplifying process piping

2019-09-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 22 September 2019 at 16:06:04 UTC, Jesse Phillips wrote: https://github.com/JesseKPhillips/std.process-example/ I'm wondering if there are any thoughts for simplification. I don't mean simplify to perform the same end result, but is the threading and data copies as simple as they

Re: Downloading a file and showing progress via curl.

2019-08-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 20 August 2019 at 11:51:03 UTC, Daniel Kozak wrote: For that you can use https://dlang.org/phobos/std_file#append Don't do that. It will reopen and close the file on every received chunk. Not only is it slow, but if the file is renamed/moved/deleted while the download is

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 15 July 2019 at 11:48:13 UTC, Anonymouse wrote: dub run digger -- build "stable + druntime#2675" sc.ini and dub output at: https://pastebin.com/jPnh4yEA By default Digger builds D for 32-bit only. However, it looks like Dub is trying to build your code targeting the 64-bit

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 15 July 2019 at 10:27:49 UTC, Anonymouse wrote: OPTLINK : Warning 9: Unknown Option : OUT It looks like it's trying to use MS link command-line syntax with DM OPTLINK. I'm not sure why that would happen, as Digger creates a complete sc.ini file containing full paths to all

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 20:17:37 UTC, Steven Schveighoffer wrote: We do have a nanosecond resolution, and it's just rounded down to the nearest 10. For example: auto d = 15.nsecs; assert(d == 10.nsecs); I'm not sure how to feel about this. Maybe there was a better way to handle

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:42:17 UTC, Alex wrote: I'm not sure if they are failing to block or if they are blocking what is being opened(and not the original console). That is, do I need to not open and simply close stdout? Yes, I see. It won't work because the two libraries are using

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:18:01 UTC, Alex wrote: adding int dup(int) @trusted; int dup2(int, int) @trusted; int close(int) @trusted; int open(in char*, int, ...) @trusted; Be sure to make them extern(C). Sorry, I haven't tried it, I'm guessing that it

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:05:01 UTC, Alex wrote: One thing you could try is going one level lower, and using dup() to save the stream to another fd, close() to close the stdout one, and dup2() to restore the saved fd over the stdout one. Unfortunately D doesn't seem to have dup, dup2.

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 16:52:22 UTC, Vladimir Panteleev wrote: On Thursday, 16 May 2019 at 16:49:35 UTC, Alex wrote: Why not just use u? It generally works fine on all the other filesystems * operating systems

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 16:49:35 UTC, Alex wrote: Why not just use u? It generally works fine on all the other filesystems, which today have mostly standardized on UTF-8. If that is too much trouble then detect the code page and use u rather than the extended ascii which looks very out

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:52:05 UTC, Steven Schveighoffer wrote: Hecto-nano-second, the smallest representable unit of time in SysTime and Duration. The output shouldn't involve the inner workings of the type. It should be changed to say 10 ns. If the output is meant for the developer,

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:19:03 UTC, Alex wrote: 1 - 17 ms, 553 ╬╝s, and 1 hnsec WTH!! is there any way to just get a normal u rather than some fancy useless asci hieroglyphic? Why don't we have a fancy M? and an h? It's outputting UTF-8, but, your console is not configured to display

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 14:53:14 UTC, Alex wrote: I have some code that disables the console because some other code puts junk on it that I don't want to see... then I enable it. One thing you could try is going one level lower, and using dup() to save the stream to another fd, close()

Re: Error: template instance `Reflect!(type)` cannot use local `type` as parameter to non-global template `Reflect(Ts...)()`

2019-04-06 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 7 April 2019 at 05:24:38 UTC, Alex wrote: Error: template instance `Reflect!(type)` cannot use local `type` as parameter to non-global template `Reflect(Ts...)()` mixin(`import `~moduleName!(T)~`;`); mixin(`alias X = T.`~name~`;`); super.Reflect!(X); I realize

Re: Reading data from the network without knowing the size of the buffer that is coming

2019-03-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 21 March 2019 at 16:54:01 UTC, Roman Sztergbaum wrote: I would like to get rid of the "ubytes[256]" because I do not know the size of the data that is comming, I would like to read the entire buffer that I send at once. Can someone point me? If you do not know the size of the

Re: File.lockingBinaryWriter is not output range?

2019-03-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 13:25:27 UTC, Denis Feklushkin wrote: On Tuesday, 19 March 2019 at 13:20:37 UTC, Vladimir Panteleev wrote: On Tuesday, 19 March 2019 at 13:14:52 UTC, Denis Feklushkin wrote: /+ dub.sdl: name "hello_world" +/ This doesn't seem necessary :) I add it ~everywhere

Re: File.lockingBinaryWriter is not output range?

2019-03-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 13:14:52 UTC, Denis Feklushkin wrote: /+ dub.sdl: name "hello_world" +/ This doesn't seem necessary :) static assert(isOutputRange!(typeof(stdout.lockingBinaryWriter), byte)); static assert(isOutputRange!(typeof(stdout.lockingBinaryWriter()), byte));

Re: Any easy way to extract files to memory buffer?

2019-03-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 18 March 2019 at 21:09:55 UTC, Michelle Long wrote: Trying to speed up extracting some files that I first have to extract using the command line to files then read those in... Not sure what is taking so long. I imagine windows caches the extraction so maybe it is pointless? You

Re: Tricky DMD bug, but I have no idea how to report

2019-02-08 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 8 February 2019 at 09:28:48 UTC, JN wrote: I will try. However, one last thing - in the example test scripts, it runs first with one compiler setting (or D version) and the second time with the other compiler setting (or D version). But it looks like the exit code of the first run

Re: Tricky DMD bug, but I have no idea how to report

2019-02-07 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 7 February 2019 at 22:16:19 UTC, JN wrote: Does it also work for dub projects? It will work if you can put all the relevant D code in one directory, which is harder for Dub, as it likes to pull dependencies from all over the place. When "dub dustmite" is insufficient (as in

Re: Tricky DMD bug, but I have no idea how to report

2019-02-06 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 17 December 2018 at 21:59:59 UTC, JN wrote: while working on my game engine project, I encountered a DMD codegen bug. It occurs only when compiling in release mode, debug works. Old thread, but FWIW, such bugs can be easily and precisely reduced with DustMite. In your test script,

Re: Putting dmd error through grep for dustmite

2018-11-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 5 November 2018 at 03:01:43 UTC, Dennis wrote: Does anybody know what the problem is? I'm using Windows 10 and Git Bash. Sounds like the problem comes from the differences in shell syntax (quoting style) for the two shells here. When you run the command in Git Bash, the syntax

Re: Can i watch folders/files for changes with D language?

2018-10-09 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 9 October 2018 at 17:20:25 UTC, Ephrahim wrote: So i need your help guys, can you point me to any documentation or libraries i can use to watch files/folders for changes (delete, edit, new content)? This package seems to do what you need: https://code.dlang.org/packages/fswatch

Re: What does -vtls compiler flag does and ...

2018-10-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 20:41:15 UTC, welkam wrote: This flag blocks compilation and I want to just remove it but since I dont know what it is used for I hesitate. If my attempts were to be successful in compiling dmd with other compilers I would make pull request but now I have more

Wrong module initialization order when building with Dub on Windows?

2018-10-01 Thread Vladimir Panteleev via Digitalmars-d-learn
Ran into this today, don't have time to dig in now but maybe someone ran into this too. Steps to reproduce: - git clone https://github.com/CyberShadow/ae - cd ae/demo/inputtiming - (download/unpack https://www.libsdl.org/release/SDL2-2.0.8-win32-x86.zip or

Re: transposed with enforceNotJagged not throwing?

2018-09-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 22 September 2018 at 06:16:41 UTC, berni wrote: Is it a bug or is it me who's doing something wrong? Looking at the implementation, it looks like enforceNotJagged was just never implemented for transposed (only transversed).

Re: Converting a character to upper case in string

2018-09-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:15:52 UTC, NX wrote: How can I properly convert a character, say, first one to upper case in a unicode correct manner? That would depend on how you'd define correctness. If your application needs to support "all" languages, then (depending how you interpret

Re: SerialPort

2018-09-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 20 September 2018 at 10:51:52 UTC, braboar wrote: Can anybody give me a guide of using serial port? Here's a program I wrote (after lots of trial-and-error) to control my monitor through an USB serial-port adapter: https://github.com/CyberShadow/misc/blob/master/pq321q.d Hope

Re: Get variables with call stack

2018-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 22 September 2018 at 05:49:05 UTC, Vladimir Panteleev wrote: In short: there is no easy way, in the general sense. If you can find something that achieves what you need in C++, there's a good chance that it would work to some extent (or could be adapted with reasonable effort)

Re: Get variables with call stack

2018-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 22 September 2018 at 05:43:53 UTC, Vladimir Panteleev wrote: The only way to do that would be using a debugger. The specifics of the solution would thus depend on the platform. On POSIX, it would probably mean getting gdb to print a detailed backtrace for your project. On

Re: Get variables with call stack

2018-09-21 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 21 September 2018 at 19:08:36 UTC, ANtlord wrote: Hello! I need to make a some sort of error report system for an application. I want to catch base Exception class instance and report call stack and with the call stack I want to report all variables with their values. There are a

Re: -O flag ; automatic cast in a bitshift

2018-09-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 20 September 2018 at 11:14:05 UTC, Guillaume Lathoud wrote: Thanks! FYI, it's undefined in D mainly because the behavior of the actual Intel CPU instruction is undefined in such cases: https://c9x.me/x86/html/file_module_x86_id_285.html "it is undefined for SHL and SHR

Re: Manual delegates

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 16 September 2018 at 14:12:27 UTC, Guillaume Piolat wrote: Anyone has any information about the ABI of delegates? In particular how to call them with a particular "this"/frame pointer? To solve a hairy problem I need a delegate with a synthesized frame pointer.

Re: try find the fastest way to convert a group string into index?

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 16 September 2018 at 10:04:09 UTC, learnfirst1 wrote: how to make this more fast like with one loop and get the results. This is a more general problem than any specific programming language; you may want to look into perfect hashing:

Re: Cannot use UFCS in lambda?

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 16 September 2018 at 09:46:15 UTC, berni wrote: Where is my mistake? Lambdas are not the issue here. The problem is more general: you can only use top-level symbols in UFCS. You can use an identity alias template to bypass this:

Re: array to string functional?

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 14 September 2018 at 20:43:45 UTC, SrMordred wrote: On Friday, 14 September 2018 at 19:44:37 UTC, berni wrote: a) I've got an int[] which contains only 0 und 1. And I want to end with a string, containing 0 and 1. So [1,1,0,1,0,1] should become "110101". Of course I can do this with

Re: x64 Privileged instruction

2018-09-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 15 September 2018 at 18:05:58 UTC, Josphe Brigmo wrote: I have always gotten these types of errors on x64 and, it may be my machine, it has happened with many dmd versions, visual D and visual studio... Oh, you mean the message that appears in Visual Studio, not stderr.

Re: x64 Privileged instruction

2018-09-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 13 September 2018 at 05:50:53 UTC, Josphe Brigmo wrote: Privileged instruction Lots of code. I pretty much always get this error. Something must have gone really wrong to get this error. Most likely, the CPU instruction pointer ended up in a memory area without any code in it.

Re: dealing with very long paths and names

2018-09-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 14 September 2018 at 21:16:31 UTC, Jonathan M Davis wrote: Yeah, though if you write cross-platform applications or libraries (and ideally, most applications and libraries would be platform-agnostic), you can't necessarily avoid all of the Windows insanity, even if you yourself use

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-13 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 13 July 2018 at 07:51:51 UTC, Dukc wrote: I know about Vladimir's d-scripten tools library which would help, but it's based on Alawains library copyleft library, which makes also Vladimir's work copyleft, so I won't use it. Hmm, I wasn't aware of this. I wonder if the decision to

Re: D'ish similar_text?

2018-05-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 10 May 2018 at 20:32:11 UTC, Dgame wrote: immutable size_t len = s1.length + s2.length; percent = (len - distance) * 100.0 / len; Note that this formula will give you only 50% similarity for "abc" and "def", i.e. two completely different strings. I suggest to divide by

Re: D'ish similar_text?

2018-05-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 10 May 2018 at 20:08:04 UTC, Dgame wrote: void similar_text_similar_str(char* txt1, size_t len1, char* That looks like an implementation of Levenshtein distance. We have one in Phobos: https://dlang.org/library/std/algorithm/comparison/levenshtein_distance.html

Re: dustmite watch shell script (.test vs .lookahead.*)

2018-04-06 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 6 April 2018 at 15:35:59 UTC, Anonymouse wrote: The dustmite wiki[0] lists the following example script for use to monitor the reduction progress: Here's a more complete version that also works with -j: https://gist.github.com/CyberShadow/2e8f01895c248111c171e982313bb008

Re: Spawning a process: Can I "have my cake and eat it too"?

2018-03-01 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 2 March 2018 at 04:50:06 UTC, Nick Sabalausky (Abscissa) wrote: Launch a process (spawnProcess, pipeShell, etc) so the child's stdout/stderr go to the parent's stdout/stderr *without* the possibility of them getting inadvertently reordered/reinterleaved when viewed on the terminal,

Re: Wiki spam

2018-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 3 February 2018 at 06:34:57 UTC, Tony wrote: Don't know if there is a better place to report this, but the wiki attracted a spammer: Deleted, thanks. We're generally doing pretty well with spam (compared to other wikis) thanks to https://github.com/CyberShadow/dcaptcha , but

Re: database or disk is full ; Error while posting message in this D forum

2017-12-15 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 15 December 2017 at 17:26:04 UTC, Vino wrote: Hi All, We are getting the above error message while posting any message in this forum, can any look into this please. Should be fixed now. Google was classifying one monitoring service's emails as spam, and completely rejecting

Re: behaviour of spawnProcess

2017-11-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 25 November 2017 at 02:32:17 UTC, Fra Mecca wrote: I have noticed that whenever j contains a string with a space in it, spawnprocess splits the string into another argument. That shouldn't happen. If you are on Windows, note that processes do not see the command line as an array

Re: Dustmite always reduced to empty set after two iterations

2017-10-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 11 October 2017 at 20:36:58 UTC, Nordlöw wrote: What am I doing wrong? Invoking dub from dustmite probably isn't going to work well. Instead, try using dub's dustmite command: https://code.dlang.org/docs/commandline#dustmite

Re: segfault on gc.impl.conservative.gc.Gcx.smallAlloc

2017-09-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 25 September 2017 at 21:34:40 UTC, Mengu wrote: delete fileContents; This looks suspicious - it is a slice of the memory-mapped file, not memory on the GC-managed heap, so "delete" is inapplicable to it. The GC ought to throw an exception when attempting to delete things not

Re: It makes me sick!

2017-08-01 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 1 August 2017 at 14:29:28 UTC, Adam D. Ruppe wrote: So we can keep the search path: `datetime.di`, then `datetime.d`, then `datetime/package.d`, and any one of them, as long as it has `module std.datetime;` at the top, can count equally as the package.d. Sorry, isn't that how

Re: Need simple sound

2017-07-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 July 2017 at 10:40:03 UTC, Martin Tschierschke wrote: On Monday, 3 July 2017 at 09:24:35 UTC, Guillaume Piolat wrote: On Monday, 3 July 2017 at 08:55:20 UTC, Martin Tschierschke wrote: Hello for a simple game I would like to add some very simple sound, not much different than the

Re: D and memory mapped devices

2017-06-14 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 14 June 2017 at 08:10:57 UTC, Russel Winder wrote: This would appear a priori to not allow for actual memory mapped devices using it, or am I missing something? I believe the only case where it might matter is if the device was sensitive to the read/write size (1/2/4 bytes).

Re: How to Get Screenshot on Windows ?

2017-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 28 May 2017 at 04:05:47 UTC, Softwarez wrote: Hi can anyone please help me how to get screenshot on Windows using D, because all the other threads are using linux to get screenshot. In the same way you'd do it in C. Here is a more convoluted D example in the form of a program I

Re: trait detecting anonymous union?

2017-05-22 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 22 May 2017 at 21:03:42 UTC, Bastiaan Veelo wrote: Is there a way to detect at CT that S has overlapping data members, when an anonimous union is used as above? I have an implementation here:

Re: std.getopt and std.datetime

2017-05-13 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 13 May 2017 at 05:53:25 UTC, Russel Winder wrote: Is there a canonical, idiomatic way of processing std.datetime objects using std.getopt? As std.getopt is going to give you strings, you need to convert strings to SysTime values, e.g. using fromSimpleString: import

Re: How can I pass an argument to rdmd --evel=

2017-05-07 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 7 May 2017 at 11:29:30 UTC, k-five wrote: It should be possible! rdmd --eval=, without accepting argument is useless. FWIW, you can still pass input through stdin.

Re: How can I pass an argument to rdmd --evel=

2017-05-07 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 7 May 2017 at 11:11:05 UTC, Vladimir Panteleev wrote: Currently it's not possible: https://issues.dlang.org/show_bug.cgi?id=13345

Re: How can I pass an argument to rdmd --evel=

2017-05-07 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 7 May 2017 at 10:49:25 UTC, k-five wrote: After reading about rdmd and --eval, I tried this: rdmd --eval='auto f=File("ddoc.html");foreach(line;f.byLine) if(line.length<10) writeln(line);f.close' and worked! Now I am wonder if there is a way to pass "ddoc.html" to this

Re: std.digest toHexString

2017-03-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 March 2017 at 16:13:33 UTC, Carl Sturtivant wrote: What's going on here? Looks like this bug: https://issues.dlang.org/show_bug.cgi?id=9279 Has it not been fixed?

Re: 'Access Violation Error' with parallel-foreach loop

2017-03-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 18 March 2017 at 16:15:30 UTC, ooyu wrote: I don't understand why got Access Violation error. :-( That looks like https://issues.dlang.org/show_bug.cgi?id=13727, though I thought a fix was included in recent DMD Windows versions. Try using std.file.write.

Re: code folding

2017-03-13 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 13 March 2017 at 21:33:56 UTC, Inquie wrote: One can say that it is a useless feature because D doesn't have it... or one could say that D is useless because it doesn't have it. A nice balance is simply to say "It is a useful feature that has proven it's worth and it is time that D

Re: Concatenate 2 ranges

2016-11-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 11 November 2016 at 13:39:32 UTC, RazvanN wrote: It does work, the problem is that [1, 2, 3].sort() is of type SortedRange(int[], "a < b") while r is of type SortedRange(Result, "a < b"). This is a problem if you want to return r in a function which has return type

Re: Concatenate 2 ranges

2016-11-11 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 11 November 2016 at 13:30:17 UTC, RazvanN wrote: I know that I can use the .array property, but I think that this iterates through all of my elements. Using assumeSorted(chain(r1, r2).array) will return a SortedRange, but I am not sure what the complexity for this operation is.

  1   2   3   >