Re: Very very noobie question about how imports work.

2015-12-11 Thread Mike Parker via Digitalmars-d-learn
On Friday, 11 December 2015 at 03:51:35 UTC, tcak wrote: In D, directory structure doesn't matter. What matters is module names. Actually, it does matter sometimes. // src/foo/bar.d module foo.oops; // main.d import foo.oops; void main() {} Compile: dmd -Isrc main.d Result: main.d(1):

Re: %s not producing string representation of enum?

2015-12-11 Thread Shriramana Sharma via Digitalmars-d-learn
Ali Çehreli wrote: > http://ddili.org/ders/d.en/enum.html#ix_enum.EnumMembers,%20std.traits Ali that's great! Thank you! -- Shriramana Sharma, Penguin #395953

Re: "is not callable using a non-shared object"

2015-12-11 Thread Kagamin via Digitalmars-d-learn
On Thursday, 10 December 2015 at 22:07:48 UTC, Entity325 wrote: Usually the DMD compiler errors are very helpful, but I guess nothing can be perfect. In this case, I have a class I'm trying to declare. The class is intended to be a transport and storage medium, to allow information to be

Re: Using std.math: FloatingPointControl.enableExceptions

2015-12-11 Thread Shriramana Sharma via Digitalmars-d-learn
rumbu wrote: > Constant folding: a is evaluated at compile time to + infinity. Hmm... I guess the compiler figures that if someone is hardcoding that expression then they don't want to see an exception. Thanks for the explanation. -- Shriramana Sharma, Penguin #395953

How do I properly use std.net.curl onSocketOption hook?

2015-12-11 Thread Or Dahan via Digitalmars-d-learn
Here is my original SO question: http://stackoverflow.com/questions/34218692/how-do-i-properly-set-socket-options-on-std-net-curl any ideas? thx!

Dynamic cartesianProduct()

2015-12-11 Thread Nordlöw via Digitalmars-d-learn
Have anybody put together a lazy variant of cartesianProduct() that operates on a range of ranges: Sample call cartesianProductDynamic([["2", "3"], ["green", "red"], ["apples", "pears"]]) should return [["2", "green", "apples"], ["3", "green", "apples"], ["2", "red", "apples"], ["3",

Re: How to check if result of request to DB is empty?

2015-12-11 Thread anonymous via Digitalmars-d-learn
On 11.12.2015 22:05, Suliman wrote: I am using https://github.com/buggins/ddbc string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what

How to check if result of request to DB is empty?

2015-12-11 Thread Suliman via Digitalmars-d-learn
I am using https://github.com/buggins/ddbc string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); auto rs = db.stmt.executeQuery(query_string); string dbpassword; string dbuser; while

Re: check variable for undefinedness

2015-12-11 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 12 December 2015 at 07:39:47 UTC, Suliman wrote: if(a is null) How to check if variable "is not null" ? a !is null or !(a is null)

Re: Dmd doesn't like tuples or me :>

2015-12-11 Thread Ali Çehreli via Digitalmars-d-learn
On 12/11/2015 05:41 PM, Enjoys Math wrote: > import std.stdio; > import std.typecons; > > int main(string[] argv) > { > auto value = Tuple(5, 6.7, "hello"); I don't understand how it relates to the error message but you should use lowercase 'tuple' there: auto value = tuple(5, 6.7,

Re: How to check if result of request to DB is empty?

2015-12-11 Thread Suliman via Digitalmars-d-learn
string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what happens when the user enters an apostrophe in the username field. Do you mean to

Re: check variable for undefinedness

2015-12-11 Thread Suliman via Digitalmars-d-learn
if(a is null) How to check if variable "is not null" ?

Re: benchmark on binary trees

2015-12-11 Thread visitor via Digitalmars-d-learn
ok, i have a working version (memory is nice, twice the speed as non parallel) ; http://dpaste.dzfl.pl/504a652c6c47 real0m14.427s user1m19.347s sys 0m0.124s i've got similar performances, without Allocators, using directly malloc and free i had to recursively deallocate ...

Re: %s not producing string representation of enum?

2015-12-11 Thread Ali Çehreli via Digitalmars-d-learn
On 12/10/2015 08:58 PM, Shriramana Sharma wrote: Ali should really update that section of his book to use EnumMembers. Done[1]: http://ddili.org/ders/d.en/enum.html#ix_enum.EnumMembers,%20std.traits Thank you, Ali [1]

Dmd doesn't like tuples or me :>

2015-12-11 Thread Enjoys Math via Digitalmars-d-learn
import std.stdio; import std.typecons; int main(string[] argv) { auto value = Tuple(5, 6.7, "hello"); assert(value[0] == 5); assert(value[1] == 6.7); assert(value[2] == "hello"); writeln("Hello D-World!"); return 0; } // Standard example copied from the