Tuesday, 31 December 2013

Learning JavaScrip 2nd Edition Full Textbook


  • Learn the JavaScript application structure, including basic statements and control structures
  • Identify JavaScript objects -- String, Number, Boolean, Function, and more
  • Use browser debugging tools and troubleshooting techniques
  • Understand event handling, form events, and JavaScript applications with forms
  • Develop with the Browser Object Model, the Document Object Model, and custom objects you create
  • Learn about browser cookies and more modern client-side storage techniques
  • Get details for using XML or JSON with Ajax applications


Monday, 30 December 2013

Environmental Science and Disaster management Textbook

Diploma 6th semester Environmental Science and Disaster management Textbook PDF


Monday, 23 December 2013

Simple Applet Calculator Program


import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code=Calc width=300 height=200>
</applet>
*/
public class Calc extends Applet implements ActionListener
{
Button one=new Button("1");
Button two=new Button("2");
Button three=new Button("3");
Button four=new Button("4");
Button five=new Button("5");
Button six=new Button("6");
Button seven=new Button("7");
Button eight=new Button("8");
Button nine=new Button("9");
Button zero=new Button("0");
Button plus=new Button("+");
Button minus=new Button("-");
Button div=new Button("/");
Button mul=new Button("*");
Button eql=new Button("=");
Button bk=new Button("C");
Button point=new Button(".");
TextField dis=new TextField("0");
Label rs=new Label(" ",Label.RIGHT);
boolean flag=true,calc=true;
String sign="";
Double x=0.0,y=0.0;
public void init()
{
setLayout(new GridLayout(3,1));
Panel d=new Panel();
d.setBackground(Color.gray);
d.setForeground(Color.blue);
d.setLayout(new BorderLayout(2,2));
d.add(BorderLayout.CENTER,dis);
d.setFont(new Font("SansSerif",Font.BOLD,18));
Panel r=new Panel();
r.setBackground(Color.white);
r.setForeground(Color.black);
r.setLayout(new BorderLayout());
r.add(BorderLayout.WEST,rs);
Panel b=new Panel();
b.setFont(new Font("SansSerif",Font.BOLD,14));
b.setBackground(Color.gray);
b.setForeground(Color.red);
b.setLayout(new GridLayout(4,4));
b.add(one);
b.add(two);
b.add(three);
b.add(four);
b.add(five);
b.add(six);
b.add(seven);
b.add(eight);
b.add(nine);
b.add(zero);
b.add(plus);
b.add(minus);
b.add(div);
b.add(mul);
b.add(eql);
b.add(bk);
b.add(point);
add(d);
add(r);
add(b);
one.addActionListener(this);
two.addActionListener(this);
three.addActionListener(this);
four.addActionListener(this);
five.addActionListener(this);
six.addActionListener(this);
seven.addActionListener(this);
eight.addActionListener(this);
nine.addActionListener(this);
zero.addActionListener(this);
plus.addActionListener(this);
div.addActionListener(this);
minus.addActionListener(this);
mul.addActionListener(this);
eql.addActionListener(this);
bk.addActionListener(this);
point.addActionListener(this);
}
public void actionPerformed(ActionEvent a)
{
if(flag==true)
{
dis.setText("");
flag=false;
}
String i=dis.getText();
rs.setText("");
if(a.getSource()==one)
{
dis.setText(i+"1");
}
else if(a.getSource()==two)
{
dis.setText(i+"2");
}
else if(a.getSource()==three)
{
dis.setText(i+"3");
}
else if(a.getSource()==four)
{
dis.setText(i+"4");
}
else if(a.getSource()==five)
{
dis.setText(i+"5");
}
else if(a.getSource()==six)
{
dis.setText(i+"6");
}
else if(a.getSource()==seven)
{
dis.setText(i+"7");
}
else if(a.getSource()==eight)
{
dis.setText(i+"8");
}
else if(a.getSource()==nine)
{
dis.setText(i+"9");
}
else if(a.getSource()==zero)
{
dis.setText(i+"0");
}
else if(a.getSource()==point)
{
dis.setText(i+".");
}
if((a.getSource()==plus)||(a.getSource()==div)||(a.getSource()==mul)||(a.getSource()==minus))
{
dis.setText("");
sign=a.getActionCommand();
calc=false;
try
{
String temp0=i;
Double temp1=new Double(temp0);
x=temp1.doubleValue();
}
catch(NumberFormatException n)
{
rs.setText("Illigal data is enterd");
return;
}
flag=true;
i="";
}
if(a.getSource()==eql)
{
if(calc==true)
{
rs.setText("Please enter values");
}
if(!calc)
{
try
{
String temp2=i;
Double temp3=new Double(temp2);
y=temp3.doubleValue();
}
catch(NumberFormatException n)
{
rs.setText("Illigal data is enterd");
return;
}
}
dis.setText("");
if(sign.equals("+"))
dis.setText(x+" "+sign+" "+y+" = "+(x+y));
else if(sign.equals("-"))
dis.setText(x+" "+sign+" "+y+" = "+ (x-y));
else if(sign.equals("*"))
dis.setText(x+" "+sign+" "+y+" = "+ (x*y));
else if(sign.equals("/"))
{
if(y!=0)
{
dis.setText(x+" "+sign+" "+y+" = "+ (x/y));
}
else
{
rs.setText("Division by zero is not possible");
}
}
}
if(a.getSource()==bk)
{
dis.setText("");
i="";
flag=true;
calc=true;
x=0.0;
y=0.0;
}
}
}


Saturday, 21 December 2013

2 nd Semester Diploma Programming methodology Importent Pseudo code and C program

Share PM.pdf - 153 KB

2 nd Semester Diploma Programming methodology Importent Pseudo code and C program


1.Display a text
Pseudo code
Write”hello”
C program
#include<stdio.h>
main()
{
printf(“hello”);
getch();
}
2. Adding two number
Pseudo code
Declare A,B,C as integer
A=10
B=20
C=A+B
Write “The sum of A and B=”;C
C program
#include<stdio.h>
main()
{
int A=10;
int B=20;
int C=A+B;
clrscr();
printf(“The sum of A and B=”,C);
getch();
}
3. To Display a string
Pseudo code
Declare C as string
Write “Enter a string”
Input C
Write “The string is”,C
C program
#include<stdio.h>
main()
{
char c[10];
clrscr();
printf(“Enter a string\n”);
scanf(“%S”,&c);
printf(“\nThe string is %s”,c);
getch();
}
4.Temperature Conversion
Pseudo code
Declare Celsius, Fahrenheit are float
Write “Enter the value of Degree Celsius=”
Input Celsius
Set Fahrenheit=(9/5)*(Celsius+32)
Write”The value of Degree Fahrenheit=”,Fahrenheit
C program
#include<stdio.h>
main()
{
float c,f=0;
clrscr();
printf(“Enter the value of degree Celsius=”);
scanf(“%f”,&c);
f=(9/5)*(c+32);
printf(“\nThe value of degree Celsius=%f”,c);
printf(“\nThe value of degree Fahrenheit=%f”,f);
getch();
}
5. Larger Number
(iF then)
Pseudo code
Declare X,Y,Large are integer
Write “Enter two number”
Input X,Y
Set Large=X
If X<Y then
Set Large=Y
Endif
Write “The larger is”,Large
C program
#include<stdio.h>
main()
{
int X,Y,Larger;
clrscr();
printf(“Enter two numbers”);
scanf(“%d%d”,&X,&Y);
Larger=X;
if (X<Y)
Larger=Y;
printf(“The larger number is=%d”,Larger);
getch();
}
(if then else)
Pseudo code
Declare X,Y as integer
Write “Enter two number”
Input X,Y
If X>Y
Write “The large number=”,X
Else
Write “The large number=”,Y
End if
C program
#include<stdio.h>
main()
{
int X,Y;
clrscr();
printf(“Enter two number\n”);
scanf(“%d%d”,&X,&Y);
if(X>Y)
Printf(“The larger number=%d”,X);
else
printf(“The larger number=%d”,Y);
getch();
}
6.Even Checking
Pseudo code
Declare X as integer
Write “Enter a number “
Input X
If (X%2)==0
Write “The number is even”
Else
Write “The numberis odd”
End if
C program
#include<stdio.h>
main()
{
int X;
clrscr();
printf(“Enter a number\n”);
scanf(“%d”,&X);
if ((X%2)==0)
printf(“The number is even”);
else
printf(“The number is odd”);
getch();
}
7.To Disply Day name(Multiple selection structur)
Pseudo code
Declare NO as integer
Write “Enter day number”
Input NO
Select case as NO
Case 1
Write”Day name is Sunday”
Case 2
Write”Day name is Monday”
Case 3
Write “Day name is Tuesday”
Case 4
Write “Day name is Wendnesday”
Case5
Write “Day name is Thursday”
Case6
Write”Day name is Friday”
Case7
Write “Day name is Saturday”
Default
Write”NOT a valid number”
End case
C Program
#include<stdio.h>
main()
{
int NO;
clrscr();
printf(“Enter the day NO:”);
scanf(“%d”,&NO);
switch(NO)
{
case 1:
printf(“\nDay name,Sunday”);
break;
case 2:
printf(“\nDay name, Monday”);
break;
case 3:
printf(“\nDay name, Tuesday”);
break;
case 4:
printf(“\nDay name, Wednesday”);
break;
case 5:
printf(“\nDay name, Thursday”);
break;
case 6:
printf(“\nDay name, Friday”);
break;
case 7:
printf(“\nDay name, Saturday”);
break;
default:
printf(“\n NOT a valid no”);
break;
}
getch();
}

Thursday, 19 December 2013

Find Largest of an Array Element Assembly Language Program


PROGRAM
display macro msg
                lea dx,msg
                mov ah,09h
                int 21h
endm
read macro
                mov ah,01h
                int 21h
                sub al,30h
endm                   
stack segment stack
                db 10 dup(?)
stack ends
data segment
                msg1 db "Enter the limit: $"
                msg2 db 0ah,0dh,"Enter the numbers: $"
                msg3 db 0ah,0dh,"largest:$"
                msg4 db 0ah,0dh,"$"
                num db 10 dup("$")
data ends
code segment
                assume ss:stack,cs:code,ds:data
                start:     mov ax,data
                                mov ds,ax
                                display msg1
                                read
                                mov cl,al
                                mov si,00h
                                mov bl,al
                                display msg2
                label1:  display msg4
                                read
                                mov num[si],al
                                inc si
                                loop label1
                                mov di,00h
                                mov cl,bl
                                mov bl,00h
                label2:  cmp bl,num[di]
                                ja label3
                                mov bl,num[di]
                label3:  inc di
                                loop label2
                                display msg3
                                add bl,30h
                                mov dl,bl
                                mov ah,02h
                                int 21h
                stop:      mov ah,4ch
                                int 21h
code ends
end start
OUTPUT
Enter the limit: 6
Enter the numbers:
9
8
7
6
5
0
Largest: 9

Monday, 16 December 2013

Find Sub-string in a Sentence Assembly language program


PROGRAM

.model small
.stack
print macro p
            lea dx,p
            mov ah,09h
            int 21h
endm
.data
            m1 db 0ah,0dh,"Enter the String:$"
            m2 db 0ah,0dh,"Enter the Substring:$"
            m3 db 0ah,0dh,"String Found$"
            m4 db 0ah,0dh,"String not Found$"
            a db 20h dup("$");
            b db 20h dup("$");
            k dw 0
            f db 0
.code
            mov ax,@data
            mov ds,ax
            mov es,ax
            mov si,0000h
            mov di,0000h
            print m1

loop1:  mov ah,01h
            int  21h
            mov a[si],al
            inc si
            inc k
            cmp al,0dh
            jne loop1
           
            print m2

loop2:  mov ah,01h
            int  21h
            mov b[di],al
            inc di
            inc cl
            cmp al,0dh
            jne loop2

            mov f,cl
            mov si,0000h
            mov di,0000h
            mov ax,0000h

loop3:  mov bh,a[si]
            mov bl,b[di]
            inc si
            inc di
            cmp bh,bl
            jne l1
            loop loop3
            jmp l2

l1:        inc ax
            mov si,ax
            mov cl,f
            mov di,0000h
            mov bx,k
            cmp ax,bx
            jl loop3
            jmp l3

l2:        print m3
            jmp l4

l3:        print m4

l4:        mov ah,4ch
            int 21h
end

OUTPUT

Enter the String:india is my country
Enter the Substring:count
String Found

Enter the String:i love my india
Enter the Substring:loves
String not Found

Count and Display Vowels and Consonants Assembly Language Program


PROGRAM

.model small
.stack
print macro p
            lea dx,p
            mov ah,09h
            int 21h
endm

display macro g
            mov dl,g
            mov bh,0ah
            mov ah,00h
            mov al,dl
            div bh
            mov ch,ah
            mov dl,al
            add dl,30h
            mov ah,02h
            int 21h
            mov dl,ch
            add dl,30h
            mov ah,02h
            int 21h
endm
.data
            m1 db 0ah,0dh,"Enter the String: $"
            m2 db 0ah,0dh,"Vowels= $"
            m3 db 0ah,0dh,"Consonants= $"
            m4 db 0ah,0dh,"No of Vowels= $"
            m5 db 0ah,0dh,"No of Consonants= $"
            a db 20h dup("$")
            b db "aeiouAEIOU"
            v db 20h dup("$")
            co db 20h dup("$")
            k dw 0
            f dw 0
            g db 0
            z db 0
.code
            mov ax,@data
            mov ds,ax
            mov es,ax
            mov si,0000h
            print m1

loop1:  mov ah,01h
            int  21h
            mov a[si],al
            inc si
            cmp al,0dh
            jne loop1
           
            mov cx,si
            mov di,0000h
            mov si,0000h
            dec cx

loop3:  mov bh,a[si]
loop4:  mov bl,b[di]
            cmp bh,bl
            jne loop2
            mov dx,0000h
            mov dx,si
            mov si,k
            inc k
            mov v[si],bh
            inc g
            mov si,dx
loop6:  inc si
            mov di,0000h
            cmp si,cx
            jne loop3
            jmp loop5

loop2:  inc di
            cmp di,0ah
            jl loop4
            mov dx,0000h
            mov dx,si
            mov si,f
            inc f
            mov co[si],bh
            inc z
            mov si,dx
            jmp loop6
           

loop5:  print m2
            print v
            print m4
            display g
            print m3
            print co
            print m5
            display z
            mov ah,4ch
            int 21h
end

OUTPUT

Enter the String: india is my country
Vowels= iiaiou
No of Vowels= 06
Consonants= nd s my cntry
No of Consonants= 13