Sunday, 21 August 2016

Custom Shadowbox Modal

The below code shows the Processing Image as a Modal.

You can close it by setting the processing property on the angular $scope.

 .customModal {

            position: fixed; /* Stay in place */

            z-index: 1; /* Sit on top */

            padding-top: 100px; /* Location of the box */

            left: 0;

            top: 0;

            width: 100%; /* Full width */

            height: 100%; /* Full height */

            text-align: center;

            background-color: rgb(0, 0, 0); /* Fallback color */

            background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */

        }



        /* Modal Content */

        .customModal-content {

            margin: auto;

            width: 220px;

            height: 183px;

        }
    
   

Tuesday, 9 August 2016

SMS Gateway Providers


·         TextLocal
o   They provide an API to use http://www.textlocal.com/sms-api-integrations
o   Commercial – PAYG (2.4p per text) or Monthly payments
·         ClickATell
o   Commercial (2.9p per message)
·         Twilio:
o   Commercial
·         Email to SMS Gateway (doesn’t seem to be reliable):

Dynmark:


·         There seems to be a way also with pure .NET but need to look into it if it has any drawbacks: http://www.codeproject.com/Articles/19023/Sending-SMS-using-NET

Sinch
Nexmo
Plivo



Thursday, 7 July 2016

DateTime Extensions

public static class DateTimeExtensions
    {
        /// 
        /// Includes the from and to dates so from Monday to Tuesday it returns 2
        /// 
        public static int FindBusinessDaysUntil(this DateTime from, DateTime to)
        {
            double calcBusinessDays =
                1 + ((to - from).TotalDays * 5 -
                (from.DayOfWeek - to.DayOfWeek) * 2) / 7;

            if ((int)to.DayOfWeek == 6) calcBusinessDays--;
            if ((int)from.DayOfWeek == 0) calcBusinessDays--;

            return Convert.ToInt16(calcBusinessDays);
        }

        public static DateTime NextBusinessDay(this DateTime from)
        {
            var nextDay = from.AddDays(1);

            while (true)
            {
                var numberOfBusinessDays = FindBusinessDaysUntil(from, nextDay);

                if (numberOfBusinessDays == 2)
                {
                    return nextDay;
                }

                nextDay = nextDay.AddDays(1);
            }
        }

        public static DateTime NextBusinessDay(this DateTime from, int days)
        {
            var result = from;

            for (int i = 0; i < days; i++)
            {
                result = result.NextBusinessDay();
            }

            return result;
        }        
    }
}

Tuesday, 28 June 2016

.NET Memory Leak Checklist


CheckList:

  • Check application logs
  • Check IIS logs
  • Check event viewer
  • Check Windows Error Logs
  • Check Windows Resource Monitoring window
  • Check Crash Dumps; if not configured set it up.

How to Create a Memory Dump:
https://support.symantec.com/en_US/article.howto31321.html

https://blogs.msdn.microsoft.com/chaun/2013/11/12/steps-to-catch-a-simple-crash-dump-of-a-crashing-process/

You can then use it for further analysis via DebugDiag or Visual Studio.

Tools

ProcDump Tool

DebugDiag Tool

ANTS Memory Profiler
Add LocalDumps

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps


Will be captured to:

%LOCALAPPDATA%\CrashDumps

Wednesday, 22 June 2016

Google Maps Geolocation