Re: need data capture, stat analysis, graph display software for PC
- From: "John Barrett" <ke5crp1@xxxxxxxxxxx>
- Date: Fri, 23 Mar 2007 21:54:45 GMT
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:hiXMh.7865$F82.403@xxxxxxxxxxxxxxxxxxxxxxx
"John Barrett" <ke5crp1@xxxxxxxxxxx> wrote in message
news:qJWMh.1554$un.161@xxxxxxxxxxx
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:dyVMh.17081$2F5.9747@xxxxxxxxxxxxxxxxxxxxxxx
"John Barrett" <ke5crp1@xxxxxxxxxxx> wrote in message
news:rdUMh.100$un.40@xxxxxxxxxxx
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:ZbHMh.8121$Kk5.859@xxxxxxxxxxxxxxxxxxxxxxx
"John Barrett" <ke5crp1@xxxxxxxxxxx> wrote in message
news:SoFMh.10724$8B1.2161@xxxxxxxxxxx
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:gNEMh.17020$2F5.756@xxxxxxxxxxxxxxxxxxxxxxx
....
I was thinking more realtime than logging to files -- think about
having the com thread pump the data to a writer thread in that case
:) sounds like you may end up with 3 or 4 threads sharing the load,
which is a good thing IMO -- as threads that are idle dont take
resources -- event driven makes life much simpler
might also look at the background worker class -- it encapsulates a
lot of the crap for starting a worker thread as needed and getting
notified when it completes
I dragged that very class right of the IDE toolbar into the project.
same with the serial class.
3 or 4 threads is probably about right.
I need to save the data regardless anyway.
I could have the analysis done after all the data is gathered but
realy
would like to see how well its progressing so i can catch anything
going wrong and not waste days colecting duff data.
I found a Queue wich can transfer objects between threads
took me a while to figure out I needed to actualy create an instance
of it with new.
works but I gues I need to protect it with lock and I need to have
something to wait on.
I tried the messaging thing but it complains its not installed on my
pc.
the sockets seem primitive as they stil rely on byte streams,
although come to think of it that is actually all what I have anyway.
cant beleive they havnt put in some sort of decent inter thread
message queue.
although theres a few examples of how to implemet one about.
cant even send them as simple windows event messages like with mfc.
Colin =^.^=
ya -- they dont make the collection classes thread-safe for performance
reasons -- they figure anyone that needs it thread safe can create a
wrapper class derived from the collection and override the key methods
to implement locking
If by messaging, you are talking about MSMQ -- thats a bit overkill for
this --
ah ok I guesed it was something a bit more complicated.
just create a protected queue class and go from there --
done that.
its easy enough to add events to the class so that the reciever can get
notification when data is available. You dont need to "wait" on
anything -- just have each class set up its event handlers in the
constructor, and leave the instance to sit until an event occurs.
erm easy if you know how I gues, I didnt come accross events so far,
im using the workerthread things dragged from the toolbox so I kind
bypased the constructor details.
I used System.Threading.AutoResetEvent, to wait for the queue to become
non empty,
wich is actually easy enough.
"simple windows event messages" -- why get the OS involved with the
notifications ?? I can understand how you would feel that WM is simple
given your MFC background, but you are pushing your message out of
process when it really doesnt need to. using WM like that was a "lazy"
solution for people that didnt want to write thread safe code, or didnt
undestand mutual exclusion locks and syncronization. Not that I didnt
use it when I was writing win apps in C++, but it really wasnt the
right way to solve the problem :)
but it sounds like these event handlers you mention before do the
equivalent of
what the old win32 messages do wich is what I was looking for,
but just with the strong type control thats needed ?
windows messages wasnt realy a lazy solution as they were the underlying
fabric of mfc.
they were not only used to talk from task to task but mostly within the
same task.
although there was the problem of ensuring what was responsible for the
allocated memory
wich c# takes care of.
I find it hard to beleive the functionality of sscanf isnt in c#
I found loads of articles of people trying to convert c++ code into c#
and loads of people trying to answer but getting tied into knots with
saying you just use
regex or tryparse without realy knowing how to exactly,
but these are either rather low level or overkill.
trying to parse my variables wich are seperated with a variety of
delimiters for clarity
is irritating without an equivalent.
I tried to make a function template but it wouldnt let me access the
right
TryPars member from the template. So i have one for each type. it works
anyway.
thanks
Colin =^.^=
To create an event
1. create a "public delegate <method prototype>;" outside the class that
will have the event... inside the class -- add a "public event <delegate
method name> <event name>;"
2. any place in the class where you want to fire the event, add "if
(<event name> != null) <event name>(delegate params);"
3. in any class that you want to handle the event, add "object.<event
name> += handler;"... the IDE will create the handler stub for you if you
hit tab twice after the +=
the delegate defines the parameters that will be passed, the event
statement defines the variable that will contain the list of handlers to
be invoked when the event is fired. Since delegates are typed, you can
pass any number/type of parameters that you like -- no limitations :)
cool thanks, although my autoreset works ok but il def look at that too.
although I initialy forgot to reset the thing if I didnt have to wait
then i forgot to check to not reset it if there was more there,
id forget my head if .. oh wait ...
Re sccanf == ya -- that doesnt really fit into the java/c# paradigm --
you've probably already found this or something similar -- but here is a
regex based sccanf for c#
http://www.codeproject.com/csharp/CsScanf.asp
Yeah I saw that in a google search, scaned through about 10- pages of
stuff and thought geez
my brain is already starting to melt trying to take in new lang dev system
etc.
all i want to do is 1 line like sscanf(s,"%d:%s:%d,%d|%d,%d\n"...
I could porobably write a whole sscanf function in less time it takes to
read and digest all that.
I remember long ago it only took me a few hours to write a whole sprintf()
wich was reentrant friendly.
sscanf was realy out of place in c++ too, I gues its time it went, but not
in quite this way.
Instead I wrote a function wich just tryParse 1 variable at a time with
given delimter and skip chars,
and wich advances the string to the next unread point. I only need int and
string so no biggy.
works like a charm as the format can change depending on what %s is
anyway.
Im sure regex is realy powerful though.
Its interesting that c# is an awkward name as # is an often an illegal
char eg in wikipedia as a title.
havnt got the hang of thinking csharp yet :s
Aso I couldnt find c# in any of the .lang newsgroups ?
This thread has become purly software now,
I hope its not trying the patience of those who like to make noises
about keeping this group on topic too much.
But im probably on my way to seeing it through now anyway so thanks for
you much appreciated help :)
Theres probably a lot il not know about c# even after ive finished.
Colin =^.^=
It took me about 2 years to become really proficient, and had C++ and java
background going in -- there will always be a learning curve !!
good luck with the rest of the project !!
.
- Follow-Ups:
- References:
- need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: Wim Ton
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- need data capture, stat analysis, graph display software for PC
- Prev by Date: Re: OT: orbits in space
- Next by Date: Re: Divide by 200 single IC
- Previous by thread: Re: need data capture, stat analysis, graph display software for PC
- Next by thread: Re: need data capture, stat analysis, graph display software for PC
- Index(es):
Relevant Pages
|