Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 18:52:41 UTC, Suliman wrote: auto html = someStringActions(); res.writeBody(cast(ubyte[])html); Thanks, but how to attach to html css file? Now page is loading, but do not handle css that also placed in this folder. CSS should be exported automatically when you us

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Chris via Digitalmars-d-learn
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( This should work, put it in your `app.d` file: import vibe.d; shared static this() { auto settings = new HTTPServerSe

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Chris via Digitalmars-d-learn
On Thursday, 7 May 2015 at 09:27:39 UTC, Chris wrote: On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( This should work, put it in your `app.d` file: import vibe.d; sha

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Chris via Digitalmars-d-learn
Later you can have more sophisticated methods, e.g. if you want to handle query strings you could do something like this: import vibe.d; shared static this() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["::1", "127.0.0.1"]; auto router = ne

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Chris via Digitalmars-d-learn
On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write "./public/" ? In examples often simply "public/" will work too. even "public" it goes trough Path struct, see: https://github.com/rejectedsoftware/vibe.d/blob/1157

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Chris via Digitalmars-d-learn
On Friday, 8 May 2015 at 10:20:35 UTC, Rikki Cattermole wrote: On 8/05/2015 10:17 p.m., Chris wrote: On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write "./public/" ? In examples often simply "public/" will work t

Chaining input

2015-05-08 Thread Chris via Digitalmars-d-learn
I have the following code that converts input like blah, blub, gobble, dygook to string[] auto f = File("file.txt", "r"); auto words = f.byLine .map!( a => a.to!(string) .splitter(", ") .filter!(a => a.length)

Re: Chaining input

2015-05-08 Thread Chris via Digitalmars-d-learn
On Friday, 8 May 2015 at 11:14:43 UTC, Robert burner Schadek wrote: On Friday, 8 May 2015 at 11:00:01 UTC, Chris wrote: I'm sure there is room for improvement. It looks like your reading some kind of comma seperated values (csv). have a look at std.csv of phobos ``` foreach(record; f

Re: Moving from Python to D

2015-05-08 Thread Chris via Digitalmars-d-learn
"Moving from Python to D" always a good idea ;-)

Re: Moving from Python to D

2015-05-08 Thread Chris via Digitalmars-d-learn
On Friday, 8 May 2015 at 14:13:43 UTC, Chris wrote: "Moving from Python to D" always a good idea ;-) You might be interested in this: http://wiki.dlang.org/Programming_in_D_for_Python_Programmers http://d.readthedocs.org/en/latest/examples.html#plotting-with-matplotlib-python

Re: Why .dup not work with multidimensional arrays?

2015-05-08 Thread Chris via Digitalmars-d-learn
On Friday, 8 May 2015 at 06:30:46 UTC, Ali Çehreli wrote: On 05/07/2015 07:39 PM, Dennis Ritchie wrote: On Friday, 8 May 2015 at 02:23:23 UTC, E.S. Quinn wrote: It's because arrays are references types, and .dup is a strictly shallow copy, so you're getting two outer arrays that reference the

Re: Weird OSX issue

2015-05-12 Thread Chris via Digitalmars-d-learn
On Monday, 27 April 2015 at 13:54:42 UTC, Steven Schveighoffer wrote: On 4/25/15 3:07 AM, Dan Olson wrote: Jacob Carlborg writes: On 2015-04-24 20:37, Steven Schveighoffer wrote: So am I going crazy? Or is dmd doing things differently depending on where its environment is? Any compiler guru

-vgc Info ok?

2015-05-18 Thread Chris via Digitalmars-d-learn
The following string[string] myarray = ["key":"value"]; string entry; entry = myarray["key"]; // => vgc: indexing an associative array may cause GC allocation Why is _accessing_ an assoc treated as indexing it?

Re: -vgc Info ok?

2015-05-18 Thread Chris via Digitalmars-d-learn
On Monday, 18 May 2015 at 14:34:38 UTC, ketmar wrote: On Mon, 18 May 2015 14:30:42 +, Chris wrote: The following string[string] myarray = ["key":"value"]; string entry; entry = myarray["key"]; // => vgc: indexing an associative array may cause GC allocation Why is _accessing_ an assoc t

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Monday, 18 May 2015 at 18:40:15 UTC, ketmar wrote: On Mon, 18 May 2015 14:41:19 +, Chris wrote: On Monday, 18 May 2015 at 14:34:38 UTC, ketmar wrote: On Mon, 18 May 2015 14:30:42 +, Chris wrote: The following string[string] myarray = ["key":"value"]; string entry; entry = myarray

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 09:10:50 UTC, Namespace wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: The following string[string] myarray = ["key":"value"]; string entry; entry = myarray["key"]; // => vgc: indexing an associative array may cause GC allocation Why is _accessing_ an

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 11:08:52 UTC, thedeemon wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you understand "indexing" as we do? It's not like indexing of databases, it's just "accessing by index" i.e. using

Re: -vgc Info ok?

2015-05-19 Thread Chris via Digitalmars-d-learn
On Tuesday, 19 May 2015 at 12:41:29 UTC, ketmar wrote: On Tue, 19 May 2015 11:36:32 +, Chris wrote: On Tuesday, 19 May 2015 at 11:08:52 UTC, thedeemon wrote: On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote: Why is _accessing_ an assoc treated as indexing it? Are you sure you unders

Regex-Fu

2015-05-25 Thread Chris via Digitalmars-d-learn
I'm a bit at a loss here. I cannot get the longest possible match. I tried several versions with eager operators and stuff, but D's regex engine(s) always seem to return the shortest match. Is there something embarrassingly simple I'm missing? void main() { import std.regex : regex, matchFir

Re: Regex-Fu

2015-05-25 Thread Chris via Digitalmars-d-learn
On Monday, 25 May 2015 at 11:20:46 UTC, novice2 wrote: I cannot get the longest possible it match longest for first group ([a-z]+) try ^([a-z]+?)(hula|ula)$ Namespace, novice2: Ah, I see. The problem was with the first group that was too greedy, not with the second. I was focusing on the l

AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular.

Re: AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
On Friday, 12 June 2015 at 12:41:23 UTC, weaselcat wrote: On Friday, 12 June 2015 at 10:54:46 UTC, Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking about Windows 7 on a HP625 laptop in particular. Can you be any more specific? What kind of problems? A DLL in D

Re: AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
On Friday, 12 June 2015 at 14:20:58 UTC, Alex Parrill wrote: On Friday, 12 June 2015 at 13:16:32 UTC, Chris wrote: On Friday, 12 June 2015 at 12:41:23 UTC, weaselcat wrote: On Friday, 12 June 2015 at 10:54:46 UTC, Chris wrote: Has anyone run into problems with D on AMD processors? I'm talking

Re: AMD & Windows 7

2015-06-12 Thread Chris via Digitalmars-d-learn
On Friday, 12 June 2015 at 14:55:15 UTC, Benjamin Thaut wrote: On Friday, 12 June 2015 at 14:39:55 UTC, Chris wrote: I wish it were an error in the Python code so I could fix it, but it works on all other machines (at least those with Intel). It's only on the HP625 with AMD that this error o

Struct vs. Class

2015-06-26 Thread Chris via Digitalmars-d-learn
I have still some classes lying around in my code. As threading is becoming more and more of an issue, classes and OOP in general turn out to be a nuisance. It's not so hard to turn the classes into structs, a lot of classes are in fact singletons (yes, I've been kinda fading out classes for a

Re: Struct vs. Class

2015-06-26 Thread Chris via Digitalmars-d-learn
On Friday, 26 June 2015 at 11:28:38 UTC, Daniel Kozák wrote: On Fri, 26 Jun 2015 11:11:15 + Chris via Digitalmars-d-learn wrote: I have still some classes lying around in my code. As threading is becoming more and more of an issue, classes and OOP in general turn out to be a nuisance

Concurrency in DLL

2015-07-01 Thread Chris via Digitalmars-d-learn
Would anyone know off the top of the head why a std.concurrency.send() message can fail in a DLL? The DLL is loaded into Python and works (including the threading) when in a test program or mine and loaded via cytpes.CDLL() etc. However, embedded in a third party package, where it is loaded in

Thread pools

2015-07-22 Thread Chris via Digitalmars-d-learn
What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at once, once a new command comes in? A thread pool? How would that look like in D? I feel my knowledge of D threads is still a bit limited.

Re: Thread pools

2015-07-22 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: On Wednesday, 22 July 2015 at 14:28:48 UTC, Chris wrote: What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at once, once a new command comes in? A thread pool? How would

Re: Thread pools

2015-07-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 16:16:36 UTC, John Colvin wrote: I would send a message to terminate to thread1, which would in turn send a similar message to any threads it has started, wait until they've all stopped (maybe with a time-out), then return. I.e. every thread knows how to cleanl

Re: Thread pools

2015-07-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 17:01:52 UTC, Marc Schütz wrote: You can probably simply terminate the main thread, which will send an OwnerTerminated message to all dependent threads. The threads need to `receive()` this message and terminate. Not possible here. Main has to run the all the ti

Re: Yes or No Options

2015-07-29 Thread Chris via Digitalmars-d-learn
On Monday, 27 July 2015 at 15:50:11 UTC, Alex wrote: Hey guys! I am super new to programming and still trying to learn the very basics via a book that I bought. Out of interest: what made you start with D? It's not the most obvious choice for a programming novice.

Re: Yes or No Options

2015-07-30 Thread Chris via Digitalmars-d-learn
On Thursday, 30 July 2015 at 14:20:41 UTC, Alex wrote: My father owns a small software company, specialized in market data products. www.bccgi.com (in case anyone is interested) So programming was basically around all my life. I do a small job in his company and my next task was to learn D.

Re: Yes or No Options

2015-07-31 Thread Chris via Digitalmars-d-learn
On Thursday, 30 July 2015 at 17:48:51 UTC, Ali Çehreli wrote: On 07/30/2015 08:14 AM, Chris wrote: I wonder, is your father's company listed among those using D? I think there's a list somewhere on Wiki, if not we should have one :-) I don't think they use D yet but the page is here: htt

Thread communication

2015-08-04 Thread Chris via Digitalmars-d-learn
Is there a good way to stop work-intensive threads via thread communication (instead of using a shared variable)? The example below is very basic and naive and only meant to exemplify the basic problem. I want to stop (and abort) the worker as soon as new input arrives. However, while executi

Re: Thread communication

2015-08-05 Thread Chris via Digitalmars-d-learn
On Tuesday, 4 August 2015 at 18:15:08 UTC, Ali Çehreli wrote: On 08/04/2015 09:19 AM, Dicebot wrote: receiveTimeout I think the problem here is that the worker is busy, not even able to call that. This sounds like sending a signal to the specific thread (with pthread_kill()) but I don't kn

Re: Thread communication

2015-08-06 Thread Chris via Digitalmars-d-learn
On Thursday, 6 August 2015 at 08:40:58 UTC, Kagamin wrote: } AFAIK, boost does it by integrating support for interruption into various functions, so IO, waits and locks reply to interrupt requests appropriately. You can do something similar. I understand the philosophy behind D-thread

std.stream.MemoryStream deprecated, range is the alternative?

2015-08-06 Thread chris via Digitalmars-d-learn
class Test { MemoryStream m_stream; this(MemoryStream stream) { m_stream = stream; } void write(byte val) { m_stream.write(val); } byte read() { byte val; m_stream.read(val); return val; } } void main() { byte[] read = [0,

Re: Concurrency Confusion

2015-08-07 Thread Chris via Digitalmars-d-learn
On Thursday, 6 August 2015 at 21:17:15 UTC, 岩倉 澪 wrote: On Tuesday, 4 August 2015 at 08:35:10 UTC, Dicebot wrote: // in real app use `receiveTimeout` to do useful stuff until // result message is received auto output = receiveOnly!(immutable(Bar)[]); New question: how would I rece

Re: Concurrency Confusion

2015-08-07 Thread Chris via Digitalmars-d-learn
On Friday, 7 August 2015 at 15:55:33 UTC, Chris wrote: Using a shared boolean is probably not the "best way", I should have said the most efficient and reliable way.

Re: Concurrency Confusion

2015-08-08 Thread Chris via Digitalmars-d-learn
On Saturday, 8 August 2015 at 00:39:57 UTC, 岩倉 澪 wrote: On Friday, 7 August 2015 at 22:13:35 UTC, 岩倉 澪 wrote: "message" is local to the delegate that receiveTimeout takes. I want to use "message" outside of the delegate in the receiving thread. However, if you send an immutable value from the

flush MessageBox

2015-08-20 Thread Chris via Digitalmars-d-learn
Is there a way to flush a thread's message box other than aborting the thread? MailBox is private: https://github.com/D-Programming-Language/phobos/blob/master/std/concurrency.d#L1778

Re: flush MessageBox

2015-08-21 Thread Chris via Digitalmars-d-learn
On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other than aborting the thread? MailBox is private: https://github.com/D-Programming-Language/phobos/blob/master/std/concurre

Re: flush MessageBox

2015-08-21 Thread Chris via Digitalmars-d-learn
On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: On Friday, 21 August 2015 at 10:43:22 UTC, Chris wrote: On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote: Is there a way to flush a thread's message box other th

Re: flush MessageBox

2015-08-21 Thread Chris via Digitalmars-d-learn
On Friday, 21 August 2015 at 14:35:53 UTC, Chris wrote: On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: On Friday, 21 August 2015 at 10:43:22 UTC, Chris wrote: On Thursday, 20 August 2015 at 15:57:47 UTC, John Colvin wrote: On Thursday, 20 August 2015 at 15:25:57 UTC, Chris wrote

Re: flush MessageBox

2015-08-24 Thread Chris via Digitalmars-d-learn
On Friday, 21 August 2015 at 17:05:56 UTC, John Colvin wrote: On Friday, 21 August 2015 at 14:35:53 UTC, Chris wrote: On Friday, 21 August 2015 at 12:59:09 UTC, John Colvin wrote: [...] Wouldn't it be easier to have a library function that can empty the mailbox immediately? It's a waste of t

Re: Lazy sort

2015-09-11 Thread Chris via Digitalmars-d-learn
On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally lazy.

Bloat with std.(string.)format?

2015-09-17 Thread Chris via Digitalmars-d-learn
If I have code like this: auto builder = appender!string; builder ~= "Hello, World!"; builder ~= "I'm here!"; builder ~= "Now I'm there!"; the object file grows by 10-11 lines with each call to `builder ~=`. If I use this: builder ~= format("%s", "Hello, World!"); builder ~= format("%s", "I'm

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

2015-09-17 Thread Chris via Digitalmars-d-learn
On Thursday, 17 September 2015 at 10:33:44 UTC, John Colvin wrote: Some initial bloat is expected, format is pretty big (although twice as big is a lot, unless your original code was quite small?). It was in a test program. Only a few lines. But it would still add a lot of bloat in a progra

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

2015-09-17 Thread Chris via Digitalmars-d-learn
On Thursday, 17 September 2015 at 12:49:03 UTC, John Colvin wrote: On Thursday, 17 September 2015 at 10:53:17 UTC, Chris wrote: On Thursday, 17 September 2015 at 10:33:44 UTC, John Colvin wrote: Some initial bloat is expected, format is pretty big (although twice as big is a lot, unless your

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

2015-09-17 Thread Chris via Digitalmars-d-learn
On Thursday, 17 September 2015 at 15:17:21 UTC, John Colvin wrote: On Thursday, 17 September 2015 at 13:42:15 UTC, Chris wrote: On Thursday, 17 September 2015 at 12:49:03 UTC, John Colvin wrote: [...] Thanks. That's up to date enough now. Is it stable, though? Reasonably so in my testing,

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

Re: What's wrong with this code?

2015-09-19 Thread Chris via Digitalmars-d-learn
On Saturday, 19 September 2015 at 02:45:54 UTC, Adam D. Ruppe wrote: 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 vari

Re: What's wrong with this code?

2015-09-19 Thread Chris via Digitalmars-d-learn
Update: If I add *also* a auto vec2 = vec; now the code works. So it looks like this now: voxel_vec [string] move_buttons = [ "button_xp" : voxel_vec ([ 1, 0, 0 ]), "button_xm" : voxel_vec ([ -1, 0, 0 ]), "

Linker error with dmd

2015-10-02 Thread Chris via Digitalmars-d-learn
Why do I get this error msg with dmd 2.067.1 and 2.068.0 in release mode: $ dub --build=release (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined reference to `_D64TypeInfo_C3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ' col

Re: Linker error with dmd

2015-10-06 Thread Chris via Digitalmars-d-learn
On Friday, 2 October 2015 at 14:03:08 UTC, John Colvin wrote: On Friday, 2 October 2015 at 09:43:54 UTC, Chris wrote: Why do I get this error msg with dmd 2.067.1 and 2.068.0 in release mode: $ dub --build=release (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__

vibe.d maxRequestSize

2016-09-14 Thread Chris via Digitalmars-d-learn
The vibe.d server rejects `XMLHttpRequest`s that are too long (in the eyes of the server). In the docs it says "maxRequestSize ulong Maximum number of transferred bytes per request after which the connection is closed with [sic!]" However, when you go to http://vibed.org/api/vibe.http.ser

Re: vibe.d maxRequestSize

2016-09-15 Thread Chris via Digitalmars-d-learn
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 wr

Re: vibe.d maxRequestSize

2016-09-15 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

Re: vibe.d maxRequestSize

2016-09-16 Thread Chris via Digitalmars-d-learn
On Friday, 16 September 2016 at 00:35:25 UTC, sarn wrote: I hope this isn't too obvious, but I have to ask because it's such a common gotcha: Are you reverse proxying through a server like nginx by any chance? There are default request size limits there. (For nginx specifically, it's this o

Re: std.algorithm.iteration.each requires opApply to have ref elements?

2016-09-16 Thread Chris via Digitalmars-d-learn
On Thursday, 15 September 2016 at 18:23:14 UTC, Q. Schroll wrote: Why does it do that? And seemingly it does not require it for opApply with more than two arguments. Here's what the comment says: https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d#L929 // opApply with >2 pa

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

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. -St

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/r

Re: vibe.d maxRequestSize

2016-09-22 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 18:13:12 UTC, Chris wrote: 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 def

vibe.d Logger

2016-10-03 Thread Chris via Digitalmars-d-learn
Is this the preferred logging module for vibe.d: http://vibed.org/api/vibe.core.log/ There is also: http://vibed.org/api/vibe.http.log/ which is there for backwards compatibility?

vibe.d HTMLLogger

2016-10-12 Thread Chris via Digitalmars-d-learn
Why does FileLogger work while HTMLLogger crashes on the same thing? I've had a look at the source code, but couldn't find anything. It happens with vibe.d `0.7.30-beta1` and `0.7.29` alike (haven't tested lower versions). [Test code] auto logLine = LogLine(); logLine.level = LogLevel.info; /

Re: vibe.d HTMLLogger

2016-10-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 11:54:14 UTC, Chris wrote: Why does FileLogger work while HTMLLogger crashes on the same thing? I've had a look at the source code, but couldn't find anything. It happens with vibe.d `0.7.30-beta1` and `0.7.29` alike (haven't tested lower versions). [Test code

Re: vibe.d HTMLLogger

2016-10-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 14:19:36 UTC, Chris wrote: The answer is that `HTMLLogger` needs to be given the time in the `LogLine` struct, else it fails. The time stamp is not auto generated. I completely overlooked that. Here's the culprit: cf. m_logFile.writef(`%s`, msg.time.toISOE

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 11:24:28 UTC, Alfred Newman wrote: Hello, I'm getting some troubles to replace the accented letters in a given string with their unaccented counterparts. Let's say I have the following input string "très élégant" and I need to create a function to return just "t

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 12:52:04 UTC, Marc Schütz wrote: On Friday, 28 October 2016 at 11:24:28 UTC, Alfred Newman wrote: [...] import std.stdio; import std.algorithm; import std.uni; import std.conv; void main() { auto str = "très élégant"; immutable accents = unicode.Diacritic

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 13:50:24 UTC, Alfred Newman wrote: On Friday, 28 October 2016 at 11:40:37 UTC, Chris wrote: [...] @Chris As a new guy in the D community, I am not sure, but I think the line below is something like a Python's lambda, right ? auto removed = to!string(str.map!(a

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 14:31:47 UTC, Chris wrote: On Friday, 28 October 2016 at 13:50:24 UTC, Alfred Newman wrote: It boils down to something like: if (c in _accent) return _accent[c]; else return c; Just a normal lambda (condition true) ? yes : no; I'd recommend you to use Marc's

Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
Only one of the two cases is considered. What am I doing wrong? ` import std.array; import std.conv; import std.stdio; void main() { auto tokens = to!(dchar[][])(["D"d, "’"d, "Addario"d, "'"d]); // Or use this below: //~ dstring[] tokens = ["D"d, "’"d, "Addario"d, "'"d]; while (!tokens.e

Re: Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 17:33:04 UTC, Steven Schveighoffer wrote: I tested this locally with different ideas. This definitely looks like a codegen bug. I was able to reduce it to: void main() { switch("'"d) { case "'"d: writeln("a"); break; case "’

Re: Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 18:34:28 UTC, Steven Schveighoffer wrote: Please file here: https://issues.dlang.org/enter_bug.cgi I think this has been there forever. Happens in 2.040 too (the earliest dmd I have on my system). -Steve Here it is: https://issues.dlang.org/show_bug.cgi

Re: Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 19:30:01 UTC, ketmar wrote: On Wednesday, 23 November 2016 at 19:07:49 UTC, Chris wrote: It has something to do with the smart quote, e.g.: it is wrong binary search in `_d_switch_string()`. strings for switch are lexically sorted, and compiler calls `_d_swi

Re: Switch ignores case (?)

2016-11-24 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 22:13:38 UTC, ketmar wrote: On Wednesday, 23 November 2016 at 22:00:58 UTC, Steven Schveighoffer wrote: I can't see why you need to deal with the glue layer at all -- just tell the glue layer that it's a list of strings and not dstrings ;) 'cause that is how

Re: Switch ignores case (?)

2016-11-24 Thread Chris via Digitalmars-d-learn
On Thursday, 24 November 2016 at 10:12:40 UTC, ketmar wrote: thanks. tbh, i am surprised myself -- it is completely fubared, but nobody noticed. maybe that says something about real-world useability of dstring/wstring... ;-) Well, I came across it, because I wanted to work around autodecode

Re: [Semi-OT] I don't want to leave this language!

2016-12-07 Thread Chris via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 15:17:21 UTC, Picaud Vincent wrote: On Wednesday, 7 December 2016 at 11:48:32 UTC, bachmeier wrote: [...] I understand and I do agree with these points, honestly. These points are also the reason why I will maybe try to use D for my own codes (D is really mu

Re: [Semi-OT] I don't want to leave this language!

2016-12-08 Thread Chris via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 16:43:54 UTC, bachmeier wrote: On Wednesday, 7 December 2016 at 16:15:32 UTC, Chris wrote: I don't understand this discussion at all. Why not have both? I don't need bare metal stuff at the moment but I might one day, and I perfectly understand that people may n

Re: [Semi-OT] I don't want to leave this language!

2016-12-08 Thread Chris via Digitalmars-d-learn
On Thursday, 8 December 2016 at 11:09:12 UTC, ketmar wrote: [...] what can be done, tho, is article (or series of articles) describing what exactly druntime is, how it is compared to libc and libc++, why it doesn't hurt at all, how to do "bare metal" with custom runtime, why GC is handy (and

Re: Other libraries - web site link, and other thoughts

2016-12-16 Thread Chris via Digitalmars-d-learn
Forgive if I'm suggesting something which was already discussed and dismissed, but I too would love a way to leverage C++ stuff into D. Can't we go to C++? Meaning there's a C++ compiler coming from the same hands as D. Couldn't we try to get the C++ compiler to compile in such a manner that D

Copying and moving directories

2017-02-16 Thread Chris via Digitalmars-d-learn
In `std.file`, I haven't found a function that allows me to move or at least copy directories, as in `mv dir /toDir`. Do I have to go the awkward way over `rename` or something?

Re: Copying and moving directories

2017-02-16 Thread Chris via Digitalmars-d-learn
On Thursday, 16 February 2017 at 16:41:48 UTC, Adam D. Ruppe wrote: On Thursday, 16 February 2017 at 16:38:51 UTC, Chris wrote: In `std.file`, I haven't found a function that allows me to move or at least copy directories, as in `mv dir /toDir`. Do I have to go the awkward way over `rename` or

Re: Copying and moving directories

2017-02-17 Thread Chris via Digitalmars-d-learn
On Thursday, 16 February 2017 at 17:06:30 UTC, Jonathan M Davis wrote: Well, there's zero difference between renaming the file or directory and moving it. It's simply a difference in name. rename actually comes from POSIX, where rename is used in C code, and mv is used in the shell. So, I gue

Re: Copying and moving directories

2017-02-17 Thread Chris via Digitalmars-d-learn
On Friday, 17 February 2017 at 11:40:35 UTC, Jonathan M Davis wrote: Well, there's a _long_ history of it being called rename on POSIX systems, and since the D function is a simple wrapper around rename, it makes sense that it's called rename, much as I agree that the name isn't the best for

<    1   2   3