|
1 - everyone wants help, 'help' is not an intelligent subject
2 - yes, we can help. What's the problem ? Oh, the problem is that you have a bunch of blank methods and hope we'll do your homework for you ? In that case, no.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
alextheman wrote: Subject:Help
Never give subject line in that way. alswas try to put correct subject for your problem.
alextheman wrote: Is any one can help me with this coding :
How can some one help you with out knowing your problem?
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
sorry, I newbie in programming, I still confuse about this code
if(strs[0]=="q")
break;
else if(strs[0]=="print")
PrintSortedData();
else if(strs[0]=="inc")
Increase(strs[1]);
else if(strs[0]=="dec")
Decrease(strs[1]);
else if(strs[0] == "swap")
Swap(strs[1], strs[2]);
else if (strs[0] == "ref")
Ref(strs[1], strs[2]);
else if (strs[0] == "unref")
UnRef(strs[1]);
I have already make some changes in the coding, like below :
I confuse what i should fill in Increase, Decrease and unref procedure
Thx
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ApplicantTestin
{
/// The DataObject class stored with a key
class DataObject
{
// Populate
}
class Program
{
static Hashtable Data = new Hashtable();
static string[] StaticData = new string[] { "X-Ray","Echo","Alpha", "Yankee","Bravo", "Charlie",
"Delta", "Hotel", "India", "Juliet", "Foxtrot","Sierra",
"Mike","Kilo", "Lima", "November", "Oscar", "Papa", "Qubec",
"Romeo", "Tango","Golf", "Uniform", "Victor", "Whisky",
"Zulu"};
static void Main(string[] args)
{
for(int i=0;i<staticdata.length; i++)<br="" mode="hold"> Data.Add(StaticData[i].ToLower(), new DataObject(StaticData[i]) );
while(true)
{
PrintSortedData();
Console.WriteLine();
Console.Write("> ");
string str = Console.ReadLine();
string[] strs = str.Split(' ');
if(strs[0]=="q")
break;
else if(strs[0]=="print")
PrintSortedData();
else if(strs[0]=="inc")
Increase(strs[1]);
else if(strs[0]=="dec")
Decrease(strs[1]);
else if(strs[0] == "swap")
Swap(ref strs[1], ref strs[2]);
else if (strs[0] == "ref")
Ref(ref strs[1], ref strs[2]);
else if (strs[0] == "unref")
UnRef(strs[1]);
}
}
///
/// Create a reference from one data object to another.
///
/// <param name="key1" />The object to create the reference on
/// <param name="key2" />The reference object
static void Ref(ref string key1, ref string key2)
{
string key3;
key3 = key1;
key1 = key2;
key2 = key3;
}
///
/// Removes an object reference on the object specified.
///
/// <param name="key" />The object to remove the reference from
static void UnRef(string key)
{
// Populate
}
///
/// Swap the data objects stored in the keys specified
///
static void Swap(ref string key1, ref string key2)
{
string key3;
key3 = key1;
key1 = key2;
key2 = key3;
}
///
/// Decrease the Value field by 1 of the
/// data object stored with the key specified
///
static void Decrease(string key)
{
// Populate
}
///
/// Increase the Value field by 1 of the
/// data object stored with the key specified
///
static void Increase(string key)
{
// Populate
}
///
/// Prints the information in the Data hashtable to the console.
/// Output should be sorted by key
/// References should be printed between '<' and '>'
/// The output should look like the following :
///
///
/// Alpha...... -3
/// Bravo...... 2
/// Charlie.... <zulu>
/// Delta...... 1
/// Echo....... <alpha>
/// --etc---
///
///
static void PrintSortedData()
{
Console.WriteLine();
}
}
}
|
|
|
|
|
1 - are you using an ld version of .NET ? If not, use generic containers, always.
2 - like I said, we're not going to write the code for you. Write some code and ask specific questions when you get stuck. Working out what to do, is half of the reason you were given this homework.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If you don't understand the question ask your teacher. If you do understand it then work out what to do, I rather suspect the clue is in the method name and description -
alextheman wrote: ///
/// Decrease the Value field by 1 of the
/// data object stored with the key specified
///
static void Decrease(string key)
{
// Populate
}
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi i want to display the IL( intermediate language) from assembly.
have any tricks?
My small attempt...
|
|
|
|
|
|
its a third party tool na..
i want to do it from my test application
My small attempt...
|
|
|
|
|
|
ILDASM.EXE comes with Visual Studio.
Pits fall into Chuck Norris.
|
|
|
|
|
Hello everyone,
I am new to how to use C# to calculate hash value for a string. I want to check we normally use MD5CryptoServiceProvider.ComputeHash?
As described here?
http://support.microsoft.com/kb/307020/en-us
thanks in advance,
George
|
|
|
|
|
What's wrong with the gethash method that's built in ?
You can use any method you like, but I would agree you should use a built in crypto class, if you want something other than the built in method.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Do you have a sample for gethash? I can not find one from MSDN or Google.
regards,
George
|
|
|
|
|
GetHashCode is a method on all objects in .NET
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Question answered. I searched for "gethash" other than "GetHashCode" before, so no samples are found.
have a good weekend,
George
|
|
|
|
|
George_George wrote: use MD5CryptoServiceProvider.ComputeHash?
MD5 is weak. There are many algorithms available to get the original string from a MD5 hash. You may consider using SHA . There are different types like SHA256 , SHA384 , SHA512 etc. Here is an example which uses SHA512 to hash.
string stringToBeHashed = "Hello";
byte[] bytesToBeHashed = Encoding.ASCII.GetBytes(stringToBeHashed);
SHA512 sha = new SHA512Managed();
byte[] hashedBytes = sha.ComputeHash(bytesToBeHashed);
string hashedString = Convert.ToBase64String(hashedBytes); Hope this helps
|
|
|
|
|
Cool, N a v a n e e t h!
regards,
George
|
|
|
|
|
It depends on whether you need a cryptographically strong hash or not.
.GetHashCode is fast and quite weak (its easy/more likely to find something with the same hash).
The CSPs are a lot slower but generate much stronger hashes.
|
|
|
|
|
Thanks Mark,
CSP you mean Crypto Service Provider? Or? For example, C# class do you refer?
regards,
George
|
|
|
|
|
Yep the crypto service providers.
|
|
|
|
|
Thanks Mark,
Cool!
regards,
George
|
|
|
|
|
Hi,
I am trying to send email using c# and the code from my research is here:
MailMessage logMailMessage = new MailMessage();
logMailMessage.To = "email1@hotmail.com";
logMailMessage.Subject = "Subject is here ";
logMailMessage.From = "email2@hotmail.com";
logMailMessage.Attachments.Add(new MailAttachment(Settings.LogFile));
SmtpMail.Send(logMailMessage);
What I don't know is how does the machine know the password of email address that I am using to send the email? pls help thk
|
|
|
|
|
YAI wrote: hat I don't know is how does the machine know the password of email address that I am using to send the email?
It doesn't. You have to supply it somehow. That's if your SMTP server (which, BTW, you didn't specify anywhere) requires a username/password to send a message.
|
|
|
|
|
It's usually done with anonymous SMTP, if your SMTP server allows such.
|
|
|
|
|
Thank for the replies. And How can I know whether Smtp server allows that? If I want to check whether the sending is successful, is putting try catch with catch(Exception ex) enough?
|
|
|
|