|
İ want to change thread state form waitsleepjoin to running state when it is on waitsleepjoin state. so , I mean , when the thread sleep time is not finish.
|
|
|
|
|
I cound find the different between
Thread and Thread Pooling.Anybody help
me to find the solution with example.
I have use some example but I could not
find the difference.but I know threding.
what is the use of thread pooling.
Continue...
|
|
|
|
|
Have a look at Wikipedia's article on thread pools[^].
MSDN also has an article[^] that talks about .NET's thread pool in particular.
|
|
|
|
|
Hello there, it's been awhile since i've used these forums, but i've come across a program i'd like to take a crack at writing and thought this was the place to get a bit of an idea of where to start.
Ok, so anybody familiar with sound, or for that matter frequencies in general may have seen or used an oscilloscope (yes, that piece of equipment that shows sine waves and the likes on a little screen that looks slightly like a heart rate monitor). Now, i figure, that in order to make something which simulates an oscilloscope i need to be able to retrieve the amplitude of a sound or piece of music at regular intervals, and then perhaps have a series of dots that draw out the amplitude over a given time period which then forms what appears to be a single continous line (a frequency).
Ok, so in a simple form, lets say i want to load an .mp3 file into a program, play the file and as it is playing continously retrieve a value for the amplitude of the signal and then graph it. So i suppose, at least to get started, what my question comes down to is what classes, properties, methods, events should i be looking at to a) load an mp3 or sound file into a program and b) get the amplitude of the sound at a given point in time? I'm not too sure whether anybody can help or whether i'll stay left in the dark a bit here, but if anybody has any ideas or tips just to get me started it'd be much appreciated. Cheers, Bryce.
|
|
|
|
|
I know an Event is a special kind of delegate, but its the best fitting title I could think of.
I've been trying to learn about delegates & events. I've read tutorials, a book, & followed examples but I still have a question.
For an event, in short, it seems like we:
1) Declare our Delegate Class: public delegate void MeltdownHandler(object reactor, MeltdownEventArgs myMEA);
2) Create an event: public event MeltdownHandler OnMeltdown;
3) Tell some new Delegate Object to call [some_method], when the event is raised: myReactor.OnMeltdown += new MeltdownHandler([some_method]);
4) Call the event: OnMeltdown([whatever]);
5) Which calls the Delegate Object.
6) Which calls [some_method]
Why not just create a Delegate Object and call the Delegate Object directly which will call [some_method] (instead of raising the event) ?
1) Define our Delegate Class: public delegate void MeltdownHandler(object reactor, MeltdownEventArgs myMEA);
2) Create an Delegate Object of that type: MeltdownHandler myMeltdownHandler = new MeltdownHandler([some_method]);
3) Call that Delegate Object: myMetldownHandler([whatever]);
4) Which calls [some_method]
So what am I missing? Whats the benefit of creating & raising an event. By creating & directly calling a Delegate Object it seems like it still has the same effect, with less code. It still notifies another object that something has occurred.
|
|
|
|
|
It's all about good design. For example why would we bother to declare fields as private and make public properties to expose them?
If you declare your delegate as public and expose it to the users, they would have to reinstantiate it and point it to their handler method which is a very bad design.
Another major difference between delegates and events is that events may have more than one handler -you can add/remove handler methods at runtime using +=/-= respectively-, while if you exposed a single delegate you can associate it with one single method.
Regards
|
|
|
|
|
I just wanted to say thanks for the help. That makes perfect sence.
Being my first experience with events I guess I was concentrating to much on trying to understand what the code was doing (code I was trying to learn from), & not how a user would use it.
|
|
|
|
|
|
How can the data be displayed from a txt file by giving option for searching . to be specific, i want the telephone numbers / file numbers to be displayed by giving option for searching the records in alphabatical order.
Sunil Ticku
|
|
|
|
|
From your profile you use c++ and MFC so this should not be a big step for you. The IO namespace will give you the tools to read the files in I would suggest the textReader which should allow you to read it in by the line. The text namespace holds the regex tools that will let you search for the patterns that you want. Feed the results into a collection that suits your needs tada you are there.
Hope this helps
|
|
|
|
|
Hi All,
Wish you happy New year to all.
Can anybody help me to fill only a selected column from a table to a datagridview?
|
|
|
|
|
Hi
I want to access the server directory to write a file in the share folder but I have to set the username and password to access this dictory but I want to set the userName and password in my programm because I dont want to get password to the client so he can access this directory but in HiddenCode this Login set and after finishing my job this username logOut.
similar to login to SQL Server database account :
crptSt.SetDatabaseLogon("userName","Password");
but I dont find this in MSDN or other help center. I`m so be glad that anyone could help me. Thanks
Mohammad Khatibi (M.khatibi@gmail.com)
|
|
|
|
|
Hi all,
I'm learing C# and have been for over 6 months. I've written several programs and believe I am near to becoming an "intermediate" level programmer.
I need to purchase some good reference/help books that I can study and am thinking of purchasing "C# Cookbook" to help me develop my skills/understanding.
I would appreciate any comments and recommendations as to what books I should be reviewing.
Thanks,
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: I need to purchase some good reference/help books that I can study
A reference book is something like a dictionary or encyclopaedia. It isn't something that you would sit down and study. It is something that you would delve into from time-to-time for a specific purpose.
Glen Harvy wrote: to help me develop my skills/understanding.
Read articles - Here on code project there are many articles, if you stick with the good ones (rating 3 or above) you should do okay. MSDN Magazine[^] is published online for free.
Attend user groups / community events. You'll find like minded people, especially the kind that like to help out. Often a person with knowlege of a specific area will get up and talk on their area of expertise at these events. Or, you might find people organising "geek dinners" where you can socialise and get to know people who may be able to tell you how to solve a problem over pizza.
|
|
|
|
|
Hey.
I am building an application where there will be different 'users', each with a username and password. The application is using a webservice (Amazon S3) which requires a logon also. It is envisaged that a company buys an S3 account, and allows it's users to utilise it through an application. The users can store and delete files on their part of S3. Each user would only have access to their own files, etc. Deciding who's files belongs to who is a different issue.
Anyway, so if, say, Joe logs into the application, his password is checked against a database on a central sever, and upon authentication, the S3 'access ID' and 'secret access ID' is sent to the application, which then uses it to log on S3. The users password would initially be MD5'd, and then sent to the server for authentication. (The database will hold MD5'd passwords).
So my first question is: What's the best way to get the 'access ID' and 'secret access ID' from a central server, to the user? Obviously, to keep it secret it would need to be encrypted. The application can be ran on any machine, so a key cannot be stored, say, in the registry. I was considering encrypting the S3 access/secret id string with an MD5 of the users password, but that'll be sent over the network too, and itself will be exposed. Please, any ideas greatly appreciated???
Next, then Joe wants to upload files.
I am looking for any suggestions on how to encrypt these files, using a different key for each user. So, for example, a company admin couldnt go onto the S3 service, and look at a users files, without knowing the encryption/decryption key. Again, I was considering using an MD5 of the users password as an encryption/decryption string, but this itself poses the problem whereby a user changes password.
My main problem is how to get a string from the server to any PC, but for it not to be exposed on the network.
Any help in this whole area is much much much appreciated.
Regards,
Cormac Redmond
|
|
|
|
|
Cormac M Redmond wrote: The users password would initially be MD5'd, and then sent to the server for authentication. (The database will hold MD5'd passwords).
MD5 is broken. Consider using SHA256 of SHA512. Also you might want to consider using a salted hash. This means adding some additional random data on the front of a password before it is hashed so that in the event that two users happen to have the same password it isn't obvious by looking at the resulting hash values. The salt is stored in plain text in an additional column in the database. The salt being in plain text has no value to an attacker because its function is solely to remove the ability to detect duplicate passwords. A brute force attack would still be necessary to break the password. When a user types their password the salt is added to the password as before, then it is hashed and the salted hash values are checked.
Cormac M Redmond wrote: So my first question is: What's the best way to get the 'access ID' and 'secret access ID' from a central server, to the user? Obviously, to keep it secret it would need to be encrypted. The application can be ran on any machine, so a key cannot be stored, say, in the registry. I was considering encrypting the S3 access/secret id string with an MD5 of the users password, but that'll be sent over the network too, and itself will be exposed. Please, any ideas greatly appreciated???
Consider the use of public/private key encryption. The basic idea is that anything encrypted using the public key can only be read by the holder of the private key. Anything encrypted with the private key can be read by anyone with the public key. The former could be useful for your purposes, the latter is useful when you want to authenticate where something has originated.
So, you decide on an asymetric encryption algorithm, you send the issuer of the access/secret id your public key. When the data comes back, you are the only one that can read it because you have the private key. It doesn't matter than anyone can see the public key because it is no use to them.
Cormac M Redmond wrote: I was considering using an MD5 of the users password as an encryption/decryption string, but this itself poses the problem whereby a user changes password.
You also have the problem that you are using a key that can be discovered. If you are using a hashed version of the password as the key, then the admin doesn't need to know the password, just the hashed value. They can then attack the file/database directly without going through the application.
This leads in to the same problems as you have with DRM systems. The key and the encrypted data end up in the same place at the same time with the party you do not trust.
|
|
|
|
|
Thanks. That's all very helpful!
I'm slightly confused regarding the salting. Is this how it should work? Say, I try to login to the application from any P.C.:
Username: Cormac
Password: Redmond
Would the application tell the server to get the salt key from the table where, say, username = Cormac?
And then send the salt key BACK to the application, which would then creat the salted hash value and send back to the server for authentication? *breath*
Therefore, when creating the salts and populating the database, there would be checks that none of them are the same, thus there never being similar hash values?
Also, could you recommend a suitable public/private key encrpytion algorithm? RSA...Diffie-Hellman?
Thanks for the help.
Regards,
Cormac Redmond
-- modified at 0:03 Monday 1st January, 2007
|
|
|
|
|
Cormac M Redmond wrote: Therefore, when creating the salts and populating the database, there would be checks that none of them are the same, thus there never being similar hash values?
If you use a GUID as a salt value you are virtually guaranteed uniqueness. You'd have to generate billions-upon-billions of GUIDs before you'd get a collision - in fact the number is closer to 2.5 * 1038 (250 undecillion) - If you had all the PCs in the world cranking out GUIDs constantly it would still take a heck of a long time.
You can also use something simpler. Like the primary key of the row in the database - since a primary key is guaranteed to be unique it could be a good candidate.
Typically, I just use a random number generator to generate a random sequence of bytes.
Cormac M Redmond wrote: Also, could you recommend a suitable public/private key encrpytion algorithm? RSA...Diffie-Hellman?
You may want to take a look at this entry on Wikipedia[^]. It will help you choose an algorithm that is suitable. From this point you make also find other useful information about cryptography.
One thing to remember about public/private key cryptography is that they are computationally expensive when compared to symmetric encryption - so they are only ever used to encrypt small pieces of data, often they are used to encrypt symmetric keys.
|
|
|
|
|
I wonder why good informative posts like this get only my vote of 5?!!Why don't CPains vote in favour of a post anymore -only voting ones and twoes-?
Thanks Colin. Even though I didn't ask the question, but I've been really pleased by reading your well said, well organized post.
Regards
|
|
|
|
|
I didn't even know you could vote, if you're reffering to me!
|
|
|
|
|
Oops!:-> I didn't even imply it.. I just noticed this for some weeks that many good posts don't get high votes anymore -excpet mine if I were around-, and I was a bit frustrated. Forgive me if you got offended. I really didn't mean you Personally.
Regards
|
|
|
|
|
Hehe. I wasn't offended.
Anyway, at least now I know!
|
|
|
|
|
Nader Elshehabi wrote: Thanks Colin. Even though I didn't ask the question, but I've been really pleased by reading your well said, well organized post.
Thank you. I very much appreciate your compliment.
|
|
|
|
|
Hi.
I have problem storing a composite structure in MS Access using relations. The class structure looks like this:
http://www.web-tech.dk/CompositeStructure.jpg[^]
It uses a composite design pattern.
Any ideas?
Programming is like Mathematics… you take ONE step at the time!
|
|
|
|
|
I am not sure you can do this in ms access. I would try the vb forum since you would be using vba which as far as I know will not support the use of classes in the way you are trying.
Just curious as to why you are trying to do this in ms Access when there are so many OO languages avalilable?
|
|
|
|
|