Generating Non-Repeating Random Values in C++

I have seen this question pop up on the board from time to time about generating random number values, in a given range, but not repeating any of the values. It is simple enough to create your standard number generator, and even simple to test the value it generates against previously selected values, but that method has always been a "brute force" type of approach and can be a nightmare ...

Fading Objects in Javascript

Ever visit a website and see some elements which seem to disappear or appear with a gradual fade in or fade out effect? Ever wonder how that is done? I am sure you have at one point. You probably dug around Google and would find some long winded scripts that may or may not work quite right. Maybe they are hard to setup and always had bugs. We here at ...

Problems with Brute Force in Programming

"Damn! This solution just won't work! I have tried everything and all I get is a bunch of mush! Stupid programming I hate it!" Does this sound like you? Do you feel like one of those people on TV at the beginning of some paid television commercial? Many times the newbie and the expert alike finds themselves in the situation where a project just seems to stall. As human beings, ...

Storing Full Objects In ComboBox/ListBox in .NET

Most beginner and even intermediate level programmers, coming out of languages before .NET, often use comboboxes or listboxes to simply list strings of choices, items etc. Then they go through the headache of detecting a user's choice out of the listbox and fetch information to construct a simple object, possibly displaying that information in other controls related close by. There is an easier way of forming the "master to detail" ...

Euclidean, Bezout, and Coprime Oh My!

Occasionally a programmer loves to play with numbers. Some like to stick gum in their sister's hair, but that is besides the point. At the heart of some programming is the heart of mathematics and especially number theory. One of the great theoretical algorithms out there is the Extended Euclidean algorithm which is used to find the Greatest Common Divisor (GCD). The GCD is a number which divides both of ...

BozoSort Definitive (C++, C#, VB.NET, Java, PHP)

WARNING: PLEASE USE WITH EXTREME CAUTION! CONTENTS MAY BE FUNNY BUT NOT FOR PRODUCTION USE. Programmer Discretion is Advised! Hey you bozos out there, now there is a sort even for you! For those who don't know, a Bozo Sort is a joke sorting algorithm that actually sorts but at horrible timing and is very inefficient. It is good to see it at work from a theoretical stand point but it ...