|
Scarily, there's a song[^] about that.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
|
Isn't that Normal For Norfolk?
This space for rent
|
|
|
|
|
You should move to Tasmania, you'd feel right at home.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
There is actually a song about such constellation which gets really really confusing at some point, sadly it's only in german
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
OriginalGriff wrote: Working it out is simple...
You're father won ...
|
|
|
|
|
Well you should watch this movie for answers Apoorva Raagangal - Wikipedia[^]
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
AOTD : Algo Of The Day
Did you know you could calc GCD (Greatest Common Divisor) of two numbers using only the modulus operator? Pretty cool.
I'm still reading the Modern Cryptography book[^] and I wrote an interesting algo based upon the author's description of the Euclidean Algorithm. I thought it was kind of neat.
Fire up LINQPad (free C# code running tool) [^] paste the code below and try it out. You'll like it.
void Main()
{
long first = 15332490;
long second = 83749023324;
for (var x = 1; x < 10;x++){
calcGCD (first, second);
first +=1348;
}
}
void calcGCD(long a, long b){
long dividend = Math.Max(a, b);
long divisor = Math.Min(a,b);
while (divisor >= 1){
var tempVal = dividend % divisor;
Console.WriteLine(String.Format("value : {0}", tempVal));
dividend = divisor;
divisor = tempVal;
}
if (dividend > 1){
Console.WriteLine ("GCD is dividend : {0} ", dividend);
}
else{
Console.WriteLine("The two numbers do not share a Common Divisor");
}
Console.WriteLine("##############################");
Console.WriteLine();
}
Output looks like:
value : 2962944
value : 517770
value : 374094
value : 143676
value : 86742
value : 56934
value : 29808
value : 27126
value : 2682
value : 306
value : 234
value : 72
value : 18
value : 0
GCD is dividend : 18
##############################
value : 10934006
value : 4399832
value : 2134342
value : 131148
value : 35974
value : 23226
value : 12748
value : 10478
value : 2270
value : 1398
value : 872
value : 526
value : 346
value : 180
value : 166
value : 14
value : 12
value : 2
value : 0
GCD is dividend : 2
##############################
value : 11547684
value : 3788850
value : 181134
value : 166170
value : 14964
value : 1566
value : 870
value : 696
value : 174
value : 0
GCD is dividend : 174
##############################
|
|
|
|
|
raddevus wrote: Did you know you could calc GCD (Greatest Common Divisor) of two numbers using only the modulus operator? Pretty cool. Isn't that the normal way to do it? Maybe not the fastest way, but the most well known
|
|
|
|
|
Oh. I didn't know. First time I've really contemplated it was while reading this book.
|
|
|
|
|
Why not post this in the C# Language Forum ?
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
I didn't even know there was such a thing.
I need to look around here (cp) more.
|
|
|
|
|
fyi: there's also an Algorithm forum: [^].
cheers, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
BillWoodruff wrote: there's also an Algorithm forum
Very cool. thx
I also checked out the C# forum and spent too much time there. Great stuff.
|
|
|
|
|
A while loop for subtracting the smaller from the larger will get you the same answer just before getting zero.
|
|
|
|
|
Good analysis and comment.
thanks
|
|
|
|
|
raddevus wrote: Did you know you could calc GCD (Greatest Common Divisor) of two numbers using only the modulus operator? Pretty cool.
Indeed cool, but probably the most classical way to get the answer.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I wrote a wizard app for one of our co-workers that merges two Excel spreadsheets by matching selected columns based on one or more matching criteria (this column value == that column value), and combining the selected columns into a single file.
I essentially reduced a 2-5 day process (depending on the size of the two datasets) to no more than an hour. The reason it takes an hour is because the half-assed Telerik spreadsheet control/document code doesn't understand formulas very well, and also doesn't support Date column types, so the user has to manually modify the merged data to suit their ultimate needs.
I would write an article, but the code relies on the Telerik WPF library, which is not free.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I know what you mean. The volume of kudos that I've got from writing moron-level-simple code for Excel spreadsheets far exceeds any kind of response I've ever got from stuff I've really had to work at.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
You are so correct, but I've learned the reason that is, is that the simple stuff is what more people can connect with. It takes a *special* person to sit their entire life behind a computer, and so deep concepts aren't event familiar to them. It's out of the league so to speak - in regards to computers.
Jeremy Falcon
|
|
|
|
|
Any sufficiently advanced technology will appear as magic to primitives.
|
|
|
|
|
People that don't live in front of a computer aren't primitive. They simply have different interests and therefore know different things. Thinking you're better than someone for knowing more than someone in *your* field isn't advanced - it's arrogant.
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: Thinking you're better than someone for knowing more than someone in your field isn't advanced - it's arrogant.
Arrogance is kinda my superpower. That, and marksmanship.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
I thought your arsenal was your superpower. Arrogance is just part of your charm
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|