Re: Strange socket error

2010-12-23 Thread Bob Cowdery
this will cause the listener.accept()-call to actually wait until it gets a connection, and thus not spew out all the exceptions. BR /heywood Bob Cowdery Wrote: Hi all, This is a long shot but I'm out of ideas. I ported an app from Windows to Linux and after many issues it is working

Re: Strange socket error

2010-12-22 Thread Bob Cowdery
On 21/12/2010 22:22, Jérôme M. Berger wrote: Bob Cowdery wrote: Hi all, This is a long shot but I'm out of ideas. I ported an app from Windows to Linux and after many issues it is working but I'm left with a strange problem. The app basically reads data streams from a USB device, processes

Re: Strange socket error

2010-12-22 Thread Bob Cowdery
On 22/12/2010 10:04, Jérôme M. Berger wrote: Bob Cowdery wrote: The listner is a single thread that creates an instance of my web socket class for each connection. I'm not trying to support lots of users, most of the time just one. The listner code is almost the same as the sockets example

Strange socket error

2010-12-21 Thread Bob Cowdery
Hi all, This is a long shot but I'm out of ideas. I ported an app from Windows to Linux and after many issues it is working but I'm left with a strange problem. The app basically reads data streams from a USB device, processes them and outputs real-time graphical data to a browser. There is also

Segmentation faults on Linux

2010-12-18 Thread Bob Cowdery
Hi I'm in the middle of porting a working D with C application from Windows to Linux (Ubuntu 10.04). I've been tracking down segmentation faults and it seems that any pointer reference from C back to D is causing a crash. Even passing the address of an int causes a segmentation fault when the

DMD and C compatibility on Linux

2010-11-27 Thread Bob Cowdery
I've just started to get organised to port my project from Windows to Ubuntu. I see there is now a DMD for Linux which I have installed. My question is can anyone tell me what I need to build the C libraries in to be compatible. On Windows I had to use DMC or convert the libraries. As there is no

Re: DMD and C compatibility on Linux

2010-11-27 Thread Bob Cowdery
On 27/11/2010 22:11, Jonathan M Davis wrote: On Saturday 27 November 2010 14:04:26 Bob Cowdery wrote: I've just started to get organised to port my project from Windows to Ubuntu. I see there is now a DMD for Linux which I have installed. My question is can anyone tell me what I need to build

Bemused by this build error

2010-11-14 Thread Bob Cowdery
Hi I copied a module because I am changing its form. The original is still in the build but is a different package and class name. The closest thing I can think it might be talking about is this line: x_points[] =

std.json

2010-11-09 Thread Bob Cowdery
Hi I'm trying to decode some json using std.json. I have figured out how to get at primitives out but can't get to a dictionary object. If I send something like {mode:am} from my javascript and then say: value = parseJSON(message); I get a JSONValue struct. I can't find any documentation for

string ~ ubyte

2010-10-31 Thread Bob Cowdery
Hi I'm implementing a web sockets server as part of the UI for my application. It's almost working but the connection closes on me just after the handshake. I'm pretty sure the handshake response I'm sending is incorrect. This is the last bit of the code (I've missed ot the bit that creates the

Re: string ~ ubyte

2010-10-31 Thread Bob Cowdery
On 31/10/2010 13:13, div0 wrote: On 31/10/2010 11:36, Bob Cowdery wrote: Hi I'm implementing a web sockets server as part of the UI for my application. It's almost working but the connection closes on me just after the handshake. I'm pretty sure the handshake response I'm sending

Array-wise operations

2010-10-12 Thread Bob Cowdery
I'm trying to implement some array-wise operations. // I have an array of float values that need to be averaged over a 10 cycle period. float x_points[600]; float x_average[600][10]; int ptr = 0; // I accumulate one cycle in x_points and add that into a circular array of the last 10 cycles

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 20:29, Simen kjaeraas wrote: Bob Cowdery b...@bobcowdery.plus.com wrote: x_points[] =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+ x_average[6]+x_average[7]+x_average[8]+x_average[9])/10; The average gives me a compile error of incompatible

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:11, Simen kjaeraas wrote: Bob Cowdery b...@bobcowdery.plus.com wrote: On 12/10/2010 20:29, Simen kjaeraas wrote: Bob Cowdery b...@bobcowdery.plus.com wrote: x_points[] =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]+ x_average[6

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:25, Bob Cowdery wrote: On 12/10/2010 21:11, Simen kjaeraas wrote: Bob Cowdery b...@bobcowdery.plus.com wrote: On 12/10/2010 20:29, Simen kjaeraas wrote: Bob Cowdery b...@bobcowdery.plus.com wrote: x_points[] =(x_average[0]+x_average[1]+x_average[2]+x_average[3

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:43, Simen kjaeraas wrote: Bob Cowdery b...@bobcowdery.plus.com wrote: x_average[ptr] = x_points; // tells me array length don't match. When I print x_average[ptr] or x_average[][ptr] or x_average[ptr][] they all tell me the length is 10. What do I have to do to get

Re: Static problem

2010-10-08 Thread Bob Cowdery
On 07/10/2010 21:32, Stanislav Blinov wrote: Steven Schveighoffer wrote: What I'd propose is either: 1) Create your own lock-free associative array (yup, reinvent the wheel to introduce AA to the world of 'shared') 2) In this small case it may seem best (though mind that often such cases

Static problem

2010-10-07 Thread Bob Cowdery
Can someone sort out what I'm doing wrong here please. - import std.concurrency, std.stdio; import Definitions.procNames; class CRegistry { static Tid[E_PROC] TidRegistry; static void register(E_PROC name, Tid tid) { writeln(TidRegistry); TidRegistry[name] =

Re: Static problem

2010-10-07 Thread Bob Cowdery
On 07/10/2010 20:33, Stanislav Blinov wrote: Bob Cowdery wrote: Can someone sort out what I'm doing wrong here please. - import std.concurrency, std.stdio; import Definitions.procNames; class CRegistry { static Tid[E_PROC] TidRegistry; static void register(E_PROC

Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
I can't seem to get any sense out of associative arrays. Even the simplest definition won't compile so I must be doing something daft. int[string] aa = [hello:42]; Error: non-constant expression [hello:42] What exactly is not constant about this. The example is straight out the book. Using D

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 11:45, Denis Koroskin wrote: On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: I can't seem to get any sense out of associative arrays. Even the simplest definition won't compile so I must be doing something daft. int[string] aa = [hello:42

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 12:04, Denis Koroskin wrote: On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 11:45, Denis Koroskin wrote: On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: I can't seem to get any sense out

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 12:13, Denis Koroskin wrote: On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 12:04, Denis Koroskin wrote: On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 11:45, Denis Koroskin wrote

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 12:40, Bob Cowdery wrote: On 05/10/2010 12:13, Denis Koroskin wrote: On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 12:04, Denis Koroskin wrote: On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 13:05, Denis Koroskin wrote: On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin 2kor...@gmail.com wrote: On Tue, 05 Oct 2010 15:40:39 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 12:13, Denis Koroskin wrote: On Tue, 05 Oct 2010 15:08:39 +0400, Bob

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 13:45, Denis Koroskin wrote: On Tue, 05 Oct 2010 16:32:14 +0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 13:05, Denis Koroskin wrote: On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin 2kor...@gmail.com wrote: On Tue, 05 Oct 2010 15:40:39 +0400, Bob

Re: Associative arrays give compile error

2010-10-05 Thread Bob Cowdery
On 05/10/2010 15:14, Steven Schveighoffer wrote: On Tue, 05 Oct 2010 09:00:13 -0400, Bob Cowdery b...@bobcowdery.plus.com wrote: On 05/10/2010 13:45, Denis Koroskin wrote: static this is called a static constructor and can be used for classes and modules. The code in static constructor

Re: Send never returns

2010-10-01 Thread Bob Cowdery
On 01/10/2010 02:42, Jonathan M Davis wrote: On Thursday 30 September 2010 14:21:24 Bob Cowdery wrote: Is this a bug? I've tracked down this particular issue. It seems that if a thread (B) is spawned from another thread (A) then A can message B but if B tries to message A it never returns

Send never returns

2010-09-30 Thread Bob Cowdery
Hi I'm just starting to debug some code and have run into a problem. There is a bit too much code to post so as a first shot I wondered if anyone has had this happen. I have a thread in a read loop reading from a USB device. When it accumulates enough data it dispatches it to another thread.

Re: Send never returns

2010-09-30 Thread Bob Cowdery
On 30/09/2010 20:58, Jonathan M Davis wrote: On Thursday 30 September 2010 12:13:02 Bob Cowdery wrote: Hi I'm just starting to debug some code and have run into a problem. There is a bit too much code to post so as a first shot I wondered if anyone has had this happen. I have a thread

Dispatching from receive to a function

2010-09-27 Thread Bob Cowdery
I've been looking for a way to hook up messages to a thread with a handler function. As far as I can tell receive pattern matching only allows the pattern to be distinguished by the parameter signature which does not help when all the handlers only have a few different signatures. I like the

Re: Dispatching from receive to a function

2010-09-27 Thread Bob Cowdery
: On 27.09.2010 15:07, Bob Cowdery wrote: Failing that I think a dispatcher structure using an associative array would be my next choice. However I'm getting stuck on how to define and use an array which maps a string key to a delegate. Can someone help me out there please. I will then effectively have my

Re: Dispatching from receive to a function

2010-09-27 Thread Bob Cowdery
Thanks for the suggestions. I'm still hankering after an elegant solution to the receive rather than try to patch it up after the event. The best I can come up with is pretty ugly (odd) at the front but looks better at the back-end. Maybe someone can refine it a bit. struct RATE{}; struct

Immutable woes

2010-09-21 Thread Bob Cowdery
Hi I'm stuggling with immutable. I have a fixed size buffer which is used as a circular buffer of floats and is effectively double buffering data I wish to transfer to another thread. At an appropriate point I take the top half or bottom half of the buffer and send it to another thread. To do

Re: Immutable woes

2010-09-21 Thread Bob Cowdery
09:29 AM, Bob Cowdery wrote: Hi I'm stuggling with immutable. I have a fixed size buffer which is used as a circular buffer of floats and is effectively double buffering data I wish to transfer to another thread. At an appropriate point I take the top half or bottom half of the buffer

Problems with receive

2010-08-29 Thread Bob Cowdery
Hi I'm trying out some very simple concurrency tests to make sure I understand how it operates. However I'm having a few problems. I'm sure this is just lack of knowledge. I dont know enough to debug these things on my own yet. Bob The test below builds but does not output anything so I assume

Re: Problems with receive

2010-08-29 Thread Bob Cowdery
On 29/08/2010 20:17, Stanislav Blinov wrote: Stanislav Blinov wrote: I'm not sure about Variant part yet (never tried it myself) Hmm, after some inspection I can say this is an implementation issue. You'll find that there are cases when what's told in TDPL doesn't work (see recent msg[0]

Re: Can't get D calling C to build.

2010-08-27 Thread Bob Cowdery
On 26/08/2010 21:43, Philippe Sigaud wrote: On Tue, Aug 24, 2010 at 15:24, Bob Cowdery b...@bobcowdery.plus.com mailto:b...@bobcowdery.plus.com wrote: I might be on my way :-) . Good :) I just skimmed through the thread, so I don't know if you're still using Code::Blocks. I'm using

Re: Can't get D calling C to build.

2010-08-24 Thread Bob Cowdery
On 23/08/2010 23:04, bearophile wrote: Andrej Mitrovic: I haven't read the specifics of your problem yet, but have you tried using the newer TDM port of MinGW? The MinGW binaries are still using an older port of GCC, but the TDM version is much newer, so it might be worth trying it out.

Re: Can't get D calling C to build.

2010-08-23 Thread Bob Cowdery
On 22/08/2010 22:16, Bob Cowdery wrote: On 22/08/2010 20:57, bearophile wrote: Bob Cowdery: Well, the link still works but the download is 0 bytes so I guess its not available. Thanks for the thought. That links works for me :-) Be happy, bye, bearophile Works if I paste

Re: Can't get D calling C to build.

2010-08-23 Thread Bob Cowdery
On 23/08/2010 20:24, Bob Cowdery wrote: On 22/08/2010 22:16, Bob Cowdery wrote: On 22/08/2010 20:57, bearophile wrote: Bob Cowdery: Well, the link still works but the download is 0 bytes so I guess its not available. Thanks for the thought. That links works for me :-) Be happy, bye

Re: Can't get D calling C to build.

2010-08-22 Thread Bob Cowdery
On 22/08/2010 00:54, div0 wrote: On 21/08/2010 22:07, Bob Cowdery wrote: On 20/08/2010 18:44, div0 wrote: On 20/08/2010 09:17, Bob Cowdery wrote: I'm still concerned it's a bit too soon as a lot of things seem to be either Windows or Linux (cmake says its only tested for *nix

Re: Can't get D calling C to build.

2010-08-22 Thread Bob Cowdery
On 21/08/2010 22:41, Johannes Pfau wrote: On 21.08.2010 23:07, Bob Cowdery wrote: For me at least I'm wondering if it stacks up. Linux support seems secondary (correct me if I'm wrong). The only painless way to use C libraries is as dll's and even then the import library must be converted

Re: Can't get D calling C to build.

2010-08-22 Thread Bob Cowdery
On 22/08/2010 20:57, bearophile wrote: Bob Cowdery: Well, the link still works but the download is 0 bytes so I guess its not available. Thanks for the thought. That links works for me :-) Be happy, bye, bearophile Works if I paste it but not straight from the email,odd.

Re: Can't get D calling C to build.

2010-08-21 Thread Bob Cowdery
On 20/08/2010 18:44, div0 wrote: On 20/08/2010 09:17, Bob Cowdery wrote: I'm still concerned it's a bit too soon as a lot of things seem to be either Windows or Linux (cmake says its only tested for *nix) but not both and there is very little guidance on building. I really want to get

Re: Can't get D calling C to build.

2010-08-20 Thread Bob Cowdery
Thanks for the replies. I've bounced off D a few times because it didn't seem ready to risk a whole development. I should have mentioned I'm trying this on Windows 7. I did suspect object formats were incompatible but as you say would have expected a decent error message. I also tried from the

Re: Can't get D calling C to build.

2010-08-20 Thread Bob Cowdery
On 20/08/2010 06:51, Kagamin wrote: Bob Cowdery Wrote: Now I've tried this with just D code and it writes the output and runs so I know something works. Does anyone know where to look, is it Code::Blocks, compiler, stupidity (probably). On windows dmd uses ancient OMF object format, but gcc

Re: Can't get D calling C to build.

2010-08-20 Thread Bob Cowdery
has led me a right old game by adding in switches the compiler doesn't understand. Eventually got it configured to use the dmc and dmd toolchains and managed to build and link in a C library. Some progress at last. bob On 20/08/2010 09:54, Bob Cowdery wrote: On 20/08/2010 06:51, Kagamin wrote