Please keep in mind that mad geniuses as many programmers may be, few people tend to lump us programmers into the "high social skills" cliche. It's been a while since I worked with scientists but I seem to recall from my university days they can be somewhat socially lacking too. I remember this one physicist... Ahem... Uh, anyway, its probably best to just take the "water off a ducks back" approach - no one really means to insult - especially if you want any of us social deviants to actually help you.
It's been a while since I worked with scientists but I seem to recall from my university days they can be somewhat socially lacking too.
Could not agree more! At the end of the day we are all human.
Michael A. Cochran wrote:
it’s probably best to just take the "water off a ducks back" approach
I normally do, however, being told by someone that I had never met or spoke to that I was not a scientist was what got to me. It was not just an insult and ignorant statement, but it was not even to do with programming and in my own opinion was a personal attack that was not called for.
Anyway, I have taken what I need from this post, got my code to work and moved on
Why didn't I think of that? Too much business programming, I guess. We don't use modulus in business programming much - at least I haven't had the need.
Correct, of course. Much more elegant.
If Stephen is still listening, in C# it becomes;
// To generate as random numbers as possible, this variable must only // be initialized once and then reused as much as possible.
Random rand = new Random();
///<summary>/// Generates a random number between 0 and 99995 that is always divisible by 5.
///</summary>///<returns>Returns a random integer up to 5 digits long that is evenly divisible by 5.</returns>privateint GetDivBy5()
// Get a random number between 0 and 99999. int divBy5 = rand.Next(0, 99999);
// Subtract the remainder of (n/5) to make n divisible by 5.return divBy5 - (divBy5 % 5);
privatevoid button1_Click(object sender, EventArgs e)
this.textBox1.Text = this.GetDivBy5().ToString("00000");
Do you mean that you want to build an application that conforms to a layered architecture (commonly known as an n-tier architecture)? If so, there are plenty of resources available on the web (or in books) to get you started. I would suggest that you should take a look at Rocky Lhotka's CSLA framework to get some idea as to what's involved in n-tier applications.
1. Learn the basics of C#
2. Learn the basics of requirements gathering
3. Learn the basics of design
4. Learn the basics of "web" servers including various protocol types.
5. Learn how to program 4 in C#.
6. Use 2 to create your requirements
7. Use 3 and 6 to design your system.
8. Use 1, 4 and 7 to create your system.
9. Unit test your system.