Follow by Email

Sunday, March 31, 2013

abstract class and interface


As we all know c# does not support multiple inheritance hence if you want to implement multiple inheritance in c# we need to use Interfaces.
In interface we just declare the method signature and the implementation we write after inheriting it inside the class.

Below is the example how the interface is declared. The methods signatures defined inside the interface is  always declared without the access modifiers(i.e. public,private etc).
Interface Name should always start with I and then name i.e IAdd as displayed in the below example.

After the method signature is declared in the Interface. Now lets see how to define the method inside the class.

The Interface IAdd is inherited inside the class and the method code is written here. If suppose we have declared 2 method signature inside the interface then we will have to write the code for both the two methods in the class.

When to use Interface ?
Interface should be used when your software design or plan is rigid and not changeable. suppose we have declared 2 method signatures in the interface and in future we need to add one more method in it then we will have to check all the class using that interface and will have to write the method implementation in all the class, for that newly declared method name in the interface. Whereas in abstract class there is no such problem , if the software design plan is flexible then go for abstract class.

Abstract class
Abstract class can only be used as base class. we cannot create the object of this class. Thus all the common code we write it in the abstract class and use it in the derived class.Below example shows hows the abstract class works

An Abstract class can have both methods with implementations as well methods with out implementations
and also Abstract class can inherit from interfaces. But Abstract class do not support multiple inheritance.

meta keywords, meta description and title tags

meta keywords, meta description and titles tags. This is what appears on the search engine page for any websites.

Before this lets talk about how the search engine page looks like

So it consists of the search box where we type our keywords, the ads section to the top and on the right hand side and finally the organic search results i.e the websites with high page rank and also most relevant to the keywords entered in the search.

Now lets see where are the Meta description and title located.

The above image shows what we type in the title tag of the html page appears here and whatever the text we write in the meta description tags of the html page appears below it.

In the Meta keywords section of the html page we enter all possible keywords targeting for that website like if we have a web design company we can target keywords as web design company, web designers, professional designers etc and can enter these keywords in the meta keywords section of the html page.

As of now Google search engine has stopped using meta keywords to get the relevant websites as per the keyword entered. but still other search engines like Bing, Yahoo etc still uses the meta keyword to get the relevant websites to the keyword entered in the search engine text.

There are various numbers of websites which provides tools to generate meta description, meta keywords and title tags.

Protected by Copyscape Duplicate Content Detection Tool

Saturday, March 30, 2013

What is SEO

What  is SEO ?

SEO (Search Engine optimization) is a way of optimizing websites so as to get a better page rank and more search visibility during search operations. This is possible when the website is regularly getting crawled. crawling is a process where a crawler or the internet bot visits all the web pages and indexes the data into the database.

So whenever we search, the search engine fetches the data from the database and displays all the relevant search results on the search engine page. The highly optimized websites and the websites with high page rank gets displayed on the first page of the search results.

SEO Techniques :
1. On Page
 Under this we apply search engine optimization techniques on the webpages i.e. the HTML pages.

Eg.: a)In HTML page we check that all the relevant keywords targeting for the website should correspond to the text in the title tag, heading tag, content etc

b) There should not be any keyword stuffing or no overwriting of the same thing again and again into the website, such things can give your website bad points and your search visibility can go down.

2. Off Page
 Under this technique we provide large number of backlinks to the websites by blog posting, website directory submission, Article writing etc.

Protected by Copyscape Duplicate Content Detection Tool

Friday, March 29, 2013

Table variable and Temp table

Difference between table variable and temp table :

Table Variable Temp Table
1 It cannot be rollbacked.

It can be rollbacked.
2 It gets destroyed after the particular code gets executed(Like Stored procedures) It uses tempdb to store the temp tables. Thus it can be accessed till the sql connection exists

3 Less Recompilation

More Recompilation
4 It can only have cluster index on the table It can have both cluster and non cluster indexes
5 It can be used with Stored procedures, Functions, Triggers.

It can be used with Stored procedures, Triggers.
6 It Should be used when there is no transaction  to be used for table variables. It can be used within the transaction block.


Table variable :

Temp Variable:


Constructors are the methods in a class. The name of the constructors is same as the class name. Whenever we create object of class, constructor will get called.

Syntax :

class shape
  public shape()

shape s = new shape() --> shape constructor will get called here.

Types of constructor :

1. Default constructor:

This type of constructor don't have any parameter in there method.

example : 

class shape
  public shape() //--> no parameter

2. Parameterized Constructor:

This type of constructor can have parameters in there method.

example : 

class shape
  public shape(int width) //--> parameter constructor

3. Copy constructor :

In this type of constructor a object of a class is copied to the another object of the same class


4. Constructor Overloading

Constructor overloading  include both default and Parameterized constructor. Here the  constructor can be with parameters or without parameters.

when we create object if we pass parameter value while creating the object that constructor  with that number of parameter will get called.

class shape
 public shape()

public shape(int x)

public shape(int x, int y)


class main
shape s = new shape(10) // this will call the constructor with one parameter.

5. Static constructor

this type of constructor gets called before the object creation.


class shape
 static shape()


Now this method gets executed before the object creation of the class. 

Thursday, March 28, 2013

.net framework

.net framework what it is and how it works ?

1. .net framework is application development framework designed by Microsoft.
2. It is used by developers to develop windows or web based applications.
3. CLR i.e Common Language Run time is one of the important component of the .net Framework which is  responsible for code execution, Memory allocation, Security.

4. CLR uses JIT(Just in Time Compiler) for Converting the MSIL code to machine code. Machine code is the final execution.
5. This .net framework ensures that code written in different languages can interact with each other.
6. The various components of the .Net framework are :

  a) CLR 
  b) CTS
  c) Security 
  d) Deployment 
  e) Class library
  f) Cross language Interportibility