|
R/Sir
hello
i wanna attached a biomatric software with my login page
so plz send me coding for it.
God says
i will very thanksfull for this.
*************
sbajwa1@yahoo.in
santokh singh
|
|
|
|
|
How to assign style to grid view caption in the code behind file?
|
|
|
|
|
What technology are you using here? This question is the tiniest bit lacking in anything approaching useful detail.
|
|
|
|
|
Hello Good morning all,
I want threading to implemented in C#-windows applications with proper syncroniation. Like i have one textfile(resource) and two threads are acting upon reading and writing, now i want to provide syncrinization to that text file with some technques(critical section, semaphores, mutual exclusion etc). can some one help me out with a sample or link so that i can implement it.. Thanks in Advance
|
|
|
|
|
Check out msdn[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
thanks for ur reply...I have tried it with lock(object) but it is not working... Iam sending my code please go though it once and let me know, where i went wrong.
private void Form1_Load(object sender, EventArgs e)
{
try
{
sw = new StreamWriter("D:\\Threading.txt");
ThreadStart Thrdst = new ThreadStart(Thread1);
Thread t = new Thread(Thrdst);
t.Start();
ThreadStart Thrdstt = new ThreadStart(Thread2);
Thread tt = new Thread(Thrdstt);
tt.Start();
ThreadStart Thrdsttt = new ThreadStart(Thread3);
Thread ttt = new Thread(Thrdsttt);
ttt.Start();
}
catch (Exception err)
{
label1.Text = err.Message.ToString();
}
//Spawnning 3 Threads on form load..
private void Thread1()
{
Thread1 t1 = new Thread1();
t1.ThreadWriter(sw);
}
private void Thread2()
{
Thread2 t2 = new Thread2();
t2.ThreadWriter(sw);
}
private void Thread3()
{
Thread3 t3 = new Thread3();
t3.ThreadWriter(sw);
}
-------------------------------------------------------------------------------------------------------------------------
And i have three diferent clasees which write to text file...
class Thread1
{
private Object thisLock;
public void ThreadWriter(StreamWriter sw)
{
thisLock = new Object();
lock (this)
{
for (int i = 0; i < 10; i++)
{
sw.WriteLine("Thread 1 = " + i);
Thread.Sleep(100);
}
sw.Close();
}
}
}
The other two are almost similar...
Output is:-
--------------
Thread 1 = 0
Thread 2 = 0
Thread 3 = 0
Thread 1 = 1
Thread 3 = 1
Thread 2 = 1
Thread 1 = 2
Thread 3 = 2
Thread 2 = 2
Thread 1 = 3
Thread 3 = 3
Thread 2 = 3
Thread 1 = 4
Thread 3 = 4
Thread 2 = 4
Thread 1 = 5
Thread 2 = 5
Thread 3 = 5
Thread 1 = 6
Thread 3 = 6
Thread 2 = 6
Thread 1 = 7
Thread 3 = 7
Thread 2 = 7
Thread 1 = 8
Thread 3 = 8
Thread 2 = 8
Thread 1 = 9
Thread 3 = 9
Thread 2 = 9
Please help me out.. Thanks in Advance...
|
|
|
|
|
You're going to have to explain what you mean by "not working". What are you expecting it to do because the output you got is what I expect, given the code you posted.
|
|
|
|
|
Your code is not synchronizing anything. Look:
class Thread1
{
private Object thisLock;
public void ThreadWriter(StreamWriter sw)
{
thisLock = new Object();
lock (this)
{
for (int i = 0; i < 10; i++)
{
sw.WriteLine("Thread 1 = " + i);
Thread.Sleep(100);
}
sw.Close();
}
}
}
Your thisLock object is completely useless: You create a new instance of it within ThreadWriter method but use it for nothing else. Using it as the argument for lock would change nothing becouse of two reasons: you create a new instance of it every time the method runs, so you would always be loosing the previously locked reference, and it is private, so the other classes cannot use it for their locks.
Using lock(this) is useless as well, becouse each class just locks itself for accessing the StreamWriter more than once at a time, but does not lock the other classes since the other classes are doing the same, I mean, each one uses a different reference for their respective locks.
What I still don't know is if you want all of your threads to be able to write at the same time in a thread safe way, or if you want only one thread writting everything it has to write and the other ones waiting. What kind of output would you like to get?
|
|
|
|
|
Thanks dude.. I will try it once again.. see all iam doing here is writing the content to stream file form mutliple threads. I spawned 3 threads, they will be writing data into a stream file. I just want to syncronize these three Threads while writing ... Thats all...
|
|
|
|
|
Ok, try this:
class Thread1
{
public void ThreadWriter(StreamWriter sw)
{
for (int i = 0; i < 10; i++)
{
lock(sw)
sw.WriteLine("Thread 1 = " + i);
}
}
}
Here each thread locks the StreamWriter object just before writing one line, and releases it just after doing it, so another thread can acquire the lock. This way a WriteLine operaton performed on one thread will never interfere a WriteLine operation of another thread. This is what I meant when I said "writing in a thread safe way".
modified on Thursday, November 18, 2010 10:33 AM
|
|
|
|
|
|
Sacha Barber did an excellent series[^] on threading. I would suggest that you start there.
|
|
|
|
|
hello i really need help in plotting the histogram of an image. anyone with any tutorials and examples?
|
|
|
|
|
|
thank you for your reply. i come across the "A simple histogam displaying control" however when i tried to build it myself, i am unable to find the display box displaying the histogram ("Histograma.HistogramaDesenat") in visual studio 2010.
i cant find HistogramControl Components in my toolbox. do i have to dl it? see ref below:
http://yfrog.com/mtwherewj[^]
modified on Thursday, November 18, 2010 2:08 AM
|
|
|
|
|
pancakeleh wrote: Histograma.HistogramaDesenat
Once again it looks like you are using a third party control so you should post your question to the site where you found the control. If you have installed a library that supports the control then make sure you have added it to your project references.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
i manage to solve it alrdy thanks.
|
|
|
|
|
Any idea how to visualize a tree in C#? Like treeview but in graphical form, circles and links. Any libraries, controls maybe as I don't have much time? It seems correct visualization of any tree is not an easy thing
|
|
|
|
|
It's easy with the right approach: Position the leaves first.
If each leaf has its own space in the Y dimension (i.e. no other nodes under it), you can easily assign Y coordinates for all the leaves. Just go through them from left to right, incrementing the Y coordinate according to each leaf's width and the gap between adjacent leaves.
The X coordinates come from the leaves' depths.
The next step is to assign coordinates to the interior nodes. One approach is to position each interior node in the middle above its leaves.
Finally go through all the nodes, drawing them at their assigned coordinates, and drawing links from each interior node to its children.
|
|
|
|
|
I encounter this particular problem. I am currently using visual studio 2010, aforge subtract class. when i try to run the program, nothing happened. the code as below:
private void button5_Click(object sender, EventArgs e)
{
Bitmap overlayImage = new Bitmap(pictureBox3.Image);
Bitmap sourceImage = new Bitmap(pictureBox4.Image);
Subtract filter = new Subtract(overlayImage);
Bitmap resultImage = filter.Apply(sourceImage);
pictureBox5.Image = pictureBox5.Image;
}
Where have i gone wrong?
ref: http://www.aforgenet.com/framework/docs/html/2d04f587-3272-2ad5-f8bc-54ff407d41f2.htm[^]
|
|
|
|
|
Uhhh...pictureBox5.Image = pictureBox5.Image; You really don't think there's a problem with this?
Aren't you completely ignoring the resultImage and not doing anything with it?
Seems pretty obvious to me...
|
|
|
|
|
sorry there is a typo. after i changed, it still cant work.
|
|
|
|
|
But what did you change it to? We can't help if you don't provide that as well.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
i changed it to this:
private void button5_Click(object sender, EventArgs e)
{
Bitmap overlayImage = new Bitmap(pictureBox3.Image);
Bitmap sourceImage = new Bitmap(pictureBox4.Image);
Subtract filter = new Subtract(overlayImage);
Bitmap resultImage = filter.Apply(sourceImage);
pictureBox5.Image = resultImage;
}
|
|
|
|
|
There are a couple of things to consider here.
1) You aren't wrapping your bitmaps (disposable objects) with the using statement so they will leak like buggery.
2) You were told yesterday that questions about a third party library should be directed to the appropriate supplier.
|
|
|
|