C# Find the next perfect square!

You might know some pretty large perfect squares. But what about the NEXT one? Complete the findNextSquare method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer n such that sqrt(n) is also an integer. If the parameter is itself not… Continue reading C# Find the next perfect square!

How to sort elements of array list in C#

There are numerous sort methods in the framework including ArrayList.Sort. The problem is that they are all going to sort alphabetically and not numerically. You’ll need to write a custom sorter that understands numeric sorts. Try the following (some argument checking left out for brevity) public class NumericComparer : IComparer { public int Compare(object x,… Continue reading How to sort elements of array list in C#

How to clear user cookies after pressing the SharePoint 2013 out-of-the-box signout button

private void RemoveCookiesAndSignOut() { // Clear session state. if (Context.Session != null) { Context.Session.Clear(); } string cookieValue = string.Empty; if (Context.Request.Browser[“supportsEmptyStringInCookieValue”] == “false”) cookieValue = “NoCookie”; // Clear my own cookie. HttpCookie cookieWinSignIn = Context.Request.Cookies[“Morpheus_WindowsSignedIn”]; if (cookieWinSignIn != null) { cookieWinSignIn.Value = cookieValue; Context.Response.Cookies.Remove(“Morpheus_WindowsSignedIn”); Context.Response.Cookies.Add(cookieWinSignIn); } // Remove cookies for authentication. HttpCookie cookieSession = Context.Request.Cookies[“WSS_KeepSessionAuthenticated”];… Continue reading How to clear user cookies after pressing the SharePoint 2013 out-of-the-box signout button

C# : Handling not sent email exception

Im stuck with problem as some of the system users are “nonactive” users and my function is not handling exception of not sending email to “nonactive” users. Function send email to users even if they are nonactive in system. private static bool Postepowanie_ObslugaPodstawowa(AlertTyp typPowiadomienia, string statusDescr, int podanieId, IUzytkownik sender, IEnumerable<IUzytkownik> recipients) { SzablonPowiadomien szablon… Continue reading C# : Handling not sent email exception