|
now, i can analize a file (file.log) convert it to StreamReader and analize it with my object Parser(StreamReader sr).
(i am using there sr.readline() etc.)
now i want to receive the same information from port.
i want to receive information from port232 (strings) and to save them (somewhere),and to analize them with th same object Parser(StreamReader sr) on a real time(2 threads- one for writing information from port to StreamReader(possible???) and another thread for reading the inforamtion by using Parser).
thank you.
|
|
|
|
|
ok well i think the problem you will have is writing to a file that is open for reading.
So you could either close the file after the write and then read, somehow you will have to decide which process to do, or alteratively you could pass the string value to the parsing thread and write it to the log file, rather than reading from the file.
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
i thought about it but..
opening and closing the file a lot of times will not slow down the analizing time?
maybe there is something like "virtual file" or another solution that will let update the real file every X seconds?(for backup).
or this is the only way to solve this problem?
|
|
|
|
|
i think you should be opening and closing streams with each write anyway, you dont want to leave a stream open longer than needed.
As i also suggested, i think the best way is to:
Get string from port,
Write it to the log file,
then pass it to the parsing thread for whatever that needs to do
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I have a solution with various projects, normally I gather the logon credentials via the UI and settings and pass 1 copy to the DAL. In this project there will be multiple DAL implementations all requiring a set of credentials. Credentials is declared as a class in the intermediate layer (server,DB,User & password) which is referenced by the UI.
Now I have the requirement of passing the creds to many objects which do not reference where the Credentials class resides. I initially created a copy of the Credentials class in the target object and attempted to pass Credentials as an object and then converting to the local Credentials type.
DAL.Server = (Creds as Credentials).Server;
This gets an error to use NEW. Creds is an object and has data in it.
Any recommendations on how to do this properly
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
you should use interfaces. Define a Credentials-interface, which will be accessible by all objects (do this by putting the interface into a seperate assembly). Let your Credentials-class implement the interface. Within all objects you can now use the interface to interact with the object, without knowing how it is implemented (how it should be within OOP).
interface ICredentials {
}
Your credentials-class:
class Credentials:ICredentials {
}
How to use it:
DAL.Server = MyCreds.Server
Hope this helps.
Regards
Sebastian
|
|
|
|
|
There you go, ask for a simple casting solution get the application of a whole different technology. What a way to learn, I have not used interfaces except when building services, will be working with this info today.
Thanks
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It turns out the interface does not meet the requirements - one of the assemblies will need to be isolated for use with another solution and will not have access to the interface. Changed it to use a list<string>.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i developed an application for a mobile device using ce 5.in the application i have two forms A ,and B. A is the main form and B is the child form most of the times form B is created, used and closed.but before showing the Form B the memory
usage (ex: 15MB) when form B is loaded the mem is (ex:16MB),but when the form is closed the mem is still 16 MB.i there might be a memory leak . do you
have any suggestions on this
|
|
|
|
|
Hi all,
I am currently make use of the Assembly.LoadFile to get hold of some of the attributes.
The problem that I am experiencing is that the LoadFile method holds on to the assembly, thus preventing me from taking actions on the assembly file like: deleting the file or moving the file. Only when the program closes does the release on the assembly take place.
How can I load the attribute data of the assembly without running into this issue.
Many thanks in advance
Regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Look at this[^]
or
This[^]
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Ahh, the "I realised google can answer me quicker than a forum post" reply. Well done sir!
|
|
|
|
|
yeah, someone should make a tutorial on the subject - apparently its not an easy task
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Indeed. If only somebody here on Code Project had written this[^] article. Oh how I wish somebody would.
|
|
|
|
|
ahhh... now with my new found knowledge i will never not find an already created tutorial that im suggesting to be written again
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Hi,
I'm trying to find the existence of a child node in Treeview control. I used the following find(), Contains(), ContainsKey() methods.
1. TreeNode[] ad= treeView2.Nodes.Find("child2",true);
2. bool res= treeView2.Nodes[0].Nodes.Contains(selNode);
3. res = treeView2.Nodes[0].Nodes.ContainsKey("child2");
None of the above is giving result. Please let me know how to find a child node in a treeview control.
Thanks in advance.
|
|
|
|
|
what are you searching for and is it in the base level only?
the Find method should work fine, "child2" should be the key of the node to find, i.e. the Name property, change false to true if you want to search deeper than the base level.
what results are you getting from you find function?
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Try the following code for the same:
For Each LeftMenuNode As TreeNode In LeftMenu.Nodes ' LeftMenuNode will give you Nodes in TreeView
For Each LeftChildNode As TreeNode In LeftMenuNode.ChildNodes 'LeftChildNode will give u childnodes if any
If LeftChildNode.Text <> "Child Nodes" Then
LeftChildNode.NavigateUrl = "#"
End If
Next
Next
Regards,
Kaushal Arora
|
|
|
|
|
Ive never seen a more non-sense programming language lol
Anyway after translation it is a good suggestion, but from what i gather this will only search levels 0 and 1 of the treeview. No?
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
infact your code s k to find the child the treeview control
what more u have to do is to select that child node.
[code]
if (treV.Nodes.Find("child",true).Length>0)
{
treV.Focus();
treV.SelectedNode=treV.Nodes.Find("child",true)[0];
treV.SelectedNode.EnsureVisible();
}
[/code]
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi All
Im trying to make an address look up application using sql.
I want it so that when the user selects a country the window will change and match the country Address Formart.
For Example if i choose UK from the combobox the form will change to this
address formart :
Building
Road
Town
PostCode
United Kingdom
but if i click USA
Holtsville NY 00501
United States
How can i achieve this...
|
|
|
|
|
create the maximum number of different textboxes you need, then assign them a number each i.e.
TBLine1 = 0
TBLine2 = 1
TBCity = 2
TBRegion = 3
TBPostcode = 4
TBCountry = 5
Then in your database you have a list of countries and also a column with the order the address should be displayed split with a non numeric character, i.e.
UK 0;1;2;3;4;5
USA 2;3;4;5
Then you can parse the column and dynamically set the location of the fields based on the ordering
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Thank You
|
|
|
|
|
Hi,
I need to create a simple application where a user types in an abbreviation of a word and this is automatically changed into the full word. The text can be entered in any application e.g. MS Word, MS Excel, Notepad, E-mail, Blog, etc.
A simple example:
Use enters.. tc<space>mw.
System recognizes a space, comma or any other punctuation and replaces the text to.. take care Matthew White.
tc -> take care
<space> triggers the previous action
mw -> Matthew White
fullstop triggers the previous action
Basically, the application matches the entered text to a dictionary (edited by user) and replaces the word with the meaning. Also the program can be running in the task bar allowing the user to disable the feature.
10x
|
|
|
|
|