Anna University Results November - December 2011 available with your GPA only for Credit System

Exam Results 2012

Exam Results 2012 Inspirational Quotes

Friday, December 31, 2010

Wish you a Happy New Year .....

Wish you a Happy New Year
Fireworks.

May your New Year be blessed with peace,love and joy.
Sending you my heartfelt wishes with joy that never ends.
Wishing you a very Happy New Year.

By

M.Baran Mahamood

Tuesday, December 28, 2010

Cascading Style Sheets

Algorithm :

Start the cascading program.
Give link from main page to other like cascading, Embedded..
Write the code for separate page finally terminate program

Source code for html Programming for Home page and Cascading, Embedded, Inline style sheet



<!-- Home.html -->

<html>
<head>
<title>Cascading Style Sheets</title>
</head>
<body alink="blue" vlink="brown">
<h1><u><b><font face="Monotype corsiva" color="red">
Different types of Cascading Style Sheets</font> </b></u></h1>
<br />
<font face="Arial"size="6">
<a href ="inline.html" style="text-decoration :none;"> 1. Inline Style Sheet</a><br />
<a href ="embedded.html" style="text-decoration :none;"> 2. Embeded Style Sheet</a><br />
<a href ="external.html" style="text-decoration :none;"> 3. External Style Sheet</a><br />
<a href ="import.html" style="text-decoration :none;"> 4. Imported Style Sheet</a><br /></font>
</body>
</html>

<!-- embedded.html -->


<html>
<head>
<title>Embedded Style Sheet</title>
<style type="text/css">
ol{list-style-type:decimal}
h1{text-align: left; background:antiquewhite;font-family:monotype corsiva;color:red}
h3{text-align: right; font-family:arial;color:blue}
</style>
</head>
<body>
<ol class="lroman"><h1>
<li>Embedded style sheet</li></h1>
<br />
<h3>
Embedded style is the style attached to one specific document.
The information is specified as a content of the style element
inside the head element and wil apply to the entire documents.
</h3></ol>
</body>
</html>

<!-- inline.html -->

<html>
<head>
<title>Inline Style Sheet</title>
</head>
<body>
<ol class="decimal">
<h1 style="font-family :Monotype Corsiva ;background-color:antiquewhite ;"><li> Inline Style Sheet</li></h1>
<h3>
<p style="text-indent :30pt;color:blue;font-family :arial;">
Inine Style is the style attached to one specific element.
The style is specified directly in the start tag as a value of the style attribute well apply
exclusively to this specific element occurrence.
</p></h3>
</ol>
</body>
</html>

<!--  import.html -->

<html>
<head><title>Imported Style Sheet</title>
<link rel= stylesheet href="style2.css" type="text/css">
</head>
<body>
<h1>1. Imported Style Sheet</h1>
<h3> Imported style sheet is a shet that can be imported to another sheet.
This alignes exacting one main sheet containing declarations that apply to
the whle site and partial sheets containing declarations that apply to specific
elements.</h3>
</body>
</html>

<!-- external.html -->

<html>
<head>
<title>External Style Sheet</title>
<link rel=Stylesheet href="style1.css" type="text/css" />
</head>
<body>
<h1>1. External Style Sheet</h1><br />
<h3>
An external style sheet is a template documents/files
containing style info which can be linked with any number
of the documents. This is a very convenient way of formating
the entire site as well as restyling it by editing just one file</h3>
</body>
</html>

<!-- style1.css -->

<style type="text/css">
ol{list-style-type:decimal}
h1{text-align: left; background:antiquewhite;font-family:monotype corsiva;color:Green}
h3{text-align: right; font-family:TimesNewRoman;color:Red}
</style>

<!-- style2.css -->

<style type="text/css">
ol{list-style-type:decimal}
h1{text-align: left; background:antiquewhite;font-family:monotype corsiva;color:Orange}
h3{text-align: right; font-family:arial;color:Yellow}
</style>

Monday, December 27, 2010

Software Requirements Specification



Software Requirements Specification

for
<Project>



<date created>


Table of Contents :

Table of Contents........................................................................................................................... ii
Revision History............................................................................................................................. ii
1.   Introduction............................................................................................................................... 1
1.1   Purpose................................................................................................................................. 1
1.2   Document Conventions........................................................................................................... 1
1.3   Intended Audience and Reading Suggestions............................................................................ 1
1.4   Project Scope......................................................................................................................... 1
1.5   References............................................................................................................................ 1
2.   Overall Description.................................................................................................................. 2
2.1   Product Perspective................................................................................................................ 2
2.2   Product Features.................................................................................................................... 2
2.3   User Classes and Characteristics............................................................................................. 2
2.4   Operating Environment........................................................................................................... 2
2.5   Design and Implementation Constraints.................................................................................... 2
2.6   User Documentation............................................................................................................... 2
2.7   Assumptions and Dependencies............................................................................................... 3
3.   System Features....................................................................................................................... 3
3.1   System Feature 1.................................................................................................................... 3
3.2   System Feature 2 (and so on).................................................................................................. 4
4.   External Interface Requirements............................................................................................ 4
4.1   User Interfaces...................................................................................................................... 4
4.2   Hardware Interfaces.............................................................................................................. 4
4.3   Software Interfaces................................................................................................................ 4
4.4   Communications Interfaces..................................................................................................... 4
5.   Other Nonfunctional Requirements......................................................................................... 5
5.1   Performance Requirements..................................................................................................... 5
5.2   Safety Requirements............................................................................................................... 5
5.3   Security Requirements............................................................................................................ 5
5.4   Software Quality Attributes..................................................................................................... 5
6.   Other Requirements................................................................................................................. 5
Appendix A: Glossary.................................................................................................................... 5
Appendix B: Analysis Models....................................................................................................... 6
Appendix C: Issues List................................................................................................................. 6


Name
Date
Reason For Changes
Version












1.     Introduction

1.1     Purpose

<Identify the product whose software requirements are specified in this document, including the revision or release number. Describe the scope of the product that is covered by this SRS, particularly if this SRS describes only part of the system or a single subsystem.>

1.2     Document Conventions

<Describe any standards or typographical conventions that were followed when writing this SRS, such as fonts or highlighting that have special significance. For example, state whether priorities  for higher-level requirements are assumed to be inherited by detailed requirements, or whether every requirement statement is to have its own priority.>

1.3     Intended Audience and Reading Suggestions

<Describe the different types of reader that the document is intended for, such as developers, project managers, marketing staff, users, testers, and documentation writers. Describe what the rest of this SRS contains and how it is organized. Suggest a sequence for reading the document, beginning with the overview sections and proceeding through the sections that are most pertinent to each reader type.>

1.4     Project Scope

<Provide a short description of the software being specified and its purpose, including relevant benefits, objectives, and goals. Relate the software to corporate goals or business strategies. If a separate vision and scope document is available, refer to it rather than duplicating its contents here. An SRS that specifies the next release of an evolving product should contain its own scope statement as a subset of the long-term strategic product vision.>

1.5     References

<List any other documents or Web addresses to which this SRS refers. These may include user interface style guides, contracts, standards, system requirements specifications, use case documents, or a vision and scope document. Provide enough information so that the reader could access a copy of each reference, including title, author, version number, date, and source or location.>

2.     Overall Description

2.1     Product Perspective

<Describe the context and origin of the product being specified in this SRS. For example, state whether this product is a follow-on member of a product family, a replacement for certain existing systems, or a new, self-contained product. If the SRS defines a component of a larger system, relate the requirements of the larger system to the functionality of this software and identify interfaces between the two. A simple diagram that shows the major components of the overall system, subsystem interconnections, and external interfaces can be helpful.>

2.2     Product Features

<Summarize the major features the product contains or the significant functions that it performs or lets the user perform. Details will be provided in Section 3, so only a high level summary  is needed here. Organize the functions to make them understandable to any reader of the SRS. A picture of the major groups of related requirements and how they relate, such as a top level data flow diagram or a class diagram, is often effective.>

2.3     User Classes and Characteristics

<Identify the various user classes that you anticipate will use this product. User classes may be differentiated based on frequency of use, subset of product functions used, technical expertise, security or privilege levels, educational level, or experience. Describe the pertinent characteristics of each user class. Certain requirements may pertain only to certain user classes. Distinguish the favored user classes from those who are less important to satisfy.>

2.4     Operating Environment

<Describe the environment in which the software will operate, including the hardware platform, operating system and versions, and any other software components or applications with which it must peacefully coexist.>

2.5     Design and Implementation Constraints

<Describe any items or issues that will limit the options available to the developers. These might include: corporate or regulatory policies; hardware limitations (timing requirements, memory requirements); interfaces to other applications; specific technologies, tools, and databases to be used; parallel operations; language requirements; communications protocols; security considerations; design conventions or programming standards (for example, if the customer’s organization will be responsible for maintaining the delivered software).>

2.6     User Documentation

<List the user documentation components (such as user manuals, on-line help, and tutorials) that will be delivered along with the software. Identify any known user documentation delivery formats or standards.>

2.7     Assumptions and Dependencies

<List any assumed factors (as opposed to known facts) that could affect the requirements stated in the SRS. These could include third-party or commercial components that you plan to use, issues around the development or operating environment, or constraints. The project could be affected if these assumptions are incorrect, are not shared, or change. Also identify any dependencies the project has on external factors, such as software components that you intend to reuse from another project, unless they are already documented elsewhere (for example, in the vision and scope document or the project plan).>

3.     System Features

<This template illustrates organizing the functional requirements for the product by system features, the major services provided by the product. You may prefer to organize this section by use case, mode of operation, user class, object class, functional hierarchy, or combinations of these, whatever makes the most logical sense for your product.>

3.1     System Feature 1

<Don’t really say “System Feature 1.” State the feature name in just a few words.>
3.1.1      Description and Priority
<Provide a short description of the feature and indicate whether it is of High, Medium, or Low priority. You could also include specific priority component ratings, such as benefit, penalty, cost, and risk (each rated on a relative scale from a low of 1 to a high of 9).>
3.1.2      Stimulus/Response Sequences
<List the sequences of user actions and system responses that stimulate the behavior defined for this feature. These will correspond to the dialog elements associated with use cases.>
3.1.3      Functional Requirements
<Itemize the detailed functional requirements associated with this feature. These are the software capabilities that must be present in order for the user to carry out the services provided by the feature, or to execute the use case. Include how the product should respond to anticipated error conditions or invalid inputs. Requirements should be concise, complete, unambiguous, verifiable, and necessary. Use “TBD” as a placeholder to indicate when necessary information is not yet available.>

<Each requirement should be uniquely identified with a sequence number or a meaningful tag of some kind.>

REQ-1:    
REQ-2:    

3.2     System Feature 2 (and so on)

4.     External Interface Requirements

4.1     User Interfaces

<Describe the logical characteristics of each interface between the software product and the users. This may include sample screen images, any GUI standards or product family style guides that are to be followed, screen layout constraints, standard buttons and functions (e.g., help) that will appear on every screen, keyboard shortcuts, error message display standards, and so on. Define the software components for which a user interface is needed. Details of the user interface design should be documented in a separate user interface specification.>

4.2     Hardware Interfaces

<Describe the logical and physical characteristics of each interface between the software product and the hardware components of the system. This may include the supported device types, the nature of the data and control interactions between the software and the hardware, and communication protocols to be used.>

4.3     Software Interfaces

<Describe the connections between this product and other specific software components (name and version), including databases, operating systems, tools, libraries, and integrated commercial components. Identify the data items or messages coming into the system and going out and describe the purpose of each. Describe the services needed and the nature of communications. Refer to documents that describe detailed application programming interface protocols. Identify data that will be shared across software components. If the data sharing mechanism must be implemented in a specific way (for example, use of a global data area in a multitasking operating system), specify this as an implementation constraint.>

4.4     Communications Interfaces

<Describe the requirements associated with any communications functions required by this product, including e-mail, web browser, network server communications protocols, electronic forms, and so on. Define any pertinent message formatting. Identify any communication standards that will be used, such as FTP or HTTP. Specify any communication security or encryption issues, data transfer rates, and synchronization mechanisms.>

5.     Other Nonfunctional Requirements

5.1     Performance Requirements

<If there are performance requirements for the product under various circumstances, state them here and explain their rationale, to help the developers understand the intent and make suitable design choices. Specify the timing relationships for real time systems. Make such requirements as specific as possible. You may need to state performance requirements for individual functional requirements or features.>

5.2     Safety Requirements

<Specify those requirements that are concerned with possible loss, damage, or harm that could result from the use of the product. Define any safeguards or actions that must be taken, as well as actions that must be prevented. Refer to any external policies or regulations that state safety issues that affect the product’s design or use. Define any safety certifications that must be satisfied.>

5.3     Security Requirements

<Specify any requirements regarding security or privacy issues surrounding use of the product or protection of the data used or created by the product. Define any user identity authentication requirements. Refer to any external policies or regulations containing security issues that affect the product. Define any security or privacy certifications that must be satisfied.>

5.4     Software Quality Attributes

<Specify any additional quality characteristics for the product that will be important to either the customers or the developers. Some to consider are: adaptability, availability, correctness, flexibility, interoperability, maintainability, portability, reliability, reusability, robustness, testability, and usability. Write these to be specific, quantitative, and verifiable when possible. At the least, clarify the relative preferences for various attributes, such as ease of use over ease of learning.>

6.     Other Requirements

<Define any other requirements not covered elsewhere in the SRS. This might include database requirements, internationalization requirements, legal requirements, reuse objectives for the project, and so on. Add any new sections that are pertinent to the project.>

<Define all the terms necessary to properly interpret the SRS, including acronyms and abbreviations. You may wish to build a separate glossary that spans multiple projects or the entire organization, and just include terms specific to a single project in each SRS.>

<Optionally, include any pertinent analysis models, such as data flow diagrams, class diagrams, state-transition diagrams, or entity-relationship diagrams.>

< This is a dynamic list of the open requirements issues that remain to be resolved, including TBDs, pending decisions, information that is needed, conflicts awaiting resolution, and the like.>

Tuesday, December 21, 2010

Creating Image Maps in HTML

Aim :

To create webpage and embed map and fix the hot spots in that map and show related information CS2358 INTERNET PROGRAMMING LABORATORY.

Algorithm :

Start the program for embed map in web page
Create ImageMap.htm file
Set the coordination for the hot spot areaCreate separate html file for separate hot place
Like Tamilnadu,keral,karanadha
Finally terminate the program embed webpage


Source code in HTML programming for embed page CS2358 INTERNET PROGRAMMING LABORATORY.


<!- - Creating and Using Image Maps -->
<!-- ImageMap.html -->

<HTML>
<HEAD>
<TITLE>Image Map</TITLE>
</HEAD>
<BODY>
<MAP id = "picture">
<AREA href = "TamilNadu.html" shape = "circle"
coords = "170, 490, 30" alt = "Tamil Nadu" />
<AREA href = "Karnataka.html" shape = "rect"
coords = "115, 390, 150, 450" alt = "Karnataka" />
<AREA href = "AndhraPradesh.html" shape = "poly"
coords = "165, 355, 200, 355, 220, 380, 170, 425, 165,
355" alt = "Andhra Pradesh" />
<AREA href = "Kerala.html" shape = "poly"
coords = "115, 455, 160, 470, 140, 485, 150, 505, 150,
530, 135, 500, 115, 455" alt = "Kerala" />
</MAP>
<IMG src = "India.Jpg" alt = "India" usemap = "#picture" />
</BODY>
</HTML>

<!-- TamilNadu.html --><HTML>
<HEAD>
<TITLE>About Tamil Nadu</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Tamil Nadu</H1></CENTER>
<HR>
<UL>
<LI>Area : 1,30,058 Sq. Kms.</LI>
<LI>Capital : Chennai</LI>
<LI>Language : Tamil</LI>
<LI>Population : 6,21,10,839</LI>
</UL>
</BODY>
</HTML>



<!-- AndhraPradesh.html --><HTML>
<HEAD>
<TITLE>About Andhra Pradesh</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Andhra Pradesh</H1></CENTER>
<HR>
<UL>
<LI>Area : 2,75,068 Sq. Kms</LI>
<LI>Capital : Hyderabad</LI>
<LI>Language : Telugu</LI>
<LI>Population : 7,57,27,541</LI>
</UL>
</BODY>
</HTML>

<!-- Kerala.html --><HTML>
<HEAD>
<TITLE>About Kerala</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Kerala</H1></CENTER>
<HR>
<UL>
<LI>Area : 38,863 Sq. Kms.</LI>
<LI>Capital : Thiruvananthapuram</LI>
<LI>Language : Malayalam</LI>
<LI>Population : 3,18,38,619</LI>
</UL>
</BODY>
</HTML>

<!-- Karnataka.html --><HTML>
<HEAD>
<TITLE>About Karnataka</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Karnataka</H1></CENTER>
<HR>
<UL>
<LI>Area : 1,91,791 Sq. Kms</LI>
<LI>Capital : Bangalore</LI>
<LI>Language : Kannada</LI>
<LI>Population : 5,27,33,958</LI>
</UL>
</BODY>
</HTML>

Thursday, December 2, 2010

Happy Holidays .........


JCE 2008 CSE - A

JCE 2008 CSE - A

Join This Community to get the Updates on your Mail ...... 
( Only for JCE 2008 CSE - A )

Saturday, October 23, 2010

System Software Viva Questions .....

System Software Viva Questions  :
 
                                 Download from Here ......

Friday, October 22, 2010

All The Best for your Exams .........

Hi friends ..............

           i hope , you are well prepared for the SEMESTER EXAM ,
All The Best for your Exams........

ALL THE BEST FOR YOUR EXAMS ........

Silence and smile is the best ...

SILENCE
Is d best Answer
for all questions
SMILE
Is d best Reaction
in all situations
Unfortunately
BOTH Never Help In
any EXAM, VIVA, REVIEW & INTERVIEW
----------------------------

It takes
3 months for a Writer
2 months for a Doctor
1 month for a Lawyer and
Only 1 night before exam for a Student
To read a 1000 pages book
All the best!

-----------------------------------------

To be a good professional,
Always start to study late for Exams.
Because it teaches how to manage Time
And tackle Emergencies!
Best of luck!

Show your Grade .....
     
All The Best for your Exam








 Please avoid one night effort  ........ it creates more a pressure and fear ........ start studying now itself ............




  Work hard to score high ....................



To achieve great things,
We must not only act,
But also dream,
Not only plan but also believe,
Best wishes for your exam.


-------
By

M.Baran Mahamood

Wednesday, October 6, 2010

Lab Programs - CSE - V SEM

Lab Programs - CSE - V SEM :

(As per Anna University Syllabus - Regulation 2008)

1.Network Lab Programs - CS2307

2.System Software Lab Programs - CS2308

3.Java Lab Programs - CS2309

Thursday, September 30, 2010

OPAC Library Management System program in Java

OPAC Library Management System program in Java :
 
                       Develop a simple OPAC system for library using even-driven and concurrent programming paradigms of Java. Use JDBC to connect to a back-end database.

Procedure  :

  1. Create a new Database file in MS ACCESS (our backend) named “books.mdb”.
  2. Then create a table named “Library” in it.
  3. The table Library contains the following fields and data types,
  1. AuthorName – Text
  2. ISBN – Text
  3. BookName - Text
  4. Price - Number
  5. Publisher – Text
  1. Enter various records as you wish.
  2. Save the database file.
  3. Next step is to add our “books.mdb” to the System DSN. To do that follow the procedure given below,
  1. Go to Start-> Control Panel -> Administrative tools.
  2. In that double click “Data Sources (ODBC)”.
  3. ODBC Data Source Administrator dialog appears.
  4. In that select “System DSN” tab and click the Add Button.
  5. Select “Microsoft Access Driver(*.mdb)” and click Finish.
  6. ODBC Microsoft Access Setup appears. In the “Data Source name” type “Library”.
  7. Click on the “Select” button and choose your database file. Then click ok.
Now your database file gets added to the System DSN. It should look like below,


Now execute the following code “Library.java”.

Library.java 

import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;

public class Library implements ActionListener
{
    JRadioButton rbauthor = new JRadioButton("Search by Author name");
    JRadioButton rbbook = new JRadioButton("Search by Book name");
    JTextField textfld = new JTextField(30);
    JLabel label = new JLabel("Enter Search Key");
    JButton searchbutton = new JButton("Search");
    JFrame frame = new JFrame();
    JTable table;
    DefaultTableModel model;
    String query = "select * from Library";
   
    public Library()
    {
         frame.setTitle("Online Public Access Catalog");
         frame.setSize(500,600);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setLayout(new BorderLayout());
        
         JPanel p1 = new JPanel();
         JPanel p2 = new JPanel();
         JPanel p3 = new JPanel();
        
         p1.setLayout(new FlowLayout());
         p1.add(label);
         p1.add(textfld);
        
         ButtonGroup bg = new ButtonGroup();
         bg.add(rbauthor);
         bg.add(rbbook);
        
         p2.setLayout(new FlowLayout());
         p2.add(rbauthor);
         p2.add(rbbook);
         p2.add(searchbutton);
         searchbutton.addActionListener(this);
        
         p3.setLayout(new BorderLayout());
         p3.add(p1,BorderLayout.NORTH);
         p3.add(p2,BorderLayout.CENTER);
        
         frame.add(p3,BorderLayout.NORTH);
         addTable(query);
         frame.setVisible(true);
    }
    public void addTable(String s)
    {
         try
         {
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection conn = DriverManager.getConnection("jdbc:odbc:Library","","");
              Statement st = conn.createStatement();
             
              ResultSet rs = st.executeQuery(s);
              ResultSetMetaData md = rs.getMetaData();
              int cols = md.getColumnCount();
              model = new DefaultTableModel(1,cols);
              table = new JTable(model);
              String[] tabledata = new String[cols];
              int i=0;
              while(i<cols)
              {
                   tabledata[i] = md.getColumnName(i+1);
                   i++;
              }
              model.addRow(tabledata);
              while(rs.next())
              {
                 for(i=0;i<cols;i++)
                   tabledata[i] = rs.getObject(i+1).toString();
                 model.addRow(tabledata);
              }
              frame.add(table,BorderLayout.CENTER);
             
              conn.close();
         }catch(Exception e){}
        
     }
     public void actionPerformed(ActionEvent evt)
     {
        if(rbauthor.isSelected())
          query = "select * from Library where AuthorName like '"+textfld.getText()+"%'";
        if(rbbook.isSelected())
          query = "select * from Library where BookName like '"+textfld.getText()+"%'";
        while(model.getRowCount()>0)
          model.removeRow(0);
        frame.remove(table);
        addTable(query);
    }
    public static void main(String[] args)
    {
      new Library();
    }
   
}
 

Screenshots of Output :

(Opening Screen)

(author Search)

(Book Search)



Download the Source Code


Library.java
books.mdb

OPNET Download ......

OPNET Download :
 procedure to install...........
click here to download the user guide...........(must download)

Saturday, September 25, 2010

Muti-Threaded Echo Server and Corresponding GUI Client in Java


/* Muti-Threaded Echo Server and Corresponding GUI Client in Java */

// EchoServer.java
import java.net.*;
import java.io.*;

public class EchoServer
{        
    ServerSocket ss;
    
    
    public EchoServer() 
    {
        try
        {
            ss = new ServerSocket(12111);
        }
        catch(Exception e)
        {
            System.out.println("Error ... " + e.getMessage());
            System.exit(-1);
        }
        
        System.out.println("Listening for clients.....");
       
        int id = 0;
        while(true)
        {                        
            try
            {
                Socket cs = ss.accept();
            
                ClientServiceThread ct = new ClientServiceThread(cs, id++);
                ct.start();
            }
            catch(Exception e)
            {
                System.out.println(" Error " + e.getMessage());
                System.exit(-1);
            }
        }
    }
    
    public static void main (String[] args)
    {
        new EchoServer();    
    }

    
    class ClientServiceThread extends Thread
    {
        Socket cs;        
        int m_clientID = -1;
        boolean m_bRunThread = true;
        
        ClientServiceThread(Socket s, int clientID)
        {
            cs = s;
            m_clientID = clientID;
        }
       
        public void run()
        {            
           BufferedReader in = null; 
            PrintWriter out = null;

            System.out.println("Accepted Client : ID - " + m_clientID + " : Address - " + cs.getInetAddress().getHostName());
                
            try
            {                                
                in = new BufferedReader(new InputStreamReader(cs.getInputStream()));
                out = new PrintWriter(new OutputStreamWriter(cs.getOutputStream()));

                while(m_bRunThread)
                {                    
                    String clientCommand = in.readLine();
                    
                    System.out.println("Client Says :" + clientCommand);
                    
                    
                    if(clientCommand.equalsIgnoreCase("exit"))
                    {
                        m_bRunThread = false;   
                        System.out.print("Stopping client thread for client : " + m_clientID);
                        System.exit(-1);    
                    }
                    else
                    {
                        out.println(clientCommand);
                        out.flush();
                    }
                }
                    in.close();
                    out.close();
                    cs.close();
                    System.out.println("...Stopped");
                }
                catch(Exception e)
                {
                    System.exit(-1);
                }
        }
    }
}

// EchoClient.java

import java.net.*;
import java.io.*;

public class EchoClient
{
    public static void main(String args[])
    {

        Socket s = null;

        try
        {
            s = new Socket("localhost", 12111);
        }        
        catch( Exception e)
        {
               System.out.println("Error ... " + e.getMessage());
            System.exit(-1);
        }

        if(s == null)
            System.exit(-1);
        
        BufferedReader in = null;
        PrintWriter out = null;
        
        try
        {
            in = new BufferedReader(new InputStreamReader(s.getInputStream()));
            out = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
            BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
            String msg;
            while(true)
            {
            System.out.print(" Enter the Message : " );
            msg=br.readLine();
            if(msg.compareTo("exit")==0)
            {
                out.println(msg);
                out.flush();
                break;
            }

            out.println(msg);
            out.flush();

            System.out.println(" Server Says : " + in.readLine());
            }
                out.close();
                in.close();
                s.close();
            }
            catch(Exception e)
            {
                System.out.println("Error ... " + e.getMessage());
                System.exit(-1); 
            }                       
    }
}

OUTPUT : 

// EchoServer.java 

javac EchoServer.java
java EchoServer

Listening for clients.....
Accepted Client : ID - 0 : Address - localhost
Client Says :Welcome To JCE
Client Says :I am Baran
Client Says :CSE Rocks .....
Client Says :exit
Stopping client thread for client : 0


// EchoClient.java 

javac EchoClient.java
java EchoClient

 Enter the Message : Welcome To JCE
  Server Says : Welcome To JCE
 Enter the Message : I am Baran
 Server Says : I am Baran
 Enter the Message : CSE Rocks .....
 Server Says : CSE Rocks .....
 Enter the Message : exit

If u find any flaws , Contact to M.Baran Mahamood

Object Serialization in Java


 /* SerializationWrite.java */

import java.io.*;
import java.util.*;

class Currency implements Serializable
{
  protected String currency;
  protected int amount;
 
  public Currency(String cur, int amt)
  {
    this.currency = cur;
    this.amount = amt;
  }
  public String toString()
  {
    return currency + amount;
  }
  public String dollarToRupee(int amt)
  {
    return "Rs" + amt * 45;
  }
}
class Rupee extends Currency
{
  public Rupee(int amt)
  {
    super("Rs",amt);
  }
}
class Dollar extends Currency
{
  public Dollar(int amt)
  {
    super("$",amt);
  }
}
public class SerializationWrite
{
  public static void main(String args[])
  {
    Random r = new Random();
    try
    {
      Currency currency;
      FileOutputStream fos = new FileOutputStream("serial.txt");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
      System.out.println("Writing to file using Object Serialization:");
      for(int i=1;i<=25;i++)
      {
        Object[] obj = { new Rupee(r.nextInt(5000)),new Dollar(r.nextInt(5000)) };
        currency = (Currency)obj[r.nextInt(2)]; // RANDOM Objects for Rs and $
        System.out.println(currency);
        oos.writeObject(currency);
        oos.flush();
      }
      oos.close();
    }
    catch(Exception e)
    {
      System.out.println("Exception during Serialization: " + e);
    }
  }
}

OUTPUT :

Writing to file using Object Serialization:

Rs2337 
Rs1629 
$339 
Rs1092
Rs1193
$1957
Rs1450 
$1799
$1497
$4586 
Rs1650
Rs88 
Rs1862 
$4392
$4216 
Rs4722
Rs676
Rs3159
$409
$1093
Rs2751
Rs2299
Rs1595
$4650
Rs2126

/* SerializationRead.java */

import java.io.*;
import java.util.*;

public class SerializationRead
{
  public static void main(String args[])
  {
    try
    {
      Currency obj;
      FileInputStream fis = new FileInputStream("serial.txt");
      ObjectInputStream ois = new ObjectInputStream(fis);
      System.out.println("Reading from file using Object Serialization:");
      for(int i=1;i<=25;i++)
      {
        obj = (Currency)ois.readObject();
        if((obj.currency).equals("$"))
          System.out.println(obj + " = " + obj.dollarToRupee(obj.amount));
        else
          System.out.println(obj + " = " + obj);
         
      }
      ois.close();
    }
    catch(Exception e)
    {
      System.out.println("Exception during deserialization." + e);
    }
  }


OUTPUT :

Reading from file using Object Serialization:

Rs2337 = Rs2337
Rs1629 = Rs1629
$339 = Rs15255
Rs1092 = Rs1092
Rs1193 = Rs1193
$1957 = Rs88065
Rs1450 = Rs1450
$1799 = Rs80955
$1497 = Rs67365
$4586 = Rs206370
Rs1650 = Rs1650
Rs88 = Rs88
Rs1862 = Rs1862
$4392 = Rs197640
$4216 = Rs189720
Rs4722 = Rs4722
Rs676 = Rs676
Rs3159 = Rs3159
$409 = Rs18405
$1093 = Rs49185
Rs2751 = Rs2751
Rs2299 = Rs2299
Rs1595 = Rs1595
$4650 = Rs209250
Rs2126 = Rs2126

If  u find any flaws , Contact to M.Baran Mahamood

Multi Thread Using Pipe in Java Program


 /* Multi Thread Using Pipe in Java Program */

import java.util.*;
import java.io.*;

class Fibonacci extends Thread
{
  private PipedWriter out = new PipedWriter();
  public PipedWriter getPipedWriter()
  {
    return out;
  }
  public void run()
  {
    Thread t = Thread.currentThread();
    t.setName("Fibonacci");
    System.out.println(t.getName() + " thread started");
    int fibo1=0,fibo2=1,fibo=0;
    while(true)
    {
      try
      {
        fibo = fibo1 + fibo2;
        if(fibo>100000)
        {
          out.close();
          break;
        }
        out.write(fibo);
        sleep(1000);
      }
      catch(Exception e)
      {
        System.out.println("Fibonacci:"+e);
      }
      fibo1=fibo2;
      fibo2=fibo;
    }
    System.out.println(t.getName() + " thread exiting");
   
  }
}
class Prime extends Thread
{
  private PipedWriter out1 = new PipedWriter();
  public PipedWriter getPipedWriter()
  {
    return out1;
  }
  public void run()
  {
    Thread t= Thread.currentThread();
    t.setName("Prime");
    System.out.println(t.getName() + " thread Started...");
    int prime=1;
    while(true)
    {
      try
      {
        if(prime>100000)
        {
          out1.close();
          break;
        }
        if(isPrime(prime))
          out1.write(prime);
        prime++;
        sleep(0);
      }
      catch(Exception e)
      {
        System.out.println(t.getName() + " thread exiting.");
        System.exit(0);
      }
    }
  }
  public boolean isPrime(int n)
  {
    int m=(int)Math.round(Math.sqrt(n));
    if(n==1 || n==2)
      return true;
    for(int i=2;i<=m;i++)
      if(n%i==0)
         return false;
      return true;
  }
}
public class PipedIo
{
  public static void main(String[] args) throws Exception
  {
    Thread t=Thread.currentThread();
    t.setName("Main");
    System.out.println(t.getName() + " thread Started...");
    Fibonacci fibonacci = new Fibonacci();
    Prime prime = new Prime();
    PipedReader fpr = new PipedReader(fibonacci.getPipedWriter());
    PipedReader ppr = new PipedReader(prime.getPipedWriter());
    fibonacci.start();
    prime.start();
    int fib=fpr.read(), prm=ppr.read();
    System.out.println("The numbers common to PRIME and FIBONACCI:");
    while((fib!=-1) && (prm!=-1))
    {
      while(prm<=fib)
      {
        if(fib==prm)
          System.out.println(prm);
        prm=ppr.read();
      }
      fib=fpr.read();
    }
    System.out.println(t.getName() + " thread exiting");
  }
}
 
OUTPUT :

Main thread Started...
Fibonacci thread started
Prime thread Started...
The numbers common to PRIME and FIBONACCI:
1
2
3
5
13
89
233
1597
28657
Fibonacci thread exiting
Main thread exiting
Prime thread exiting.

If u find any flaws, Contact to M.Baran Mahamood

Saturday, September 18, 2010

OPNET - TCP versus UDP Response Time

Download from here .....

OPNET - TCP versus UDP Response Time

OPNET - TCP Throughput

Download from here .....

OPNET - TCP Throughput

OPNET - Routing Protocols

Download from here .....

OPNET - Routing Protocols

OPNET - Shared Ethernet Networks

Download from here .....

OPNET - Shared Ethernet Networks

Implementation of Shortest Path Computation in OSPF (Dijikstra’s Algorithm)



/* Implementation of Shortest Path Computation in OSPF (Dijikstra’s Algorithm) */

#include<stdio.h>
main()
{
int i,j,k,n,a[10][10],b[10][10];
printf("\n Enter the no.of nodes : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("\n Enter the distance between the host %d to %d : ",i+1,j+1);
scanf("%d",&a[i][j]);
}
}
printf("\n The given Matrix is : \n\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf(" %d\t",a[i][j]);
}
printf("\n");
}

for(k=0;k<n;k++)
{
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
if(a[i][j]>a[i][k]+a[k][j])
a[i][j]=a[i][k]+a[k][j];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=a[i][j];
if(i==j)
b[i][j]=0;
}
}


printf("\n The output Matrix is : \n\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf(" %d \t",b[i][j]);
}
printf("\n");
}
}
OUTPUT :

 Enter the no.of nodes : 4

 Enter the distance between the host 1 to 1 : 0

 Enter the distance between the host 1 to 2 : 2

 Enter the distance between the host 1 to 3 : 5

 Enter the distance between the host 1 to 4 : 3

 Enter the distance between the host 2 to 1 : 2

 Enter the distance between the host 2 to 2 : 0

 Enter the distance between the host 2 to 3 : 6

 Enter the distance between the host 2 to 4 : 1

 Enter the distance between the host 3 to 1 : 3

 Enter the distance between the host 3 to 2 : 1

 Enter the distance between the host 3 to 3 : 0

 Enter the distance between the host 3 to 4 : 6

 Enter the distance between the host 4 to 1 : 3

 Enter the distance between the host 4 to 2 : 1

 Enter the distance between the host 4 to 3 : 5

 Enter the distance between the host 4 to 4 : 0

 The given Matrix is :

 0       2       5       3
 2       0       6       1
 3       1       0       6
 3       1       5       0

 The output Matrix is :

 0       2       5       3
 2       0       6       1
 3       1       0       2
 3       1       5       0