|
yes it does,
and guess what ... i've tested my application on another pc with another USB device, and it worked, it seems that the problem is in the dongle bluetooth device, but another problem came up ... when I click find devices, it shows nothing .. 
|
|
|
|
|
Hello!
Hope you all are doing great! We were having clumsy sort of issue! details are as follows:
- We have c# windows application, which processes the data(simple text file, huge in size aprox. 40Gb).
- Doing so, it doesnot show any sort of items on the form, it looks as if its hanged/not responding
- Application consists of 1 form, which contains few performance indicators, few labels, few progress bars.
- But in reality it is working and processing the data(checked from the task manager, and also the output file is generated very accuratly).
- From start till end application utilizes 100% of the cpu.
- If we try to run any other program even notepad, system hangs n we have to restart it!
We are using Windows Server 2003, any sort of help, idea, suggestion, question will definitly be appreciated! !
Thanks in advance!
Adeel
--
|
|
|
|
|
Processing 40GB file is very expensive for computer. The time it takes will depend on the computer you are running it on. Also use threads in your application
|
|
|
|
|
Very right , but why it is not showing up the items(labels, progress bars...etc), and how can we make it show them and also do the processing as well!!?
The machine specs are 2.8E GHz HT Processor, 1 GB RAM, 160 GB SATA-II Drive!
Any suggestions how shall we implement threads, like processing in seperate thread? is this what you mean? and wil it solve the issue
|
|
|
|
|
Have a look at Backgroundworker component. It has got a good example
|
|
|
|
|
It sounds as if you are doing your file processing on the UI thread, and you are not allowing any time to any other threads.
1> do the data processing on a worker thread, use
2> do a small chunk of processing then call Thread.Sleep(ms) to allow other things to run for a few ms, that way you don't hog 100% of the CPU.
|
|
|
|
|
Ok, will surely give it a try, and will let know of the result! Thanks both of you! !
|
|
|
|
|
! Thanks Rob, shifted the processing part on the workerthread, and without calling Thread.Sleep, its working great!!! !
|
|
|
|
|
Create a BackgroundThread for processing the file. If you are storing the data read from the file in memory, make sure it does not consume too much ( Check the return value of FileStream.Read which returns the number of bytes read and add them to a "long totalBytesRead = 0;" variable each time as "totalBytesRead += bytesRead" and check:
if(totalBytesRead <= (1024*1024*50)) // more than 50 MB
{
ReadMore();
}
else
{
ProcessCurrentData();
CleanMemory(); // reset the read buffer forexample
}
And don't forget Application.DoEvents(); method
Hope this helps...
|
|
|
|
|
I am trying to load a list of number in a combobox, it seems to be reading the xml file elements but it is reading my numbers as the index for the combobox
here is my xml file data that is is reading
<Days>21, "21"</Days>
<Days>20, "20"</Days>
<Days>19 19</Days>
<Days>18</Days>
<Days>17</Days>
<Days>16</Days>
<Days>15</Days>
<Days>14</Days>
<Days>13</Days>
<Days>12</Days>
<Days>11</Days>
<Days>10</Days>
all i get is a blank drop down list, if you want to see the code let me know but the code is working to read the other elements and filling text boxes
-- modified at 9:53 Saturday 5th May, 2007
|
|
|
|
|
Well, as you guessed, posting relevant code will be helpful.
BTW your XML file doesn't seem very elegant, for instance, in:
<br />
<Days>21,"21"</Days><br />
you enclose two pieces of info inside a single item. Maybe it is not a good idea.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
xtr = new XmlTextReader(filename);
while (xtr.Read())
{
if (xtr.NodeType == XmlNodeType.Element)
{
if (xtr.LocalName.Equals("Days"))
{
this.cbodays.Items.Add(xtr.Value);
}
}
}
the <Days>21,"21"</Days> was just test data, I was trying to use the <Days>20</Days> but that gave me just the blank drop down box, so i was wondering if it just took my numbers and made them the index of the combobox so I put a few different data formats in the XML file to see if that made any difference
I have used a switch statement to check for XmlNodeType.Element and gives same results, if I change .equals("days") to an name that is not in the file I just get one blank drop down, currently it looks like it see that there are the right number of records but no data in the drop down
Rob
|
|
|
|
|
Planker wrote: this.cbodays.Items.Add(xtr.Value);
Substitute xtr.Value with xtr.ReadElementString() in the above line.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thank you, that worked. is there a reason that xtr.Value works for text boxes and you need readelementstring for combobox?
|
|
|
|
|
No, there isn't. I think that xtr.Value doesn't work for text boxes too. But I must test it...tomorrow...maybe!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
thank you for your help, wondering if you could answer a question about writing back to the xml file.
I think you are right, I looked at my other code again and i was using ReadString
I am getting an error at run time on this line of code
newDayIndex.InnerXml = index.ToString();
here is how i'm doing all the xml code
XmlTextReader reader = new XmlTextReader(C_strFileName);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNode oldIndex;
XmlElement root = doc.DocumentElement;
oldIndex = root.SelectSingleNode("/config/Days_Index");
XmlElement newDayIndex = doc.CreateElement("Days_Index");
newDayIndex.InnerXml = index.ToString();
root.ReplaceChild(newDayIndex, oldIndex);
doc.Save(C_strFileName);
|
|
|
|
|
1) You should first correct these:
<days>21, "21"
<days>20, "20"
2) Then check if it you are really reading the values from the XML file correctly.
3) Use Convert.ChangeType(...) to convert the values you read to a specific type if you want.
4) Update ComboBox.DataSource Property with the list of values you read ( check out MSDN Library for ComboBox.DataSource Property on how to add specific, custom data sources to ComboBox )
Hope this helps...
|
|
|
|
|
Thanks for the info, i got the loading of the combobox working, i am not trying to figure out how to save the changes back to the xml file if the user changes the value.
|
|
|
|
|
I know that you are not trying to save back the user modified values to the XML file. What I suggest using Convert is to give you the ability to store the datatype of the object(what ever you create) as a string value and then convert it to what you want. You may also write a custom type converter or implement iSerializable interface or add XmlAttributes to your fields for which you want to serialize.
|
|
|
|
|
yes I am trying to save back the user modified values. I'm updating a config file so when the program is shutdown the changed value is read the next time the program is run.
|
|
|
|
|
Do you know what you want?
This is your post:
Thanks for the info, i got the loading of the combobox working, i am not trying to figure out how to save the changes back to the xml file if the user changes the value.
And now you are saying:
yes I am trying to save back the user modified values. I'm updating a config file so when the program is shutdown the changed value is read the next time the program is run.
Are you OK?
|
|
|
|
|
I've been trying to a simple Comm program to work using the
ReadExisting method of the .Net 2.0 SerialPort class.
The data is being transmitted to me from a PIC micro dev board.
The data received event fires when ReceivedBytesThreshold is
reached as it should, but I only get back one character when there are
4 in the buffer. I verified this by retrieving the BytesToRead
property and it is set to 4.
If I add additional ReadExisting method calls afterwards I will get
one and only one char back for each read.
I also tried the Read method but same result as ReadExisting.
Lastly I ran Hyperterm and another terminal program
and they both receive the entire 4 chars with no problems.
The databits, baudrate, and handshaking are all set the same
for my code as well as the terminal programs. I have also
tried setting the DtrEnable and RtsEnable to true but with
no success.
sorry for the long post but i tried to be as brief as possible
Any help will be greatly appreciated.
|
|
|
|
|
Hi, since ReadExisting reads bytes but returns a string, I would guess you have a problem with
the encoding. Why dont you use Read(byte[],...) ?
|
|
|
|
|
Its possible but then why do the successive ReadExisting invocations
return the characters that were sent? I will give it a try.
|
|
|
|
|