XML:Creating XML Document Using XSL (For-Each)

Friday, 24 February 2012
Step 1:
First Create XML File And Name It As Fourth.XML
<?xml version="1.0" encoding="utf-8"?>
<?xml:stylesheet type="text/xsl" href="Fourth.xsl"?>
<PRODUCTDATA>
    <PRODUCT PRODID="P001"  CATEGORY="TOY">
        <PRODUCTNAME>Mini Bus</PRODUCTNAME>
        <DESCRIPTION>This is a toy for children aged 4 and above</DESCRIPTION>
        <PRICE>75</PRICE>
        <QUANTITY>54</QUANTITY>
    </PRODUCT>

    <PRODUCT PRODID="P002"  CATEGORY="TOY">
        <PRODUCTNAME>Barbie Doll</PRODUCTNAME>
        <Description>This is a toy for children age group of 5-10</Description>
        <Price>20</Price>
        <Quantity>200</Quantity>
    </PRODUCT>
   
</PRODUCTDATA>



Step 2:
Then Create CSS File And Name It As Fourth.xsl
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <xsl:for-each select="PRODUCTDATA/PRODUCT">
        <xsl:sort select="PRODUCTNAME" data-type="text" order="ascending"/>
    PRODUCT NAME:<xsl:value-of select="PRODUCTNAME"/><BR/>
    DESCRIPTION:<xsl:value-of select="DESCRIPTION"/><BR/>
    PRICE:<xsl:value-of select="PRICE"/><BR/>
    QUANTITY:<xsl:value-of select="QUANTITY"/><BR/>
    <html>
    <body>
    <!--
        This is an XSLT template file. Fill in this area with the
        XSL elements which will transform your XML to XHTML.
    -->
    </body>
    </html>
    </xsl:for-each>
</xsl:template>

</xsl:stylesheet>






XML:Creating XML Document Using XSL

Step 1:
First Create XML File And Name It As Third.XML
<?xml version="1.0" encoding="utf-8"?>
<?xml:stylesheet type="text/xsl" href="Third.xsl"?>
<PRODUCTDATA>
    <PRODUCT PRODID="P001"  CATEGORY="TOY">
        <PRODUCTNAME>Mini Bus</PRODUCTNAME>
        <DESCRIPTION>This is a toy for children aged 4 and above</DESCRIPTION>
        <PRICE>75</PRICE>
        <QUANTITY>54</QUANTITY>
    </PRODUCT>
<PRODUCT PRODID="P002"  CATEGORY="TOY">
        <PRODUCTNAME>Barbie Doll</PRODUCTNAME>
        <Description>This is a toy for children age group of 5-10</Description>
        <Price>20</Price>
        <Quantity>200</Quantity>
    </PRODUCT>
    </PRODUCTDATA>

Step 2:
Then Create CSS File And Name It As Third.xsl
<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    PRODUCT NAME:<xsl:value-of select="PRODUCTDATA/PRODUCT/PRODUCTNAME"/><BR/>
    DESCRIPTION:<xsl:value-of select="PRODUCTDATA/PRODUCT/DESCRIPTION"/><BR/>
    PRICE:<xsl:value-of select="PRODUCTDATA/PRODUCT/PRICE"/><BR/>
    QUANTITY:<xsl:value-of select="PRODUCTDATA/PRODUCT/QUANTITY"/><BR/>
 
</xsl:template>

</xsl:stylesheet>



XML:Creating XML Document Using CSS

Step 1:
First Create XML File And Name It As Second.XML
<?xml version="1.0" encoding="utf-8"?>
<?xml:stylesheet type="text/css" href="Second.css"?>
<PRODUCTDATA>
    <PRODUCT PRODID="P001"  CATEGORY="TOY">
        <PRODUCTNAME>Mini Bus</PRODUCTNAME>
        <DESCRIPTION>This is a toy for children aged 4 and above</DESCRIPTION>
        <PRICE>75</PRICE>
        <QUANTITY>54</QUANTITY>
    </PRODUCT>

    <PRODUCT PRODID="P002"  CATEGORY="TOY">
        <PRODUCTNAME>Barbie Doll</PRODUCTNAME>
        <Description>This is a toy for children age group of 5-10</Description>
        <Price>20</Price>
        <Quantity>200</Quantity>
    </PRODUCT>
   
</PRODUCTDATA>



Step 2:
Then Create CSS File And Name It As Second.css
PRODUCTNAME
{
font-family=Arial;
font-size=20pt;
font-weight:bold;
color:red;
display:block;
padding-top:6pt;
padding-bottom:6pt;
}



Price,Description,Quantity
{
font-family=Arial;
font-size=20pt;
color:teal;
display:block;
padding-top:2pt;
padding-bottom:2pt;
}

XML:Simple XML File

<?xml version="1.0" encoding="utf-8"?>
<PRODUCTDATA>
    <PRODUCT PRODID="P001"  CATEGORY="TOY">
        <PRODUCTNAME>Mini Bus</PRODUCTNAME>
        <DESCRIPTION>This is a toy for children aged 4 and above</DESCRIPTION>
        <PRICE>75</PRICE>
        <QUANTITY>54</QUANTITY>
    </PRODUCT>

    <PRODUCT PRODID="P002"  CATEGORY="TOY">
        <PRODUCTNAME>Barbie Doll</PRODUCTNAME>
        <Description>This is a toy for children age group of 5-10</Description>
        <Price>20</Price>
        <Quantity>200</Quantity>
    </PRODUCT>
</PRODUCTDATA>


SQL: Queries Based On Following Tables

Thursday, 23 February 2012

Table Name:Location
Column_Name Data_Type Constraints
Location_ID int Primary Key
Regional_Group varchar(25) Not Null


Table Name:Department
Column_Name Data_Type Constraints
Department_ID int Primary Key
Name varchar(25) Not Null
Location_ID int Foreign Key(Location:Location_ID)


Table Name:Job
Column_Name Data_Type Constraints
Job_ID int Primary Key
Function varchar(25) Not Null


Table Name:Employee
Column_Name Data_Type Constraints
Employee_ID int Primary Key
Last_Name varchar(25) Not Null
First_Name varchar(25) Not Null
Middle_Name varchar(25) Not Null
Job_ID varchar(25) Foreign Key(Job:Job_ID)
Manager_ID int Foreign Key(Employee:Employee_ID)
Hire_Date smalldatetime Not Null
Salary int Not Null
Comm varchar(25) Not Null
Department_ID int Foreign Key(Department:Department_ID)

Queries based on the above tables Ans Comming Soon:
If You know Then U Can Comment Below The Answers.....

Simple Queries:

  1. List all the employee details
  2. List all the department details
  3. List all job details
  4. List all the locations
  5. List out first name,last name,salary, commission for all employees
  6. List out employee_id,last name,department id for all  employees and rename employee id as “ID  of the employee”, last name as “Name of the employee”, department id as  “department  ID”
  7. List out the employees anuual salary with their names only.


Where Conditions:

  1. List the details about “SMITH”
  2. List out the employees who are working in department 20
  3. List out the employees who are earning salary between 3000 and 4500
  4. List out the employees who are working in department 10 or 20
  5. Find out the employees who are not working in department 10 or 30
  6. List out the employees whose name starts with “S”
  7. List out the employees whose name start with “S” and end with “H”
  8. List out the employees whose name length is 4 and start with “S”
  9. List out the employees who are working in department 10 and draw the salaries more than 3500
  10. list out the employees who are not receiving commission.

Order By Clause:

  1. List out the employee id, last name in ascending order based on the employee id.
  2. List out the employee id, name in descending order based on salary column
  3. list out the employee details according to their last_name in ascending order and salaries in descending order
  4. list out the employee details according to their last_name in ascending order and then on department_id in descending order.


Group By & Having Clause:

  1. How many employees who are working in different departments wise in the organization
  2. List out the department wise maximum salary, minimum salary, average salary of the employees
  3. List out the job wise maximum salary, minimum salary, average salaries of the employees.
  4. List out the no.of employees joined in every month in ascending order.
  5. List out the no.of employees for each month and year, in the ascending order based on the year, month.
  6. List out the department id having atleast four employees.
  7. How many employees in January month.
  8. How many employees who are joined in January or September month.
  9. How many employees who are joined in 1985.
  10. How many employees joined each month in 1985.
  11. How many employees who are joined in March 1985.
  12. Which is the department id, having greater than or equal to 3 employees joined in April 1985.


Sub-Queries

  1. Display the employee who got the maximum salary.
  2. Display the employees who are working in Sales department
  3. Display the employees who are working as “Clerk”.
  4. Display the employees who are working in “New York”
  5. Find out no.of employees working in “Sales” department.
  6. Update the employees salaries, who are working as Clerk on the basis of 10%.
  7. Delete the employees who are working in accounting department.
  8. Display the second highest salary drawing employee details.
  9. Display the Nth highest salary drawing employee details


Sub-Query operators: (ALL,ANY,SOME,EXISTS)

  1. List out the employees who earn more than every employee in department 30.
  2. List out the employees who earn more than the lowest salary in department 30.
  3. Find out whose department has not employees.
  4. Find out which department does not have any employees.


Co-Related Sub Queries:

47.Find out the employees who earn greater than the average salary for their department.

Joins

Simple join

48.List our employees with their department names
49.Display employees with their designations (jobs)
50.Display the employees with their department name and regional groups.
51.How many employees who are working in different departments and display with department name.
52.How many employees who are working in sales department.
53.Which is the department having greater than or equal to 5 employees and display the department names in ascending order.
54.How many jobs in the organization with designations.
55.How many employees working in “New York”.

Non – Equi Join:

56.Display employee details with salary grades.
57.List out the no. of employees on grade wise.
58.Display the employ salary grades and no. of employees between 2000 to 5000 range of salary.


Self Join:

59.Display the employee details with their manager names.
60.Display the employee details who earn more than their managers salaries.
61.Show the no. of employees working under every manager.

Outer Join:

61.Display employee details with all departments.
62.Display all employees in sales or operation departments.


Set Operators:

63.List out the distinct jobs in Sales and Accounting Departments.
64.List out the ALL jobs in Sales and Accounting Departments.
65.List out the common jobs in Research and Accounting Departments in ascending order.

Use GIMP as Free Alternative to Photoshop

Monday, 20 February 2012
1.GIMP is an acronym for GNU Image Manipulation Program. The program is free, and it works very similar to Photoshop.

2. Download GIMP - Use the windows installer.

3. GIMP Video Tutorials - Here are a few basic video tutorials to get you started. If you want more, try 25 GIMP Video Tutorials or GIMP Video Tutorial Blog.

GIMP User Interface

Two Core Differences Between ASPNET Development Server and IIS

1. Security Context - In ASPNET Development Server, it is determined by who you login as on your computer. In IIS, it is typically IUSR_MachineName.

2. Accessing Static Pages - In ASPNET Development Server, you can not access static pages in a secure folder if you are not logged in, but in IIS, you can.

For more info, please watch the 7-minute video below or refer to the excellent article: Core Differences Between IIS and ASPNET Development Server

Two Core Differences Between ASPNET Development Server and IIS

Use FireFox Firebug to Edit HTML/CSS in Realtime

The Firebug extension for FireFox browser allows you to edit HTML and CSS in realtime.

This can save you a lot of time if you want to experiment with different fonts, colors, and layouts on the fly.

This is also very helpful when you are trying to analyze how someone else's site has the look and feel that it does.

C# Program:To Do Sum Of Even Numbers From Given Array Set

using System;
class ArraySum
{
    public static void Main()
    {
        int[] score={1,5,6,2,8,15,13,17,4,12};
        int sum=0;
        for(int i=0;i<=9;i++)
        {
            if(score[i]%2==0)
            {
                sum=sum+score[i];
            }  
        }
        Console.WriteLine("Sum:"+sum);
    }
}

C# Programm:Fibonacci Series Till 200

using System;
class Fibonacci
{
    static void Main(string [] args)
    {
        int number1;
        int number2;
        number1=number2=1;
        Console.WriteLine("{0}",number1);
        while(number2<200)
        {
            Console.WriteLine(number2);
            number2+=number1;
            number1=number2-number1;
        }
    }

}

C# Program:Creating Matrix using Arrays

using System;
class Matrix
{
    public static void Main()
    {
        int[,] mat=new int[2,2];
        int n=11;
        for(int i=0;i<2;i++)
        {
            for(int j=0;j<2;j++)
            {
                mat[i,j]=n;
                n++;
                Console.Write(mat[i,j]+"\t");
            }
        Console.WriteLine("");
        }   

    }
}

C# Program:Sorting Numbers using Arrays

using System;
class BubbleSort
{
    public static void Main()
    {
        int temp=0;
        int[] score={9,3,4,6,2};
        for(int i=0;i<=4;i++)
        {
            for(int j=0;j<=4-i-1;j++)
            {
                if(score[j]>score[j+1])
                {
                    temp=score[j+1];
                    score[j+1]=score[j];
                    score[j]=temp;
                }
            }
        }
        for(int x=0;x<=4;x++)
        {
            Console.WriteLine(score[x]);
        }
    }
}

Create Expert System

Tuesday, 14 February 2012
Background:
Expert Systems were very popular in the 1980's, but they are still a great idea today. How Expert Systems
Work:
Instead of giving all the information on everything to someone, ask the person about what they are trying to do, and then return the answer to that specific problem.
Example:
Expert System applications are similar to medical diagnosis programs where you describe symptoms, and the computer returns the disease.

C# Program: Use Of Relational Operator

using System;
class RelationalOperator
{
    public static void Main()
    {
        float a=15.0F, b=20.75F, c=15.0F;
        Console.WriteLine("a=" +a);
        Console.WriteLine("b="+b);
        Console.WriteLine("c="+c);
        Console.WriteLine("a<b is"+(a<b));
        Console.WriteLine("a>b is" +(a>b));
        Console.WriteLine("a==c is"+(a==c));
        Console.WriteLine("a<=c is"+(a<=c));
        Console.WriteLine("a>=b is"+(a>=b));
        Console.WriteLine("b!=c is"+(b!=c));
        Console.WriteLine("b==a+c is"+(b==a+c));
    }
}

C# Program:Enter a number from 1 to 7 and display corresponding day of the week

Monday, 13 February 2012
using System;
class WeekDays
{
    public static void Main()
    {
    int number1;
        Console.WriteLine("Enter No Between 1 to 7:");
        number1=Convert.ToInt32(Console.ReadLine());
        if(number1==1)
        {
        Console.WriteLine("Sunday");
        }
        else if(number1==2)
        {
        Console.WriteLine("Monday");
        }
        else if(number1==3)
        {
        Console.WriteLine("Tueday");
        }
        else if(number1==4)
        {
        Console.WriteLine("Wednesday");
        }
        else if(number1==5)
        {
        Console.WriteLine("ThursDay");
        }
        else if(number1==6)
        {
        Console.WriteLine("Friday");
        }
        else if(number1==7)
        {
        Console.WriteLine("Saturday");
        }
        else
        {
        Console.WriteLine("Please Enter No Between 1 to 7");
        }
    }
}

C# Program:To print stars in a traingle shape

using System;
class Test
{
    public static void Main()
    {
        for (int i = 1; i <= 5; i++)
        {
            for (int j = 1; j <=5 - i; j++)
            {
                Console.Write(" ");
            }
                for (int k = 1; k <= i; k++)
                {
                    Console.Write(" *");
                }
        Console.WriteLine("");
        }
    }
}

C# Program:Calculate The Product Of 5 Numbers Entered By User.It Should Use Only One Variable To Accept 5 Numbers.Using For Loop

Sunday, 12 February 2012
using System;
class Break
{
      public static void Main()
     {
             int incr,sum,num;
             Console.WriteLine("Enter 5 Numbers:");
             for(sum=1,num=incr=0;incr<5;incr++)
            {
                   num=Convert.ToInt32(Console.ReadLine());
                   if(num<=0)
                   continue;
                   sum=sum*num;
            }
            Console.WriteLine("The Product of Above numbers is:{0}",sum);
      }
}


C# Program:Accepet 3 Numbers Display Their Sum And Average. This Process Needs To Be Repeated 15 Times


using System;
class Prod
{
public static void Main()
{
int n1,n2,n3,sum,avg,cnt;
cnt=1;
while(cnt<=15)
{
Console.WriteLine("{0}.Enter 3 Numbers:",cnt);
n1=Convert.ToInt32(Console.ReadLine());
n2=Convert.ToInt32(Console.ReadLine());
n3=Convert.ToInt32(Console.ReadLine());
sum=n1+n2+n3;
avg=sum/3;
cnt++;
Console.WriteLine("Sum Of Three No:"+sum);
Console.WriteLine("Avg Of Three No:"+avg);
}
}
}
OUTPUT:-

C# Program:To Find Area Of a Circle

using System;
class Circle
{
             public static void Main()
            {
                 double r;
                double result;
                Console.WriteLine("Enter Radius:");
                r=Convert.ToDouble(Console.ReadLine());
                result=(3.14*r*r);
               Console.WriteLine(result);
            }
}

C# Program:To Find The Greatest Of 3 Numbers Entered By User

using System;
class Greatest
{
        public static void Main()
       {
             int n1, n2, n3;
            Console.WriteLine("Enter Three no:");
            n1=Convert.ToInt32(Console.ReadLine());
            n2=Convert.ToInt32(Console.ReadLine());
            n3=Convert.ToInt32(Console.ReadLine());
           if(n1>n2)
                   if(n1>n3)
                 {
                     Console.WriteLine("The Greatest Of Three numbers are:"+n1);
                  }
                  else
                 {
                     Console.WriteLine("The Greatest Of Three numbers are:"+n3);
                  }
                  else
                  if(n2>n3)
                 {
                     Console.WriteLine("The Greatest Of Three numbers are:"+n2);
                 }
                else
                {
                     Console.WriteLine("The Greatest Of Three numbers are:"+n3 );
                }
          }

}

C# Program: To Find The first Number Eneterd By User Is Divisible By Second Number


C# Program: To Find Avereage Of 5 Numbers Entered By User

using System;
class Average5
{
    public static void Main()
    {
        int number1,number2,number3,number4,number5,avg,sum;
        Console.WriteLine("Enter 5 Numbers:");
        number1=Convert.ToInt32(Console.ReadLine());
        number2=Convert.ToInt32(Console.ReadLine());
        number3=Convert.ToInt32(Console.ReadLine());
        number4=Convert.ToInt32(Console.ReadLine());
        number5=Convert.ToInt32(Console.ReadLine());
        sum=(number1+number2+number3+number4+number5);   
        avg=(sum/5);
        Console.WriteLine("The Sum Is:"+sum);
        Console.WriteLine("The Average Is:"+avg);
    }
}
OUTPUT:-

C# Program: Name Of The Shapes that Can Be Drawn By Lines Corresponding To The Number(1-5) Entered By User

using System;
class Shapes
{
    public static void Main()
   {
        int number1;
        Console.WriteLine("Enter No Between 1 to 5:");
        number1=Convert.ToInt32(Console.ReadLine());
        if(number1==1)
        {
              Console.WriteLine("You can draw a Single line");
        }
        else if(number1==2)
        {
              Console.WriteLine("You can draw a Angle");
        }
        else if(number1==3)
        {
              Console.WriteLine("You can draw a Traingle");
        }
        else if(number1==4)
        {
             Console.WriteLine("You can draw 3 shapes i.e. Square,Rectangle,Trapezoid");
        }
        else if(number1==5)
        {
             Console.WriteLine("You can draw Pentagon");
        }
        else
        {
             Console.WriteLine("Please Enter No Between 1 to 5");
         }
    }
}
Output:

C# Program: To Find Area Of A Rectangle When Lenghth And Breath Entered By User

using System;
class Traingle
{
    public static void Main()
    {
        float l,b,a;
        Console.WriteLine("Enter Length Of A Rectangle:");
        l=float.Parse(Console.ReadLine());
        Console.WriteLine("Enter Breath Of A Rectangle:");
        b=float.Parse(Console.ReadLine());
        a=l*b;
        Console.WriteLine("Area Of Rectangle is {0}",a);
    }
}
Output:-

C# Program :A user enters 3 sides of a traingle, find which traingle can be made using those 3 sides


Code:
using System;
class Traingle
{
    public static void Main()
    {
        float a,b,c;
        Console.WriteLine("Enter Three Sides Of A Traingle:");
        a=float.Parse(Console.ReadLine());
        b=float.Parse(Console.ReadLine());
        c=float.Parse(Console.ReadLine());
        if(a==b && b==c)
        {
            Console.WriteLine("The Traingle is an Equilateral Traingle");
        }
        else if((a==b) || (b==c) || (c==a))
        {
            Console.WriteLine("The Traingle is an Isosceles Traingle");       
         }
         else
         {
            Console.WriteLine("The Traingle is an Scalen Traingle");       
         }
    }
}
Output:-

C# Program to find smallest of the numbers entered by user


Code:
using System;
class Smallest
{
    public static void Main()
    {
    int n1, n2, n3;
    Console.WriteLine("Enter Three no:");
    n1=Convert.ToInt32(Console.ReadLine());
    n2=Convert.ToInt32(Console.ReadLine());
    n3=Convert.ToInt32(Console.ReadLine());
    if(n1<n2)
        if(n1<n3)
        {
        Console.WriteLine("The Smallest Of Three numbers are:"+n1);
        }
        else
        {
        Console.WriteLine("The Smallest Of Three numbers are:"+n3);
        }
        else
        if(n2<n3)
        {
        Console.WriteLine( "The Smallest Of Three numbers are:"+n2);
        }
        else
        {
        Console.WriteLine("The Smallest Of Three numbers are:"+n3 );
        }
}
}
OUTPUT:-

C# Program to show the Relational Operators



Code:
using System;
class RelationalOperator
{
    public static void Main()
    {
        float a=15.0F, b=20.75F, c=15.0F;

        Console.WriteLine("a=" +a);
        Console.WriteLine("b="+b);
        Console.WriteLine("c="+c);
        Console.WriteLine("a<b is"+(a<b));
        Console.WriteLine("a>b is" +(a>b));
        Console.WriteLine("a==c is"+(a==c));
        Console.WriteLine("a<=c is"+(a<=c));
        Console.WriteLine("a>=b is"+(a>=b));
        Console.WriteLine("b!=c is"+(b!=c));
        Console.WriteLine("b==a+c is"+(b==a+c));
    }
}
OUTPUT:-

C# Programm inverted right angle pyramid of star.

Saturday, 11 February 2012

Code:
using System;
class Test
{
     public static void Main()
     {
       int i,j;
       for(i=0;i<5;i++)
       {
           for(j=i;j<5;j++)
           {
               Console.Write('*');
           }
           Console.WriteLine("");
        }
     }
} 
OUTPUT:-