Re: Strange socket error

2010-12-24 Thread Bob Cowdery
t's getting interrupted from someone who knows the language and library implementation. Regards Bob On 23/12/2010 18:28, Bob Cowdery wrote: > Hi > All communication is appreciated. I often find just trying to explain a > problem can lead to fixing it. Sorry this is a bit rambling. &

Re: Strange socket error

2010-12-23 Thread Bob Cowdery
e I quite understand the structure of your > app, and where in this structure the bug happends. Is this bug happening when > your html/5-client tries to connect to the server? Or are the threads using > sockets to communicate between eachother? > > > BR > /heywood > > &g

Re: Strange socket error

2010-12-23 Thread Bob Cowdery
gt; connection and the program prints "end". > > I don't know why the program doesn't do this on Windows. As far as I can tell > the endless exceptions _is_ the correct behaviour, right? > > Anyway, if you comment out the the line > listener.blocking = fals

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 co

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. T

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 s

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 data

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 any

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 D

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[] = (x_average[0][]+x_average[1][]+x_average[2][]+x_average[3][]+x_average[4][]+x_avera

Re: std.json

2010-11-10 Thread Bob Cowdery
To answer my own question 'value.object["mode"].str' gets me there. bob On 09/11/2010 21:12, Bob Cowdery wrote: > 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 ob

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

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 pret

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 pa

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:43, Simen kjaeraas wrote: > Bob Cowdery 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

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 wrote: >> >>> On 12/10/2010 20:29, Simen kjaeraas wrote: >>>> Bob Cowdery wrote: >>>> >>>>> x_points[] >>>>>

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 21:11, Simen kjaeraas wrote: > Bob Cowdery wrote: > >> On 12/10/2010 20:29, Simen kjaeraas wrote: >>> Bob Cowdery wrote: >>> >>>> x_points[] >>>> =(x_average[0]+x_average[1]+x_average[2]+x_average[3]+x_average[4]+x_average[5]

Re: Array-wise operations

2010-10-12 Thread Bob Cowdery
On 12/10/2010 20:29, Simen kjaeraas wrote: > Bob Cowdery 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 give

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 x_ave

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

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 { >> sta

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: 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 > wrote: > >> On 05/10/2010 13:45, Denis Koroskin wrote: > >>> "static this" is called a static constructor and can be used for >>> classes

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 > 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: >>> >

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 >> wrote: >> >>> On 05/10/2010 12:13, Denis Koroskin wrote: >>&g

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 >> wrote: >> >>> On 05/10/2010 12:04, Denis Koroskin wrote: >>>> On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery &g

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 > wrote: > >> On 05/10/2010 12:04, Denis Koroskin wrote: >>> On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery >>> wrote: >>> >>>> On 05/10/2010 11:

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 > wrote: > >> On 05/10/2010 11:45, Denis Koroskin wrote: >>> On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery >>> wrote: >>> >>>> I can'

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 > 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. >> >>

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

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 b

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

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. Th

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 SRC_1{

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

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 patt

Re: Immutable woes

2010-09-21 Thread Bob Cowdery
010 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 appro

Re: Immutable woes

2010-09-21 Thread Bob Cowdery
Thanks, that at least builds now. I didn't see that trick in the book but I've found it on the on-line library ref under std.exception. I can't say I understand why its under std.exception. bob On 21/09/2010 08:48, Simen kjaeraas wrote: > Bob Cowdery wrote: > >&

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 t

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 rec

Re: Problems with receive

2010-08-29 Thread Bob Cowdery
On 29/08/2010 19:17, Stanislav Blinov wrote: > Bob Cowdery wrote: >> 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 kno

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: 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 <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

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 >

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 fo

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

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-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

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 >>

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 g

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

2010-08-20 Thread Bob Cowdery
de::Blocks 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

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 dm

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 com

Can't get D calling C to build.

2010-08-19 Thread Bob Cowdery
Hi Just trying to get started and need a little advice. First up was selecting an IDE, tried a few and settled on Code::Blocks. I need Windows and Linux and also C and D supported in the same IDE. The support does not seem to be finished in Code::Blocks though, does it really not have syntax high