|
OK, while I can see what you've done here, I would have to question why you've done it. Is it that the ActiveX components are interfering with each other being STA? Are they responsible for processing the feed? Before we can offer further advice, we really need to know why you are having to work around your controls.
|
|
|
|
|
I'm flattered to be included in that list
|
|
|
|
|
I still don't think you want the forms in separate threads. Do the market processing in separate threads, sure – since they're independent and of roughly equal processing intensity, that is a natural division of effort that makes a lot of sense to make use of the cores. But the heavy processing is in the analytics (having done a bit of trading code myself I know that the complexity of those is limited by your imagination or the ability to run within the tick speed, and speed is usually a bigger constraint) – you should be able to keep the UI all in one thread (avoiding the side effects I mentioned in my last post of a multithreaded UI) and notify it from multiple threads.
Because the data will be being touched all the time you might need to queue updates and take a non-volatile UI thread copy of the data, or use Invoke (not BeginInvoke) so that the processing is stalled while the UI update completes. This rather depends on your analytics and how much of the data you want to be visible on the UI; if the UI is just displaying the output of the analytics you shouldn't need to be too clever with update synchronisation, but if you want to see numbers (or particularly tables; DataGridViews don't take kindly to their binding source being updated) you will.
|
|
|
|
|
I think some of the responses here to what appears to be an identical design scenario to yours may be relevant:[^].
best, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright
|
|
|
|
|
Some weeks ago I sort help achieving the following functionality:
"Dynamically create a tab-page, place a form on it running in it own thread"
I need to do this because I want each of these forms to run like a separate application within an integrated framework. The application is very time critical, handling multiple, but independent streams of data.
I thought at the time that I had found a way to do this, however, as it turned out my solution did not work reliably - do not use the code I posted previously. Sometimes it worked, other times it didn't, and in the most extreme crashed my PC. You think its working and then for no good reason it crashes; hence, why we are told the the GUI must run in the main thread. I tried many different approaches to no avail.
However, I had a stroke of luck and discovered that the order of operation is perhaps the key to cracking this nut, possibly avoiding a race condition that creates the instability. What I now have as a prototype that appears completely robust and shamelessly breaks all the rules.
The prototype application needs to be interdependently tested. That person must be expert at threaded applications. Also, this would have to be done under an NDA, they could not publish the method. I now that there are some highly talented people that participate in this forum. Contact me if interested.
|
|
|
|
|
Since I am new to working with linq in a C# 2010 .net application, I have the following question to ask:
In some new code that I need to write, I need to insert a new row in org1 table where the identity (key) column is called org1_id. I also need to insert a row in org2 table that has org1_id column as foreign key (that is associated with org1 table.
How would you accomplish this task?
The following is what i have so far:
[^]org = new Organization();
PopulateOrganization(org);--puts data in all the appropriate columns
orgModuleDataContext.Organizations.InsertOnSubmit(org); [^]
|
|
|
|
|
It seems your question is related more to Entity Framework than Linq specifically.
This is about performance but there are examples of foreign key relationships with EF.
Entity Framework Performance[^]
No comment
|
|
|
|
|
Hi,
What is the best way to convert a point string to a point object ?
Point Pt1 = new Point(10, 20);
string strPt = Pt1.ToString();
Point Pt2 = ? (use strPt to convert back to Point object)
Thx.
|
|
|
|
|
paper67 wrote: What is the best way to convert a point string to a point object ?
Using the appropriate TypeConverter[^]
Bastard Programmer from Hell
|
|
|
|
|
First new class of the week!
|
|
|
|
|
No, they won't be covering classes or instantiation for a while yet
|
|
|
|
|
|
Interestingly, I tried that but it fails, as the ouput of Point.ToString() is not parsable by the converter.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm not surprised. The .ToString method shows the contents of the object, it doesn't convert it to it's string-representation. I'd expect one would have to go from object->string and vice versa over the TypeConverter .
Bastard Programmer from Hell
|
|
|
|
|
If you have control over both parts of the operation, i.e. this is for persisting some data you own to disk/network/etc, you should use the TypeConverter:
Point pt1 = new Point(10, 20);
string strPt = TypeDescriptor.GetConverter(pt1).ConvertToString(pt1);
Point pt2 = TypeDescriptor.GetConverter(typeof(Point)).ConvertFromString(strPt);
If you don't have control over the string format, you will have to write a parser. It's pretty simple (clean off the brackets, split on ',', verify two parts, aand parse both halves as int).
|
|
|
|
|
If you have control over both ends, why use strings at all?
|
|
|
|
|
As an intermediate format without having to resort to serialization
Bastard Programmer from Hell
|
|
|
|
|
|
True, that's an option too
You can store every class by simply looping it's public properties, and to store the contents as a string. (Storing both ints in a string is the same thing) That would mean that you have to pay attention to the format, and match up the encode/decode functions.
The TypeConverter is a somewhat "safer" way of converting your class, because it adheres to a fixed format for that type in a human-readable form. It's not only used for locations, but also for colors and the like. This would be my recommendation.
A third option would be serialization. That'd be a bit overkill in this particular situation, but it remains an option.
Bastard Programmer from Hell
|
|
|
|
|
Well I was just going to store the ints and ints, but yea it really depends on where the data is supposed to go..
|
|
|
|
|
Eddy Vluggen wrote: You can store every class by simply looping it's public properties, and to store the contents as a string. Just curious: you mean by using Reflection ?
And, if I may ask, why would serialization be "over-kill" in this scenario ... assuming this question is not a one-off, but has broader implications.
And, how about using Mehdi Gholam's zippy implementation of JSON on steroids here on CP ? Over-kill ?
best, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright
|
|
|
|
|
BillWoodruff wrote: Just curious: you mean by using Reflection ?
That's what it implies, and yes, I know that you don't need reflection for serialization.
BillWoodruff wrote: And, if I may ask, why would serialization be "over-kill" in this scenario ... assuming this question is not a one-off, but has broader implications.
Because the TS gave an example where he'd convert a small structure to a string and back. If he had asked how to store a class or a collection, I'd answered serialization.
BillWoodruff wrote: And, how about using Mehdi Gholam's zippy implementation of JSON on steroids here on CP ? Over-kill ?
I'm not familiar with the article, but it sounds like a viable alternative.
Bastard Programmer from Hell
|
|
|
|
|
Typically the answer to this is if you want to store something in a human readable form. Object->string conversions are often part of file I/O. (This is what I'm using similar code for.) Or, for a web app, creating a POST request body, though there it might be better to use &x=42&y=72.
|
|
|
|
|
Ah yes of course, I was thinking too much in terms of persistence
|
|
|
|
|
Hey guys,really need some serious help with my capcha code project.My caphca code variation is that it has to consist of a number pattern and the user has to input the missing number
For eg. 2,4,6__,10 (Fill in the missing code)
I already have the graphics class setup ,so just the code for randomly generating a number pattern itself.Please Help guys.I'm a beginner programer.Help much appreciated.
|
|
|
|