Re: How do you get the min / max of two numbers a, b?

2015-09-18 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 19 September 2015 at 03:53:12 UTC, Enjoys Math wrote: I know there's fmax for floats, but what about ints? Thanks. I see: http://dlang.org/phobos/std_algorithm_comparison.html#max

How do you get the min / max of two numbers a, b?

2015-09-18 Thread Enjoys Math via Digitalmars-d-learn
I know there's fmax for floats, but what about ints? Thanks.

Re: What's wrong with this code?

2015-09-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 19 September 2015 at 02:30:39 UTC, Chris wrote: bmove.addOnClicked (delegate void (Button aux) { What's the context of this call? If it is inside a struct and you are accessing local variables you can get in trouble because the context pointer may not be c

Re: Why is sort allocating in this case?

2015-09-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 18 September 2015 at 02:21:13 UTC, Jack Stouffer wrote: The docs explicitly say that SwapStrategy.unstable is non-allocating, but this code (which is for finding the statistical mode of a range) will fail to compile. Perhaps related to this issue you filed? https://issues.dlang.org

What's wrong with this code?

2015-09-18 Thread Chris via Digitalmars-d-learn
This crashes when triggered: voxel_vec [string] move_buttons = [ "button_xp" : voxel_vec ([ 1, 0, 0 ]), "button_xm" : voxel_vec ([ -1, 0, 0 ]), "button_yp" : voxel_vec ([ 0, 1, 0 ]), "b

broken program, silly error messages, dub

2015-09-18 Thread Joel via Digitalmars-d-learn
I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated errors. I've tried resetting dub. Joels-MacBook-Pro:DGuy joelcnz$ dub WARNING: A deprecated branch based version specification is used for the dependency dsfml:audio. Please use numbered

Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-18 Thread Random D user via Digitalmars-d-learn
So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go away if I disable the optimizer. I get: tym = x1d Internal error: backend\cgxmm.c 547 Does anyone have a clue what might trigger th

Re: Thrift

2015-09-18 Thread David Eagen via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 16:57:39 UTC, ddos wrote: Looking for a RPC library, thrift looked promising, but i can't even compile the simple example given here https://thrift.apache.org/tutorial/d I just ran into the same thing. I tried earlier branches of Thrift and those don't work

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Friday, 18 September 2015 at 00:13:41 UTC, BBasile wrote: On Thursday, 17 September 2015 at 22:22:22 UTC, WhatMeWorry wrote: [...] After hours of reading existing freetype/derelict documents, I'm stuck again. Any suggestions. Thanks. Hello, this[1] compiled dll one works fine here on wind

Re: Why do abstract class functions require definitions?

2015-09-18 Thread Jakob Ovrum via Digitalmars-d-learn
On Friday, 18 September 2015 at 13:18:23 UTC, Jacob Carlborg wrote: On 2015-09-16 12:36, Marc Schütz wrote: Wouldn't the following behaviour be more useful as a default? abstract class Foo { void bar1() { } // non-abstract, obviously void bar2();// abstract,

Re: reading file byLine

2015-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2015 05:58 AM, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 12:28:29 UTC, Namal wrote: So do I understand it right: does => in map! indicates a lambda function? Yes exactly. There are a number of ways you can define a lambda function in D. For example if the function is m

Re: Passing Arguments on in Variadic Functions

2015-09-18 Thread jmh530 via Digitalmars-d-learn
On Friday, 18 September 2015 at 00:55:12 UTC, anonymous wrote: On Thursday 17 September 2015 23:27, jmh530 wrote: I think I could figure out how to look through the arguments for a bool, but wouldn't that make me give up the default value for the bool? If you don't find a bool, you use the d

Re: mysql-native: SQL Transaction support?

2015-09-18 Thread salvari via Digitalmars-d-learn
On Thursday, 17 September 2015 at 21:19:07 UTC, Gary Willoughby wrote: On Thursday, 17 September 2015 at 19:47:33 UTC, salvari wrote: I'm parsing a text input file, the generated sql is about 1 million lines of SQL. By using mysql-native it takes about 4 hours to load data. I've used mysql-

Re: [Code Example for Beginners (like me)] Sockets with Fibers

2015-09-18 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 18 September 2015 at 07:58:10 UTC, ddos wrote: hello! yesterday i got curious about how fibers work, and if the can be used as a replacement in network programming. so i started hacking a small example together, which is hopefully useful to other D beginners too :) http://pastebi

Re: Why do abstract class functions require definitions?

2015-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-16 12:36, Marc Schütz wrote: Wouldn't the following behaviour be more useful as a default? abstract class Foo { void bar1() { } // non-abstract, obviously void bar2();// abstract, because it's in an abstract class // (di

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 12:28:29 UTC, Namal wrote: So do I understand it right: does => in map! indicates a lambda function? Yes exactly. There are a number of ways you can define a lambda function in D. For example if the function is multiline I often use: (l) { ...; // do somet

Re: reading file byLine

2015-09-18 Thread Namal via Digitalmars-d-learn
So do I understand it right: does => in map! indicates a lambda function?

Re: reading file byLine

2015-09-18 Thread Namal via Digitalmars-d-learn
On Friday, 18 September 2015 at 11:37:15 UTC, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 11:11:51 UTC, Namal wrote: compiles but crashes For me it works fine. You probably have extra spaces or something in your file. It would help if you posted the error message you get when ru

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 11:11:51 UTC, Namal wrote: compiles but crashes For me it works fine. You probably have extra spaces or something in your file. It would help if you posted the error message you get when running the program.

Re: "if sting in string"

2015-09-18 Thread John Colvin via Digitalmars-d-learn
On Friday, 18 September 2015 at 11:26:46 UTC, John Colvin wrote: On Friday, 18 September 2015 at 11:18:33 UTC, John Colvin wrote: On Friday, 18 September 2015 at 09:42:05 UTC, smadus wrote: Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.n

Re: "if sting in string"

2015-09-18 Thread John Colvin via Digitalmars-d-learn
On Friday, 18 September 2015 at 11:18:33 UTC, John Colvin wrote: On Friday, 18 September 2015 at 09:42:05 UTC, smadus wrote: Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.net/file/d/4114/9zryku49_png.htm but i dont understand this, becau

Re: "if sting in string"

2015-09-18 Thread yawniek via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:42:05 UTC, smadus wrote: Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.net/file/d/4114/9zryku49_png.htm but i dont understand this, because, the exception should be "Something wrong" ?!? But, thanks f

Re: "if sting in string"

2015-09-18 Thread John Colvin via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:42:05 UTC, smadus wrote: Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.net/file/d/4114/9zryku49_png.htm but i dont understand this, because, the exception should be "Something wrong" ?!? But, thanks f

Re: reading file byLine

2015-09-18 Thread Namal via Digitalmars-d-learn
On Friday, 18 September 2015 at 11:06:46 UTC, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 10:48:25 UTC, Namal wrote: On Friday, 18 September 2015 at 10:34:41 UTC, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote: Hello guys, is there a nice functio

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 10:48:25 UTC, Namal wrote: On Friday, 18 September 2015 at 10:34:41 UTC, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote: Hello guys, is there a nice functional way to read the file which is like 1,2,3,4,5,6 2,3,4,5,6,7 8,9,0

Re: reading file byLine

2015-09-18 Thread Namal via Digitalmars-d-learn
On Friday, 18 September 2015 at 10:34:41 UTC, Edwin van Leeuwen wrote: On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote: Hello guys, is there a nice functional way to read the file which is like 1,2,3,4,5,6 2,3,4,5,6,7 8,9,0,9,2,3 line by line, split numbers and remove each ',' conv

Re: reading file byLine

2015-09-18 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote: Hello guys, is there a nice functional way to read the file which is like 1,2,3,4,5,6 2,3,4,5,6,7 8,9,0,9,2,3 line by line, split numbers and remove each ',' convert it to int and save in a matrix int[][] arr? Not tested, but I thin

Re: reading file byLine

2015-09-18 Thread Namal via Digitalmars-d-learn
Hello guys, is there a nice functional way to read the file which is like 1,2,3,4,5,6 2,3,4,5,6,7 8,9,0,9,2,3 line by line, split numbers and remove each ',' convert it to int and save in a matrix int[][] arr?

Re: "if sting in string"

2015-09-18 Thread smadus via Digitalmars-d-learn
Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.net/file/d/4114/9zryku49_png.htm but i dont understand this, because, the exception should be "Something wrong" ?!? But, thanks for the answers, realy good and the code has been smaller.

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:35:53 UTC, BBasile wrote: On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote: On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? i

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote: On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? it's like a raw string (prefixed with a r) so there is escaped

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? it's like a raw string (prefixed with a r) so there is escaped char: r"\": correct token for a string, terminal " is not e

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/12/2015 01:13 AM, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? I realized that there was no index entry for back tick in my book. I've just added that and provided an Index section for the web version of the b

Re: bug? for(int i=0;i<1;) vs while(true)

2015-09-18 Thread Kagamin via Digitalmars-d-learn
This compiles with enabled warnings: --- int f() { while(true){} assert(false); } ---

Re: Bloat with std.(string.)format?

2015-09-18 Thread Kagamin via Digitalmars-d-learn
On Thursday, 17 September 2015 at 15:45:10 UTC, Chris wrote: I suppose it's an area most people (including myself) shy away from. I know next to nothing about compiler implementation. Sometimes it's just diagnosis of test failures.

Re: How not to run after a DUB build ?

2015-09-18 Thread ponce via Digitalmars-d-learn
On Thursday, 17 September 2015 at 19:44:36 UTC, BBasile wrote: On Thursday, 17 September 2015 at 19:36:10 UTC, BBasile wrote: Each time I execute `dub.exe --build=release` (or any other the build type) DUB tries to run the project after the build. This generates often generates an error when

[Code Example for Beginners (like me)] Sockets with Fibers

2015-09-18 Thread ddos via Digitalmars-d-learn
hello! yesterday i got curious about how fibers work, and if the can be used as a replacement in network programming. so i started hacking a small example together, which is hopefully useful to other D beginners too :) http://pastebin.com/Xg4GJbKE

Re: bug? for(int i=0;i<1;) vs while(true)

2015-09-18 Thread ddos via Digitalmars-d-learn
thank you :) works now