Re: Delegate parameter name shadows type name

2017-01-09 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-01-09 20:51, Ali Çehreli wrote: Those two syntaxes always confuse me and I'm never sure without trying which one to use when. :) However, the code is correct in this case because that's a delegate instance. I agree. When it comes to declaring a delegate type, i.e. a variable or functi

Re: Android Status

2017-01-09 Thread Joakim via Digitalmars-d-learn
On Monday, 9 January 2017 at 18:38:01 UTC, Ignacious wrote: On Monday, 9 January 2017 at 08:28:04 UTC, Joakim wrote: I've tried to write up detailed instructions on the wiki. I'm still improving those and plan to spin off those two sections I linked you, on how to just build the samples, into

Re: Primality test function doesn't work on large numbers?

2017-01-09 Thread Elronnd via Digitalmars-d-learn
Thank you! Would you mind telling me what you changed aside from pow() and powm()? diff isn't giving me readable results, since there was some other stuff I trimmed out of the original file. Also, while this is a *lot* better, I still get some lag generating 1024-bit primes and I can't gener

Re: Getch() Problem: C vs D

2017-01-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 10 January 2017 at 02:37:31 UTC, LouisHK wrote: Again this worked for me, but my terminal.d version is a bit older, and you may had already fixed, I can't change the version right now to test because I have some legacy code. k. I try not to break things very often btw. terminal.d d

Re: Getch() Problem: C vs D

2017-01-09 Thread LouisHK via Digitalmars-d-learn
On Tuesday, 10 January 2017 at 02:04:07 UTC, Adam D. Ruppe wrote: On Tuesday, 10 January 2017 at 01:06:53 UTC, LouisHK wrote: So, I thought a little bit and I changed the terminal.d to check on the KeyEvent if the KeyEvent.bKeyDown is true, otherwise assigns a null event, and it's working fine

Re: Getch() Problem: C vs D

2017-01-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 9 January 2017 at 23:33:45 UTC, Era Scarecrow wrote: For direct interactions (a game menu or similar) getting individual characters makes sense; I can't help but think Rogue-likes. However for data input (per line basis) or doing bulk data/processing, it doesn't work well. Well, l

Re: Getch() Problem: C vs D

2017-01-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 10 January 2017 at 01:06:53 UTC, LouisHK wrote: So, I thought a little bit and I changed the terminal.d to check on the KeyEvent if the KeyEvent.bKeyDown is true, otherwise assigns a null event, and it's working fine and now I can get the ESCAPE key. :) What line did you change? M

Re: Getch() Problem: C vs D

2017-01-09 Thread LouisHK via Digitalmars-d-learn
On Monday, 9 January 2017 at 20:12:38 UTC, Adam D. Ruppe wrote: Probably a bug, though I don't like using the getch function, I usually use the full input stream. So, I thought a little bit and I changed the terminal.d to check on the KeyEvent if the KeyEvent.bKeyDown is true, otherwise assig

Re: Loading assimp

2017-01-09 Thread Mike Parker via Digitalmars-d-learn
On Monday, 9 January 2017 at 18:13:03 UTC, Dlearner wrote: I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error: derelict.util.except

Re: Getch() Problem: C vs D

2017-01-09 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 9 January 2017 at 20:12:38 UTC, Adam D. Ruppe wrote: Probably a bug, though I don't like using the getch function, I usually use the full input stream. For direct interactions (a game menu or similar) getting individual characters makes sense; I can't help but think Rogue-likes. H

Re: Android Status

2017-01-09 Thread Ignacious via Digitalmars-d-learn
How difficult is it to build for x86/x64? Would be nice to be able to use something like http://www.android-x86.org/ as a test instead of an actual device. Does one simply have to use the proper ldc2/dmd and link in the correct libs? or is it more complex? Also, I'm a bit confused on how to

Re: Getch() Problem: C vs D

2017-01-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 9 January 2017 at 19:11:48 UTC, LouisHK wrote: No, that duplicate problem occurs even on normal keys, if I press "a" it shows "aa", and through the WinDBG, I saw the kbhit() was always true 2x after a key is pressed. I think my lib returns on key *release* as well, since it registe

Re: Delegate parameter name shadows type name

2017-01-09 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-01-09 20:18, Ali Çehreli wrote: This is something that surprised me in a friend's code. (A "friend", hmmm? No, really, it wasn't me! :) ) // Some type of the API struct MyType { int i; } // Some function of the API that takes a delegate void call(void delegate(MyType) dlg) { dl

Re: Delegate parameter name shadows type name

2017-01-09 Thread Ali Çehreli via Digitalmars-d-learn
On 01/09/2017 11:23 AM, H. S. Teoh via Digitalmars-d-learn wrote: > On Mon, Jan 09, 2017 at 11:18:02AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: >> // Some function of the API that takes a delegate >> void call(void delegate(MyType) dlg) { That's a delegate type. >> call(delegate

Vibe.d: Implementing file upload with WEB interface

2017-01-09 Thread aberba via Digitalmars-d-learn
So I implemented a file upload at https://aberba.github.io/2016/form-upload-in-vibe-d/. I'm trying to understand how HTTPServerRequest req.files can be accessed when using the web interface (Porting the same example to use vibe.d WEB interface). I couldn't find the implementation details in t

Re: Delegate parameter name shadows type name

2017-01-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 09, 2017 11:18:02 Ali Çehreli via Digitalmars-d-learn wrote: > This is something that surprised me in a friend's code. > > (A "friend", hmmm? No, really, it wasn't me! :) ) > > // Some type of the API > struct MyType { > int i; > } > > // Some function of the API that takes

Re: Delegate parameter name shadows type name

2017-01-09 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 09, 2017 at 11:18:02AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: [...] > // Some type of the API > struct MyType { > int i; > } > > // Some function of the API that takes a delegate > void call(void delegate(MyType) dlg) { > dlg(MyType(42)); > } > > void main() { >

Delegate parameter name shadows type name

2017-01-09 Thread Ali Çehreli via Digitalmars-d-learn
This is something that surprised me in a friend's code. (A "friend", hmmm? No, really, it wasn't me! :) ) // Some type of the API struct MyType { int i; } // Some function of the API that takes a delegate void call(void delegate(MyType) dlg) { dlg(MyType(42)); } void main() { /* Th

Re: Getch() Problem: C vs D

2017-01-09 Thread LouisHK via Digitalmars-d-learn
On Monday, 9 January 2017 at 18:09:21 UTC, Ivan Kazmenko wrote: That's because special keys actually put two characters in the buffer, right? Otherwise, using that buffer alone, you won't be able to distinguish, for example, arrow keys from capital Latin letters with the same codes. No, that

Re: Android Status

2017-01-09 Thread Ignacious via Digitalmars-d-learn
On Monday, 9 January 2017 at 08:28:04 UTC, Joakim wrote: On Monday, 9 January 2017 at 00:40:35 UTC, Ignacious wrote: On Sunday, 8 January 2017 at 22:19:31 UTC, Joakim wrote: On Sunday, 8 January 2017 at 21:52:01 UTC, Ignacious wrote: Not sure what is going on, of course ;) So much BS just to d

Loading assimp

2017-01-09 Thread Dlearner via Digitalmars-d-learn
I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error: derelict.util.exception.SymbolLoadException@..\..\AppData\Roaming\dub\packages\d

Re: Getch() Problem: C vs D

2017-01-09 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 9 January 2017 at 17:22:41 UTC, LouisHK wrote: On Monday, 9 January 2017 at 13:10:30 UTC, Adam D. Ruppe wrote: ... Best solution is to skip those C library functions and do it yourself with the OS-level calls. Then you can turn it off and actually control the buffering behavior. T

Re: Getch() Problem: C vs D

2017-01-09 Thread LouisHK via Digitalmars-d-learn
On Monday, 9 January 2017 at 13:10:30 UTC, Adam D. Ruppe wrote: ... Best solution is to skip those C library functions and do it yourself with the OS-level calls. Then you can turn it off and actually control the buffering behavior. That's what I was afraid of. I even tried your terminal.d, a

Re: Getch() Problem: C vs D

2017-01-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 8 January 2017 at 21:19:15 UTC, LouisHK wrote: And works fine, but the D version below nothing happens when I hit ESCAPE: Different runtimes are free to line buffer data, meaning getch won't actually see anything until you hit enter. (Actually, the operating system does the buffer

Re: Getch() Problem: C vs D

2017-01-09 Thread LouisHK via Digitalmars-d-learn
On Monday, 9 January 2017 at 04:31:04 UTC, Era Scarecrow wrote: On Sunday, 8 January 2017 at 21:19:15 UTC, LouisHK wrote: ... Regardless, try ^[ ( Ctrl+[ ), which is 27 and ^] is 29. Interesting, I'll try that at home. And maybe it will work. One more thing: I had tried the C version with gcc

Re: Conditional Compilation Multiple Versions

2017-01-09 Thread Claude via Digitalmars-d-learn
Druntime uses this for its translation of POSIX header files: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/config.d An example: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/resource.d#L96 Ok, I see. Thanks! (I've gotta try reggae someday) :)

Re: Android Status

2017-01-09 Thread Joakim via Digitalmars-d-learn
On Monday, 9 January 2017 at 00:40:35 UTC, Ignacious wrote: On Sunday, 8 January 2017 at 22:19:31 UTC, Joakim wrote: On Sunday, 8 January 2017 at 21:52:01 UTC, Ignacious wrote: Not sure what is going on, of course ;) So much BS just to do something that is suppose to be simple ;) test.d v