Saturday, September 14, 2013

GROWING


Dynamic Positioning

Welcome!

Sunday, September 8, 2013

Windows program-Mouse Event-1(win32)

MOUSE EVENT I

Program:

MouseEvents.C


#include <windows.h>
LRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )
{
 static  TCHAR szAppName[]=TEXT ("HELLO");
HWND hwnd;
MSG msg;
// DECLARING AND INTIAZING THE WINDOW CLASS
WNDCLASS wc;                                                       // Window class declaration
wc.style = CS_HREDRAW| CS_VREDRAW;        // Window style
wc. lpfnWndProc = WndProc;                                   // Window Procedure
wc.cbClsExtra = 0;                                                     // Extra Parameters
wc.cbWndExtra = 0;                                                   // Extra Parameters
wc.hInstance = hInstance;                                          // Instance handle
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); // Icon
wc.hCursor = LoadCursor (NULL, IDC_ARROW);            // Window Cursor
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
                                                                                    // Set Background Color
wc.lpszMenuName = NULL;                                     // Menu Handle
wc.lpszClassName = szAppName;                             // Class Name
// REGISTERING THE WINDOW CLASS
if (!RegisterClass (&wc))
{
            MessageBox(NULL, TEXT("This program requires WindowsNT!"), szAppName, MB_ICONERROR);
            return 0;
}
// CREATING THE WINDOW
hwnd = CreateWindow ( szAppName,                                  // window class name
TEXT("The Hello Program"), // window caption 
WS_OVERLAPPEDWINDOW,      // window style
CW_USEDEFAULT,                                    // initial x position
CW_USEDEFAULT,                                    // initial x position
CW_USEDEFAULT,                                    // initial x position
CW_USEDEFAULT,                                    // initial x position
NULL,                                                            // parent window handle
NULL,                                                            // window menu handle
hInstance,                                          //program instance handle
NULL);                                               // creation parameters
// DISPLAYING THE WINDOW
            ShowWindow (hwnd, iCmdShow);              
            UpdateWindow (hwnd);
// PROCESSING THE MESSAGE LOOP
                                    while (GetMessage(&msg,NULL,0,0))          // extracts message from Message Queue
{
                        TranslateMessage (&msg);
                        DispatchMessage (&msg);                  // dispatches the message received
            }
            return msg.wParam;
}

// WINDOW PROCEDURE FUNCTION
LRESULT CALLBACK WndProc (HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
            char left[]="How are u?";
            char right[]="Hello";
            switch (message)
            {
            case WM_LBUTTONDOWN:           // Left mouse button press message
                        MessageBox(GetFocus(),left,"Left Mouse Button Pressed",MB_OK);
                        return 0;
            case WM_RBUTTONDOWN:          // Right mouse button press message
                        MessageBox(GetFocus(),right,"Right Mouse Button Pressed",MB_OK);
                        return 0;
            case WM_DESTROY:                       // used to close the window
                        PostQuitMessage(0);               // used to terminate while loop in WinMain()
                        return 0;
            }
            return DefWindowProc(hwnd,message,wparam,lparam);

}
Sample Output:

Windows Simple Program-Win32

  1. SIMPLE WINDOW PROGRAM

             PROGRAM:
#include <windows.h>
LRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )
{
 static  TCHAR szAppName[]=TEXT ("HELLO");
HWND hwnd;
MSG msg;
// DECLARING AND INTIAZING THE WINDOW CLASS
WNDCLASS wc;                                                       // Window class declaration
wc.style = CS_HREDRAW| CS_VREDRAW;        // Window style
wc. lpfnWndProc = WndProc;                                   // Window Procedure
wc.cbClsExtra = 0;                                                     // Extra Parameters
wc.cbWndExtra = 0;                                                   // Extra Parameters
wc.hInstance = hInstance;                                          // Instance handle
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); // Icon
wc.hCursor = LoadCursor (NULL, IDC_ARROW);            // Window Cursor
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
                                                                                    // Set Background Color
wc.lpszMenuName = NULL;                                     // Menu Handle
wc.lpszClassName = szAppName;                             // Class Name
// REGISTERING THE WINDOW CLASS
if (!RegisterClass (&wc))
{
            MessageBox(NULL, TEXT("This program requires WindowsNT!"), szAppName, MB_ICONERROR);
            return 0;
}
// CREATING THE WINDOW
hwnd = CreateWindow ( szAppName,   // window class name
TEXT("The Hello Program"), // window caption 
WS_OVERLAPPEDWINDOW,      // window style
CW_USEDEFAULT,          // initial x position
CW_USEDEFAULT,  // initial x position
CW_USEDEFAULT,         // initial x position
CW_USEDEFAULT,              // initial x position
NULL,                         // parent window  handle
NULL,                               // window menu handle
hInstance,                          //program instance handle
NULL);                           // creation parameters
// DISPLAYING THE WINDOW
            ShowWindow (hwnd, iCmdShow);              
            UpdateWindow (hwnd);
// PROCESSING THE MESSAGE LOOP
            while (GetMessage(&msg,NULL,0,0) // extracts message from Message Queue
            {
                                                TranslateMessage (&msg);  // dispatches the message received
                        DispatchMessage (&msg);
            }
            return msg.wParam;
}
// WINDOW PROCEDURE FUNCTION
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
            HDC hdc;
            PAINTSTRUCT ps;
            RECT rect;
            switch (message)
            {
            case WM_PAINT:    // Used to draw on client area using objects
                        hdc = BeginPaint (hwnd, &ps); // Gets Device Context
                        GetClientRect (hwnd, &rect);   // To get Client area size
                        DrawText (hdc, TEXT ("HELLO WINDOWS 98"),-1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                        EndPaint(hwnd,&ps);    // Releases Device Context
                        return 0;

            case WM_DESTROY:     // Used to close the window
                        PostQuitMessage(0);  // used to terminate while loop in WinMain()
                        return 0;
            }
            return DefWindowProc (hwnd, message, wparam, lparam);
}



Sample Output:




Saturday, September 7, 2013

LINUX OPERATING SYSTEM


LINUX DIRECTORIES

bin , boot,  dev,  etc,  home , lib,  lib64,  lost+found,  media , misc,  mnt,  net,  opt , proc,  root,  sbin,  selinux,  srv,  sys,  tftpboot,  tmp , usr,  var

Some Useful Commands in Linux:
chmod

[mamce@localhost ~]$ ls -l|grep Desktop
drwxr-xr-x 3 mamce mamce   4096 Sep  5 18:42 Desktop
[mamce@localhost ~]$ chmod g+r Desktop
[mamce@localhost ~]$ ls -l|grep Desktop
drwxr-xr-x 3 mamce mamce   4096 Sep  5 18:42 Desktop
[mamce@localhost ~]$ chmod g+w Desktop
[mamce@localhost ~]$ ls -l|grep Desktop
drwxrwxr-x 3 mamce mamce   4096 Sep  5 18:42 Desktop
[mamce@localhost ~]$ chmod o+w Desktop
[mamce@localhost ~]$ ls -l|grep Desktop
drwxrwxrwx 3 mamce mamce   4096 Sep  5 18:42 Desktop
[mamce@localhost ~]$ chmod o+w Desktop
[mamce@localhost ~]$ ls -l|grep Desktop
drwxrwxrwx 3 mamce mamce   4096 Sep  5 18:42 Desktop
[mamce@localhost ~]$ chmod o-w Desktop
[mamce@localhost ~]$ ls -l|grep Desktop
drwxrwxr-x 3 mamce mamce   4096 Sep  5 18:42 Desktop
[mamce@localhost ~]$

Thursday, August 22, 2013

Login page

Login page

Ragava Login page

Username
Password

Monday, July 15, 2013

DBMS-TRIGGERS

                                    TRIGGERS



 AIM:

To perform High-level language extension with triggers (Student mark list).

SYNTAX:

CREATE[OR REPLACE]TRIGGER[schema.]trigger
{BEFORE|AFTER|INSTEAD OF}
{DELETE
|INSERT
|UPDATE[OF column[,column].....]}
|OR {DELETE
|INSERT
|UPDATE[OF column,[,column]....]}]...
ON[schema.]{table|view}
REFERENCING(OLD[AS]old
|NEW[AS]new...]
FOR EACH{ROW|STATEMENT}{WHEN(condition)}]

DESCRIPTION:

            The details about the students mark are being in the stu table with attributes.

            Name
            Rollno
            Mark1
            Mark2
            Mark3

The stu1 table consists of attributes,

            Rollno
            Total
            Average
            Result

The details of the first table are being given in the prompt by the user.  The total, average are processed for currently processed row in the stu table using after insert on trigger the values are placed in the table stu1.

PROGRAM:
create or replace trigger st_trig
after insert on stu
for each row
 declare
 total number;
 average number;
 result varchar2(10);
 begin
 total:=(:new.m1+:new.m2+:new.m3);
 average:=total/3;
 if(:new.m1>50 and :new.m2>50 and :new.m3>50) then
 result:='pass';
 else
result:='fail';
 end if;
 insert into stu1 values(:new.rollno,total,average,result);
 end;

SQL> /

Trigger created.

SQL> desc stu;

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 NAME                                                 VARCHAR2(20)
 ROLLNO                                             NUMBER
 M1                                                        NUMBER
 M2                                                        NUMBER
 M3                                                        NUMBER

SQL> desc stu1;

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ROLLNO                                              NUMBER
 TOTAL                                                 NUMBER
 AVERAGE                                           NUMBER
 RESULT                                               VARCHAR2(10)


SAMPLE OUTPUT:

BEFORE TRIGGER CREATION:

SQL> select * from stu;

no rows selected

SQL> select * from stu1;

no rows selected

AFTER TRIGGER CREATION:

SQL> insert into stu values('&name',&rollno,&m1,&m2,&m3);
Enter value for name: GOWTHAM
Enter value for rollno: 1212
Enter value for m1: 100
Enter value for m2: 89
Enter value for m3: 90
old   1: insert into stu values('&name',&rollno,&m1,&m2,&m3)
new   1: insert into stu values('GOWTHAM',1212,100,89,90)

1 row created.

SQL> select * from stu;

NAME                     ROLLNO         M1         M2         M3
-------------------- ---------- ---------- ----------------- ----------
GOWTHAM               1212             100         89         90
GOKILA                     1213               89         67         55
RAMYA                     1214               45         67         78

SQL> select * from stu1;

    ROLLNO      TOTAL    AVERAGE RESULT
     ----------      ---------- ------------------- ----------
      1212             279             139.5           pass
      1213             211             105.5           pass
      1214             190               95               fail





RESULT:

Thus the high-level language extension with triggers has been performed for generating the students mark list.


DBMS-FUNCTIONS and PROCEDURES

EX.NO:5                                FUNCTIONS AND PROCEDURE

AIM:

            To write PL/SQL(Functions)and to understand stored procedures in SQL.

FUNCTION:


            A function is a subprogram that computes a value. The syntax for creating a function is given below

Create or replace function<function_name>[argument]
Return datatype is
(local declaration)
begin
            (executable statements)
[Exception]
            (exception handlers)
end

PROCEDURE:

CREATE [ORREPLACE] PROCEDURE PROCEDURENAME
                        [PARAMETER[IN/OUT/IN/IN OUT] DATATYPE
                        [:=/DEFAULT EXPRESSION]
                        [(PARAMETER)]
                        IS/AS
                        DECLARATION
                        BEGIN
                        PL/SQL CODES
                        [EXCEPTION]
                        END

Sample Output

           *****FUCTION USING FOR STATEMENT*****

  SQL>create  or replace function fact(a number)return number as
  2  i number;
  3  f number;
  4  begin
  5  f:=1;
  6  for i in 1..a
  7  loop
  8  f:=f*i;
  9  end loop;
 10  return f;
 11* end fact;
SQL> /

Function created.

*********FUNCTION USING WHILE STATEMENT *************

SQL> create or replace function fact(a number) return number as
  2   i number;
  3   f number;
  4   begin
  5   f:=1;
  6   i:=1;
  7   while (i<=a)
  8   loop
  9   f:=f*i;
 10   i:=i+1;
 11   end loop;
 12   return f;
 13*  end fact;
 14  /

Function created.

SQL>begin
  2  dbms_output.put_line('the factorial='||fact(&a));
  3* end;
SQL> /
Enter value for a: 4
old   2: dbms_output.put_line('the factorial='||fact(&a))
new   2: dbms_output.put_line('the factorial='||fact(4));
the factorial=24

PL/SQL procedure successfully completed.

*****PROCEDURE TO FIND WHETHER A GIVEN NUMBER IS ODD OR EVEN*********

SQL> declare
  2  n number;
  3  begin
  4  n:=&n;
  5  if(mod(n,2)=0)then
  6  dbms_output.put_line(n||'is even');
  7  else
  8  dbms_output.put_line(n||'is odd');
  9  end if;
 10  end;
 11  /

Enter value for n: 3
old   4: n:=&n;
new   4: n:=3;
3is odd

PL/SQL procedure successfully completed.


**********PROCEDURE TO DISPLAY 1-10 USING WHILE*******
  1   declare
  2   n number;
  3   i number;
  4   begin
  5   n:=10;
  6   i:=1;
  7   while (i<=n)
  8   loop
  9   dbms_output.put_line(i);
 10   i:=i+1;
 11   end loop;
 12*  end;
SQL> /
1
2
3
4
5
6
7
8
9
10

PL/SQL procedure successfully completed.
***********Procedure to display some numbers lesser than given number**********
  1  declare
  2  num number;
  3  i number;
  4  begin
  5  num:=&num;
  6  i:=1;
  7  loop
  8  dbms_output.put_line(i);
  9  exit when(i>num);
 10  i:=i+1;
 11  end loop;
 12* end;
SQL> /
Enter value for num: 4
old   5: num:=&num;
new   5: num:=4;
1
2
3
4
5
PL/SQL procedure successfully completed.


RESULT: Thus the functions and stored procedures are executed in SQL.