|
i having two server pc,both pc having big data, i want to maintain synchronize folder and file structure that means if PC A & PC B having file a1.doc if any change happend in pc A's file a1.doc then it should reflect automatically on pc B's a1.doc. so can any one help me how i will achieve this thing by using .net.
|
|
|
|
|
Directory.GetAllFiles and the fileinfo class ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm a bit new to C#, and am wondering - specifically - how to keep a remote MySQL connection alive as long as the program runs. It has an MDI container and will have many forms open throughout its operation. I want to keep the connection running from start until close.
I can connect, no issue there. (Although, it would be nice if the program wouldn't lock up while it was connecting. Any work-around there, at least to display a waiting cursor?) I would just like to be able to globally access the MySqlConnection object throughout the application. Thanks for any help!
_________________________________________
1 + 1 = 10. What do you not understand?
|
|
|
|
|
You can connect on another thread, that will keep the UI responsive. To create a globally accessable object, make it public and static on a class. Not that I think this is a good idea. A better idea would be to do a proper data layer and make the connection private and static in that dll/class.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hey, thanks for the reply. Unfortunately, all that at the end is a bit above my skill level right now. Why would private be better than public? And how would I do something like that, Google doesn't seem to like my search query :P
Thanks again
|
|
|
|
|
|
hi i am totally new to this programming language c#. and i wanted to know y we use interfaces..
as all we do in interfaces is write the method declaration, and when we use it in a class we write there implementations there...
why cant we just directly write the implementation in the class and use it?
will be helpful if u make me understand this concept
thank you.
sri..
|
|
|
|
|
Hi, may I suggest you buy an introductory book on the programming language you choose
and work your way through it; in that way you will get all the information necessary
to understand the language, the logic behind it, and some examples.
And later you can go back to it if you did forget some details (or skipped some of
the more advanced chapters in a first read).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
i already have one book, but it does not clearly explain or may b i am not able to get it
i checked out on the net too.... but couldnt find anything that could clear me out..
|
|
|
|
|
OK, I will give a very short explanation:
an interface is like a contract, it promises a couple of things (the presence of some
specified public properties and methods), without revealing other functionality or any
implementation details.
Example: a lot of collections (e.g. ArrayList) know how to sort object collections.
Q: How is that possible if they don't even know what the objects are?
A: They need an object that implements IComparer interface, which means something that
can decide whether object1 is less than/equal/greater than object2, so you provide
a class that holds the
int Compare (
Object x,
Object y
)
method, the only one required by IComparer.
So you could collect cars and compare them by color, by size, by mileage, whatever
you choose to implement in the Compare method you provide. And later on you can
replace the cars by plains, and still sort them, since your collection is unaware
of what exactly it is holding.
If this is a mystery, read up on sorting and IComparer, it is one of the simplest
examples around.
PS: I will not expand on this, there are thousands of books and tons of documentation
that cover this.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
To offer some further explanation, consider IDisposable. Any number of unrelated classes may want to dispose of a resource, an interface provides a standard way to do this, this means whatever object I have, I know how to check if it needs disposing. An interface is not like inheritance, it can be used to define how completely unrelated objects impliment a commmon interface.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I would like to implement some form of simple checking, if the code of my program was tampered or not. The solution seems to be easy. Just calculate hash of the exe file and that's it. The problem is that I am unable to open the exe file, from which the program was launched. I have tried a C# file stream, but I got an exception. I also tried creatfile and readfile, but it does not work either. Does anyone has an idea, why I cannot open the program file for reading?
Thanks a lot for any help,
Tomas Pevny
|
|
|
|
|
Hi,
the .NET FrameWork has provisions for this; look for "strong naming" and "signing" an
assembly. When applied, Windows will perform the check for you, and refuse to even launch
your app if it has been tampered with. (If you try to protect it yourself, the tampering
may have circumvented your check anyway).
Remark: IIRC it will require all referenced DLLs to also be strongnamed/signed, which
is OK for .NET itself, but may pose a problem with third-party stuff.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
The problem is that strong names can be easily overstepped. I think there was an article about this on codeproject. Moreover, I would like to know, why I cannot open the exe file for reading?
|
|
|
|
|
Hi,
1. as I already said, one can tamper with your checking code too.
2. I am not convinced you can't read a loaded EXE file; I would try with both the right
access mode (=what you want to be allowed to=READ) and the right share mode (=what you
want others to be able to do=probably also READ).
public static FileStream Open (
string path,
FileMode mode,
FileAccess access,
FileShare share
)
I doubt Windows loads with Share.None prohibiting anyone else from reading.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
You are right. It works right now.
Thanks a lot,
Tomas Pevny
|
|
|
|
|
Hi!
I have and HashTable object in my class, i initialize it with new as the class creates.
I am trying to use the ContainsKey in a function and i get this error:
Object reference not set to an instance of an object. at VAControls.clsScheduler.TaskHandle(SchedulerTask[]& taskarray, Int32& counter) in C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\VASchedular\VASchedular\clsScheduler.cs:line 350
at VAControls.clsScheduler.main_scheduler() in C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\VASchedular\VASchedular\clsScheduler.cs:line 312
I initialize it, so i do not understand why i get this message.
Do you know??
Thanks
|
|
|
|
|
Hard to say without seeing the code. Have you used a debugger to see if the hashtable is what's null ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes I did!
it show that it is not null and that the count is 0;
This is the code:
if (m_eventhashtable.ContainsKey(taskarray[counter].SchedularAction))
{
if (CheckIfTaskMultiTime(taskarray[counter].SchedularAction))
{
//If i contain this Task but it is multiple, then add it to the list of event with number to process.
m_eventhashtable.Add(taskarray[counter].SchedularAction + duptaskcounter.ToString(), taskarray[counter]);
}
else
{
//if i contain this Task but it is not multiple, then change replace this one for the old one.
m_eventhashtable.Remove(taskarray[counter].SchedularAction);
m_eventhashtable.Add(taskarray[counter].SchedularAction, taskarray[counter]);
}
}
else
{
//If i do not contain this Task yet add it to the list of event to process.
m_eventhashtable.Add(taskarray[counter].SchedularAction , taskarray[counter]);
}
|
|
|
|
|
ytubis wrote: if (m_eventhashtable.ContainsKey(taskarray[counter].SchedularAction))
is taskarray[counter] null ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here I am in a situation where three events should occur one after another provided that the
preceding event occured successfully.
For eg. When i click a button, the first event prints the first report and when the first
printing succeds ,it should print the second report.But sometimes, the first report printing
cannot be done because some printing error may occur.In that case,the program should stop there.
How can it be done?? I need a general idea only.
Could you guys help me out??
X
|
|
|
|
|
It seems to me that you need to fire an event from the first print to state that it's finished and the second print will be triggered by this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Dear Pete O'Hanlon,
Yes, this could be done but my case is little bit different.
Is there any way the second event can know that the first event has occured successfully??
X
|
|
|
|
|
Also, does anyone know some GOOD articles on Xinput that I could see? (I'll accept DirectInput, too. And DirectSound.) Thanks.
-- modified at 15:57 Sunday 11th November, 2007
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
These[^] articles are quite decent.
Deja View - the feeling that you've seen this post before.
|
|
|
|