System.Console in C#

By // No comments:
System.Console  allow you to display things on the monitor's screen, the .NET Framework provides a class named Console. The Console class is defined in the System namespace. The System namespace is part of the mscorlib.dll library. When you create a C# application, the mscorlib.dll library is directly available; means you don't have to import it. System.Console Class can never be inherited
and also Console class is static.

Relational Database Concept

Relational Database Concept

By // No comments:
Relational Database Concept
To understand relation database first lets understand what is data, database & database management system.
DATA : In simple words data can be anything which is relation considerable object. Lets take an Example
Your Name,City, Address is data. another example telephone number is another kind of data.
DataBase : Database is basically a systematic collection of data. Databases permit manipulation or retrieval of their contained data in usable manners.  For Example An online telephone directory would definitely use database to store data related to people, phone numbers, other contact details, etc. There are lots of another example which use database to store the data. Some popular database in programming language are Oracle,SQL Server, MySQL, DB2, Sybase.

Relational Database Concept

A Relational Database management System(RDBMS) is a database management system based on relational model introduced by E.F Codd. In relational model, data is represented in terms of tuples(rows). Relational databases are the most common and frequently used .This type of DBMS defines database relationships in form of tables, also known as relations.MySQL, Oracle, and Microsoft SQL Server database are the example of RDBMS. RDBMS stands for Relational Database Management System. RDBMS follow the Concept Of Normalisation and Denormalisation

Normalisation and Denormalisation

Relational databases use the concept of normalisation. Normalisation is a design technique that reduce the redundancy of data. It also reduces the risk of errors in data caused by copies of the same information not being kept synchronised. By using relationships, the duplication required can be reduced or get rid completely. For example, the database could be created with a single table containing all employees and the details of the department that they have. If two employees have the same department, the department details will be entered twice and must be maintained in two places. By creating a relationship between the employees table and the department table, the department data appears only once and requires updating in only one place. The opposite of normalisation is denormalisation. In a denormalised database information is purposefully duplicated. This provides greater performance than a normalised database at the cost of increased database size and the risk of data integrity problems. Denormalised databases are useful where speed of data retrieval is paramount, such as in a database used for reporting purposes only.

SQL (Strcture Query Language)

Structured Query language (SQL) pronounced as "S-Q-L" or sometimes as "See-Quel"is actually the standard language for dealing with Relational Databases. SQL programming can be effectively used to insert, search, update, delete database records. That doesn't mean SQL cannot do things beyond that. In fact it can do lot of things including, but not limited to, optimizing and maintenance of databases. Relational databases like MySQL Database, Oracle, Ms SQL server, Sybase, etc uses SQL ! How to use sql syntaxes? SQL syntaxes used in these databases are almost similar, except the fact that some are using few different syntaxes and even proprietary SQL syntaxes.
SQL Example
SELECT * FROM Members WHERE Age > 30

program to check number is prime or not

By // 1 comment:
Program to check prime in C#
In Interview its a common question for fresher as well as experience to do code to check given number is prime or not. No matter in which language you written the code but matter is what logic you follow to do this. I hope you all aware about what is prime number if no then let me explain what is prime number
Prime number is a number which is divisible by same number and only by 1. Lets take an example
Suppose we take a number 6. Is it prime number ?
No due to its divisible by 2 & 3 also.
Lets take an another example is 23 is prime number
Yes because its divisible by 1 & 23 only.
Lets Implement these in programming language

Program to check number is prime or not in C#

using System;
namespace example
{
  public class CheckPrime
    {
        public static void Main()
        {
            Console.Write("Please enter a number: ");
            int num;
            num = Convert.ToInt32(Console.ReadLine());
            int j;
            j = 0;
            for (int i = 1; i <= num; i++)
            {
                if (num % i == 0)
                {
                    j++;
        }
            }
            if (j == 2)
            {
                Console.WriteLine("Wow! Entered Number is a Prime Number");
            }
            else
            {
                Console.WriteLine("Oops! Entered Number is Not a Prime Number");
            }
            Console.ReadLine();
        }
    }
}

Output of prime number check in C#

Please enter a number 23
Wow! Entered Number is a Prime Number

Rootscope in angular JS

By // No comments:
$rootscope in angualr
In this article i explain what is rootscope in angular js & how its different from normal scope. First thing we have notice is every application has a single rootscope and we can use this entirely in application. Simple means is $rootScope is available for all controller but the $scope only within the controller. In another way we can say that $scope is an object that is accessible to current controller & $rootScope is also an object which is accessible from anywhere in the application .
For example if you make any variable global then it will accessible from everywhere & in case of local variable only local accessible are present same like $scope & $rootScope. $scope is created with ng-controller while $rootscope is created with ng-app. Here we give an example of the $rootScope. you have to also notice that controller's color variable does not overwrite the rootScope's color value in below example.

rootScope in Angualr JS

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body ng-app="myApp">
  <div>I am not in any controller </div>
  <p>rootScope Properties Call :- {{color}}</p>
  <div ng-controller="myCtrl">
    <fieldset>
      <legend>
        I am in Controller
      </legend>
      <p>Controller Properties Call :- {{color}}</p>
      <p>rootScope Properties Call :-  {{$parent.color}}</p>
   </fieldset>
  </div>
  <div>Again i am not in any Controller </div>
  <p>rootController property color is called :- {{color}}</p>
 <script>
   var app = angular.module('myApp', []);
   app.run(function($rootScope) {
     $rootScope.color = 'blue';
   });
   app.controller('myCtrl', function($scope) {
     $scope.color = "red";
   });
 </script>
</body>
</html>

output of rootScope in Angualr JS

I am not in any controller
rootScope Properties Call :- blue
I am in Controller
Controller Properties Call :- red
rootScope Properties Call :- blue
Again i am not in any Controller
rootController property color is called :- blue

Nested Controller In Angular JS

By // No comments:
Nested Controller in Angular Js In this article we discuss about how to get main controller object or value in child controller. I am not going to discuss here what is angular js controller. Some time in interview such type of question asked by interviewer. Here we make a two controller one is main controller and second is subcontroller which is inside of main controller. Now suppose in code we set title variable in both controller & want to access main controller title variable to subcontroller. I Here is complete code about above scenario you have to just copy paste & execute it.

Nested Controller in Angualr JS

<!DOCTYPE html>
<html>
<head lang="en">
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
 <script>
   angular.module('app', []);
   angular.module('app').controller("MainController", function($scope){
   $scope.title = 'I am Parent Controller Title';
   });
   angular.module('app').controller("SubController", function($scope){
    $scope.title = 'I am Sub-Controller Title';
    });
</script>
</head>
<body ng-app='app' ng-controller='MainController'>
<div class='container'>
  <p style="color:Red">Angular JS Main Controller - {{title}}</p>
  <div ng-controller='SubController'>
    <p style="color:green">
      Angular JS SUB Controller - {{title}}</p>
    <p style="color:blue">Angular JS Call Main Controller object inside child controller - {{$parent.title}}</p>
   </div>
</div>
</body>
</html>

Output of nested controller example in Angualr JS

Angular JS Main Controller - I am Parent Controller Title
Angular JS SUB Controller - I am Sub-Controller Title
Angular JS Call Main Controller object inside child controller - I am Parent Controller Title