|
Use the lock keyword around the code you want to protect. You need a reference variable (e.g. an object) in your class to identify the lock.
lock (myObject) {
// code in here is only run by one thread at a time.
}
---
b { font-weight: normal; }
|
|
|
|
|
Hello everyone,
I need to write a DCOM server object in C#. Is this possible? Can I just write a C# Remoting object and then expose this as a COM object, or will this not work because the object needs to be accessed remotely?
Any help would be greatly appreciated!
Thanks,
Shehzad
|
|
|
|
|
I need to draw a rounded rectangle.
I think I create the points and fill that in.
Can anyone tell me if thats so, and what method fill fill an object created from points.
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
|
thats cool. but it doesnt make them rounded.
Can I create a clip region based on 4 lines and 4 curves? ( a rounded rectangle drawn piece by piece )
The problem is that doesn't draw curves.
Nevermind. I figured it out with GraphicsPath.
Thanks tho
Nick
1 line of code equals many bugs. So don't write any!!
-- modified at 12:04 Friday 26th May, 2006
|
|
|
|
|
hi all,
is there something important to do that i dont know when inserting password fields into database ?
i have a password textbox on my form and have a masked field on database.
look at this :
string query = "insert into users(username,password,status,logintime,lastlogintime) values('" + txtuser.Text + "' , '" + txtpassword.Text + "' , '" + cmbstatus.Text + "','" + lblLoginTime.Text + "','" + lblLoginTime.Text + "')"; gives insert into error.
but this :
string query = "insert into users(username,status,logintime,lastlogintime) values('" + txtuser.Text + "' , '" + cmbstatus.Text + "','" + lblLoginTime.Text + "','" + lblLoginTime.Text + "')";
doesnt give an error ;( [password field removed when inserting data to database.]
so i dont know why that masked password field causes an error when inserting data ?
help please ...
thanks in advance,
bye.
|
|
|
|
|
Password word is keyword in SQL too and probably this is the problem. but make google-ing and sure u gonna understand reason.
|
|
|
|
|
I have my static RegistryAccess class which reads and sets values in the registry. I want to be able to set/get the value that contains the space (Default) in the registry. However if I access it with key="(Default)" it creates another registry entry with that key value instead of accessing the default registry key.
(In otherwords this is what I see in regedit:
(Default) REG_SZ (value not set)
(Default) REG_SZ true
Do I access it with key = string.Empty ???
Thanks.
|
|
|
|
|
How can i make my program to loop for .5 second before moving on to next line of code.
Is it the same as using Thread.Sleep(500)?
Yes, it's running on a thread but i don't know doing that how it's gonna affect other threads.
Appreciate
Donkaiser
|
|
|
|
|
The whole point of threads is that doing something in one does not affect any others.
So you are right, Thread.Sleep(500) will wait for half a second.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Is there some kind of code to delay .5 seconds instead of using thread.sleep()?
Donkaiser
|
|
|
|
|
What's wrong with Thread.Sleep?
How about this (untested code):
DateTime start = DateTime.Now;
TimeSpan ts = DateTime.Now - start;
while (ts.TotalMilliseconds < 500)
{
ts = DateTime.Now - start;
}
But that would be silly. Use Thread.Sleep.
|
|
|
|
|
Thread.Sleep(500) has only effect on the current thread.
It doesn't have any effect on the other threads.
|
|
|
|
|
string query = "Insert Into Users(username,password) values(' + "\"" txtusername.Text "\" ','"\" txtpassword.Text"\"')";
adp1 = new OleDbDataAdapter(query, conn); > firstly, is this correct ?
secondly: how should i change this values(' + "\"" txtusername.Text "\" ','"\" txtpassword.Text"\"') ? it gives error ;( dont know how to modify ?
|
|
|
|
|
string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')";
|
|
|
|
|
Message Closed
modified 27-Apr-15 10:59am.
|
|
|
|
|
string baglan = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=veritabani.mdb";<br />
conn = new OleDbConnection(baglan);<br />
conn.Open();<br />
string query = "Insert Into Users(username,password) values('" + txtusername.Text +"','"+ txtpassword.Text+"')";<br />
OleDbDataAdapter da = new OleDbDataAdapter(query ,conn );<br />
DataSet ds = new DataSet();<br />
da.Fill(ds);<br />
conn.Close();<br />
|
|
|
|
|
Message Closed
modified 27-Apr-15 10:59am.
|
|
|
|
|
Once you get it working you really should make a method to go through the textboxes and strip out some characters. Right now you are vulnerable to a sql injection attack.
If I put: bob'; delete * from user; --
I just deleted everything in the user table.
|
|
|
|
|
eggsovereasy wrote: Once you get it working you really should make a method to go through the textboxes and strip out some characters.
You should never strip out and limit the user´s possibilities. You should escape the characters instead.
|
|
|
|
|
Hi,
Does anybody know how to calculate/extract the Pitch values from a Wave (*.wav) file?
Thanks,
Gidon
|
|
|
|
|
Hi!
For this you'll have to perform a fourier transformation.
Basically, your try to approximate the wave form you have by adding many sinus waves. That way you get the volume (amplitude) at certain frequencies, which will ultimately give you the pitch.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Thanks for the explanation.
|
|
|
|
|
Hi ,
I succeeded in performing the FFT on my wave file and even printed the results into a nice Spectogram.
But I don't know how to extract the pitch from these values. Do you have any pointers at to what function I need to perform on the FFT data?
Thanks
Gidon
|
|
|
|
|
Hi!
I'm afraid I don't have any further pointers on how to calculate the pitch value.
You should be able to get a pitch value by multipyling each frequency with the amplitude for this frequency and summing up the values.
That way you'd get a high value if you have many loud, high-frequency bands and a low value if there are more low-frequency bands.
But I must admit I don't know if that'll suite your needs.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|