how to correctly 'typedef' handle types

2014-06-19 Thread midi via Digitalmars-d-learn
import std.stdio; import core.sys.windows.windows; int main(string[] argv) { HGDIOBJ h; // Compile error: // Error 1 Error: main.foo called with argument types (void*) matches both: D:\Projetos-D\ConsoleApp1\main.d 12 // Error2 main.foo(void* h) D:

std.algorithm.splitter on string inserts \\ for every occurrence of \

2014-06-19 Thread WhatMeWorry via Digitalmars-d-learn
string path = environment["PATH"]; // get the value of the env variable PATH. writeln("Path is ", path); writeln(); auto paths = std.algorithm.splitter(path, ";"); writeln("Paths are ", paths); Path is E:\dmd2\windows\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32... Paths are ["E

Re: std.algorithm.splitter on string inserts \\ for every occurrence of \

2014-06-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 20 June 2014 at 02:41:06 UTC, WhatMeWorry wrote: The function is perfect except it converts \ to \\. The function isn't doing that conversion, that's just because when you do writeln() on a range or array, it prints it out in a format that can be read back. That's also why it put t

Re: how to store a range transformed by a range function?

2014-06-19 Thread Vlad Levenfeld via Digitalmars-d-learn
Thank you. This would work, however I'm wary of a class-based solution. InputRangeObject.save() calls new and it appears opSlice is unimplemented for some technical reasons... I think perhaps, since my case is more specialized than the use cases InputRangeObject is meant for, wrapping some kind

Re: how to store a range transformed by a range function?

2014-06-19 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jun 19, 2014 at 08:02:39PM +, Vlad Levenfeld via Digitalmars-d-learn wrote: [...] > For example, lets say I had a couple of managed arrays of doubles, and > I had some computational path that, at some point, took these two > ranges and zipped them before passing them along. At that nod

how to store a range transformed by a range function?

2014-06-19 Thread Vlad Levenfeld via Digitalmars-d-learn
I've got an app that uses a custom range type over some preallocated arrays. These arrays are accessed through a getter fuction (supplied by the struct that is maintaining a unique reference to the array) that returns a T[]. Typical usage involves a source range, target range, and a graph of

Re: Tango Server Example

2014-06-19 Thread JJDuck via Digitalmars-d-learn
I solved it. void main() { const int port = 8080; auto server = new ServerSocket (new IPv4Address(port)); Cout("server started").flush; while (true ) { // wait for requests auto request = server.accept; // wr

Re: dub "--annotate" option

2014-06-19 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 19 June 2014 at 17:45:56 UTC, FreeSlave wrote: Dub has option called "--annotate". It's described like this: Do not perform any action, just print what would be done I supposed it's something similar to "-n" option of Jam build system (I really like this feature). But dub's "annot

Re: Some kind of RPC exists for D?

2014-06-19 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 19:24:03 UTC, Bienlein wrote: Hello, I'm looking for a way to do some kind of RPC in D. Some way of being able to say aFoo.bar(int i, ...) with receiver object and method being marshalled at the sender's site and being unmarshalled and invoked at the receiver's s

dub "--annotate" option

2014-06-19 Thread FreeSlave via Digitalmars-d-learn
Dub has option called "--annotate". It's described like this: Do not perform any action, just print what would be done I supposed it's something similar to "-n" option of Jam build system (I really like this feature). But dub's "annotate" prints nothing. So what is that? I have DUB version 0.9

Re: DMD Fails with fPIC error

2014-06-19 Thread Mike Wey via Digitalmars-d-learn
On 06/18/2014 08:51 AM, Reuben wrote: On Sunday, 15 June 2014 at 09:08:10 UTC, Mike Wey wrote: In that case the static Phobos needs to be build with -fPIC, which currently isn't the case looking at the Ebuild. Compiling DMD with PIC=1 doesn't seem to do the trick. -fPIC is used for the C files

Re: Working on a library: request for code review

2014-06-19 Thread Mike via Digitalmars-d-learn
Once again thanks for the feedback. The RLE rewrite using std is impressive! I will use it today or tomorrow, great stuff.

Re: Tango Server Example

2014-06-19 Thread JJDuck via Digitalmars-d-learn
I modify the server program as follow and it works ok. But how do I use thread to expedite the execution? void main() { const int port = 8080; auto server = new ServerSocket (new IPv4Address(port)); Cout("server started"); while (true ) {

Re: DUB linking problem on WinXp

2014-06-19 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 19 June 2014 at 15:12:10 UTC, Orfeo wrote: The problem was on ddb 0.2.1 ... if I remove it I can compile Did you try a full rebuild? dub --force sometimes helps, especially when you've upgraded your compiler.

Tango Server Example

2014-06-19 Thread JJDuck via Digitalmars-d-learn
reference: Tango Server: http://www.dsource.org/projects/tango/wiki/SocketServerExample Tango Client: http://www.dsource.org/projects/tango/wiki/SocketHelloExample I'm referring to these two examples. In the server Example, I strip off the client part and it becomes as follow. void main() {

Re: Run child process with null stdin/stdout

2014-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wed, 18 Jun 2014 16:15:40 -0400, David Nadlinger wrote: On Wednesday, 18 June 2014 at 20:00:43 UTC, Justin Whear wrote: For POSIX, seems like you could pass `File("/dev/null", "r")` for stdin and `File("/dev/null", "w")`. On Windows I believe you can use `File ("nul")` for the same effec

Re: rehabilitating Juno

2014-06-19 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 19 June 2014 at 13:06:15 UTC, Jason King wrote: This is specifically for Jesse K Phillips, Jesse, It appears we're both interested in Juno. You lack time and I lack D experience. What could a D clown do for your juno repository to get it functional again. The last time I grabbe

Re: DUB linking problem on WinXp

2014-06-19 Thread Orfeo via Digitalmars-d-learn
The problem was on ddb 0.2.1 ... if I remove it I can compile

Re: Some kind of RPC exists for D?

2014-06-19 Thread Dicebot via Digitalmars-d-learn
On Thursday, 19 June 2014 at 13:54:01 UTC, David Nadlinger wrote: On Thursday, 19 June 2014 at 12:13:12 UTC, Dicebot wrote: However if you application design implies thousands of RPC calls per second it is quite likely performance won't be good with any RPC implementation :) Backend people at

Re: How to I call D code from C# Project?

2014-06-19 Thread SomeRiz via Digitalmars-d-learn
I know it but I can not do without the drag-and-drop. (Design etc..)

Re: How to I call D code from C# Project?

2014-06-19 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 20:55:09 UTC, GoD wrote: D, very fast programming language. But I can not WinForm applications from D. I'm using C# for WinForm applications. DWT and TkD didn't work for you?

Re: Some kind of RPC exists for D?

2014-06-19 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 19 June 2014 at 12:13:12 UTC, Dicebot wrote: However if you application design implies thousands of RPC calls per second it is quite likely performance won't be good with any RPC implementation :) Backend people at Google, Facebook, and others would beg to disagree. ;) Of cours

Re: DUB linking problem on WinXp

2014-06-19 Thread Orfeo via Digitalmars-d-learn
Thank you for your reply... On Thursday, 19 June 2014 at 12:28:31 UTC, Mathias Lang wrote: >8 AFAIK, D is not officially supported on Win XP. >8 The strange thing is that it worked yesterday and not today. I have also tried with Win7 64bit (on Vi

Re: Link to C library

2014-06-19 Thread monnoroch via Digitalmars-d-learn
Oh, found a problem, it was about one more layer of pointer indirection.

rehabilitating Juno

2014-06-19 Thread Jason King via Digitalmars-d-learn
This is specifically for Jesse K Phillips, Jesse, It appears we're both interested in Juno. You lack time and I lack D experience. What could a D clown do for your juno repository to get it functional again. The last time I grabbed the code and ran it vs. current D compiler I got a whole bu

Link to C library

2014-06-19 Thread monnoroch via Digitalmars-d-learn
I can't link to libjvm.so. Here's my code: extern (C) { int JNI_CreateJavaVM(void ** pvm, void ** penv, void * args); } void main() { writefln("0x%x", &.JNI_CreateJavaVM); } Which ptints wrong stuff. When then i use it and check the contents of **pvm is also prints wrong stuff f

Re: Working on a library: request for code review

2014-06-19 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 19 June 2014 at 12:06:58 UTC, Marc Schütz wrote: On Wednesday, 18 June 2014 at 14:05:12 UTC, Rene Zwanenburg wrote: On Tuesday, 17 June 2014 at 13:07:33 UTC, Marc Schütz wrote: On Monday, 16 June 2014 at 23:04:33 UTC, Rene Zwanenburg wrote: This one depends on taste, but these help

Re: DUB linking problem on WinXp

2014-06-19 Thread Mathias Lang via Digitalmars-d-learn
On Thursday, 19 June 2014 at 12:18:54 UTC, Orfeo wrote: Under WinXp I got the following AFAIK, D is not officially supported on Win XP. That's probably why you don't have a meaningful stacktrace or error message.

DUB linking problem on WinXp

2014-06-19 Thread Orfeo via Digitalmars-d-learn
I've this dub.json { "name": "ega_editor", "description": "Editor for ega database", "targetType": "executable", "targetPath": "bin", "dependencies": { "sdlang-d": ">=0.8.4", "ddb": ">=0.2.1", "dejector": "~master",

Re: Some kind of RPC exists for D?

2014-06-19 Thread Dicebot via Digitalmars-d-learn
On Thursday, 19 June 2014 at 10:25:08 UTC, Bienlein wrote: vibe.web.rest server/client combo is effectively RPC over HTTP/json This looks good. For what am I'm thinking of doing performance is important. In that way rest makes me think a bit or is this only a prejudice from the Java world?

Re: Working on a library: request for code review

2014-06-19 Thread via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 14:05:12 UTC, Rene Zwanenburg wrote: On Tuesday, 17 June 2014 at 13:07:33 UTC, Marc Schütz wrote: On Monday, 16 June 2014 at 23:04:33 UTC, Rene Zwanenburg wrote: This one depends on taste, but these helpers can be eliminated by changing the Header definition a litt

Re: How to I call D code from C# Project?

2014-06-19 Thread Andre Artus via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 20:55:09 UTC, GoD wrote: Hi. I want use my D code in C# How can I do this? D, very fast programming language. But I can not WinForm applications from D. I'm using C# for WinForm applications. But, also i want to use D code for my project. for example; I'm see

Re: Some kind of RPC exists for D?

2014-06-19 Thread Bienlein via Digitalmars-d-learn
What I want to do is some little framework that allows Julia-style (julialang.org) distributed computation: send some function invocation to some other machine along with the numbers to be crunched and get the result back. vibe.web.rest server/client combo is effectively RPC over HTTP/json

Re: Concurrency on Windows (spawn)

2014-06-19 Thread Chris via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 15:23:11 UTC, Kapps wrote: On Wednesday, 18 June 2014 at 15:03:55 UTC, Ali Çehreli wrote: On 06/18/2014 06:28 AM, Chris wrote: On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote: Windows: in a D-DLL I'm trying to spawn a thread. However, nothing happens aut

Re: Placement of shared does not allow to set a delegate

2014-06-19 Thread Tolga Cakiroglu via Digitalmars-d-learn
Yes the understanding is correct. I simplified the code a little: IMPORTANT: DMD 2.065 is used. class Car{ void delegate() onEvent; } class Test{ this() shared { auto car = new shared Car(); assert( typeid( car.onEvent ).toString() == "shared(void dele

Re: how can I ensure that a template instantiation is unique?

2014-06-19 Thread Vlad Levenfeld via Digitalmars-d-learn
Thanks! Mixin strings can punch through anything.

Re: how can I ensure that a template instantiation is unique?

2014-06-19 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 19 June 2014 at 05:48:24 UTC, Vlad Levenfeld wrote: I'm instantiating a couple of template structs that conflict with each other. I'd like them to be unique types, automatically. So I tried this: template Foo (string unique_id = __FILE__~__LINE__.to!string) {...} but it didn't wo

Re: how can I ensure that a template instantiation is unique?

2014-06-19 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 19 June 2014 at 07:26:12 UTC, Andrea Fontana wrote: On Thursday, 19 June 2014 at 05:48:24 UTC, Vlad Levenfeld wrote: I'm instantiating a couple of template structs that conflict with each other. I'd like them to be unique types, automatically. So I tried this: template Foo (strin