Tuesday, September 27, 2016

Server Date Time Setting in CWP Panel

Solution 1:-

In CWP Panel

in website php.ini and for server mysql set in my.cnf
and also in system.starup.php ---date_default_timezone_set("Asia/Kolkata");
date.timezone = Asia/Kolkata;

===============OR====================================

Solution 1:-

Time-zone Setting in Linux in centos command


[root@s$$-$$-$$$-$$$ server1]# ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
[root@s$$-$$-$$$-$$$ server1]# date
Sat Mar 19 15:48:53 IST 2016
[root@s$$-$$-$$$-$$$ server1]#

Create short URL - Google URL Shortener

Google URL Shortener at goo.gl is used by Google products to create short URLs that can be easily shared, tweeted, or emailed to friends.


What is a short URL?

URL shortening is a technique on the World Wide Web in which a uniform resource locator (URL) may be made substantially shorter in length and still direct to the required page. This is achieved by using an redirect on a domain name that is short, which links to the web page that has a long URL.


What is the site Goo GL?

http://goo.gl/ is a URL shortener, that is it is creating short URLs that redirect you to other, usually longer, URLs. As it can be used to create a redirect to any URL out there a goog.le link it may point to malicious or otherwise unwanted software.

How do you find the URL for a website?

Here's how to find the exact URL of an image: Click the image that you locate in the image search results. Right-click View original image or Full size, and copy the link address. Paste the URL into a file or document, so it's available when you use the URL removal tool.

SQL Server Paging of Memory Identification - PowerShell

This blog and powershell script was a fall out of that engagement.


param (
    [string]$SqlServerName = "localhost"
)

Add-Type -Path "C:\Program Files\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.Smo.dll"

$SqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($SqlServerName)

foreach ($LogArchiveNo in ($SqlServer.EnumErrorLogs() | Select-Object -ExpandProperty ArchiveNo)) {
    $SqlServer.ReadErrorLog($LogArchiveNo) |
        Where-Object {$_.Text -like "*process memory has been paged out*"}
}


The output of this script would look like below:




Why is this important?

If there is excessive memory pressure on SQL Server’s memory allocations causing memory to get paged out to disk, that could be a potentially large performance impact as it invites I/O latency to memory access. It is best practice to ensure that there is enough physical memory on the machine, as well as a well-designed memory infrastructure from SQL Server so that there isn’t overcommitting of memory in order to ensure that paging is not excessive. It is recommended that reevaluation of memory allocations and/or available physical memory is taken into account in order to relieve memory pressure for the current SQL Server instance.

Interfaces in C#

What is Interface?

An interface looks like a class, but has no implementation. The only thing it contains are declarations of events, indexers, methods and/or properties. The reason interfaces only provide declarations is because they are inherited by structs and classes, that must provide an implementation for each interface member declared.
Why Interface come in C#?
    public class Father
    {
       
    }

    public class Mother
    {

    }

    public class Son : Father,Mother
    {
          //C# doesn’t support multiple inheritances.
    }
Implicit Interface:
interface Father
    {
        void Display();
    }

    interface Mother
    {
        void DisplayMember();
    }

    public class Son : Father, Mother
    {
        void Display()
        {
           //Implemnt Interface
        }

        void DisplayMember()
        {
            ///Implemnt Interface
        }
    }
Explicit Interface:
interface Father
    {
        void Display();
    }

    interface Mother
    {
        void Display();
    }

    public class Son : Father, Mother
    {
        void Mother.Display()
        {
            //Implemnt Interface
        }

        void Father.Display()
        {
            //Implemnt Interface
        }

     
    }
Note: 1) Interface all method should be public by default.
      2) Interface don’t have constructor.


Monday, September 26, 2016

SQL SERVER – Improve performance by turning off AUTO_CLOSE Database Option

Set AUTO_CLOSE Database Option to OFF


You can go to Your Database and Right Click on it. Click on Properties on the right, click menu and it will bring up the following screen. Over here you should change the Auto Close value to FALSE.


You probably tried to upload a file that is too large. Please refer to documentation for a workaround for this limit.

1) Navigate to PHP Setting –> PHP.ini Configuration. Search for the line upload_max_filesize = 2M and post_max_size = 8M and change its value to 100M. After changing value click save.



2) Now you have changed value to 100mb and it must also reflect in phpMyAdmin

C# - Types of Polymorphism in C#.Net with Real Time Example

Polymorphism means many forms (ability to take more than one form). In Polymorphism poly means “multiple” and morph means “forms” so polymorphism means many forms.

1)Compile Time Polymorphism
2)Run Time Polymorphism

Compile Time Polymorphism: Compile time polymorphism means we will declare methods with same name but different signatures in the same class.
How to achieve them as shown below:
Example:
public class Overloading
    {
        //diff no of paramteres
        public int Method(int a)
        {
            return a;
        }
        public int Method(int a , int b)
        {
            return a + b;
        }

        // diff types of parameters
        public float Method(float a)
        {
            return a;
        }

        //diff order of parameters
        public void Method(int b, float a)
        {
        }
        public void Method(float a, int b)
        {
        }

    }
Run Time Polymorphism: Run time polymorphism also called as late binding or method overriding or dynamic polymorphism. Run time polymorphism or method overriding means same method names with same signatures in different class.








How to achieve run time polymorphism: In base class if we declare methods with virtual keyword then only we can override those methods in derived class using override keyword.