|
|
Can someone recommend a good resource on resolving thread timing issues?
I'm having an issue with a value that doesn't get set "quickly enough" in the debug version, but the release version works nicely.
--
I've killed again, haven't I?
|
|
|
|
|
You have to make sure that the value really is set before you try to use it. To be more specific is hard without knowing anything about what you are trying to do. The problem has nothing to do with timing, though, but the sharing of data between threads. The code shouldn't rely on one thread being ahead of the other, as that is very unpredictable.
Be most grateful that you found this bug already, though. You say that the release version works nicely, but I'm not so sure of that. Perhaps that also fails, only not so often.
---
b { font-weight: normal; }
|
|
|
|
|
I think I can speak for all of us when I say "Huh?"
What do you "timing issue"?
If you're trying to keep two threads in sync, you'll have to use some kind of synchronization mechinism. You absolutely cannot trust that two threads are going to run at exactly the same speed on every machine, let alone run after run on the same machine, or even under slightly differing conditions, like you've already discovered.
Off the top of my head, I'm guessing you'll have to implement some kind of "checkpoint" system, depending on what these threads are doing, where each checkpoint will only release when both threads make it to the same point. The down side of this is a lock condition where a thread waits forever for the other thread to get to the checkpoint, but the other thread has failed and aborted for some reason.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: What do you "timing issue"?
I speak for myself when I say, "Huh?"
Never mind the unanswered question; I've solved the issue.
--
I've killed again, haven't I?
|
|
|
|
|
Dave Kreskowiak wrote: I think I can speak for all of us when I say "Huh?"
Hits the spot exactly...
You know where this originates from? To my knowledge it's actually a quote from a Buffy the vampire slayer episode...
mav
|
|
|
|
|
Yeah, I realized that after I posted it. A commerical for Buffy reruns came on about a half-hour later!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a form which is "heavy" , it have some pics and rich texts and stuff.
when i run the code "this.Show()" to display it starts drawing the form and the user can see the parts of the form being built.
i try to created it long time before showing it it still dont work.
the form is Borderless and it have a big picture on him with transperent color.
any ideas how to show it quick?
Ran.
R.Z
|
|
|
|
|
There's usually no way to speed things up. Most people who have "heavy" forms are using 100's++ of controls and don't realize that creating a control is an expensive operation. Drawing all of them is also not cheap. The form is not compiled into an .EXE prebuilt with all the controls in place, ready to go. They are created added to the form's Controls collection when the instance of the form is created (calling the its constructor) and the constructor calls the form's InitializeComponents method.
I think the next most common problem is using images that are FAR bigger than they need to be for displaying at a normal resolution. For example, loading a 2,000x2,000 pixel image at 32bbp into a PictureBox that is only sized to 200x200. That's 10 times the image detail being put in a box that will never show it. Reduce the image size, if at all possible, to what is actually going to be shown.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi
well that aint the case.
i do not have over resolution at all. i am using 3 smallpics and 1 piger one and another picture which is all over the form.
but the resolution is normal and i create it long time before showing it.
isnt there some way to tell him to praper the form as picture or something and show it all together..?
Ran.
R.Z
|
|
|
|
|
Nope. You'd be going through the same problem just to get a snapshot of the form. You'd also have to wait until the thing draw the REAL form to get usable controls.
If you're only using a few controls and pics, then what's taking so long? Perhaps a code profile would be in order.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to access a field of a strongly typed dataset (i.e. .xsd)
When I compile, it says: FirstNameColumn inaccessible due to it's protection level.
Where do I check this access level please?
Thanks
|
|
|
|
|
Hello,
I have managed to create an n-tier application which is structured as follows:
1) The database holds the data and contains the stored procedures
2) The datalayer calls the database and retrieves the data as DataSets
3) The WebService calls the datalayer and retrieves the data as DataSets
4) The Business layer calls the web service
5) The user interface which is a windows form, gets the data as datasets from the business and presents it in a DataGrid.
My intention is now to use strongly Typed DataSets i.e. .XSD files in the DataLayer and then use that dataset in the front end eventually.
My question is:
Is it possible to have a strongly typed DataSet in this datalayer or do I have to reference the datalayer from the client using add references. Hope you follow what I mean.
Thanks
|
|
|
|
|
What I'm trying to do is set up a system that can read records from a database and build a form according to the information contained in those records.
I've largely succeeded, but I'm having difficulty setting up a way to set sub-properties.
For demonstration purposes, I will use a concrete example. Let's say I'm trying to set up a label. I want to use database records to set the label's properties. One of the properties I want to set is Font. In the case of Font, there are subproperties, i.e. Bold, Italic, Name, Size, etc. In my example, I want the font to be bold, which means I need to set the Font.Bold subproperty to True.
I've pulled the applicable data from the database into a dataset called dsMyDataSet, set up as follows:
tblTemplateControls
ControlID | ControlType
1 | System.Web.UI.WebControls.Label
tblControlProperties
PropertyID | ControlID | PropertyName | PropertyValue | ParentPropertyID
1 | 1 | Font | NULL | 0
2 | 1 | Bold | True | 1
3 | 1 | Text | Hi, Mom! | 0
Here's the code I'm using:
<br />
for (int n = 0; n < this.dsMyDataSet.Tables["tblTemplateControls"].Rows.Count; n++)<br />
{<br />
dr = this.MyDataSet.Tables["tblTemplateControls"].Rows[n];<br />
<br />
Type myControlType = typeof(Control).Assembly.GetType((string)dr["ControlType"]);<br />
<br />
ConstructorInfo myControlContructor = myControlType.GetConstructor(System.Type.EmptyTypes);<br />
Control myControl = (Control)myControlContructor.Invoke(null);<br />
myControl.ID = Convert.ToString((int)dr["ControlID"]);<br />
<br />
DataRow[] Properties = this.dsMyDataSet.Tables["tblControlProperties"].Select("ControlID = " + myControl.ID);<br />
<br />
for (int j = 0; j < Properties.Length; j++)<br />
{<br />
DataRow Property = Properties[j];<br />
if ((int)Property["ParentPropertyID"] == 0)
{<br />
foreach (PropertyInfo pi in myControlType.GetProperties())<br />
{<br />
if (pi.Name == Property["PropertyName"].ToString().Trim())<br />
{<br />
MethodInfo mi = pi.GetSetMethod();<br />
<br />
string str = Property["PropertyValue"] is DBNull ? "" : Property["PropertyValue"].ToString().Trim();<br />
if (str != "")<br />
{<br />
mi.Invoke(myControl, new object[1] { Convert.ChangeType(str, pi.PropertyType) });<br />
}<br />
<br />
break;<br />
}<br />
}<br />
}<br />
<br />
else <br />
{<br />
DataRow[] ParentProperty = this.dsMyDataSet.Tables["tblControlProperties"].Select("ControlID = " + myControl.ID + " AND PropertyID = " + Property["ParentPropertyID"].ToString());<br />
foreach (PropertyInfo pi in myControlType.GetProperties())<br />
{<br />
if (pi.Name == ParentProperty[0]["PropertyName"].ToString().Trim())<br />
{<br />
MethodInfo mi = pi.GetSetMethod();<br />
<br />
Type myPropertyType = typeof(Control).Assembly.GetType(pi.PropertyType.FullName);<br />
foreach (PropertyInfo pi2 in myPropertyType.GetProperties())<br />
{<br />
if (pi2.Name == Property["PropertyName"].ToString().Trim())<br />
{<br />
MethodInfo mi2 = pi2.GetSetMethod();<br />
string str = Property["PropertyValue"] is DBNull ? "" : Property["PropertyValue"].ToString().Trim();<br />
if (str != "")<br />
{<br />
}<br />
break;<br />
}<br />
}<br />
}<br />
}<br />
}<br />
}<br />
Frankly, I've just started playing with Reflection and Assembly, so there are some gaps in my understanding. Am I even pointing to the right spot? If not, how do I do so?
I am not above changing the structure of my database if that will provide a solution.
Thanks for your help!
|
|
|
|
|
Hi, where can i foud how to implement databinding for new Lisview control windows forms 2.0.
I need to use it in virtual mode?
Thank you!!!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
|
thank you!!!!
Downloading...
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I'd like to aquire the published version number and display it (say, in a label).
How do I go about getting that information?
I've seen a few articles about the AssemblyInfo file however I still don't understand how to get the version values out of that either.
Thanks for the help!
|
|
|
|
|
I've got a small form that takes rankings from a user and submits it into a database. Nothing fantastic or difficult or anything. Anyway, I THEN find out after everything's just about set up that they now want rankings from 1-30 input via text box. They want the data validated so not to any number used more than once.
My question is this: What is the quickest/easiest/most painless way to go about validating all that. Does anyone know where I can find an example? Thanks for any input!
Ken
<---signature--->
Your kid gets into Duke.
You pay the tuition.
That tuition goes into my checking account.
My money in my checking account goes into beer, porn, and other such fun. Thank you
|
|
|
|
|
Hi Ken
Im new to .NET, but not new to coding...
My suggestion:
1. Charge the customer more money for the new feature.
2. Collect all input up front before populating your DB or DataTable Object. Create a collection and use the rankings as keys to populated the collection. If the user tries to reuse a rank, an error will pop, which you can propagate up to the User Interface prompting for a unique unused rank. After everything is filled in, populate the DB from the collection.
- or -
You could just make the rankings part of the DB a unique field or primary key. I think this would also throw a catchable error that you can use to prompt the user to use a new rank.
Not sure how much this helps, I've done something similar in VB6 putting everything in XML, but you didn't leave a lot of details
gl hf,
Pualee
|
|
|
|
|
Sounds like a start. Basically I'm collecting all the data upfront. There's a simple aspx page that the user comes to. The user then has a list of items that s/he has to put a ranking next to: 1-9, 1-20, and 1-5. All three ranking sets have to be done on the same page (chairman's orders). Upon hitting submit, the information has to be sent to a database and so forth. Basically, I need to make sure each group only has numbers 1-9, 1-20 and 1-5. I'm thinking your way's sounding rather not too complicated. Any other ideas on top of it would be greatly appreciated.
<---signature--->
Your kid gets into Duke.
You pay the tuition.
That tuition goes into my checking account.
My money in my checking account goes into beer, porn, and other such fun. Thank you
|
|
|
|
|
I still rather like the idea of using collection objects for each set. You can use the "lost focus" and "validate" events (not sure what they are called in .NET) on the text boxes for entering the values into its respective collection. If the collection fires an error, return focus to the textbox and ask for a unique value
If you use combo boxes instead of textboxes you could be cute and remove the values that are already used from the blank combos, but this might make some user frustration as they try to change values after initially selecting them. Bah, go w/ textboxes ^.^
|
|
|
|
|
Hi,
I can't begin to understand this one. I have a form with a tabcontrol. When I first enter one of the pages (whether by tabbing or opening the form), I say to focus on a button. It does focus on that button but you wouldn't know it by looking at it (the dotted rectangle isn't there). I noticed that when the Tab key was pressed, the newly focused button will highlight, so when opening the form, I focused on the button next to the one I want focused and did a SendKeys.Send("{Tab}"); . This works if the current tab page is the one in focus (I have another "screen" on that same tabpage where I can press an Exit button to return to the original screen), but it refuses to work when that tabpage is first opened - when tabbing into the page from another or opening the form. I'm completely out of ideas around this problem. Anyone know what I could do?
Thanks so much for any help!!!
Mel
|
|
|
|
|
Your solution looks like a hack. Did you try setting the TabIndex property in the Designer to set the right Tab order?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
There are 6 comboboxes used on the Form, each combobox should be bind with sql server datasource with particular Table having six fields.After selection of each combobox one by one the output comes as appended string in Label .
as
ans of combobox1-ansof combobox2-.....- ans of combobox6
I want to bind combobox with sql server datasource ,using stored procedures how can i start with...?
Raj
|
|
|
|