Saturday, October 1, 2016

C# What is Abstract and Virtual Method?

What is Abstract and Virtual Method?
Abstract Method:
Abstract methods are that type of method which is created only for signature only in base class. Means it is created in base class with abstract keyword but it has no body implementation.
 For example:
                        Abstract public void Display ( );
An abstract class must be overridden in child class with override keyword.
1.       Note:   An abstract modifier can be used with classes, methods, properties, indexers and events.
2.        If class contains abstract member then class must be created with abstract modifier.
a.       Example: abstract class base class
3.        An abstract class must be overridden using override keyword in child class. If you miss to    override them, program will raise compile time error.
4.       An abstract class cannot be instantiated. Means you cannot create object of abstract class with new keyword.
5.       An abstract method has no method body. The method declaration ends with semi colon (;) and after that there is no curly braces ({}).
6.       Example:
7.  abstract class baseclass
8.      {
9.          public int num = 5;
10.         public abstract void Display(string name);
11.     }
12.     class childclass : baseclass
13.     {
14.         public override void Display(string name)
15.         {
16.             Console.WriteLine("Hello :" + name);
17.         }
18.     }
19.     class Program
20.     {
21.         static void Main(string[] args)
22.         {
23.             baseclass obj = new childclass();
24.             obj.Display("Aditya");
25.             Console.ReadLine();
26.         }
27.       }

Output: Hello Aditya


Virtual Method:

There may be very long definition of Virtual Method but I kept it simple and short. A virtual method can be overridden or cannot be overridden by child class. It is upon programmer choice. It gives flexibility to direct use of virtual method or add additional functionality in it by overriding it.

Following example have a base class which has a virtual method Display(). There is two child class is created. Child1 is overriding the virtual method and adding own message where child2 is displaying direct message of virtual method.

Programming Example
class baseclass
    {
        public virtual void Display()
        {
            Console.WriteLine("I am base class Virtual Method");
        }
    }
    class child1 : baseclass
    {
        public override void Display()
        {
            Console.WriteLine("I am child  class");
        }
    }
 
    class Program
    {
        static void Main(string[] args)
        {
            baseclass obj = new child1();
            obj.Display();
            Console.ReadLine();
        }
    }
OutPut : I am child 1 class


Friday, September 30, 2016

Using hashtags on Facebook

Hashtags turn topics and phrases into clickable links in your posts on your personal Timeline or Page. This helps people find posts about topics they’re interested in. To make a hashtag, write # (the number sign) along with a topic or phrase and add it to your post. For example:


I just saw and think the facebook page name ! #smarttechgroup

When you click a hashtag, you’ll see a feed of posts that include that hashtag. You may also see some related hashtags at the top of the page.

Please keep in mind:

  • A hashtag must be written as a single word, without any spaces
  • You can include numbers in a hashtag, but punctuation and special characters (like $ and %) won't work
  • You can search for a hashtag using the search bar at the top of any page
  • You'll only see posts that were shared with you


Using hashtags on Twitter


"A hashtag—written with a # symbol—is used to index keywords or topics on Twitter. This function was created on Twitter, and allows people to easily follow topics they are interested in."

Using hashtags to categorize Tweets by keyword:

  • People use the hashtag symbol (#) before a relevant keyword or phrase in their Tweet to categorize those Tweets and help them show more easily in Twitter search. 
  • Clicking or tapping on a hashtagged word in any message shows you other Tweets that include that hashtag.
  • Hashtags can be included anywhere in a Tweet.
  • Hashtagged words that become very popular are often Trending Topics.


Example of a Tweet with a hashtag:


Tips for using hashtags:
  • You cannot add spaces or punctuation in a hashtag, or it will not work properly.
  • If you Tweet with a hashtag on a public account, anyone who does a search for that hashtag may find your Tweet.
  • We recommend using no more than 2 hashtags per Tweet as best practice, but you may use as many hashtags in a Tweet as you like.
  • Type a hashtagged keyword in the search bar to discover content and accounts based on your interests.

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.