Re: testing for deprecation

2017-08-25 Thread jmh530 via Digitalmars-d-learn
On Thursday, 1 September 2016 at 11:13:42 UTC, rikki cattermole wrote: That is a first that somebody wanted it. Bug report please! I just ran across this with deprecated { void foo(); } void main() { pragma(msg, __traits(getAttributes, foo)); } producing just tuple(). I came across

Re: wrapping a C style delegate

2017-08-25 Thread Ali Çehreli via Digitalmars-d-learn
On 08/25/2017 04:00 PM, Nicholas Wilson wrote: On Friday, 25 August 2017 at 13:49:20 UTC, Kagamin wrote: You're not specific enough. What would be semantics of such wrapper? The C function I'm trying to wrap takes a function pointer which is essentially a delegate, but not quite: ErrorEnum

spawnProcess: Exit parent process without terminating child process

2017-08-25 Thread timvol via Digitalmars-d-learn
Hi guys, I want execute a process. I know, I can execute a process using "spawnProcess" or "executeShell". But I want exit the parent. My code for testing purposes is the following: int main(string[] asArgs_p) { if ( (asArgs_p.length >= 2) && asArgs_p[1].isDir() ) { while(1)

How do I create a fileWatcher with an onFileChange event using spawn?

2017-08-25 Thread Enjoys Math via Digitalmars-d-learn
Something like this: module file_watcher; import std.concurrency; import std.file; import std.signals; import std.datetime; void fileWatcher(Tid tid, string filename, int loopSleep) { auto modified0 = timeLastModified(filename); while (true) { modified =

Re: Choosing between enum arrays or AliasSeqs

2017-08-25 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 24 August 2017 at 22:38:29 UTC, Meta wrote: https://dlang.org/phobos/std_meta.html#aliasSeqOf Thanks! Your advice led to the following sample solution import std.meta : aliasSeqOf; immutable englishIndefiniteArticles = [`a`, `an`]; bool isEnglishIndefiniteArticle(S)(S s) {

Re: Terminating a thread (which is blocking)

2017-08-25 Thread Eugene Wissner via Digitalmars-d-learn
On Thursday, 24 August 2017 at 07:23:15 UTC, Timothy Foster wrote: I've started a thread at the beginning of my program that waits for user input: `thread = new Thread().start;` `static void checkInput(){ foreach (line; stdin.byLineCopy) { ... } }` I need to stop checking for user input

Re: Web servers in D

2017-08-25 Thread Hasen Judy via Digitalmars-d-learn
On Friday, 25 August 2017 at 06:15:35 UTC, Eugene Wissner wrote: There is collie [1]. Never used. Can't say a lot about it. arsd [2] has a lot of interesting web stuff: event loop, FastCGI/SimpleCGI; web-, DOM-, mail-utilities. And the last but not least I'm running currently a small web

Re: Long File path Exception:The system cannot find the path specified

2017-08-25 Thread zabruk70 via Digitalmars-d-learn
On Thursday, 24 August 2017 at 18:02:24 UTC, vino wrote: Thanks for your support, was able to resolve this issue. Hello. IMHO, it will be better, if you will share your solution for other peoples :)

Re: (SIMD) Optimized multi-byte chunk scanning

2017-08-25 Thread Igor via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 22:07:30 UTC, Nordlöw wrote: I recall seeing some C/C++/D code that optimizes the comment- and whitespace-skipping parts (tokens) of lexers by operating on 2, 4 or 8-byte chunks instead of single-byte chunks. This in the case when token-terminators are expressed

Re: wrapping a C style delegate

2017-08-25 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 26 August 2017 at 00:27:47 UTC, Ali Çehreli wrote: I think you need a variation of intermediateCallback() below. I passed the address of the delegate as userData but you can construct any context that contains everything that you need (e.g. the address of ms). import std.stdio;

Re: wrapping a C style delegate

2017-08-25 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 25 August 2017 at 13:49:20 UTC, Kagamin wrote: You're not specific enough. What would be semantics of such wrapper? The C function I'm trying to wrap takes a function pointer which is essentially a delegate, but not quite: ErrorEnum function(Struct* s, void function(Struct*,

pipeProcess not returning immediately

2017-08-25 Thread Johnson Jones via Digitalmars-d-learn
I am running ffplay.exe and my application does not return immediately from pipeProcess. I have to close ffplay for my program to continue execution. pipeProcess is suppose to return immediately/run asynchronously, and it does with ffmpeg or other programs that return. (which I do not know

Re: Web servers in D

2017-08-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-08-25 07:25, Hasen Judy wrote: What libraries are people using to run webservers other than vibe.d? Don't get me wrong I like the async-io aspect of vibe.d but I don't like the weird template language and the fact that it caters to mongo crowd. I think for D to a have good web story

Re: Tools to help me find memory leaks?

2017-08-25 Thread Sebastien Alaiwan via Digitalmars-d-learn
I always use "valgrind --tool=massif" + "massif-visualizer". Gives me a nice timeline allowing to find quickly who the big memory consumers (allocation sites) are.

Re: Choosing between enum arrays or AliasSeqs

2017-08-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-08-25 08:12, Nordlöw wrote: Thanks! Your advice led to the following sample solution import std.meta : aliasSeqOf; immutable englishIndefiniteArticles = [`a`, `an`]; bool isEnglishIndefiniteArticle(S)(S s) {     return cast(bool)s.among!(aliasSeqOf!englishIndefiniteArticles); } Is

Re: wrapping a C style delegate

2017-08-25 Thread Kagamin via Digitalmars-d-learn
You're not specific enough. What would be semantics of such wrapper?

Re: Web servers in D

2017-08-25 Thread Eugene Wissner via Digitalmars-d-learn
On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote: What libraries are people using to run webservers other than vibe.d? Don't get me wrong I like the async-io aspect of vibe.d but I don't like the weird template language and the fact that it caters to mongo crowd. I think for D

Re: Choosing between enum arrays or AliasSeqs

2017-08-25 Thread Nordlöw via Digitalmars-d-learn
On Friday, 25 August 2017 at 08:27:41 UTC, Jacob Carlborg wrote: Since you're converting the returned index to a bool, can't you use "canFind" instead? immutable englishIndefiniteArticles = [`a`, `an`]; bool isEnglishIndefiniteArticle(S)(S s) { return englishIndefiniteArticles.canFind(s);

Re: Appending data to array results in duplicate's.

2017-08-25 Thread Vino.B via Digitalmars-d-learn
On Friday, 25 August 2017 at 17:02:53 UTC, Jonathan M Davis wrote: On Friday, August 25, 2017 16:45:16 Vino.B via Digitalmars-d-learn wrote: Hi, Request your help on the below issue, Issue : While appending data to a array the data is getting duplicated. Program: import std.file:

Re: Appending data to array results in duplicate's.

2017-08-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 25, 2017 16:45:16 Vino.B via Digitalmars-d-learn wrote: > Hi, > > Request your help on the below issue, > > Issue : While appending data to a array the data is getting > duplicated. > > Program: > import std.file: dirEntries, isFile, SpanMode; > import std.stdio: writeln,

Re: Long File path Exception:The system cannot find the path specified

2017-08-25 Thread Vino.B via Digitalmars-d-learn
On Friday, 25 August 2017 at 09:08:44 UTC, zabruk70 wrote: On Thursday, 24 August 2017 at 18:02:24 UTC, vino wrote: Thanks for your support, was able to resolve this issue. Hello. IMHO, it will be better, if you will share your solution for other peoples :) Hi, Please find the solution

Appending data to array results in duplicate's.

2017-08-25 Thread Vino.B via Digitalmars-d-learn
Hi, Request your help on the below issue, Issue : While appending data to a array the data is getting duplicated. Program: import std.file: dirEntries, isFile, SpanMode; import std.stdio: writeln, writefln; import std.algorithm: filter, map; import std.array: array; import std.typecons:

Re: Appending data to array results in duplicate's.

2017-08-25 Thread Moritz Maxeiner via Digitalmars-d-learn
On Friday, 25 August 2017 at 16:45:16 UTC, Vino.B wrote: Hi, Request your help on the below issue, Issue : While appending data to a array the data is getting duplicated. Program: import std.file: dirEntries, isFile, SpanMode; import std.stdio: writeln, writefln; import std.algorithm:

Re: (SIMD) Optimized multi-byte chunk scanning

2017-08-25 Thread Nordlöw via Digitalmars-d-learn
On Friday, 25 August 2017 at 09:40:28 UTC, Igor wrote: As for a nice reference of intel intrinsics: https://software.intel.com/sites/landingpage/IntrinsicsGuide/ Wow, what a fabulous UX!

Re: Multi dimensional array format priting

2017-08-25 Thread Vino.B via Digitalmars-d-learn
On Friday, 25 August 2017 at 17:41:31 UTC, Vino.B wrote: On Friday, 25 August 2017 at 17:02:53 UTC, Jonathan M Davis wrote: On Friday, August 25, 2017 16:45:16 Vino.B via Digitalmars-d-learn wrote: Hi, Request your help on the below issue, Issue : While appending data to a array the data