|
hi guys,
how do i connect to a gateway using csharp and get its output so taht i can manipulate them...
as im a biginner in csharp 1 idea i had was uusing telnet and get the data..
is there any good solutions for this??
aneef
|
|
|
|
|
Hello all,
I'm in the process of writing a windows service. We would like to provide a small application that lives in the system tray so that people can monitor the status of the service. This application doesn't really need to do anything other than display an icon in the taskbar and maybe a context menu. All of the options selected from the context menu will either do something in the background (stopping/starting the service) or will launch another application. Is there a more eloquent way to handle this that just putting the component on an other wise empty form, loading the form and then making it invisible?
I generally hate task tray icons and usually turn them off, so I've never run into this problem before.
Will
|
|
|
|
|
I don't know of any other way of doing it. So yes blank form with the component on the empty form.
Ben
|
|
|
|
|
Hi,
I have a C++ DLL exporting a function that takes a callback of the following type:
typedef muFloat_t* (*muFacFun_t)(const muChar_t*, void*);
Is there any chance i can wrap this into a delegate? The Problem is that the function returns a pointer but C# has no pointers.
Regards,
Ingo
|
|
|
|
|
|
Generally speaking, System.IntPtr is used for marshalling pointers. Sometimes ref or out is used to pass variables in by reference.
I notice your function has a void pointer. Check out this[^] MSDN example of marshalling void pointers.
This[^] example may help as well.
|
|
|
|
|
I have a DataSet containing several tables.
Client, ClientEvent, Purchase, Return, PaymentMade
The relationships are:-
Client to ClientEvent
ClientEvent to Purchase
ClientEvent to Return
ClientEvent to PaymentMade
I use this tables to populate grids in my program but when I show the Purchase table I want the Client.Surname, Client.Telephone and Client.ClientType columns to show.
I would like to use an expression to do this but when I try "Parent(ClientEvent2Purchase).Parent(Client2ClientEvent).Surname" I get the following error:
Unhandled Exception: System.Data.SyntaxErrorException: Expected token 1 (Name), but actual token at the position 24 is token 15 (Parent).
Is there a way to do this using expressions and if not how could I do it? (I would prefer not to use sql to load the data directly using a join as I am working with the data already stored in memory)
-- modified at 16:11 Wednesday 28th March, 2007
|
|
|
|
|
I'm not sure if the expressions will work, but I believe you can solve that problem by adding DataRelation(s) to your DataSet. This basically joins parent/child DataTables based on whatever columns you specify. Once you have a relation set up for the parent/child relationships, you can use dataRow.GetChildRows() or dataRow.GetParentRows() to get the data you're after.
HTH
|
|
|
|
|
Helloo all
am using xmltextWriter to write node in xml file
XmltextWriter w=null
w=new Xmltextwriter(-----);
but the problem not in using writer
the problem is
I have listbox have this values
----------
Level1
Level2
Level2
Level2
Level3
Level3
Level1
Level2
Level3
Level4
Level2
Level2
-----------
and soon on
i want to make witer get values for list and write it to xml
every level1 present base node(root node) and sublevels is subnodes
i want be unlimeted level
xml file show be appear like this
<root>
<level1>
<level2/>
<level2/>
<level2>
<level3/>
<level3/>
</level2>
</level1>
<level1>
<level2>
<level3>
<level4/>
</level3>
</level2>
</level2>
</level2>
</level1>
</root>
I want make it recursive;;;;
|
|
|
|
|
Tkml236 wrote: I want make it recursive;;;;
Sounds like a TreeView might go along with want you want better than a listbox will.
|
|
|
|
|
no ...data is stored in listbox
(my real problem is stored in othere place but i simplifeid the problem to me clear)
i went to get data and write it in XML
|
|
|
|
|
It's easy.
In this routine, you will iterate throught the items in the listbox, fetching their values one by one.
Now i assume that you are getting the info on which list-item is a child and which is a parent from the value of the listbox item. In that case, you need to assign all items in the list box with a unique level number (depending on their nesting in the XML). Based on this, when you iterate through items in the list box, you would know which item to nest under which node and at which level.
It won't help much by trying to make this recursive. Keep it simple and straight. Any by the way, it's pretty hard understanding your written english Please be a little more clearer with your questions.
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
ok..how can I solve this problem if I have unlimeted nested levels for level1
please see the example it will be clear for you?
|
|
|
|
|
As I said.... If you have unlimited nested levels for level 1, keep on making a list of all the nestings that you have already written in a stringdictionary or so. the key wud be level number and value would be name, in the StringDict. This list will kee on growing as your list size. if ur list item is unlimited, recursive is a real bad idea since it will give you stack overflow soon enough. Putting in a bit of logic to use a normal collection instead of a recursive stack is a much much better idea for unlimited list items.
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
but how can I do that ...did you use xmlTextWriter?
I want to use it for writing in xml???
|
|
|
|
|
Dear friends,
In my organization, the employees are sending me messages through net send command . I want to create a application or sercive to listen all the messages and save it in the database.
( Because the messages are like requests. so we need record of them.
at last we need to give report to the authority)
If you have ideas and solutions plz give me.
thanks in advance.
By
Joe
|
|
|
|
|
You would be better blocking off the Windows Messenger Service in your box.
That will disable the net send command operation since that is a sensible thing to do since it can be easily used by spammers and exploited. Vista has this blocked by default.
However, if you still wanna capture the net send message, then you will need to coide for the Windows Messenger Service using the API's to listen to the same. Net Send uses the NetBEUI protocol and you will need to code in COm for capturing the message through the exposed Interfaces of the API.
Another easy way would be to observe the net send popups displaying and capturing the message in it. There is also a sample around it: Check this out http://msdn2.microsoft.com/en-us/library/ms940840.aspx[^]
Accept the reply if it helped you!
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
sorry for the late replay
thank u for u r replay.
thanks a lot.
|
|
|
|
|
Hello everyone,
I am trying to read a CSV file and place its data into a ListView. Each line of the CSV file contains 4 values seperated by comma. Can someone tell me how I can place each value under its correct column as I have 4 column in the ListView?
I am using the following code and that is going to populate the first Column with the four values.
StreamReader streamReader = new StreamReader("MyFileList.txt");<br />
while (streamReader.ReadLine() != null)<br />
{<br />
listView4.Items.Add(streamReader.ReadLine());<br />
}<br />
<br />
streamReader.Close();
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
Perhaps this will do the trick:
<br />
StreamReader streamReader = new StreamReader("MyFileList.txt");<br />
<br />
while (streamReader.ReadLine() != null)<br />
{<br />
ListViewItem listViewItem = new ListViewItem(streamReader.ReadLine().Split(new char[] { ',' }));<br />
listView4.Items.Add(listViewItem);<br />
}<br />
<br />
streamReader.Close();<br />
|
|
|
|
|
OK, forget the Dog/Vet metaphor I posted yesterday.[^]. It was the easiest way to describe my original question which was general in nature and not specific to my problem. Here is the actual scenario.
I have an editor (type of data being edited is irrelevant). In this editor, I want to support undo/redo operations. I have employed the Command pattern for this purpose. All changes to underlying data must be encapsulated in a command object. For example, to set text you would create a SetText command and call its “Execute” method. To undo this operation, you would call the SetText object’s “Unexecute” method.
This architecture is working really well but it has one flaw. Every time an engineer executes a command he is responsible for managing command history (i.e. the undo/redo stacks). If the execution is successful, he MUST add the command to the undo stack. If the execution fails, he MUST NOT add the command to the undo stack. If the execution throws an exception, he MUST CLEAR THE STACK as we cannot allow the undo stack at any time to be out of sync with the application state (this logic is somewhat simplified for the purposes of this post).
If the engineer forgets to do any of these things he poses a risk of undefined behavior in the application. Furthermore, the logic will be the same for every command that gets executed, so there’s no need to write this command-history-management-logic every time a command is executed.
In steps the factory pattern. The factory encapsulates the creation of commands. Because the factory controls the creation of the commands, it can setup a relationship between the UndoManager class (manages command history) and each command that gets created. Voila!
Now here’s my problem (and perhaps it’s not a problem at all. Perhaps this is where I’m rubegoldberging). Any engineer can create a command and execute it. If the UndoManager class has no knowledge of this command, he cannot manage it and the undo history could get out of sync with the application state. Obviously this is really bad.
To solve this problem, I have nested a private UndoManager class in the command factory. This class implements the IUndoManager interface. All commands require an IUndoManager at construction. So, because the UndoManager is private to the factory, only the factory can create commands. For example, to create a generic command:
public ICommand GetGenericCommand()
{ return new GenericCommand(this.undoManager); }
It is true that any engineer could implement IUndoManager and then begin creating rogue commands, but this is unlikely.
I would love to hear comments on this solution. Am I being overly cautious? Is this a hack? Or have I implemented a reasonable safeguard in a reasonable fashion? Is there a pattern that matches this solution? (Hopefully not an antipattern… )
Thanks!
|
|
|
|
|
Edmundisme wrote: I would love to hear comments on this solution.
Sounds reasonable to me.
led mike
|
|
|
|
|
Edmundisme wrote: This architecture is working really well but it has one flaw. Every time an engineer executes a command he is responsible for managing command history (i.e. the undo/redo stacks). If the execution is successful, he MUST add the command to the undo stack. If the execution fails, he MUST NOT add the command to the undo stack. If the execution throws an exception, he MUST CLEAR THE STACK as we cannot allow the undo stack at any time to be out of sync with the application state (this logic is somewhat simplified for the purposes of this post).
If the engineer forgets to do any of these things he poses a risk of undefined behavior in the application. Furthermore, the logic will be the same for every command that gets executed, so there’s no need to write this command-history-management-logic every time a command is executed.
In steps the factory pattern. The factory encapsulates the creation of commands. Because the factory controls the creation of the commands, it can setup a relationship between the UndoManager class (manages command history) and each command that gets created. Voila!
I was about to suggest that the logic for managing the undo stack be placed in the commands, i.e. when a command is executed, it's responsible for placing itself on the undo stack (or not depending on the results). But it sounds like you've solved this problem?
Edmundisme wrote: Now here’s my problem (and perhaps it’s not a problem at all. Perhaps this is where I’m rubegoldberging). Any engineer can create a command and execute it. If the UndoManager class has no knowledge of this command, he cannot manage it and the undo history could get out of sync with the application state. Obviously this is really bad.
Underlying the commands is a document of some type that is being acted upon, correct? You're concern is that rogue command objects can be created that execute an action against a document. Being rogue command objects, they're not being managed, so they're never placed on the undo stack? As a result, a document's history could become corrupted.
The question is how could a rogue command object obtain access to the document in the first place?
I haven't looked at GOF in awhile regarding the Command pattern as it's applied to undo functionality, so I'm not sure how they implemented it. But how about the document itself being responsible for creating commands. The document has several private Command classes that implement an interface. And perhaps the document holds an UndoManager object for managing the commands.
When a client wants to execute an action against a document, they first ask for the appropriate command. The document gives them back a command it has created and is responsible for. The client, however, only sees the command object through some generic interface. This approach makes rogue commands impossible.
Edmundisme wrote: To solve this problem, I have nested a private UndoManager class in the command factory. This class implements the IUndoManager interface. All commands require an IUndoManager at construction. So, because the UndoManager is private to the factory, only the factory can create commands. For example, to create a generic command:
public ICommand GetGenericCommand()
{ return new GenericCommand(this.undoManager); }
This may be close to what I've suggested above, I'm not sure. I need to know more about how the actual document, or model, is being used by the commands.
|
|
|
|
|
I like your suggestion about encapsulating the document access - forcing modifications through a single access point. Unfortunately I'm adding Undo/Redo to an existing application and this solution would require a complete rework of the document management.
Basically, if I can get everyone to understand that all modifications must be done via command objects we'll be OK. However, any code at anytime could directly change the document...
Thanks for your ideas!
|
|
|
|
|
Hi,
I need to develop a commercial use application and I found
some code source that is under GNU version 2, license term agreement.
For GNU, does it mean that I can incorporate the binary format (the dll)
of the code (I didn't modify the source code) into my application
without contributing back my application source code ?
Thanks
|
|
|
|