Interesting OOPS puzzle [closed]

Assuming you meant B A C on three lines (plus no typo on main method name): namespace ConsoleApplication1 { public class BaseHome { static BaseHome() { Console.WriteLine(“B”); AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); } public static void Main() { Console.WriteLine(“A”); } private static void OnProcessExit(object sender, EventArgs e) { Console.WriteLine(“C”); Console.Read(); } } }

Fastest algorithm for circle shift N sized array for M position

If you want O(n) time and no extra memory usage (since array was specified), use the algorithm from Jon Bentley’s book, “Programming Pearls 2nd Edition”. It swaps all the elements twice. Not as fast as using linked lists but uses less memory and is conceptually simple. shiftArray( theArray, M ): size = len( theArray ) … Read more

How to test randomness (case in point – Shuffling)

Statistics. The de facto standard for testing RNGs is the Diehard suite (originally available at http://stat.fsu.edu/pub/diehard). Alternatively, the Ent program provides tests that are simpler to interpret but less comprehensive. As for shuffling algorithms, use a well-known algorithm such as Fisher-Yates (a.k.a “Knuth Shuffle”). The shuffle will be uniformly random so long as the underlying … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)