|
Hi Guys,
I want to know how can I detect that the internet connection on my machine is idle.
Can you hint me with any code snippet, .net class or something like that
Thanks in advance
Mahmoud Zidan myBlog[^]
|
|
|
|
|
hope this will give an Idea.
SSK.
|
|
|
|
|
|
I've been trying to find out about this process for a while now and am getting nowhere. Is there anyway to do this using Directsound? While looking at DirectX.Capture it seems to me that it will save the sound everytime, which I don't want.The reason I am needing this is to make a guitar tuner program and so need to be able to extract the pitch of the sound in real time.
Any help is appreiciated
Thanks
|
|
|
|
|
if you want to do pitch extraction then you have to resort mathematics to solve this problem, i.e Fourier Transform. Back in the 70s Lawrence Rabiner published a paper in pitch extraction. You can follow his algorithm to extract the pitch or formants of a sound wave and its pretty easy to implment in c# or vb .net since I have done it using Matlab. If you google hard enough you should be able to find it, it was published in one of the IEEE journals.
Over the weekend if I find my research paper I will add the details on to this post.
|
|
|
|
|
well i did manage to figure out the algorithm I had used, it wasnt by Rabiner but by Markel. Markel wrote the paper, "The SIFT Algorithm, For Fundamental Frequency Estimation" and was published in the IEEE Transactions on Audio and Electoracoustics. SIFT stands for The Simple Inverse Filtering Technique. The paper was published in 1976, so a long time ago. I wrote the code in Matlab just by reading the paper and it was pretty easy.
However, I was more interested in determining the gender of the voicing recording any performing pitch analysis. The actual accuracy of determination of the pitch was handled by a second algorithm component. I had used two algorithms MLE, Maximum Likelihood Estimation and MAP, Maximum A Posteriori. Refer to Numerical Receipies in C pdf book to get implementation details for MLE and MAP.
I dont know how appealing this maybe but its an alternative to DirectX but a bit too mathematically challenging.
|
|
|
|
|
Thanks very much, I'll look into SIFT and see how that goes.
|
|
|
|
|
hello all,
in my database i took empid ,username,password, status,usertype
for status =1 is for admin
status=2 for normal user
in my code it doesn't work
please see my code
depends on status my page goes to that page.
<pre>
SqlConnection con= new SqlConnection ("uid=sa; password=sa123; database=usermanagement; server=c113");
SqlCommand cmd=new SqlCommand ("select * from tbl_user_management",con);
SqlDataReader dr;
con.Open ();
dr=cmd.ExecuteReader ();
con .Close ();
Lbluser .Text ="";
Lblpassword .Text ="";
Txtusername .Text ="username";
Txtpassword .Text ="password";
int status;
//status= dr["status"];
//int status;
status=Convert.ToInt32(1);
if(status==1)
{
//status=Convert.ToInt32 ("1");
Response .Redirect ("admin.aspx");
}
else if (status==2)
{
//status=Convert.ToInt32 ("2");
Response .Redirect ("Welcome.aspx");
}
srinivas
|
|
|
|
|
srinivassam wrote: int status;
//status= dr["status"];
//int status;
status=Convert.ToInt32(1);
Erhm, it looks like you're converting 1 to the declared integer 'status'... This makes everyone an admin :->
|
|
|
|
|
srinivassam wrote: status=Convert.ToInt32(1);
if(status==1)
{
What should that be?
All the best,
Martin
|
|
|
|
|
Hi,
How many records has your database and how do you know you have the proper row?
I would do it something like this:
<br />
String connection = "uid=sa; password=sa123; database=usermanagement; server=c113";<br />
<br />
SqlConnection con= new SqlConnection (connection);<br />
SqlCommand cmd=new SqlCommand ("select * from tbl_user_management where username ='" + txtUsername.Text + "'",con);
<br />
SqlDataReader dr;<br />
con.Open ();<br />
dr=cmd.ExecuteReader ();<br />
<br />
if (dr.HasRows())<br />
{<br />
if (dr.Read())<br />
{<br />
Lbluser.Text = String.Empty;<br />
Lblpassword.Text =String.Empty;<br />
Txtusername.Text ="username";<br />
Txtpassword.Text ="password"; <br />
int status = Convert.ToInt32(dr["status"].ToString());<br />
}<br />
}<br />
con.Close();<br />
switch (status)<br />
{<br />
case 1: Response .Redirect ("admin.aspx"); break;<br />
case 2: Response .Redirect ("Welcome.aspx"); break<br />
default: break;
}<br />
<br />
|
|
|
|
|
hi friend thankyou very much
now its working
thanks for your help
earlier i got errors but i solved now it is working fine
thank you
srinivas
|
|
|
|
|
Hi,
How do you run an application under different credentials?
I have created a small app which accesses active directory. One of its tasks is to move objects. However only admin credentials can move object as i wish to. I need to run my c# windows app under this username and password so that i can move these objects.
Thanks
Steve
|
|
|
|
|
|
Hello all ,
I am tring to bind the listbox control to a database table.
I am trying to do this using a thread.
But i am not succeeded yet. Please help me i am new to this threadign concept.
thanks in advance.
Bharath.S Ron
|
|
|
|
|
Don't double post your question...
|
|
|
|
|
PLease don't repost the question just because you didn't get the answer you are looking for.
The problem is that you cannot access a GUI object (like the listbox) from a different thread, other than the main application thread. You have to do an invoke back to the GUI thread for that. But if the binding itself is time-consuming, the Invoke will not help because you are again doing it on the GUI thread so your application will not respond during that period.
If you can isolate the time-consuming bit of the code, you can move that alone to a different thread and then Invoke back to the GUI thread when you are done.
Checkout this example:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scag-ch06.asp[^]
|
|
|
|
|
Hi,
I have a small problem.
In a gridview I want to read out cellValues. It regards the reading of cellValues after Editing.
My Method
<br />
public string giveCellValue(Object typeOfObject, GridView gv, Int32 rowNumber, Int32 cellNumber, Int32 controlNumber)<br />
{<br />
return ((typeOfObject)gv.Rows[rowNumber].Cells[cellNumber].Controls[controlNumber]).Text;<br />
}<br />
If I want to read out a textBox object I want to do:
String ReadValue = giveCellValue(TextBox, gridMyGrid, 1, 0, 0);
For a Label I want to do
String ReadValue = giveCellValue(Label, gridMyGrid, 1, 0, 0);
That is where .NET shoots me and says I cannot pass the object as a variable.
How to overcome this problem.
|
|
|
|
|
Hi,
if you define giveCellValue(TextBox myTextBox, ...) then it will accept any TextBox,
but it wont accept a Label.
if you define giveCellValue(Control myControl, ...) then it will accept a TextBox,
a Label, and all other Controls; now you can access myControl.Text since Text is a
property that exists for all Controls; but you still would not be able to access
a property that exists just for some Controls.
The better way however is to define giveCellValue(string text, ...)
and call it like so:
String ReadValue1 = giveCellValue(myTextBox.Text, gridMyGrid, 1, 0, 0);
String ReadValue2 = giveCellValue(myLabel.Text, gridMyGrid, 1, 0, 0);
Doing so giveCellValue does not have to touch other, independent, Controls at all.
It is better from OO perspective.
Hope this helps.
|
|
|
|
|
Hello everyone,
I am implementing a simple C# OLE DB Provider (C# COM Server). For C# (managed code), I am wondering what is the entry point (which coclass and which method), client will invoke at first?
It is clear if I write my own client, but I am confused about other clients which I do not have source codes, for example, if I use Microsoft Excel (as a client) to invoke my C# OLE DB Provider, which is the entry point? Any reference materials or debug tools?
thanks in advance,
George
|
|
|
|
|
I have to Sort An Array using C#. I have declared the Array to be 50 element size. I have got the array elements from the user using for loop. If I print the original array, the elements I entered got printed very well. I
have used the Array.Sort(arrayname) function in the Array Class to sort the elements.
After sorting, I printed the elements. All the elements got printed as Zero. Can any one tell What may be the problem?
The code is:
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
int num_ele;
int[] num = new int[50];
Console.WriteLine("Enter the Num of elements in the Array");
num_ele = Convert.ToInt32(Console.ReadLine());
for(int i = 0; i
|
|
|
|
|
Hi,
that is how it looks if you test it with:
- no more thsn 25 numbers, all positive
- more than 25 numbers, all positive, of which several are zero
try it again with negative numbers !
The problem is you have a fixed array size of 50; if you enter fewer numbers, Array.Sort
will still sort those 50 numbers (the ones you did not enter all are zero).
Now listing the sorted array will include the extra zero elements, and if they happen to
be the smaller numbers, they come out first.
Furthermore your program will fail if the user asks for more than 50 numbers.
When entering the 51th number you will get an IndexOutOfRangeException.
This is how you can fix both problems:
- dont use an array, use another kind of collection (such as ArrayList, or List<int> )
- these classes automatically adapt themselves to the number of elements
- and they provide the same Sort facility
May I suggest you read a chapter on collections, then try to use them to your
advantage.
|
|
|
|
|
Could u Please tell me any tutorial about how to use Collection Classes?
|
|
|
|
|
in the declaration, you (implicitely) initialised the array with 50 zeroes, Now, for instance, if the user inputs ten positive numbers, then the Sort method will move the reamaining 40 zeroes into the leading positions of the array, putting the user's entries in the last 10 ones (if you output the whole array then you see the mistake).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
I forgot to mention there is another overload of Sort() that accepts boundary information,
so that can solve your immediate problem; it still leaves you with the 50 limit:
public static void Sort (
Array array,
int index,
int length
)
in your case that would be: Array.Sort(num, 0, num_ele);
For general information on either .NET or C# I would recommend you buy at least one
book and work your way through it. You could also read what MSDN has to say about
ArrayList class for instance.
|
|
|
|