Re: spawnProcess() not child?

2014-11-03 Thread Bauss via Digitalmars-d-learn
Is there nobody that knows a solution? :(

Re: spawnProcess() not child?

2014-11-03 Thread via Digitalmars-d-learn
On Sunday, 2 November 2014 at 00:59:43 UTC, Bauss wrote: Is there a way to spawn a process that won't be a child process, because I can't seem to kill any processes created with spawnProcess() It keeps giving me access denied for the processes and it's necessary for me to kill a process,

Re: spawnProcess() not child?

2014-11-03 Thread angel via Digitalmars-d-learn
The parent / child relationship always exists. In POSIX OSs, you may ignore SIGCHLD signal (announcing child process death), so that in case of child process exit it will not become zombie, rather it will be disposed on the spot. As a side note, in Linux, there exist a system call allowing

Re: shallow copy of const(Object)[]

2014-11-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/31/14 2:38 PM, anonymous wrote: I have a const(Object)[] and I want a shallow copy of the array. ..dup doesn't do it, which I thought a bug, but according to Martin Nowak it's by design [1]. std.array.array fails, too. Is there really nothing in phobos for this? static import std.array;

Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName = Node!(string).Name; alias MyAttr = Node!(string).Attr; }

Re: spawnProcess() not child?

2014-11-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/3/14 6:34 AM, angel wrote: The parent / child relationship always exists. In POSIX OSs, you may ignore SIGCHLD signal (announcing child process death), so that in case of child process exit it will not become zombie, rather it will be disposed on the spot. As a side note, in Linux, there

Re: Question about eponymous template trick

2014-11-03 Thread MrSmith via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:07:55 UTC, Uranuz wrote: I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName =

Re: API hooking in Dlang?

2014-11-03 Thread Dirk via Digitalmars-d-learn
On Monday, 3 November 2014 at 07:46:57 UTC, Jack wrote: On Monday, 3 November 2014 at 06:51:11 UTC, Dirk wrote: On Monday, 3 November 2014 at 04:31:40 UTC, Dirk wrote: On Monday, 3 November 2014 at 03:41:19 UTC, Dirk wrote: I am wondering if there is any libraries I have missed for API

accessing numeric template parameters

2014-11-03 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
If I have a struct with numeric template parameter, how can I access it within member functions? Like normal member variables? And how about the constructor? struct polynomial(uint base) { private: uint[] N; public: this(uint x) { base = x; } ... void add(Polynomial!base P) {

Re: API hooking in Dlang?

2014-11-03 Thread Sean Kelly via Digitalmars-d-learn
On Monday, 3 November 2014 at 04:31:40 UTC, Dirk wrote: I should of mentioned that I have also seen the MadCodeHook Library bindings, which is great but the MCH library is very expensive. Weird, it used to be open source and free.

Re: [SDL + TKD] Seg fault from creating DirectoryDialog

2014-11-03 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 2 November 2014 at 23:05:05 UTC, Jack wrote: On Sunday, 2 November 2014 at 17:39:46 UTC, Gary Willoughby wrote: On Sunday, 2 November 2014 at 12:11:23 UTC, Jack wrote: Whole error is: http://codepad.org/C2l4rUel That's not the true error. That's dub throwing an exception when

Re: accessing numeric template parameters

2014-11-03 Thread MrSmith via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:27:47 UTC, Dominikus Dittes Scherkl wrote: If I have a struct with numeric template parameter, how can I access it within member functions? Like normal member variables? And how about the constructor? struct polynomial(uint base) { private: uint[] N;

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
Looks like compiler looks for Node, Name and Attr in Node struct, because of eponymous thing. I understand it but I want to know if it is documented behaviour or not. Could anybody clear what happens with eponymous stuff and why I can't get acces to *other* declarations inside eponymous

Re: Templates for structures

2014-11-03 Thread Ali Çehreli via Digitalmars-d-learn
On 11/02/2014 04:10 AM, novice2 wrote: Hello. I need write some wrapper around legacy data structure. May be it should be class. May be structure with methods. The problem is writing repetitive code for underlying data. For example: - code to read length-byte-prefixed string to D string for

Re: Question about eponymous template trick

2014-11-03 Thread Ali Çehreli via Digitalmars-d-learn
On 11/03/2014 06:36 AM, Uranuz wrote: Looks like compiler looks for Node, Name and Attr in Node struct, because of eponymous thing. I understand it but I want to know if it is documented behaviour or not. Could anybody clear what happens with eponymous stuff and why I can't get acces to

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
I think it's the intended behavior. I think documentation is outdated. Ali Thanks. So I will modify my programme to workaround this.

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
Also I failed to find any documentation about eponymous stuff in language reference. As far as I remember it was here but now looks like it is missing.

Re: Question about eponymous template trick

2014-11-03 Thread Sean Kelly via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:58:03 UTC, Ali Çehreli wrote: I think it's the intended behavior. I think documentation is outdated. Both forms should really work though. I had always thought that the short form was simply possible if the names matched.

simd and dmd compiler v 2.066 and 2.067.0-b1

2014-11-03 Thread Laeeth Isharc via Digitalmars-d-learn
Hi. Not sure if my code is correct - I wanted to build the simplest working example of simd use. The following compiles and works under ldc (I have not disassessembled the result to see if it is using simd instructions), but generates a compiler error under dmd (2.066 and 2.067.0-b1 running

Re: API hooking in Dlang?

2014-11-03 Thread Dirk via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:32:05 UTC, Sean Kelly wrote: On Monday, 3 November 2014 at 04:31:40 UTC, Dirk wrote: I should of mentioned that I have also seen the MadCodeHook Library bindings, which is great but the MCH library is very expensive. Weird, it used to be open source and

Re: Question about eponymous template trick

2014-11-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/3/14 9:07 AM, Uranuz wrote: I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName = Node!(string).Name; alias MyAttr = Node!(string).Attr; }

Re: simd and dmd compiler v 2.066 and 2.067.0-b1

2014-11-03 Thread John Colvin via Digitalmars-d-learn
On Monday, 3 November 2014 at 15:33:00 UTC, Laeeth Isharc wrote: Hi. Not sure if my code is correct - I wanted to build the simplest working example of simd use. The following compiles and works under ldc (I have not disassessembled the result to see if it is using simd instructions), but

Re: spawnProcess() not child?

2014-11-03 Thread Sean Kelly via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:09:21 UTC, Steven Schveighoffer wrote: From OP's code, he is on Windows. I believe on Windows you have to sort out some kind of permissions to terminate a process. No idea if std.process does this, but it sounds like probably not.

Struct template

2014-11-03 Thread deed via Digitalmars-d-learn
struct Internal { int i; double d; string s; } struct External_int { Internal internal; @property Internal* ptr () { return internal; } this (int a) { internal.s = int; internal.i = a; } } struct External (T) { Internal internal; @property Internal* ptr () {

Re: Struct template

2014-11-03 Thread deed via Digitalmars-d-learn
static if (is(typeof(T) == int)) should be static if (is(T == int)) T is already a type. Ahh. Thanks!

Re: Struct template

2014-11-03 Thread John Colvin via Digitalmars-d-learn
On Monday, 3 November 2014 at 17:03:33 UTC, deed wrote: struct Internal { int i; double d; string s; } struct External_int { Internal internal; @property Internal* ptr () { return internal; } this (int a) { internal.s = int; internal.i = a; } } struct External (T) {

Reading unicode string with readf (%s)

2014-11-03 Thread Ivan Kazmenko via Digitalmars-d-learn
Hi! The following code does not correctly handle Unicode strings. - import std.stdio; void main () { string s; readf (%s, s); write (s); } - Example input (Test. in cyrillic): - Тест. - (hex: D0 A2 D0 B5 D1 81 D1 82 2E 0D 0A) Example output: -

Re: Embedding D Shared Library in WSGI Web Server

2014-11-03 Thread John McFarlane via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 09:34:33 UTC, Chris wrote: On Tuesday, 28 October 2014 at 00:16:03 UTC, John McFarlane wrote: Hi, I've written a modest shared library in D that I'd like to call directly from a Python web server (Linux/OS X, Apache, WSGI, Pyramid). I can call it reliably from

Re: Reading unicode string with readf (%s)

2014-11-03 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko wrote: readf (%s, s); Worth noting: this reads to end-of-file (not end-of-line or whitespace), and reading the whole file into a string was what I indeed expected it to do. So, if there is an idiomatic way to read the whole

Re: Reading unicode string with readf (%s)

2014-11-03 Thread Ali Çehreli via Digitalmars-d-learn
On 11/03/2014 11:47 AM, Ivan Kazmenko wrote: On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko wrote: readf (%s, s); Worth noting: this reads to end-of-file (not end-of-line or whitespace), and reading the whole file into a string was what I indeed expected it to do. So, if there

Re: Reading unicode string with readf (%s)

2014-11-03 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 3 November 2014 at 19:47:17 UTC, Ivan Kazmenko wrote: So, if there is an idiomatic way to read the whole file into a string which is Unicode-compatible, it would be great to learn that, too. Maybe something like this: import std.stdio; import std.array; import std.conv; string

Re: Why ByChunk is not regnize by st.range.takeOne and why Section has no value

2014-11-03 Thread bioinfornatics via Digitalmars-d-learn
On Monday, 3 November 2014 at 06:43:50 UTC, Ali Çehreli wrote: On 11/02/2014 04:58 PM, bioinfornatics wrote: Dear, Some problem to build this code: http://fpaste.org/147327/75948141/ $ ldc2 fasta_test.d /usr/include/d/std/range.d(3605): Error: template std.array.save cannot deduce

Re: accessing numeric template parameters

2014-11-03 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Nov 3, 2014 at 3:27 PM, Dominikus Dittes Scherkl via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: If I have a struct with numeric template parameter, how can I access it within member functions? Like normal member variables? And how about the constructor? struct

Re: simd and dmd compiler v 2.066 and 2.067.0-b1

2014-11-03 Thread via Digitalmars-d-learn
Reduced testcase: import core.simd; void main() { short8 vec; vec=vec*3; } I've filed a bug report: https://issues.dlang.org/show_bug.cgi?id=13674

Re: Why ByChunk is not regnize by st.range.takeOne and why Section has no value

2014-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 03, 2014 21:03:51 bioinfornatics via Digitalmars-d-learn wrote: Ok but I do not see why to use save method for a takeOne function is possible to write this function without to use it It looks like the idea was that beacause you know that there's only one element, you can

Re: Why ByChunk is not regnize by st.range.takeOne and why Section has no value

2014-11-03 Thread bioinfornatics via Digitalmars-d-learn
On Monday, 3 November 2014 at 21:03:51 UTC, bioinfornatics wrote: On Monday, 3 November 2014 at 06:43:50 UTC, Ali Çehreli wrote: On 11/02/2014 04:58 PM, bioinfornatics wrote: Dear, Some problem to build this code: http://fpaste.org/147327/75948141/ $ ldc2 fasta_test.d

Re: simd and dmd compiler v 2.066 and 2.067.0-b1

2014-11-03 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 3 November 2014 at 21:23:50 UTC, Marc Schütz wrote: Reduced testcase: import core.simd; void main() { short8 vec; vec=vec*3; } I've filed a bug report: https://issues.dlang.org/show_bug.cgi?id=13674 Thanks - appreciate it. Laeeth.

Re: [SDL + TKD] Seg fault from creating DirectoryDialog

2014-11-03 Thread Jack via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:32:07 UTC, Gary Willoughby wrote: On Sunday, 2 November 2014 at 23:05:05 UTC, Jack wrote: On Sunday, 2 November 2014 at 17:39:46 UTC, Gary Willoughby wrote: On Sunday, 2 November 2014 at 12:11:23 UTC, Jack wrote: Whole error is: http://codepad.org/C2l4rUel

How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
Hello ! I could not find a clear way that show how to use template types as parameter to functions: There is a general rule to do it ? On several examples when the return type comes from a template I saw the usage of auto where the compiler will deduce the correct type but when we need to

Re: How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
One of the problems I'm facing from vibed (but I'm asking a general rule to help here and in other similar cases): protected void sendCollectionListAsDataArrayJson2(MongoCursor!(Bson,Bson,Bson) collection_list, HTTPServerResponse res) { if(!collection_list.empty) {

Re: How to declare a template type as parameter to functions

2014-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Nov 03, 2014 at 11:43:42PM +, Domingo via Digitalmars-d-learn wrote: Hello ! I could not find a clear way that show how to use template types as parameter to functions: There is a general rule to do it ? On several examples when the return type comes from a template I saw the

UDA failling to build when using delegate

2014-11-03 Thread bioinfornatics via Digitalmars-d-learn
Dear, why this code fail to build http://dpaste.dzfl.pl/8ef3898b05d2 ? I try to have a structure which is used to fill information from a file. And I use UDA to tell : to get this field you need to read from x to y using a delegate. thanks for your advise

Re: How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
Thanks for the answer ! But then I can see that using D style templates everywhere will prevent write generic code and what seems to be an innocent function call will explode to bloated mass of code. Like the simple function that I tried to write to not duplicate code is not worth because

Re: UDA failling to build when using delegate

2014-11-03 Thread bioinfornatics via Digitalmars-d-learn
On Monday, 3 November 2014 at 23:53:53 UTC, bioinfornatics wrote: Dear, why this code fail to build http://dpaste.dzfl.pl/8ef3898b05d2 ? I try to have a structure which is used to fill information from a file. And I use UDA to tell : to get this field you need to read from x to y using a

Re: How to declare a template type as parameter to functions

2014-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 04, 2014 at 12:29:54AM +, Domingo via Digitalmars-d-learn wrote: [...] Like the simple function that I tried to write to not duplicate code is not worth because I'll need to write one for each type of MongoCursor: 1 - MongoCursor!(Bson, Bson, typeof(null)) 2 -

Re: How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
Now I realize that what I said on the previous post is not correct. Based on the proposed use of typeof/alias we will need something like this: alias MongoCurosr3NUll = MongoCursor!(Bson, Bson, typeof(null)); alias MongoCursor3Bson = MongoCursor!(Bson, Bson, Bson); alias MongoCursor3IntStr

Re: How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
Thanks again this second explanation now is easier to understand as general rule for this case and future ones that I'll face in the future. I hope that this explanation would be added to the language reference where it explain functions: http://dlang.org/function With it there people will

Re: How to declare a template type as parameter to functions

2014-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 04, 2014 at 12:48:47AM +, Domingo via Digitalmars-d-learn wrote: Thanks again this second explanation now is easier to understand as general rule for this case and future ones that I'll face in the future. I hope that this explanation would be added to the language reference

Which SciD to use (if at all)?

2014-11-03 Thread uri via Digitalmars-d-learn
Hi All, I've just started using kyllingstad/scid but it hasn't been updated for a while and I just found a fork which references some GSoC work. Is SciD is still maintained and which should I use? https://github.com/kyllingstad/scid or https://github.com/cristicbz/scid Or is there an

Re: How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
Thanks again the bug issue is there at https://issues.dlang.org/show_bug.cgi?id=13677 But probably I should fork the repository and fix myself !

Re: How to declare a template type as parameter to functions

2014-11-03 Thread Domingo via Digitalmars-d-learn
Here is my pull request https://github.com/D-Programming-Language/dlang.org/pull/690 Please anyone feel free to improve it. Cheers !

manually call opUnary

2014-11-03 Thread Algo via Digitalmars-d-learn
Is it possible? As in { int a; a.opUnary!++(); } no property 'opUnary' for type 'int'

Re: manually call opUnary

2014-11-03 Thread Algo via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 07:19:05 UTC, Algo wrote: Is it possible? As in { int a; a.opUnary!++(); } no property 'opUnary' for type 'int' ((ref typeof(a) x) = ++x)(a); works

Re: manually call opUnary

2014-11-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/11/2014 8:19 p.m., Algo wrote: Is it possible? As in { int a; a.opUnary!++(); } no property 'opUnary' for type 'int' For primitives it doesn't look like it. To confirm this, we'll first figure out what TypeInfo is used for it: pragma(msg, typeid(int).name); /d133/f260.d(16):

Re: manually call opUnary

2014-11-03 Thread Algo via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 07:49:15 UTC, Rikki Cattermole wrote: On 4/11/2014 8:19 p.m., Algo wrote: Is it possible? As in { int a; a.opUnary!++(); } no property 'opUnary' for type 'int' For primitives it doesn't look like it. To confirm this, we'll first figure out what