|
I think the time has come for you to step away from the keyboard, take a deep breath, and re-read your lecture notes - because you appear to be making changes at random!
Your original question was about calling the method you have renamed to "calculations", but you now don't call it at all. You also don't tell us what your "still has an error" is - or where it is, or whether it is run time of compile, etc.
All your code would do if you could run it is ask the user how many drawers he wants, and then tell him a desk will cost that number of dollars!
But you can't run it, can you? Because it doesn't compile. Why not? Because your "usersWood" method needs a parameter called "woodType" that you haven't told it it should expect, so it reports it can't find a variable called "woodType" in the current context. But that's ok - you don't call it anyway...
Seriously: sit down, read through your notes and try to think what you need to do, because at the moment you are probably getting frustrated because nothing you try works, and you don't know what to do, and why are computers so stupid, and...
If you stop and think about the whole task, I believe you can do this. But just guessing and hoping it will work isn't going to do anything pleasant, any more than it would if you tried to learn to drive by jumping in a Bugatti Veyron and slamming the accelerator to the floor...
|
|
|
|
|
Go and read the book I recommended to you, it explains in detail this and other issues in C#.
Veni, vidi, abiit domum
|
|
|
|
|
Hi All,
Need Decrypt C# code for below Encryption code---
public string CreatePwdHash(string pwd)
{
string s = "";
ASCIIEncoding encoding = new ASCIIEncoding();
for (int i = 0; i < pwd.Length; i++)
{
char ch = pwd[i];
byte[] bytes = encoding.GetBytes(ch.GetHashCode().ToString());
char ch2 = pwd[i];
s = s + ch2.GetHashCode().ToString() + Convert.ToBase64String(bytes);
}
return Convert.ToBase64String(encoding.GetBytes(s)).ToUpper();
}
|
|
|
|
|
That's not encryption at all.
That's is a very poor method of converting meaningless data to Base64. There is no way to convert a HashCode back to the original string that it came from.
Also, you should NEVER include code in your application that decrypts a password, no matter how it's encrypted. This increases the level of security in your application making it far more difficult to get users passwords.
If you want to know how to cryptographically hash passwords, read this[^].
|
|
|
|
|
It looks as if you don't believe what I've already told you.
Do yourself a favour and look up one way functions[^].
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
As you have been told (here and in the Lounge) you can't "decrypt" a hash value - it is not encryption.
See here: Password Storage: How to do it.[^] it should explain it to you.
|
|
|
|
|
Where did you find that gem? From the viewpoint of security, it is: bad.
Since you are calling GetHashCode on each character of the string, that thing might actually be reversible... (though hash functions are actually meant to be irreversible, but the input value has a far too narrow range).
Actually, you only need a table containg the hash code for all possible char values (note: release version, not debug version, as they might be different).
No, do not do so. Throw that function away.
If you need to identify users of your application, use proper hashing, with salt!
If you need to pass the password to another service (database, email provider, ...) use proper encryption.
|
|
|
|
|
Hi,
I have develop Chat application like gtalk, Some one help me, how start and develop.
Thanks for reading..
|
|
|
|
|
You can start by searching CodeProject, where you'll find many resources.
As you design your application, and start to write code, you can ask specific questions here, or on the QA forums, and many people will be glad to help you ... if ... you take the time to write your questions clearly, specify what you are doing, and give details about the problems you are having.
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
|
You might want to look at a number of samples available on the internet.
|
|
|
|
|
The program of conversion
1. Binary to decimal
2. Decimal to binary
3. Hex decimal to decimal
4. Decimal to hex decimal
5. Octal to decimal
6. Decimal to octal
Means at the user's request, for example, the introduction of No. 4
Convert from Decimal to hex decimal
Thus, the rest of the options, preferably without work ARRAYS
|
|
|
|
|
A little reading of the .NET number classes would show you how to solve this quite easily.
Veni, vidi, abiit domum
|
|
|
|
|
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
|
|
|
|
|
Some of these conversions are supported by the framework classes.
However, assuming this is homework, you need to implement these using some logic.
Look at the algorithms for these conversions and then implement them in your code.
|
|
|
|
|
That is a process called "base conversion", to give you something to google for.
|
|
|
|
|
|
Hi could someone please help me fix this simple program of mine. I'm trying to explore c# and i really want to learn so please bear with me and help me.
What I want to do is that from the method getDrawer it will ask the user to input the number of drawers you want, then it will pass the answer to the Main() My code below has an error please help me fix this. Thank you very much. Here is my code so far:
using System;
public class DesksP
{
int Main()
{
int drawerValue;
int drawerA = getDrawer(drawerValue);
Console.WriteLine("The number of drawers is/ are:{0}", drawerA);
}
private static int getDrawer(int drawerValue)
{
Console.WriteLine("Enter number of drawers: ");
drawerValue = Convert.ToInt16((Console.ReadLine()));
return drawerValue;
}
}
|
|
|
|
|
int drawerValue;
This line needs to come before the declaration of main , so it is accessible in both methods. It, and main , also need to be made static , the same as getDrawer . I would suggest reading .NET Book Zero by Charles Petzold[^] for a very comprehensive introduction to .NET and C#.
Veni, vidi, abiit domum
|
|
|
|
|
As Richard says, Main needs to be static or it won't be executed.
But...you never assign a value to drawerValue in a Main method, so the compiler will complain when you try to pass it to the getDrawer method - but when you get into getDrawer, you don't use any existing value anyway! And you are trying to convert to a 16 bit integer, and return a 32 - this isn't a major problem, but just use int throughout.
So...try this:
public class DesksP
{
int Main()
{
int drawerA = getDrawer();
Console.WriteLine("The number of drawers is/ are:{0}", drawerA);
}
private static int getDrawer()
{
Console.WriteLine("Enter number of drawers: ");
return Convert.ToInt32((Console.ReadLine()));
}
}
Though I would suggest that you might be better off looking at int.TryParse[^] to do the conversion, as it allows you to check if the user typed "Hello" instead of "107" and tell him off!
int value;
Console.WriteLine("Enter number of drawers: ");
while (!int.TryParse(Console.ReadLine(), out value))
{
Console.WriteLine("Please enter a number!");
}
return value;
|
|
|
|
|
Hi I tried this code below but it shows an error "not all code paths return a value". Please check what's wrong in it thanks
public class DesksP
{
int Main()
{
int drawerA = getDrawer();
Console.WriteLine("The number of drawers is/ are:{0}", drawerA);
}
private static int getDrawer()
{
Console.WriteLine("Enter number of drawers: ");
return Convert.ToInt32((Console.ReadLine()));
}
}
|
|
|
|
|
Your Main() method needs to return a value since you've declared that it does.
/ravi
|
|
|
|
|
public class DesksP
{
static int Main()
{
int drawerA = getDrawer();
Console.WriteLine("The number of drawers is/ are:{0}", drawerA);
return 0;
}
private static int getDrawer()
{
Console.WriteLine("Enter number of drawers: ");
return Convert.ToInt32((Console.ReadLine()));
}
}
|
|
|
|
|
How to use downloaded .wav audio sample voice for text to speech (speechlib)?
SpVoice voice = new SpVoice();
voice.Voice = voice.GetVoices("name = Microsoft Anna"); => The voice want to change from .wav file but not microsoft anna
voice.Speak(Label1.text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
Thanks.
|
|
|
|
|
Are you asking how to use a downlaoded .wav file as the new "voice sample" for a text-to-speech operation?? You don't like "Anna" so you want to replace her with a new sampled voice?
|
|
|
|