Re: How to setup D language with Apache httpd cgi?

2019-07-30 Thread 0xEAB via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: This can be solved by using single quotes in the argument content places #!/usr/bin/env rdmd import std.stdio; void main() { writeln("Content-type: text/html"); writeln(""); writeln("CGI D Example"); } Does the job but is a b

Re: How to setup D language with Apache httpd cgi?

2019-07-30 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote: what causes the Internal Server Error. Internal Server Error might as well appear when D language syntax is not correct. Considering this: this example has Internal Server Error, since writeln argument and argument content cannot cont

Re: How to setup D language with Apache httpd cgi?

2019-07-30 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 21:55:00 UTC, Adam D. Ruppe wrote: the required blank line to separate headers from content. That's exactly what causes the Internal Server Error. This is a working example.d #!/usr/bin/env rdmd import std.stdio; void main() { writeln(""); } And this one,

Re: How to setup D language with Apache httpd cgi?

2019-07-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 20:36:18 UTC, BoQsc wrote: writeln("Hello, world with automated script running!"); You didn't follow the cgi protocol here - you didn't output the content type and the required blank line to separate headers from content. echo "Content-type: text/html" echo '

How to setup D language with Apache httpd cgi?

2019-07-30 Thread BoQsc via Digitalmars-d-learn
Hello, I would like to know how to setup D language project, so that it would work with Apache httpd cgi. Do I need some kind of cgi library for D language? Right now all I'm getting is internal server error. Btw. Unix Bash script examples seems to work well with with Apache httpd cgi, they

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-30 Thread Matt via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 05:30:30 UTC, Jonathan M Davis wrote: In principle, it's good to use const when you know that data isn't going to change, but that gets far more complicated when you're dealing with generic code or even with classes, since as soon as you use const, everything used wi

Re: How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-30 Thread kinke via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 12:06:23 UTC, Martin Krejcirik wrote: Just be advised, this was seriously broken in the past. Depends on windows, ms libraries, whether it's stdout or stderr and more. Current versions are probably ok, will check. Don't count on this to work on older windows includin

Re: Meaning of Scoped! ??

2019-07-30 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 09:46:07 UTC, Andrea Fontana wrote: Looking at its source code, it seems it's a way to force the call of "destroy" method of wrapped object (Context in your case) when the struct goes out of its scope (and d-tor is called) Andrea Thanks, Andrea (and rikki). I ac

Re: How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-30 Thread Martin Krejcirik via Digitalmars-d-learn
On Monday, 29 July 2019 at 22:31:01 UTC, kinke wrote: Switching the console code page to UTF-8, and then restoring the original one before termination. See https://github.com/ldc-developers/ldc/pull/3086/commits/5915534530fa095e7e5d58bcfb4ad100d249bbca#diff-c59e7716a40a08ce42f141c738f2c311. You

Blog Post #0057: The Basics of Drawing with Cairo

2019-07-30 Thread Ron Tarrant via Digitalmars-d-learn
Several months ago, someone asked if I'd be covering drawing routines and after much preparation, today's post is the first in a series on drawing with Cairo. You can find it here: http://gtkdcoding.com/2019/07/30/0057-cairo-i-the-basics.html

Re: how to get the struct member as delegate type ?

2019-07-30 Thread Newbie2019 via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 10:08:55 UTC, Newbie2019 wrote: foreach(int name_index, name; __traits(allMembers, S) ) static if( isDelegateMember!(S, name, Type) ) { enum Rules = getUDAs!( __traits(getMember, S, name) , Rule); // handle the member is match this rules. } And one more qu

Re: how to get the struct member as delegate type ?

2019-07-30 Thread Newbie2019 via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 10:06:21 UTC, Newbie2019 wrote: template isDelegateMember(S, string name, D) if(is(S == struct) && __traits(hasMember, S, name) && is( D == delegate ) ) { alias Fn= typeof( __traits(getMember, S.init, name) ); static assert( isFunction!Fn ); pragma(m

how to get the struct member as delegate type ?

2019-07-30 Thread Newbie2019 via Digitalmars-d-learn
I need to check on struct members is match a delegate type. for example; alias Type = scope void delegate(int) @nogc ; struct S { void onMatch1(int) scope @nogc { } void onNotMatch2(int) scope { } void onNotMatch2(int, int) scope @nogc { } Type not_match3; }

Re: Meaning of Scoped! ??

2019-07-30 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 09:33:04 UTC, Ron Tarrant wrote: Some things are almost impossible to research. For instance, in the GtkD wrapper code—specifically the Widget.d file—the following function definition appears: gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg, ConnectFla

Re: Meaning of Scoped! ??

2019-07-30 Thread rikki cattermole via Digitalmars-d-learn
On 30/07/2019 9:33 PM, Ron Tarrant wrote: Some things are almost impossible to research. For instance, in the GtkD wrapper code—specifically the Widget.d file—the following function definition appears: gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg, ConnectFlags connectFlags

Meaning of Scoped! ??

2019-07-30 Thread Ron Tarrant via Digitalmars-d-learn
Some things are almost impossible to research. For instance, in the GtkD wrapper code—specifically the Widget.d file—the following function definition appears: gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) { return Signa