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!

SharePoint Health Analyzer + Windows Eventviewer daily mailer from localhost and remotely logs via e-mail

Hello and Happy New Year After holidays break I decided to share script that I wrote the other day. The script can handle daily routine job of some of SharePoint and Windows Administrators and do all the automation. Recieved all error and warnings about entire SharePoint and Widows Servers Environments via e-mail day by day… Continue reading SharePoint Health Analyzer + Windows Eventviewer daily mailer from localhost and remotely logs via e-mail

Entity Framework cannot update database – SaveChanges() related to SetClrFeatureSwitchMap error

I had the issue with saving data to DB using Entity Framework and SaveChanges() method, and fixed it by adding the following lines to the web.config of my application: <runtime> <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″> <dependentAssembly> <assemblyIdentity name=”Microsoft.SqlServer.Types” publicKeyToken=”89845dcd8080cc91″ /> <bindingRedirect oldVersion=”1.0.0.0-11.0.0.0″ newVersion=”10.0.0.0″ /> </dependentAssembly> </assemblyBinding> </runtime> This forces the EntityFramework to use the version 10 of the… Continue reading Entity Framework cannot update database – SaveChanges() related to SetClrFeatureSwitchMap error

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#