Re: Passing struct and struct[] into a template

2015-07-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 04:29:23 Taylor Gronka via Digitalmars-d-learn wrote: > I have a template function, and I want it to do something if the > input variable is a list of structs, and something else if the > input is a struct. If you want a template to be different for different types, th

Re: Code Coverage Analysis, how do I skip (ignore) a line?

2015-07-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 02:19:52 antropod via Digitalmars-d-learn wrote: > I want my coverage analysis to be 100%, how do I skip lines like > assert(0); > from being counted? AFAIK, there is no way to so, and I've mentioned that problem to Walter before, so I would have expected him to mention

Re: Passing struct and struct[] into a template

2015-07-21 Thread Taylor Gronka via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 05:02:59 UTC, Timon Gehr wrote: template Uks(T){ T query(string q){ T result; static if(is(T==S[],S)){ ulong test=result.length; // append S newResult; result~=newResult; }else{ /

Re: Passing struct and struct[] into a template

2015-07-21 Thread Timon Gehr via Digitalmars-d-learn
On 07/22/2015 06:29 AM, Taylor Gronka wrote: Hi, I have a template function, and I want it to do something if the input variable is a list of structs, and something else if the input is a struct. 1) What's the best way to test this? I suppose I can call __traits(identifier, results) and look at

Passing struct and struct[] into a template

2015-07-21 Thread Taylor Gronka via Digitalmars-d-learn
Hi, I have a template function, and I want it to do something if the input variable is a list of structs, and something else if the input is a struct. 1) What's the best way to test this? I suppose I can call __traits(identifier, results) and look at the last two characters. 2) If `T` is a l

Code Coverage Analysis, how do I skip (ignore) a line?

2015-07-21 Thread antropod via Digitalmars-d-learn
I want my coverage analysis to be 100%, how do I skip lines like assert(0); from being counted?

Re: GLU in DerelictOrg

2015-07-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 16:34:35 UTC, Spacen Jasset wrote: On Tuesday, 21 July 2015 at 15:17:13 UTC, Alex Parrill wrote: On Tuesday, 21 July 2015 at 14:51:47 UTC, John Colvin wrote: Isn't glu considered legacy these days? I think it's entirely OpenGL 2.x. For the maths stuff see http://cod

Re: Sending an immutable object to a thread

2015-07-21 Thread rsw0x via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 21:44:07 UTC, rsw0x wrote: On Sunday, 19 July 2015 at 17:12:07 UTC, rsw0x wrote: [...] wow, I don't even remember posting this. This is (mostly) wrong, but I'm unsure if a pointer to another pointer on the stack would correctly keep its object alive(but, I believ

Re: Sending an immutable object to a thread

2015-07-21 Thread rsw0x via Digitalmars-d-learn
On Sunday, 19 July 2015 at 17:12:07 UTC, rsw0x wrote: On Sunday, 19 July 2015 at 17:04:07 UTC, Frank Pagliughi wrote: [...] Oh, yes, pointer. Ha! I didn't even think of that. Thanks. I'm not familiar with how garbage collection works in D. If the initial reference goes out of scope, and you

Re: Sending an immutable object to a thread

2015-07-21 Thread Frank Pagliughi via Digitalmars-d-learn
On Sunday, 19 July 2015 at 17:12:07 UTC, rsw0x wrote: a pointer to a pointer(or in this case, a reference) does not keep it alive. Interesting. If you de-reference the pointer and assign it back, do you get back the keep-alive? Like, in the receiving thread: void threadFunc() { receive

Re: How do i sanitize a string for database query?

2015-07-21 Thread ddos via Digitalmars-d-learn
thx

Re: How do i sanitize a string for database query?

2015-07-21 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 18:55:53 UTC, ddos wrote: On Tuesday, 21 July 2015 at 17:58:55 UTC, Gary Willoughby wrote: On Tuesday, 21 July 2015 at 17:23:30 UTC, ddos wrote: How do i sanitize a string for database query? Is there some builtin function? thx :) Use prepared statements instead.

Re: How do i sanitize a string for database query?

2015-07-21 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 18:55:53 UTC, ddos wrote: On Tuesday, 21 July 2015 at 17:58:55 UTC, Gary Willoughby wrote: On Tuesday, 21 July 2015 at 17:23:30 UTC, ddos wrote: How do i sanitize a string for database query? Is there some builtin function? thx :) Use prepared statements instead.

Re: How do i sanitize a string for database query?

2015-07-21 Thread ddos via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 17:58:55 UTC, Gary Willoughby wrote: On Tuesday, 21 July 2015 at 17:23:30 UTC, ddos wrote: How do i sanitize a string for database query? Is there some builtin function? thx :) Use prepared statements instead. https://en.wikipedia.org/wiki/Prepared_statement thx

Re: How do i sanitize a string for database query?

2015-07-21 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 17:23:30 UTC, ddos wrote: How do i sanitize a string for database query? Is there some builtin function? thx :) Use prepared statements instead. https://en.wikipedia.org/wiki/Prepared_statement

Re: How do i sanitize a string for database query?

2015-07-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 17:23:30 UTC, ddos wrote: How do i sanitize a string for database query? You generally shouldn't even try, instead use the database functions that bind parameters to the procedure. Is there some builtin function? It is different for each database target.

How do i sanitize a string for database query?

2015-07-21 Thread ddos via Digitalmars-d-learn
How do i sanitize a string for database query? Is there some builtin function? thx :)

Re: GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 15:17:13 UTC, Alex Parrill wrote: On Tuesday, 21 July 2015 at 14:51:47 UTC, John Colvin wrote: Isn't glu considered legacy these days? I think it's entirely OpenGL 2.x. For the maths stuff see http://code.dlang.org/packages/gl3n Yep. It still uses immediate mode, G

Re: C bindings: typedef struct conflicts with method

2015-07-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-21 14:24, yawniek wrote: done, https://github.com/jacob-carlborg/dstep/issues/40 i was under the impression that there is already a ticked as https://github.com/jacob-carlborg/dstep/issues/8 looks very similar (but was closed). Yeah, looks very similar. Issue 8 i still open and has

Re: GLU in DerelictOrg

2015-07-21 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 14:51:47 UTC, John Colvin wrote: Isn't glu considered legacy these days? I think it's entirely OpenGL 2.x. For the maths stuff see http://code.dlang.org/packages/gl3n Yep. It still uses immediate mode, GL matrix functions, and all sorts of other stuff removed in Op

Re: GLU in DerelictOrg

2015-07-21 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 12:26:30 UTC, Spacen Jasset wrote: It seems that Derelict3 contains GLUT whereas derelict2 containss GLU. It appears I need GLU but I am somewhat confused as to what the diffrence is. Whoops, yes you are right, my mistake. Isn't glu considered legacy these days?

Re: idiom for C error strings

2015-07-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 12:40:37 UTC, Daniel Kozák wrote: static: char[size] buf; somefun(param1, buf.ptr, buf.length); still works there too. That's the form I prefer to use.

Re: idiom for C error strings

2015-07-21 Thread Daniel Kozák via Digitalmars-d-learn
On Tue, 21 Jul 2015 12:27:55 + "yawniek" wrote: > whats the proper way to use/wrap C functions that expect a error > string buffer > e.g.: > somefun(T param1, char* errstr, size_t errstr_size) > in D ? > dynamic: auto buf = new char[size]; somefun(param1, buf.ptr, buf.length); or some

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Baz via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 11:08:00 UTC, Rikki Cattermole wrote: On 21/07/2015 10:36 p.m., Baz wrote: [...] I'll summarize what my friend is saying. netsh is potentially going away. Don't use it if you can. Since you are using a localized system it, it may be causing issues for the interfac

Re: GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
It seems that Derelict3 contains GLUT whereas derelict2 containss GLU. It appears I need GLU but I am somewhat confused as to what the diffrence is.

idiom for C error strings

2015-07-21 Thread yawniek via Digitalmars-d-learn
whats the proper way to use/wrap C functions that expect a error string buffer e.g.: somefun(T param1, char* errstr, size_t errstr_size) in D ?

Re: C bindings: typedef struct conflicts with method

2015-07-21 Thread yawniek via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 06:12:53 UTC, Jacob Carlborg wrote: what the correct way to bind these? Please report an issue for this. In this case "rd_kafka_metadata_t" should be used for the struct name. done, https://github.com/jacob-carlborg/dstep/issues/40 i was under the impression that

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 11:08:00 UTC, Rikki Cattermole wrote: Lastly, this is half good news and half bad news. We have found a way[2] through WMI/COM to enable/disable them. Although I've never gone the path of COM let alone WMI which could be a rather mess to deal with in D. May be easier

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Kagamin via Digitalmars-d-learn
http://forum.dlang.org/post/oyzgbvdzyjmupkduz...@forum.dlang.org - maybe related On Tuesday, 21 July 2015 at 11:03:47 UTC, Baz wrote: Mmmmh i see, you think that t will be on TLS like this ? I thought it passes some weird value, that sleep doesn't like. But i'll test later, actually the cras

Re: GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 11:23:23 UTC, John Colvin wrote: On Tuesday, 21 July 2015 at 11:08:13 UTC, Spacen Jasset wrote: Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was h

Re: GLU in DerelictOrg

2015-07-21 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 11:08:13 UTC, Spacen Jasset wrote: Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was hoping to do a quick port to DerelictOrg They are not availa

Re: GLU in DerelictOrg

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 11:08 p.m., Spacen Jasset wrote: Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was hoping to do a quick port to DerelictOrg https://github.com/DerelictOrg?utf8=%E

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 10:36 p.m., Baz wrote: On Tuesday, 21 July 2015 at 10:28:27 UTC, Rikki Cattermole wrote: On 21/07/2015 10:14 p.m., Baz wrote: --- import std.process; import core.thread; import std.random; void main(string[] args) { string on = "netsh interface set interface \"Connexion au r

GLU in DerelictOrg

2015-07-21 Thread Spacen Jasset via Digitalmars-d-learn
Hello, Can anyone tell me if the GLU functions, gluSpehere etc are availble in DerelictOrg or have they been removed. I can replace these with my own versions, but was hoping to do a quick port to DerelictOrg

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Baz via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 10:41:54 UTC, Kagamin wrote: try this: import std.process, std.stdio; import core.thread; import std.random; void main(string[] args) { string on = "netsh interface set interface \"Connexion au réseau local\" Enable"; string off = "netsh interface set interf

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Kagamin via Digitalmars-d-learn
try this: import std.process, std.stdio; import core.thread; import std.random; void main(string[] args) { string on = "netsh interface set interface \"Connexion au réseau local\" Enable"; string off = "netsh interface set interface \"Connexion au réseau local\" Disable"; while(t

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Baz via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 10:28:27 UTC, Rikki Cattermole wrote: On 21/07/2015 10:14 p.m., Baz wrote: --- import std.process; import core.thread; import std.random; void main(string[] args) { string on = "netsh interface set interface \"Connexion au réseau local\" Enable"; string o

Re: Why does this script BSOD-ize windows ?

2015-07-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 21/07/2015 10:14 p.m., Baz wrote: --- import std.process; import core.thread; import std.random; void main(string[] args) { string on = "netsh interface set interface \"Connexion au réseau local\" Enable"; string off = "netsh interface set interface \"Connexion au réseau local\" Dis

Why does this script BSOD-ize windows ?

2015-07-21 Thread Baz via Digitalmars-d-learn
--- import std.process; import core.thread; import std.random; void main(string[] args) { string on = "netsh interface set interface \"Connexion au réseau local\" Enable"; string off = "netsh interface set interface \"Connexion au réseau local\" Disable"; while(true) {