rmdirRecurse - on NFS file system

2018-02-11 Thread Vino via Digitalmars-d-learn
Hi All, Request your help, the below code works find on normal File system, bu if the file system is a NFS file system the below code, is not working if Step = dryrun( Display Only) : Works for both NFS and normal file system. if Step = run (Delete folder) : Does not work on NFS file syst

Re: Adjacent item in a array

2018-02-11 Thread Vino via Digitalmars-d-learn
On Saturday, 3 February 2018 at 22:58:04 UTC, Vino wrote: On Saturday, 3 February 2018 at 19:28:01 UTC, Seb wrote: On Saturday, 3 February 2018 at 19:13:05 UTC, Vino wrote: [...] 2.079 [1, 2] will ship with slide: --- auto arr = ["T1", "T2", "T3", "T4", "T5"]; arr.slide(2).each!writeln; ---

Re: opUnary with ++ and -- on a struct that has a dynamic array

2018-02-11 Thread rumbu via Digitalmars-d-learn
On Monday, 12 February 2018 at 03:13:43 UTC, aliak wrote: Hi, Is there a way to get post increment and pre increment working properly in this scenario? import std.stdio; struct A { int[] a; this(int a) { this.a = [a]; } auto opUnary(string op)(){ return A(mixin(op ~ "this

Re: inout question

2018-02-11 Thread ketmar via Digitalmars-d-learn
Norm wrote: Hi, I'm new to D so can someone explain to me what is happening here? void func(const char* s, char** e) { import core.stdc.stdlib; auto result = strtod(s, e); } Error: function core.stdc.stdlib.strtod (scope inout(char)* nptr, scope inout(char)** endptr) is not callab

inout question

2018-02-11 Thread Norm via Digitalmars-d-learn
Hi, I'm new to D so can someone explain to me what is happening here? void func(const char* s, char** e) { import core.stdc.stdlib; auto result = strtod(s, e); } Error: function core.stdc.stdlib.strtod (scope inout(char)* nptr, scope inout(char)** endptr) is not callable using argumen

opUnary with ++ and -- on a struct that has a dynamic array

2018-02-11 Thread aliak via Digitalmars-d-learn
Hi, Is there a way to get post increment and pre increment working properly in this scenario? import std.stdio; struct A { int[] a; this(int a) { this.a = [a]; } auto opUnary(string op)(){ return A(mixin(op ~ "this.a[0]")); } } void main() { auto a = A(0); int

opCast cannot implicitly convert a.opCast of type X to Y

2018-02-11 Thread aliak via Digitalmars-d-learn
From spec: Cast expression: "cast ( Type ) UnaryExpression" converts UnaryExpresssion to Type. And https://dlang.org/spec/operatoroverloading.html#cast makes no mention of the return type of opCast. One could think that the return type of opCast would be the return type. But it seems it must

Re: Linking multiple libraries

2018-02-11 Thread Basile B. via Digitalmars-d-learn
On Sunday, 11 February 2018 at 01:38:41 UTC, b2.temp wrote: On Sunday, 26 November 2017 at 11:15:58 UTC, Jacob Carlborg wrote: On 2017-11-25 23:31, Mike Parker wrote: For "ld" on macOS the order does not matter. For "ld" on Linux the order does matter, but, if necessary, the following flags c

Re: Caesar Cipher

2018-02-11 Thread Mario via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:55:44 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:50:25 UTC, Mario wrote: On Sunday, 11 February 2018 at 18:31:35 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you al

Re: Caesar Cipher

2018-02-11 Thread Mario via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:55:14 UTC, Cym13 wrote: On Sunday, 11 February 2018 at 18:50:25 UTC, Mario wrote: On Sunday, 11 February 2018 at 18:31:35 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you

Re: [Help] programm execution leads to infinity background loop after... what reason?

2018-02-11 Thread Cym13 via Digitalmars-d-learn
On Sunday, 11 February 2018 at 17:28:25 UTC, Eld0r wrote: changed my design from extending thread to just using taskPool.parallel. seems like my implementation left to many open threads in background and forcing the operation system to cut them off. thought start() and join() allowed me to use

Re: typedef behavior

2018-02-11 Thread Alex via Digitalmars-d-learn
On Sunday, 11 February 2018 at 15:18:11 UTC, Simen Kjærås wrote: Basically, Typedef looks like this: struct Typedef(T) { T _payload; // Forward method calls, member access, etc, to _payload. } If T looks like this: struct T { static int[3] arr; void foo() { arr[0]++; } } How

Re: Caesar Cipher

2018-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: char[] encrypt(char[] input, char shift) { auto result = input.dup; result[] += shift; return result; } What's wrong? I mean, I know that z is being converted into a symbol, but how should I fix this? If you take Z (25) a

Re: Caesar Cipher

2018-02-11 Thread DanielG via Digitalmars-d-learn
Here's a newbie-friendly solution: https://run.dlang.io/is/4hi7wH

Re: Caesar Cipher

2018-02-11 Thread Seb via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:50:25 UTC, Mario wrote: On Sunday, 11 February 2018 at 18:31:35 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only

Re: Caesar Cipher

2018-02-11 Thread Cym13 via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:50:25 UTC, Mario wrote: On Sunday, 11 February 2018 at 18:31:35 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only

Re: Caesar Cipher

2018-02-11 Thread Mario via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:28:08 UTC, Cym13 wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only use the heap memory. So I'm new to the wonderful world

Re: Caesar Cipher

2018-02-11 Thread Mario via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:31:35 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only use the heap memory. [...] If you want to cheap, have

Re: Caesar Cipher

2018-02-11 Thread Seb via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only use the heap memory. [...] If you want to cheap, have a look at https://github.com/dlang-tour/core/issues/227

Re: Caesar Cipher

2018-02-11 Thread Cym13 via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only use the heap memory. So I'm new to the wonderful world of low-level and the stack-heap. I started a week ago lea

Caesar Cipher

2018-02-11 Thread Mario via Digitalmars-d-learn
Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only use the heap memory. So I'm new to the wonderful world of low-level and the stack-heap. I started a week ago learning D (which by the moment is being easy for me) but I'm

Re: [Help] programm execution leads to infinity background loop after... what reason?

2018-02-11 Thread Eld0r via Digitalmars-d-learn
changed my design from extending thread to just using taskPool.parallel. seems like my implementation left to many open threads in background and forcing the operation system to cut them off. thought start() and join() allowed me to use start() again on the same thread object in next loop. But

Re: typedef behavior

2018-02-11 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 11 February 2018 at 01:32:52 UTC, Alex wrote: On Saturday, 10 February 2018 at 02:55:26 UTC, Alex wrote: bug filed https://issues.dlang.org/show_bug.cgi?id=18416 Basically, Typedef looks like this: struct Typedef(T) { T _payload; // Forward method calls, member access, etc

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-11 Thread number via Digitalmars-d-learn
On Sunday, 11 February 2018 at 13:17:13 UTC, number wrote: unable to fork: Cannot allocate memory if i comment-out the line.. writeln(GdkKeysyms.GDK_Escape); then it compiles/links/runs fine. [...] I actually want to close the application if escape key is pressed with if (eventKey.keyval ==

Re: Fixed size array initialization

2018-02-11 Thread rumbu via Digitalmars-d-learn
On Sunday, 11 February 2018 at 14:06:32 UTC, rjframe wrote: On Sat, 10 Feb 2018 10:55:30 +, rumbu wrote: If you separate initialization to a static this, you'll get a compile error: ``` immutable uint256[78] pow10_256; static this() { // Error: mismatched array lengths, 78 and 2

[Help] programm execution leads to infinity background loop after... what reason?

2018-02-11 Thread Eld0r via Digitalmars-d-learn
I write a code calculating speed & position vectors as steps parallel & synced. each 24 calcultion steps the new positions are written with std.json. This all works fine. (dmd2 @ Visual Studio 2017 CE 15.5.4, Visual D 0.46.0) Now when I increase the anmount of steps... the process lost its...

Re: Fixed size array initialization

2018-02-11 Thread rjframe via Digitalmars-d-learn
On Sat, 10 Feb 2018 10:55:30 +, rumbu wrote: > I know that according to language spec > (https://dlang.org/spec/arrays.html#static-init-static) you can skip > declaring all your elements in a fixed size array. > > I'm just recovering from a bug which took me one day to discover because > of t

Re: free func "front" is not picked up as a candidate when doing range.front(...)

2018-02-11 Thread aliak via Digitalmars-d-learn
On Thursday, 8 February 2018 at 22:57:04 UTC, Jonathan M Davis wrote: D tends to be very picky about what it puts in overload sets in order to avoid function hijacking - e.g. it doesn't even include base class functions in an overload set once you've declared one in a derived class unless you e

unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-11 Thread number via Digitalmars-d-learn
I get dmd ouput: "unable to fork: Cannot allocate memory" when compiling the following code: import std.stdio; import gio.Application : GioApplication = Application; import gtk.Application; import gtk.ApplicationWindow; import gtk.Widget; import gdk.Keysyms; int main(string[] args) {

Re: Debugging on Windows

2018-02-11 Thread JN via Digitalmars-d-learn
On Friday, 9 February 2018 at 19:02:14 UTC, Benjamin Thaut wrote: On Thursday, 8 February 2018 at 21:09:33 UTC, JN wrote: Hi, is there any way to debug binaries on Windows? I'd at least like to know which line of code made it crash. If it's D code, I get a call trace usually, but if it's a ca

Re: Debugging on Windows

2018-02-11 Thread Cauterite via Digitalmars-d-learn
On Thursday, 8 February 2018 at 21:09:33 UTC, JN wrote: Hi, is there any way to debug binaries on Windows? I'd at least like to know which line of code made it crash. If it's D code, I get a call trace usually, but if it's a call to a C library, I get a crash and that's it. I am using VSCode