Re: thisExePath purity

2016-09-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 20, 2016 04:17:21 crimaniak via Digitalmars-d-learn 
wrote:
>  static shared immutable ReturnType!T value;

I would point out that immutable is implicitly shared, so there's no reason
to put shared on an immutable variable. However, you _do_ want to put shared
on a static constructor that initializes an immutable variable so that it's
only run once for the program instead of once per thread (the compiler
really should enforce that, but there's a longstanding bug that allows you
to reinitialize an immutable variable by not putting shared on the static
constructor and starting multiple threads).

- Jonathan M Davis



Re: thisExePath purity

2016-09-19 Thread crimaniak via Digitalmars-d-learn

Hi and thanks all!

On Tuesday, 20 September 2016 at 00:43:10 UTC, Jonathan M Davis 
wrote:



immutable string executablePath;

shared static this()
{
import std.file : thisExePath();
executablePath = thisExePath();
}


This code is good for my needs but I start to think about how to 
call thisExePath only if it is really used and come to this 
solution:


import std.traits: ReturnType, Parameters;

string staticMemoize(alias T, Parms = Parameters!T)() pure
{
struct Holder(alias T)
{
static shared immutable ReturnType!T value;
shared static this(){ value = T(Parms); }
}

return Holder!T.value;
}

unittest
{
import std.file : thisExePath;
assert(staticMemoize!thisExePath == thisExePath);
}

Something like this. Need to refine about input parameters, but I 
hope, idea is clear.
Unlike the function memoize from phobos staticMemoize really 
pure. And unlike proposed solution with ordinary variable 
staticMemoize is lazy, because no call - no instantiation.


https://dlang.org/library/std/functional/memoize.html




Re: polar coordinates with ggplotd

2016-09-19 Thread brocolis via Digitalmars-d-learn
On Monday, 19 September 2016 at 12:34:56 UTC, Edwin van Leeuwen 
wrote:

On Sunday, 18 September 2016 at 22:13:35 UTC, brocolis wrote:

Found an error in ys line. Thanks.


Does that mean you solved it?

Currently there is no special support for other coordinate 
systems, but I recently added Guides for x/y coordinates which 
should make this relatively straightforward to implement and is 
next on the list. Not sure when I'll get a chunk of time to 
implement it though.


For now you will have to convert the coordinates yourself, 
before plotting them.


Yeah, problem solved. Thanks.



Re: thisExePath purity

2016-09-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 20, 2016 00:37:10 Stefan Koch via Digitalmars-d-learn 
wrote:
> On Tuesday, 20 September 2016 at 00:01:58 UTC, crimaniak wrote:
> > Hi!
> >
> > Is there situations when output of thisExePath() can be
> > different during runtime? If yes, what the reason?
> > If no, is this possible to mark it as pure in phobos?
> >
> > https://dlang.org/library/std/file/this_exe_path.html
>
> No way to do that.
> It does I/O.
> However you cheat.
> look for assumePure in https://dlang.org/phobos/std_traits.html
> and then you can create a wrapper for it that is fake pure.

Yes, you can cast a function pointer to force purity, but that's almost
always a bad idea. It makes far more sense to just grab the value once and
reuse it. The only time that I'd suggest using the casting trick for
something like this would be when you can't afford to use static
constructors, and you can't afford to pass the value around. Casting to pure
should be a tool of last resort. It _is_ an option though if you really have
no reasonable alternative.

Another thing to consider in this case is that casting like that would
actually be needlessly expensive if he actually needs to make the call more
than once. It would be far cheaper to just save the result and reuse it. And
if it's stored in an immutable module-level or static variable, then it can
be used in a pure function.

- Jonathan M Davis



Re: thisExePath purity

2016-09-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 20, 2016 00:01:58 crimaniak via Digitalmars-d-learn 
wrote:
> Hi!
>
> Is there situations when output of thisExePath() can be different
> during runtime? If yes, what the reason?
> If no, is this possible to mark it as pure in phobos?
>
> https://dlang.org/library/std/file/this_exe_path.html

In principle, it should be impossible for it to change while the program is
running. However, what Phobos has to do to get the information can't be
pure. In the best case, it involves calling C functions that we can
reasonably assume will be pure but can't technically guarantee will be, but
in some cases, it actually involves querying the file system (e.g. on Linux,
it reads "/proc/self/exe"), which definitely can't be pure, because it
involves I/O.

If you really want a pure way to deal with this, then I'd suggest grabbing
the value at startup and setting it to an immutable variable. e.g. something
like

immutable string executablePath;

shared static this()
{
import std.file : thisExePath();
executablePath = thisExePath();
}

and then you can use that variable in pure code, because it's guaranteed not
to change.

- Jonathan M Davis



Re: thisExePath purity

2016-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn

On 9/19/16 8:01 PM, crimaniak wrote:

Hi!

Is there situations when output of thisExePath() can be different during
runtime? If yes, what the reason?
If no, is this possible to mark it as pure in phobos?

https://dlang.org/library/std/file/this_exe_path.html


Not in a way that D can ensure purity. Yes, it will not change. But that 
guarantee is not communicated via the OS functions required to call to 
get the information.


One thing you can do:

immutable string myPath;

shared static this()
{
   import std.file: thisExePath;
   myPath = thisExePath;
}

// now use myPath as required from pure functions.

-Steve


Re: thisExePath purity

2016-09-19 Thread Stefan Koch via Digitalmars-d-learn

On Tuesday, 20 September 2016 at 00:01:58 UTC, crimaniak wrote:

Hi!

Is there situations when output of thisExePath() can be 
different during runtime? If yes, what the reason?

If no, is this possible to mark it as pure in phobos?

https://dlang.org/library/std/file/this_exe_path.html


No way to do that.
It does I/O.
However you cheat.
look for assumePure in https://dlang.org/phobos/std_traits.html
and then you can create a wrapper for it that is fake pure.


thisExePath purity

2016-09-19 Thread crimaniak via Digitalmars-d-learn

Hi!

Is there situations when output of thisExePath() can be different 
during runtime? If yes, what the reason?

If no, is this possible to mark it as pure in phobos?

https://dlang.org/library/std/file/this_exe_path.html


Re: What blogs about D do you read?

2016-09-19 Thread A D dev via Digitalmars-d-learn

On Monday, 19 September 2016 at 21:49:04 UTC, Ali Çehreli wrote:

  https://atilanevesoncode.wordpress.com/

Ali


Thanks, Ali.




Re: What blogs about D do you read?

2016-09-19 Thread Ali Çehreli via Digitalmars-d-learn

On 09/19/2016 01:20 PM, Guillaume Piolat wrote:

On Monday, 19 September 2016 at 17:42:51 UTC, A D dev wrote:

Hi list,

What blogs about D do you read?

Thanks in advance.


https://dlang.org/blog/
http://dblog.aldacron.net/
http://minas-mina.com/
http://nomad.so/tag/d/
http://blog.thecybershadow.net/
https://p0nce.github.io/d-idioms/ (disclaimer: my own)


  https://atilanevesoncode.wordpress.com/

Ali



Re: What exactly does the compiler switch -betterC do?

2016-09-19 Thread Gary Willoughby via Digitalmars-d-learn

On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote:

On 2016-06-19 21:53, Gary Willoughby wrote:
When compiling, what exactly does the -betterC flag do? The 
command help
says "omit generating some runtime information and helper 
functions" but

what does this really mean? Is there any specifics somewhere?


It is intended to allow you to link an application without 
druntime. A Hello World using "extern(C) main" and printing 
using "printf" contains the following symbols on OS X:


00a8 S _D4main12__ModuleInfoZ
0068 T _D4main15__unittest_failFiZv
0018 T _D4main7__arrayZ
0040 T _D4main8__assertFiZv
00b5 s _TMP1
 U __d_arraybounds
 U __d_assert
 U __d_unittest
 T _main
 U _printf

If compiled with -betterC, it contains these:

 T _main
 U _printf


I get significantly more symbols than that when compiling the 
following program any idea why?


import core.stdc.stdio;

extern(C) void main()
{
printf("Hello World!\n");
}


$ rdmd --build-only --force -betterC -de -O -inline -release -w 
test.d

$ nm test



Re: What blogs about D do you read?

2016-09-19 Thread A D dev via Digitalmars-d-learn
On Monday, 19 September 2016 at 20:20:26 UTC, Guillaume Piolat 
wrote:

https://dlang.org/blog/
http://dblog.aldacron.net/
http://minas-mina.com/
http://nomad.so/tag/d/
http://blog.thecybershadow.net/
https://p0nce.github.io/d-idioms/ (disclaimer: my own)



Great, thanks!




Re: What blogs about D do you read?

2016-09-19 Thread Guillaume Piolat via Digitalmars-d-learn

On Monday, 19 September 2016 at 17:42:51 UTC, A D dev wrote:

Hi list,

What blogs about D do you read?

Thanks in advance.


https://dlang.org/blog/
http://dblog.aldacron.net/
http://minas-mina.com/
http://nomad.so/tag/d/
http://blog.thecybershadow.net/
https://p0nce.github.io/d-idioms/ (disclaimer: my own)


Re: What blogs about D do you read?

2016-09-19 Thread A D dev via Digitalmars-d-learn

On Monday, 19 September 2016 at 19:36:22 UTC, Karabuta wrote:
I have one here on Vibe.d for beginners 
https://laberba.github.io/2016/hello-world-app-with-the-vibe.d-web-framework/


I will be writing more for-beginners blogs in the coming few 
weeks.


Thank you. Will read it.




Re: What blogs about D do you read?

2016-09-19 Thread Karabuta via Digitalmars-d-learn

On Monday, 19 September 2016 at 19:29:25 UTC, A D dev wrote:

On Monday, 19 September 2016 at 17:42:51 UTC, A D dev wrote:

Hi list,

What blogs about D do you read?


To be more clear:

- what blogs that include posts on D, would you recommend to a 
D beginner?


Thanks.


I have one here on Vibe.d for beginners 
https://laberba.github.io/2016/hello-world-app-with-the-vibe.d-web-framework/


I will be writing more for-beginners blogs in the coming few 
weeks.


Re: What blogs about D do you read?

2016-09-19 Thread A D dev via Digitalmars-d-learn

On Monday, 19 September 2016 at 17:42:51 UTC, A D dev wrote:

Hi list,

What blogs about D do you read?


To be more clear:

- what blogs that include posts on D, would you recommend to a D 
beginner?


Thanks.



Re: Iterate over two arguments at once

2016-09-19 Thread bachmeier via Digitalmars-d-learn

On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:

Suppose I want to iterate over two arrays at once:

foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
  ...
}

I have seen a way to do this but cannot remember what it is and 
cannot find it.


Thanks for the replies. This is what I needed.


Re: Iterate over two arguments at once

2016-09-19 Thread Jon Degenhardt via Digitalmars-d-learn

On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:

Suppose I want to iterate over two arrays at once:

foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
  ...
}

I have seen a way to do this but cannot remember what it is and 
cannot find it.


range.lockstep:  https://dlang.org/phobos/std_range.html#lockstep


Re: Iterate over two arguments at once

2016-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn

On 9/19/16 2:10 PM, bachmeier wrote:

Suppose I want to iterate over two arrays at once:

foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
  ...
}

I have seen a way to do this but cannot remember what it is and cannot
find it.


http://dlang.org/phobos/std_range.html#.zip

-Steve


Re: Iterate over two arguments at once

2016-09-19 Thread Lodovico Giaretta via Digitalmars-d-learn

On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote:

Suppose I want to iterate over two arrays at once:

foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
  ...
}

I have seen a way to do this but cannot remember what it is and 
cannot find it.


You can use std.range.zip:

https://dlang.org/phobos/std_range.html#.zip

Or std.range.lockstep:

https://dlang.org/phobos/std_range.html#.lockstep


Re: vibe.d maxRequestSize

2016-09-19 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 17:54:05 UTC, Steven 
Schveighoffer wrote:

On 9/19/16 1:34 PM, Chris wrote:

[...]


Here is the culprit:

https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861

And the definition of MaxHTTPHeaderLineLength is:

https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861

4096 bytes.

I'm not super-familiar with HTTP protocol requirements, but a 
further diagnosis of your net traffic may reveal that your 
browser is doing something unorthodox, or vibe needs to adjust 
here.


-Steve


Thanks a million! I'll look into it tomorrow.


Iterate over two arguments at once

2016-09-19 Thread bachmeier via Digitalmars-d-learn

Suppose I want to iterate over two arrays at once:

foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) {
  ...
}

I have seen a way to do this but cannot remember what it is and 
cannot find it.


Re: vibe.d maxRequestSize

2016-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn

On 9/19/16 1:34 PM, Chris wrote:

On Monday, 19 September 2016 at 16:55:05 UTC, Steven Schveighoffer wrote:




Hm... you don't get a full stack trace? Hard to tell what max_bytes
should be, it defaults to ulong.max, so no way you are exhausting
that. Without knowing where readUntilSmall is called, it's hard to
diagnose.

-Steve


I didn't want to litter the thread, here it is:

400 - Bad Request

Bad Request

Internal error information:
object.Exception@../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d(349):
Reached maximum number of bytes while searching for end marker.

/home/chris/.dvm/compilers/dmd-2.071.1/linux/bin/../../src/phobos/std/exception.d:405
pure @safe void
std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong,
const(char[])) [0x8f11a7]
/home/chris/.dvm/compilers/dmd-2.071.1/linux/bin/../../src/phobos/std/exception.d:363
pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool,
lazy const(char)[], immutable(char)[], ulong) [0x8f112a]
.../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:348
void
vibe.stream.operations.readUntilSmall!(vibe.utils.array.AllocAppender!(ubyte[],
ubyte).AllocAppender).readUntilSmall(vibe.core.stream.InputStream, ref
vibe.utils.array.AllocAppender!(ubyte[], ubyte).AllocAppender,
const(ubyte[]), ulong) [0xb06b00]
.../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:137
void
vibe.stream.operations.readUntil!(vibe.utils.array.AllocAppender!(ubyte[],
ubyte).AllocAppender).readUntil(vibe.core.stream.InputStream, ref
vibe.utils.array.AllocAppender!(ubyte[], ubyte).AllocAppender,
const(ubyte[]), ulong) [0xb06a1f]
.../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:53
void
vibe.stream.operations.readLine!(vibe.utils.array.AllocAppender!(ubyte[], 
ubyte).AllocAppender).readLine(vibe.core.stream.InputStream,
ref vibe.utils.array.AllocAppender!(ubyte[], ubyte).AllocAppender,
ulong, immutable(char)[]) [0xb069c8]
.../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:39
ubyte[]
vibe.stream.operations.readLine!().readLine(vibe.core.stream.InputStream, ulong,
immutable(char)[], vibe.utils.memory.Allocator) [0xb06984]
.../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1861
void
vibe.http.server.parseRequestHeader(vibe.http.server.HTTPServerRequest,
vibe.core.stream.InputStream, vibe.utils.memory.Allocator, ulong)
[0xb5e827]


Here is the culprit:

https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861

And the definition of MaxHTTPHeaderLineLength is:

https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861

4096 bytes.

I'm not super-familiar with HTTP protocol requirements, but a further 
diagnosis of your net traffic may reveal that your browser is doing 
something unorthodox, or vibe needs to adjust here.


-Steve


What blogs about D do you read?

2016-09-19 Thread A D dev via Digitalmars-d-learn

Hi list,

What blogs about D do you read?

Thanks in advance.



Re: vibe.d maxRequestSize

2016-09-19 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 16:55:05 UTC, Steven 
Schveighoffer wrote:





Hm... you don't get a full stack trace? Hard to tell what 
max_bytes should be, it defaults to ulong.max, so no way you 
are exhausting that. Without knowing where readUntilSmall is 
called, it's hard to diagnose.


-Steve


I didn't want to litter the thread, here it is:

400 - Bad Request

Bad Request

Internal error information:
object.Exception@../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d(349):
 Reached maximum number of bytes while searching for end marker.

/home/chris/.dvm/compilers/dmd-2.071.1/linux/bin/../../src/phobos/std/exception.d:405
 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], 
ulong, const(char[])) [0x8f11a7]
/home/chris/.dvm/compilers/dmd-2.071.1/linux/bin/../../src/phobos/std/exception.d:363
 pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy 
const(char)[], immutable(char)[], ulong) [0x8f112a]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:348 
void 
vibe.stream.operations.readUntilSmall!(vibe.utils.array.AllocAppender!(ubyte[], 
ubyte).AllocAppender).readUntilSmall(vibe.core.stream.InputStream, ref 
vibe.utils.array.AllocAppender!(ubyte[], ubyte).AllocAppender, const(ubyte[]), 
ulong) [0xb06b00]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:137 
void vibe.stream.operations.readUntil!(vibe.utils.array.AllocAppender!(ubyte[], 
ubyte).AllocAppender).readUntil(vibe.core.stream.InputStream, ref 
vibe.utils.array.AllocAppender!(ubyte[], ubyte).AllocAppender, const(ubyte[]), 
ulong) [0xb06a1f]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:53 
void vibe.stream.operations.readLine!(vibe.utils.array.AllocAppender!(ubyte[], 
ubyte).AllocAppender).readLine(vibe.core.stream.InputStream, ref 
vibe.utils.array.AllocAppender!(ubyte[], ubyte).AllocAppender, ulong, 
immutable(char)[]) [0xb069c8]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d:39 
ubyte[] 
vibe.stream.operations.readLine!().readLine(vibe.core.stream.InputStream, 
ulong, immutable(char)[], vibe.utils.memory.Allocator) [0xb06984]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1861 void 
vibe.http.server.parseRequestHeader(vibe.http.server.HTTPServerRequest, 
vibe.core.stream.InputStream, vibe.utils.memory.Allocator, ulong) [0xb5e827]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1659 bool 
vibe.http.server.handleRequest(vibe.core.stream.Stream, 
vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo, ref 
vibe.http.server.HTTPServerSettings, ref bool) [0xb5c5d0]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1552 void 
vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, 
vibe.http.server.HTTPListenInfo) [0xb5be4e]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1433 void 
vibe.http.server.listenHTTPPlain(vibe.http.server.HTTPServerSettings).doListen(vibe.http.server.HTTPListenInfo,
 bool, bool).__lambda4(vibe.core.net.TCPConnection) [0xb5b814]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/core/drivers/libevent2_tcp.d:610
 void vibe.core.drivers.libevent2_tcp.ClientTask.execute() [0xbe8715]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/core/core.d:488 void 
vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void 
delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) [0xafea75]
../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/core/core.d:1119 void 
vibe.core.core.CoreTask.run() [0xb8dd79]
??:? void core.thread.Fiber.run() [0xc70ea5]
??:? fiber_entryPoint [0xc70c27]
??:? [0x]



Re: vibe.d maxRequestSize

2016-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn

On 9/19/16 11:59 AM, Chris wrote:

On Thursday, 15 September 2016 at 13:26:48 UTC, Steven Schveighoffer wrote:

On 9/15/16 9:11 AM, Chris wrote:

On Wednesday, 14 September 2016 at 20:23:09 UTC, Steven Schveighoffer
wrote:



Hm.. I have adjusted this in my project, and it works (set to 50M).
Needed it for uploading large images.

Using version 0.7.29



It doesn't seem to make any difference in my case. I wonder what could
be wrong


Seems to be in use:

https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/server.d#L1832




Finally, I could find where it happens. If I use "get" in a HTML form
(instead of "post"), vibe.d complains. I set the max request and request
header size to 25MB.

`
400 - Bad Request

Bad Request

Internal error information:
object.Exception@../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d(349):
Reached maximum number of bytes while searching for end marker.

`

https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/stream/operations.d#L349




Hm... you don't get a full stack trace? Hard to tell what max_bytes 
should be, it defaults to ulong.max, so no way you are exhausting that. 
Without knowing where readUntilSmall is called, it's hard to diagnose.


-Steve


Re: seg fault, now what?

2016-09-19 Thread Kagamin via Digitalmars-d-learn

On Saturday, 17 September 2016 at 21:12:08 UTC, Ryan wrote:
But I don't have another e-mail address, and it seems a bit 
much to create a fake e-mail account for a few bug reports.


mailmetrash.com :)


Re: vibe.d maxRequestSize

2016-09-19 Thread Chris via Digitalmars-d-learn
On Thursday, 15 September 2016 at 13:26:48 UTC, Steven 
Schveighoffer wrote:

On 9/15/16 9:11 AM, Chris wrote:
On Wednesday, 14 September 2016 at 20:23:09 UTC, Steven 
Schveighoffer

wrote:



Hm.. I have adjusted this in my project, and it works (set to 
50M).

Needed it for uploading large images.

Using version 0.7.29

-Steve


It doesn't seem to make any difference in my case. I wonder 
what could

be wrong


Seems to be in use:

https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/server.d#L1832

-Steve


Finally, I could find where it happens. If I use "get" in a HTML 
form (instead of "post"), vibe.d complains. I set the max request 
and request header size to 25MB.


`
400 - Bad Request

Bad Request

Internal error information:
object.Exception@../../.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/stream/operations.d(349):
 Reached maximum number of bytes while searching for end marker.

`

https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/stream/operations.d#L349


Re: seg fault, now what?

2016-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn

On 9/17/16 5:12 PM, Ryan wrote:

Is there an alternative to reporting bugs via bugzilla?

I tried to open an account, but they recommend not using your main
e-mail address because it will be posted to the web for all the spammers
to find. But I don't have another e-mail address, and it seems a bit
much to create a fake e-mail account for a few bug reports.


Slightly OT, but with a gmail/yahoo address, generally the spam filter 
is quite good. I've used my yahoo address for years on bugzilla and this 
forum, and never had adverse spamming issues.


-Steve


Re: Forum for new programmers in spanish.

2016-09-19 Thread Geert via Digitalmars-d-learn

On Monday, 19 September 2016 at 10:10:18 UTC, Seb wrote:


I don't speak Spanish, but I do like your idea of bringing D to 
more people :)

Two ideas:

1) You could help to translate the DLang Tour to Spanish:

https://tour.dlang.org
https://github.com/dlang-tour/spanish

2) StackOverflow has an excellent PageRank and thus many 
communities are moving there discussions over as it helps to 
increase their visibility and searchability. I don't know how 
good the spanish StackOverflow is, but it might be easier than 
maintaining a forum yourself?



Thanks Seb. I'll look at the DLang Tour.

On the other hand, i think a forum will be better, not only to 
help, but also to keep D programmers closer and expectant for 
news. Although, you are right, StackOverflow would be better to 
increase searchability and easier than maintaining a forum. I'll 
keep that in mind before taking a decision. Thanks!


Re: polar coordinates with ggplotd

2016-09-19 Thread Edwin van Leeuwen via Digitalmars-d-learn

On Sunday, 18 September 2016 at 22:13:35 UTC, brocolis wrote:

Found an error in ys line. Thanks.


Does that mean you solved it?

Currently there is no special support for other coordinate 
systems, but I recently added Guides for x/y coordinates which 
should make this relatively straightforward to implement and is 
next on the list. Not sure when I'll get a chunk of time to 
implement it though.


For now you will have to convert the coordinates yourself, before 
plotting them.




Re: Forum for new programmers in spanish.

2016-09-19 Thread Seb via Digitalmars-d-learn

On Monday, 19 September 2016 at 05:56:04 UTC, Geert wrote:

Hi all!

I'm a PHP programmer, and i've been searching for new languages 
to learn. I think D it's the best of the newest languages, due 
its good documentation, clean sintaxis (or less verbose), and 
the applications developed in D run fast. I've read a D 
application could run as fast as one devoloped in C++ if it's 
well optimized (this is what interests me most).


I think D has a good community wich is constantly growing. But 
i have not found good resources of it in my native language: 
spanish. It is for this reason that i was thinking on 
developing a D spanish forum in my own server, to help new 
programmers who don't speak english. I think a divided 
community takes longer to reach a target, and that is not my 
intention. I would like anyone who speaks english stays and 
make contributions here.



What do you think about it?


I don't speak Spanish, but I do like your idea of bringing D to 
more people :)

Two ideas:

1) You could help to translate the DLang Tour to Spanish:

https://tour.dlang.org
https://github.com/dlang-tour/spanish

2) StackOverflow has an excellent PageRank and thus many 
communities are moving there discussions over as it helps to 
increase their visibility and searchability. I don't know how 
good the spanish StackOverflow is, but it might be easier than 
maintaining a forum yourself?


Help with "cannot alias an expression" compile error

2016-09-19 Thread Jacob Carlborg via Digitalmars-d-learn

I'm trying to do some form of reflection abstraction, here's my sample code:

import std.meta;

struct Fields(T)
{
private static alias toField(alias e) = Field!(__traits(identifier, 
e));

alias fields = staticMap!(toField, T.tupleof);

static alias map(alias F) = staticMap!(F, fields);
static alias filter(alias pred) = Filter!(pred, fields);
}

struct Field(string n)
{
enum name = n;
}

struct Foo
{
int a;
}

void main()
{
Foo value;

enum toName(alias e) = e.name;
enum pred(alias e) = true;

alias a = Fields!(Foo).filter!(pred); // works
alias b = Fields!(Foo).map!(toName); // works

alias c = Fields!(Foo).init.filter!(pred); // works
alias d = Fields!(Foo).init.map!(toName); // Error: alias d cannot 
alias an expression Fields().tuple("a")

}

Alias "a" and "b" compiles just fine. Alias "c" compiles as well but not 
alias "d", which I don't understand why. I'm fully aware that it's not 
possible to alias an expression, but what I want is to alias the tuple 
of strings that is returned.


--
/Jacob Carlborg


Forum for new programmers in spanish.

2016-09-19 Thread Geert via Digitalmars-d-learn

Hi all!

I'm a PHP programmer, and i've been searching for new languages 
to learn. I think D it's the best of the newest languages, due 
its good documentation, clean sintaxis (or less verbose), and the 
applications developed in D run fast. I've read a D application 
could run as fast as one devoloped in C++ if it's well optimized 
(this is what interests me most).


I think D has a good community wich is constantly growing. But i 
have not found good resources of it in my native language: 
spanish. It is for this reason that i was thinking on developing 
a D spanish forum in my own server, to help new programmers who 
don't speak english. I think a divided community takes longer to 
reach a target, and that is not my intention. I would like anyone 
who speaks english stays and make contributions here.



What do you think about it?