Wednesday, September 28, 2016

CONCEPTS OF ENCAPSULATION AND ABSTRACTION IN C#

Abstraction is one of the principles of object oriented programming. It is used to display only necessary and essential features of an object to outside the world. Means displaying what is necessary and encapsulate the unnecessary things to outside the world. Hiding can be achieved by using access modifiers.

Note - Outside the world means when we use reference of object then it will show only necessary methods and properties and hide methods which are not necessary.
Example: Capsule Medicine
Encapsulation and abstraction is the advanced mechanism in C# that lets your program to hide unwanted code within a capsule and shows only essential features of an object. Encapsulation is used to hide its members from outside class or interface, whereas abstraction is used to show only essential features.
In C# programming, Encapsulation uses five types of modifier to encapsulate data. These modifiers are public, private, internal, protected and protected internal. These all includes different types of characteristics and makes different types of boundary of code.
Access Modifier
Description (who can access)
Private
Only members within the same type.  (default for type members)
Protected
Only derived types or members of the same type.
Internal
Only code within the same assembly. Can also be code external to object as long as it is in the same assembly.  (default for types)
Protected internal
Either code from derived type or code in the same assembly. Combination of protected OR internal.
Public
Any code. No inheritance, external type, or external assembly restrictions.

public abstract class Car
    {
        //you cant declare private access specifier
        public abstract void StartCar();

        public void dispay()
        {
            Console.WriteLine("Concrete Method");
        }
    }

    public class Audi : Car
    {
        #region Overrides of Car

        public override void StartCar()
        {
            Console.WriteLine("Audi StartCar");
        }

        #endregion
    }

    public class BMW : Car
    {
        #region Overrides of Car

        public override void StartCar()
        {
            Console.WriteLine("BMW StartCar");
        }

        #endregion
    }
    class Program
    {
        static void Main(string[] args)
        {
            Car obj = new BMW();
            obj.dispay();
            obj.StartCar();
            Console.ReadLine();

        }
    }
Output: Concrete Method
        BMW StartCar




Increase font size of MYSQL query box

xampp > phpMyAdmin > themes > pmahomme > css
open the following file with your text editor
codemirror.css.php
and add the following line to the very bottom of the file
.CodeMirror pre {font-size:1.4em;}
Now save the file and that should do it!
(if phpMyAdmin is using a different theme to pmahomme then just add that line
of code to every codemirror.css.php file you can find!

Google's new 'inspired by India' product, YouTube Go


Google says they have been researching on YouTube Go in India for the past one year. Looking at the issues people face and the lengths people go to in order to view videos on YouTube, international tech giant, Google has come up with Youtube Go, inspired by India. 

Google will be launching Youtube Go next year in India. Google had earlier launch YouTube Offline in the country that was very popular among the users. For the new product, YouTube Go, Google has mainly worked on four important aspects connectivity, cost, relatable and social.

Here’s how the product works and why it makes sense for India. In terms of connectivity, it is designed to work in areas with low or no connectivity. Users can choose whether they want to view the videos on Youtube Go in low and standard resolution. With the new product that is designed for India, users can also save videos for later on YouTube Go and share the downloaded videos with just one click. 

In order to make the product reach all across the country, Google will also make YouTube Go available in 10 different Indic languages. The page is going to be a lot simpler with just 10 videos on the home page. YouTubers can go on YoutubeGo.com/signup and experience the product. 

YouTube Go is inspired by India but it will be made available across many markets for Google. The product does touch on many key issues YouTube users face in India starting from poor connectivity to high data cost to language barriers.

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.