Re: A hash table implementation benchmark

2014-10-02 Thread Ali Çehreli via Digitalmars-d-learn
On 10/01/2014 10:00 PM, thedeemon wrote: Here's another benchmark: D AAs vs. Vibe.d's open addressing hashes vs. Robin Hood hashing: http://www.infognition.com/blog/2014/on_robin_hood_hashing.html What a coincidence. :) Your blog article was written just two weeks ago. Ali

cgi.d - fastcgi - LightTPD is not cooperative

2014-10-02 Thread Sycam_Inc via Digitalmars-d-learn
This is a cross-post from the issue i started on github (i figure i'll probably get a quicker response here) FastCGI dosen't cooperate with LightTPD on windows. as soon as lighttpd starts up and initializes fastcgi unknown listenType (0) is printed out and the server shuts down I've isolated

Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
What is the best way to kill a thread when it pleases the owner (main thread)? The background is playing audio files. The playback happens in a separate thread so the owner can keep on listening to events triggered by the user (like stop, pause). I have to queue audio files, wait until one has

Re: Obedient threads

2014-10-02 Thread thedeemon via Digitalmars-d-learn
Just use non-blocking receives in main thread's event loop. When you get a message from child thread that it's finished playing and you decide you don't need that thread anymore, send a message to child you're dismissed. The child should also have some loop to check for incoming messages

Re: Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
On Thursday, 2 October 2014 at 10:33:02 UTC, thedeemon wrote: Just use non-blocking receives in main thread's event loop. When you get a message from child thread that it's finished playing and you decide you don't need that thread anymore, send a message to child you're dismissed. The child

Re: Obedient threads

2014-10-02 Thread ketmar via Digitalmars-d-learn
On Thu, 02 Oct 2014 11:36:06 + Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Thanks. I was thinking of something like that, only I haven't found a way to set up non-blocking receives. What am I missing. I'm sure it's something trivial. you can use receiveTimeout!

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-02 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 21:34:40 UTC, Nordlöw wrote: On Wednesday, 1 October 2014 at 17:09:57 UTC, monarch_dodra wrote: Does that even work? takeExactly would pop up to N *codepoints*, whereas your string only has N *codeunits*. Your're right again :) If forgot that takeExactly

Re: cgi.d - fastcgi - LightTPD is not cooperative

2014-10-02 Thread Adam D. Ruppe via Digitalmars-d-learn
Try running the program yourself with a port argument yourprogram.exe --port 3000 for example, then have lighttpd configured to connect to that port for the application. That's what I had to do for nginx on Windows, lighttpd might be the same thing.

Re: Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
On Thursday, 2 October 2014 at 13:05:00 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 11:36:06 + Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: you can use receiveTimeout! to check if there is some message available. That won't do. It blocks the

Re: cgi.d - fastcgi - LightTPD is not cooperative

2014-10-02 Thread Sycam_Inc via Digitalmars-d-learn
On Thursday, 2 October 2014 at 13:25:14 UTC, Adam D. Ruppe wrote: Try running the program yourself with a port argument yourprogram.exe --port 3000 for example, then have lighttpd configured to connect to that port for the application. That's what I had to do for nginx on Windows, lighttpd

Re: Obedient threads

2014-10-02 Thread ketmar via Digitalmars-d-learn
On Thu, 02 Oct 2014 13:49:33 + Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: That won't do. It blocks the main thread too (for the duration of timeout) don't do hour-long timeouts. 1ms timeout is actually poll-and-receive. can't see any problems with it.

Re: cgi.d - fastcgi - LightTPD is not cooperative

2014-10-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 2 October 2014 at 13:53:48 UTC, Sycam_Inc wrote: when running in the browser the page just continues to load and the lighttpd console shows no output from it and it dosent write anything in the file. What url did you use in the browser and what's your lighttpd config look like?

Re: cgi.d - fastcgi - LightTPD is not cooperative

2014-10-02 Thread Sycam_Inc via Digitalmars-d-learn
On Thursday, 2 October 2014 at 14:17:42 UTC, Adam D. Ruppe wrote: On Thursday, 2 October 2014 at 13:53:48 UTC, Sycam_Inc wrote: when running in the browser the page just continues to load and the lighttpd console shows no output from it and it dosent write anything in the file. What url did

How do I check if a function got CTFE?

2014-10-02 Thread AsmMan via Digitalmars-d-learn
I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time. I'm trying to convert the binary executable to assembly by using objconv tool but I'm finding it very diffucult to find anything in there, since some converters

Re: How do I check if a function got CTFE?

2014-10-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote: I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time. You have to explicitly force ctfe with context, it is never done automatically, and if it fails, the

Re: Obedient threads

2014-10-02 Thread Ali Çehreli via Digitalmars-d-learn
On 10/02/2014 06:49 AM, Chris wrote: On Thursday, 2 October 2014 at 13:05:00 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 11:36:06 + Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: you can use receiveTimeout! to check if there is some message

Re: How do I check if a function got CTFE?

2014-10-02 Thread anonymous via Digitalmars-d-learn
On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote: I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time. I'm trying to convert the binary executable to assembly by using objconv tool but I'm finding it very

Re: How do I check if a function got CTFE?

2014-10-02 Thread AsmMan via Digitalmars-d-learn
On Thursday, 2 October 2014 at 18:02:30 UTC, Adam D. Ruppe wrote: On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote: I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time. You have to explicitly force ctfe with

Re: How do I check if a function got CTFE?

2014-10-02 Thread AsmMan via Digitalmars-d-learn
On Thursday, 2 October 2014 at 18:17:12 UTC, anonymous wrote: On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote: I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time. I'm trying to convert the binary

Re: How do I check if a function got CTFE?

2014-10-02 Thread anonymous via Digitalmars-d-learn
On Thursday, 2 October 2014 at 18:42:56 UTC, AsmMan wrote: I was thiking the dmd compiler did CTFE without someone ask for this, in the way as I've mentioned, checking for constant arguments + function's purity and if all this is true, it did the CTFE rather than generate code to compute it at

Re: How do I check if a function got CTFE?

2014-10-02 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Oct 02, 2014 at 07:04:56PM +, anonymous via Digitalmars-d-learn wrote: On Thursday, 2 October 2014 at 18:42:56 UTC, AsmMan wrote: I was thiking the dmd compiler did CTFE without someone ask for this, in the way as I've mentioned, checking for constant arguments + function's purity

Re: How do I check if a function got CTFE?

2014-10-02 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 2 October 2014 at 18:42:56 UTC, AsmMan wrote: I was thiking the dmd compiler did CTFE without someone ask for this, in the way as I've mentioned, checking for constant arguments + function's purity and if all this is true, it did the CTFE rather than generate code to compute it at

Re: How do I check if a function got CTFE?

2014-10-02 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote: I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time. I'm trying to convert the binary executable to assembly by using objconv tool but I'm finding it very

Hunting down rogue memory allocations?

2014-10-02 Thread Gary Willoughby via Digitalmars-d-learn
Say i have created a program written in D, what tools are available for me to track memory allocations? If you write a program and its performance is slow because you suspect too many allocations are taking place in unrecognised areas, what tools or techniques do you use to find where they

Re: Hunting down rogue memory allocations?

2014-10-02 Thread Kiith-Sa via Digitalmars-d-learn
On Thursday, 2 October 2014 at 20:16:56 UTC, Gary Willoughby wrote: Say i have created a program written in D, what tools are available for me to track memory allocations? If you write a program and its performance is slow because you suspect too many allocations are taking place in

Re: Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
On Thursday, 2 October 2014 at 18:08:40 UTC, Ali Çehreli wrote: On 10/02/2014 06:49 AM, Chris wrote: On Thursday, 2 October 2014 at 13:05:00 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 11:36:06 + Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

Re: Hunting down rogue memory allocations?

2014-10-02 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 2 October 2014 at 20:31:29 UTC, Kiith-Sa wrote: On Thursday, 2 October 2014 at 20:16:56 UTC, Gary Willoughby wrote: Say i have created a program written in D, what tools are available for me to track memory allocations? If you write a program and its performance is slow because

Re: Obedient threads

2014-10-02 Thread ketmar via Digitalmars-d-learn
On Thu, 02 Oct 2014 20:42:49 + Chris via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I'll try that now. Somehow the 1.msecs solution doesn't seem clean enough. it seems that you want thread messaging to be integrated in your event loop. sorry, there is no easy way to do it

curl and proxy

2014-10-02 Thread AntonSotov via Digitalmars-d-learn
auto http = HTTP(dlang.org); http.onReceive = (ubyte[] data) { writeln(cast(string) (data)); return data.length; }; http.proxy = 192.168.111.111; http.proxyPort = 1788; WHAT HERE ? http.perform(); // how to make Сurl authorize on a