|
Hi Martin,
I did remember that thread; I havent tried it yet, I still tend to write code that
runs also on 1.1
Martin# wrote: This was my Nr.:1000 post
Aha, that explains a few things. Now take that holiday !
|
|
|
|
|
Luc Pattyn wrote: Aha, that explains a few things. Now take that holiday !
All the best,
Martin
|
|
|
|
|
Have you tried using
_WebClient.DocumentComplete -= <your assigned="" event="" handler="" to="" be="" removed="">;
Is that what you are talking about?
|
|
|
|
|
I have a quick question.
I have a program, and I need every instance of the program to have it's own uniqure ID. (E.G the first one opened has and ID of 12345, the second one has an ID of 74982, etc.)
At the moment the only way I can see of doing this is getting the process ID.
Is this the best way of doing it or are there other, better, ways of generating a unique ID?
- Munty
|
|
|
|
|
Why not just use the random number generator and use the current system time as the seed generator. This ought to guarantee a unique sequence of numbers all the time. Or generate a GUID
|
|
|
|
|
Process ID is just fine; it is unique in that no two processes can be running simultaneously
on the same Windows PC unless their processIDs are different.
Why bother to try and come up with some other unique number ?
|
|
|
|
|
yup,if it is working with single process class which gurantee to be unique, then y to use time or random class.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Alrighty then, I guess I'll just stick with the Process ID.
Thansk All.
- Munty
|
|
|
|
|
Apologies in advance that may not be a C# issue, but perhaps .NET, NTFS, XP-SP2 or even hardware. You tell me.
I have sucessffuly ran breath-first and depth-first versions of the following C# snippet on different hardware as a precursor to noodling around with databases, SQLite, etc. Seems simple enough. Makes 1M diretcories as in D:dataset/II/JJ/KK where II, JJ, and KK are are 100 nodes each. On my developmemt machine (xp-sp2, 2GB, stable) I have this repeatable condition where when I get to about i = 67 (670K dirs created) the program slows down and then the system becomes unresponsive enough that I must reboot! No chance to use the VS debugger.
I quick format the D: drive before each operation, so the dir construction in this program is being performed on a clean FS with a new MFT. I watch the memory usage (doesn't use much). I've monitored the heap (doesn't use much). I'm perplexed with this system-specific issue; as it is one of the few times (for me) that a user-space program has caused so much trouble. Thoughs on what to try next appreacited. Or pointers to a more appropriate forum. (Yes, I know I should try/catch a possible exception at CreateDirectory; I doubt that is the issue). Thanks!
namespace make_dir_tree
{
class Program
{
static void Main(string[] args)
{
string path;
Stopwatch watch = new Stopwatch();
watch.Start();
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
{
for (int k = 0; k < 100; k++)
{
path = String.Format("D:/dataset/{0:D2}/{1:D2}/{2:D2}", i, j, k);
Directory.CreateDirectory(path);
}
Console.WriteLine("i:{0} j:{1}",i,j);
}
watch.Stop();
Console.WriteLine("Elapsed: {0}", watch.Elapsed);
Console.WriteLine("In milliseconds: {0}", watch.ElapsedMilliseconds);
}
}
}
|
|
|
|
|
Hi,
you MUST use try-catch for operations that MIGHT fail due to external circumstances,
since they WILL fail sooner or later.
How big is your D: drive ?
In your case, my best guess (and the try-catch would have shown you already) is
your D: drive is full. Each directory takes at least one cluster, cluster size depends
on partition size, but is at least one sector (normally 0.5KB).
When the disk is full, you get an IOException. I dont know what you did not to get it,
maybe running in a separate thread ??
|
|
|
|
|
OK, I'll add the try/catch around the CreateDirectory, and report back
It shouldn't fail, but it could.
In this case the D drive is a "just formated" 1TB drive with nothing else on it.
This 1M node directory structure usually takes about 1 GB in NTFS.
-ss42
|
|
|
|
|
NTFS issue. When you create a file or folder, it has to create a unique 8.3 format name ('short name') for compatibility with 16-bit DOS and Windows applications. It has to search the directory to ensure that it is unique, which takes longer the more files you have in the folder. It works best if you have distinguishing information at the beginning of the filename so that there are few clashes.
You can disable this feature globally in Windows by setting the following key
[HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\FileSystem\Ntfs]
"Disable8dot3NameCreation"=dword:1 However, you should only do this on systems used for a fixed purpose and with careful testing.
|
|
|
|
|
In my project i am using a data grid. I have have one button to delete records(rows) in the Grid. If i drag the mouse accross the rows on the grid, it selects all the rows. when clicked delete button it deletes the pointed record.
Is there any facility to restrict the user from selecting multiple rows or what event fired when user select multiple rows?
|
|
|
|
|
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
|
|
|
|