|
That's the first thought I had when I wrote the thing. "Oh how this could be perverted into something bad." I uninstalled the clients and server, zipped up the source and packed it away so noone could grab it.
|
|
|
|
|
Hi every one,
I need to record the phone calls made by the PC into files or a db, i used AT commands, and i'm working on c#.
is it only solved by TAPI??
if so i need a good tutorial in this concern..
Help is highly appreciated and Thanks in advance,
|
|
|
|
|
do you have any code so far?
|
|
|
|
|
|
Hi friends,
While going through Interface topic I came across this doubt..say there is a class called Myclass which implements an interface called ImyInterface..there is a line of code:
ImyInterface xyz=new Myclass()
can u plz explain me what this line of code actually means in terms of object and reference.
Warm Regards,
Rahul
|
|
|
|
|
Normally base class pointer can point to a derived class object.
Here, "new MyClass()" is a derived class Object(since MyClass implements ImyInterface )
and
"xyz" is the base class pointer.
MyClass will implement(define) functions in the Base interface.It can also contain its own new functions.
Even though "xyz" points to an object which contain many functions,through "xyz"
we will be able to call only the functions present in the interface.
Regards,
Arun Kumar.A
|
|
|
|
|
it means nothing or if it means something, there are only two options:
1. it's error
2. the two classes are inherited! but i'm not really sure of this option!
|
|
|
|
|
In CPP I used the macro __FUNCTION__ in order to print calling functions name to my logger. Is there any easy way to do the same in C#?
|
|
|
|
|
Logging method name in .NET[^]
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
HELLO ALL FRINDS HOW R U
I WANT TO MAKE VALIDATION IN FORM
IWANT THE TEXTBOX CONTAIN NUMBERS ONLY AND ONOTHER ONE CONTAIN DATETIME ONLY
HOW CAN I MAKE IT
AND HOW CAN ICOMPAR BETWEEN TWO TEXTBOXS
ASHRAF_23_2005@YAHOO.COM
|
|
|
|
|
Take a look at the documentation and find these items:
- ErrorProvider
- TextBox.Validate event.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
THANK YOU FOR YOUR MASSEG BUT IWANT YOU TO EXPALIN IT
|
|
|
|
|
STOP YELLING. And, when someone tells you what to use, you should type that into google. An article will always give more info than a forum post.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Caps is not going to help you getting help. Especially from me.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
I am making a program that can take a string and give you all possible strings that can be made out of the characters it contains.
Example:
Bug
Yeilds:
bug
bgu
ugb
ubg
gbu
gub
Can anyone think of how to do this short of trying until I get 6! unique results?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
the only way you will get 6! permutations is by starting off with a word that contains
6 letters, all of them different.
This is the algorithm to find all the different permutations in alphabetical order:
- initialize an int "len" to the number of total characters
- initialize a string "chars" with all the different letters in alphabetical order
- initialize an array "multipl" , with length equal to chars.Length, and values equal
to the multiplicity of each of the letters
- initialize a string "answer" to ""
- invoke the method explained below with the initialized values set out above
- create a recursive method void permute(len, answer, multipl)
that in a foreach loop over chars considers appending that character
to the partial answer, provided its multipl is non-zero; then calls itself again
(with len-1, adjusted answer, and adjusted multipl) unless len got zero, in which
case you have reached the next permutation.
BTW this topic belongs in the "algo & math" forum.
|
|
|
|
|
I have a list view which contains 100 items. For each item i need to do some work on it which takes a long time. I want to create (100 / 4) threads so i can split the work.
Lets assume my original code is
for(int i = 0; i < listview1.Items.Count; i++)<br />
{<br />
doStuff(listview1.Items[i].Subitems[1].Text);<br />
listview1.Items[i].Subitems[2].Text = "blah";<br />
}
Thread[] threads = new Thread[100/4];
Now how to split the work for each thread?
Thread 0:
for(int i = 0; i < 4; i++)<br />
{<br />
doStuff(listview1.Items[i].Subitems[1].Text);<br />
listview1.Items[i].Subitems[2].Text = "blah";<br />
}
Thread 1:
for(int i = 4; i < 8; i++)<br />
{<br />
doStuff(listview1.Items[i].Subitems[1].Text);<br />
listview1.Items[i].Subitems[2].Text = "blah";<br />
}
and so on.
|
|
|
|
|
Creating that many thread will not improve proformance, actually that many threads will slow proformance dramatically.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I think in my case it will, my function just takes a long time because it is using ping, so multiple threads will reduce the waiting time.
|
|
|
|
|
Yes, multiple is different than 25. Try looking at this, and use 1 or 2. Worker Thread[^]
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
This won't speed things up, it will add the cost of switching betweeen threads. Threads don't make things faster, they just leave the main (UI) thread responsive during large operations.
One thread that calls doStuff for all the items, and then at the end sets all the text as you want to show it's done, may make sense. Or even one that sets the text on each item as it goes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
adding threads may help as long as your job shows some remaining idle cycles,
provided the threads are not competing heavily for the same resources (CPU, memory
bandwidth, I/O bandwidth, ...).
In case of multiple pings, I expect there is some system limitation that will
make it impossible to have more than N outstanding pings, dont know what N would be tho.
Now if a succeeding ping needs a few seconds, and a failing ping times out in say
one minute, it would be bad design to split the ping destinations statically
(you might be unlucky and have all failing pings in the same thread, while the
other threads have long finished all the succesful pings, so threading did not help).
I would rather decide on a few threads, and let them fetch a ping target as soon
as they start or are idle again. So I would initially copy all targets to a list, and
(with lock) have the threads remove them one by one (so I'd use the list as a queue).
|
|
|
|
|
Hi,
as said before I wouldn't use that much threads. Second I wouldn't assign each thread its tasks from the beginning. It may be that some of your list elements need more time than others (especially true for pings) so each thread should fetch the next element whenever it needs to.
I would start by creating some sort of queue class which holds all your tasks:
public class MyQueue {
private string[] _elements;
private int _counter;
public MyQueue(string[] elements) {
_elements = elements;
_counter = 0;
}
public string GetNextElement() {
lock (_elements) {
if (_counter >= _elements.Length)
return null;
string result = _elements[_counter];
counter++;
return result;
}
}
}
Now define a function:
private void DoStuffInThread(object parameter) {
MyQueue queue = (MyQueue)parameter;
string nextElement;
while ((nextElement = queue.GetNextElement()) != null) {
}
}
And let the threading begin:
Thread[] threads = new Thread[numberOfDesiredThreads];
for (int i = 0; i < threads.Length; i++) {
threads[i] = new Thread(new ParameterizedThreadStart(DoStuffInThread));
threads[i].Start();
}
You have to add your processing logic, assignment of the results to the listview and also check when all threads are finished. Keep in mind that you should never change control properties directly from a different thread. Instead use Control.Invoke to make it safe.
Robert
|
|
|
|
|
Worked great thanks.
One problem though, not sure if im doing this correctly, everytime i try close the program while the threads are running it gets errors. I have a form closing event that invokes the Thread.Abort() method before closing but it doesnt seem to work. I think its the object disposed error.
private void displayPing(int index, string msg)<br />
{<br />
if (this.listView1.InvokeRequired)<br />
{<br />
try<br />
{<br />
displayCallBack hscb = new displayCallBack(displayPing);<br />
this.Invoke(hscb, new object[] { index, msg});<br />
}<br />
catch (Exception) { }<br />
}<br />
else<br />
{ <br />
try<br />
{<br />
this.listView1.Items[index].SubItems[5].Text = msg;<br />
}<br />
catch (Exception) { }<br />
}<br />
}
|
|
|
|
|
if you use too many threads, it will slow the computer, but to ban that, you should use Thread.Sleep(time in msec); or use boolean thread and it will be some useful
|
|
|
|