You are on page 1of 80

ABSTRACT

Dimensionality reduction methods used for prediction can be direct into a general framework by
deriving from a common target function. In traditional work, we provide a framework for
applying additive models to a large number of input variables. The main idea is to reduce the
task dimensionality by deriving a small number of new covariates obtained by linear
combinations of the inputs, the linear weights being estimated with respect to the present
regression problem. The weights are also limited to prevent overshooting and facilitate the
interpretation of the derived covariates. We determine the identifiability of the model under mild
assumptions and represent an approximate algorithm. In the proposed system, a model to predict
how people spread from one place to another after a certain time. This information is very useful
to investigate questions such as the prediction of vehicle traffic and the spread of contagious
diseases. The standard statistics provided by commercial dimensionality data are used as inputs
to our prediction model. Experiments show that if the measured time slot is less than the
expected cell residence time and is not close to the expected call retention time, a good accuracy
of the prediction model can be expected. Dimensionality Reduction is usually achieved on the
feature space by accepting one of the prescribed methods that fall under the chosen technique.
Data pre-processing is an approach in which these irregularities are detected, analyzed, and
processed by using certain behavioral predictions and modifications to alter the inapplicability
present in the record.

INTRODUCTION

Prediction of human movement behavior is important for studying issues such as prediction of
vehicle traffic and spread of contagious diseases, which requires tracing the movement of people.
In, a wireless sensor network technology is utilized to obtain high-resolution data of close
proximity interactions which cause the spread of most contagious diseases. However, this
method needs extra effort to distribute the senor network motes, and is constrained in a small
area.

The Cell-ID-based method determines the mobile users position based on the coverage of SAs.
An SA includes one or more cells. At most one-cell-sized accuracy (about 500 meters) can be
achieved when the SA includes only one cell. The observed time difference of arrival (OTDOA)
method utilizes trilateration to determine the mobile users position. At least three concurrent
downlink signals from different cells are measured by the mobile phone. The time differences
among the signal arrivals are calculated to form hyperbolic curves. The intersection of these
curves is then used to indicate the mobile users position.

A normal uplink signal from the mobile user is measured in different cells, and no extra signal is
required. Same calculation process as OTDOA is then conducted to find out the mobile users
position. Since the measurement and the calculation process are exercised only in the RAN, this
method does not require any modification to the mobile phone.

Human activity recognition (HAR) is an important component in various scientific research


contexts such as surveillance, healthcare and human computer interaction. Using a set of sensors
and intelligent detection algorithms, the main objective of HAR is to automatically detect and
analyze different activities performed by humans. In the last decade, HAR has gained increased
attention due to the arrival of minimally invasive mobile sensing platforms such as smart phones,
smart watches and fitness bracelets. HAR using smart phones has become the most common
approach to recognize physical activities, allowing easy collection of data which may be
analyzed with machine learning methods for an eventually activity classification. In fact,
considerable previous works using different feature extraction techniques and classification
algorithms showed that smart phones can address efficiently the problem of activity recognition.

EXISITING SYSTEM

However, additive models are not adapted to problems involving a large number (eg, hundreds)
of input variables because they are prone to over-adaptation, in addition to the loss of readability.
We present a framework for the application of additive models to a large number of input
variables. The basic idea is to reduce the task dimensionality by deriving a small number of new
co-variants obtained by linear combinations of inputs, estimating the linear weights in view of
the present regression problem. The weights are also limited to prevent overshooting and
facilitate the interpretation of the derived covariates. We determine the identifiability of the
model under mild assumptions and represent an approximate algorithm. Experiments on
synthetic and real data show that our approach is comparable in terms of accuracy compared to
baseline methods, resulting in models with lower complexity and practical insights In high-
dimensional real regression tasks.

DISADVANTAGES
Additive models are not designed for problems with a large number of input variables.
The structured dimen- sionality reduction is not a constraint; it is very difficult to trace
the influence of the input variables on the final response variable, since deletions can
occur systematically between the different derived covariates.

PROPOSED SYSTEM
A model for predicting how people spread from one place to another after a certain time. This
information is very useful to investigate questions such as the prediction of vehicle traffic and the
spread of contagious diseases. The standard statistics provided by commercial dimensionality
data are used as inputs to our prediction model. Experiments show that if the measured time slot
is less than the expected cell residence time and is not close to the expected call retention time, a
good accuracy of the prediction model can be expected. Dimensionality Reduction is usually
achieved on the feature space by accepting one of the prescribed methods that fall under the
chosen technique. Data pre-processing is an approach in which these irregularities are detected,
analyzed, and processed by using certain behavioral predictions and modifications to alter the
inapplicability present in the record. Our framework expands the applicability to high-
dimensional problems while maintaining their interpretability and their potential to provide
practical insights.

ADVANTAGES

The advantages of this method include the asymptotic efficiency of maximum likelihood
estimates under regularity conditions.
The technological advancements specifically the in data collection and the geographic
information systems area has enabled users to capture various aspects of the systems
ranging from the widespread physical to the high precision features.
We can take the advantage of reduced dimensionality to form better neighborhood of
customers.

FEASIBILITY STUDY
The feasibility of the project is analyzed in this phase and business proposal is put forth with
a very general plan for the project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out. This is to ensure that the
proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are

Economical Feasibility
Technical Feasibility
Social Feasibility

Economical Feasibility

This study is carried out to check the economic impact that the system will have on the
organization. The amount of fund that the company can pour into the research and development
of the system is limited. The expenditures must be justified. Thus the developed system as well
within the budget and this was achieved because most of the technologies used are freely
available. Only the customized products had to be purchased.

Technical Feasibility
This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on the available
technical resources. This will lead to high demands on the available technical resources. This
will lead to high demands being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this system.

Social Feasibility
The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not feel
threatened by the system, instead must accept it as a necessity. The level of acceptance by the
users solely depends on the methods that are employed to educate the user about the system and
to make him familiar with it. His level of confidence must be raised so that he is also able to
make some constructive criticism, which is welcomed, as he is the final user of the system.

SYSTEM SPECIFICATION

SOFTWARE REQUIREMENTS

Hard disk : 80 GB

RAM : 512MB or more

Processor Speed : 3.00GHz

Processor : Pentium IV Processor or more

HARDWARE REQUIREMENTS

Operating System : Win 2000 and above

Front-End : eclipse

Backend : SQL Server 2005

Implementation Concept : Socket in java

MODULES:
Human Movement:

Large samples of human movements. Our solution is the first work that can statistically answer
this question by effectively utilizing the statistics collected from millions of mobile users. As a
final remark, this work is pending US and Taiwan patents. The aforementioned techniques can
effectively monitor the behaviors of specific mobile users at the cost of modifications to telecom
network, which are not appropriate to generate behavior statistics for a large number of users that
are typically required to study problems such as pedestrian movement and contagious disease
spread.

Dimension Reduction

Dimension reduction is the process of reducing the random number of variables under
consideration. In recent years, the high dimensionality of modern massive datasets has provided
a considerable challenge to efficient algorithmic solutions design. Dimensionality reduction
techniques aims at finding the meaningful low dimensional data structures hidden in their high-
dimensional observations which allow the user to better analyze the complex data sets. Feature
extraction and feature selection are two popular methods for dimensionality reduction.

Dimension reduction techniques may be divided into two classes: linear methods [e.g. the
Principal Component Analysis (PCA), linear discriminant analysis (LDA)] and nonlinear
algorithms like Kernel PCA and Kernel LDA.

K-Nearest Neighbors (KNN)

KNN is very simple, highly efficient and effective algorithm for pattern recognition that
classifies new observation into the class, to which the majority of its k nearest neighbors at
training data set belong. In other words, k most similar training data observations to unclassified
observation are searched. KNN involves large storage requirement and intensive computation,
and the value of k also needs to be determined properly.

Location Coverage:
The granularity of location coverage the movement of a mobile user is described as follows: The
user stays at one cell for a period of time, and then moves to the next cell. If we sum up the
residence times of the cells he/ she visited, then we know exactly which cell the user visited after
a specific elapsed time.

Spread Prediction:

A mobile telecom SA covered by several BSs. In this figure, a cell of a BS is represented by a


circle. A mobile user is represented by a vehicle moving around the cells. If a user in
conversation moves from one cell to another, then the call connection must be switched from the
old cell to the new cell. a call arrives at a user or when he/she performs a handover, the activity is
recorded at the MSC/SGSN.

System Design
The standard statistics provided by a commercial mobile telecom network are used
as inputs of our prediction model. Experiments indicate that if the measured time
slot is smaller than the expected cell residence time, and is not close to the
expected call holding time, then good accuracy of the prediction model can be
expected. In this architecture the users are connected with the server for collecting
the data. Users can connect with the IP address from the server port. The mobile
movement collecting the moving user data based on the server. The result mainly
used for collecting user information.

Source

Connect IP Address

Mobile Movement

Mobile Hand Off

Server Information
USE CASE DIAGRAM

ENTER THE IP ADDRESS

Telecoms Handoff

SOURCE DESTINATION
Movement Based

Mobile Networks

Mobile information to server

DATA FLOW DIAGRAM:


SEQUENCE DIAGRAM:

MOBILE MOBILE SERVER DESTINATION


SOURCE CONNECT IP INFORMATION
ADDRESS MOVEMENT HANDOFF

ENTER IP ADDRESS

MOBILE LOCATION VISIBLE

HANDOFF LOGIC ON MOBILE

MOBILE MANAGEMENT INFORMATIONS

RECIVED MOBILE INFORMATION TO SERVER

COLLABORATION DIAGRAM:

SOURC
E
MOBILE
1: ENTER IP ADDRESS MOVEMENT
2: MOBILE LOCATION VISIBLE

CONNECT IP
ADDRESS
DESTINA
TION
3: HANDOFF LOGIC ON MOBILE

5: RECIVED MOBILE INFORMATION TO SERVER

MOBILE 4: MOBILE MANAGEMENT INFORMATIONS


HANDOFF
SERVER
INFORMATION
SOFTWARE ENVIRONMENT

ABOUT JAVA

Java is a programming language originally developed by Sun Microsystems and


released in 1995 as a core component of Sun Microsystems' Java platform. The
language derives much of its syntax from C and C++ but has a simpler object
model and fewer low-level facilities. Java applications are typically compiled to
bytecode that can run on any Java virtual machine (JVM) regardless of computer
architecture.

One characteristic of Java is portability, which means that computer programs


written in the Java language must run similarly on any supported
hardware/operating-system platform. One should be able to write a program once,
compile it once, and run it anywhere.

This is achieved by compiling the Java language code, not to machine code but to
Java bytecode instructions analogous to machine code but intended to be
interpreted by a virtual machine (VM) written specifically for the host hardware.
End-users commonly use a JRE installed on their own machine, or in a Web
browser.

Standardized libraries provide a generic way to access host specific features such
as graphics, threading and networking. In some JVM versions, bytecode can be
compiled to native code, either before or during program execution, resulting in
faster execution.
A major benefit of using bytecode is porting. However, the overhead of
interpretation means that interpreted programs almost always run more slowly than
programs compiled to native executables would, and Java suffered a reputation for
poor performance. This gap has been narrowed by a number of optimization
techniques introduced in the more recent JVM implementations.

One such technique, known as (just-in-time compilation) JIT, translates Java


bytecode into native code the first time that code is executed, then caches it. This
result in a program that starts and executes faster than pure interpreted code can, at
the cost of introducing occasional compilation overhead during execution. More
sophisticated VMs also use dynamic recompilation, in which the VM analyzes the
behavior of the running program and selectively recompiles and optimizes parts of
the program. Dynamic recompilation can achieve optimizations superior to static
compilation because the dynamic compiler can base optimizations on knowledge
about the runtime environment and the set of loaded classes, and can identify hot
spots - parts of the program, often inner loops, that take up the most execution
time. JIT compilation and dynamic recompilation allow Java programs to approach
the speed of native code without losing portability.

Another technique, commonly known as static compilation, or ahead-of-time


(AOT) compilation, is to compile directly into native code like a more traditional
compiler. Static Java compilers translate the Java source or bytecode to native
object code. This achieves good performance compared to interpretation, at the
expense of portability; the output of these compilers can only be run on a single
architecture. AOT could give Java something like performance, yet it is still not
portable since there are no compiler directives, and all the pointers are indirect
with no way to micro manage garbage collection.
Java's performance has improved substantially since the early versions, and
performance of JIT compilers relative to native compilers has in some tests been
shown to be quite similar. The performance of the compilers does not necessarily
indicate the performance of the compiled code; only careful testing can reveal the
true performance issues in any system.

One of the unique advantages of the concept of a runtime engine is that errors
(exceptions) should not 'crash' the system. Moreover, in runtime engine
environments such as Java there exist tools that attach to the runtime engine and
every time that an exception of interest occurs they record debugging information
that existed in memory at the time the exception was thrown (stack and heap
values). These Automated Exception Handling tools provide 'root-cause'
information for exceptions in Java programs that run in production, testing or
development environments.

SWINGS:

Swing is a platform-independent, Model-View-Controller GUI framework for


Java. It follows a single-threaded programming model, and possesses the following
traits:

PLATFORM INDEPENDENCE:

Swing is platform independent both in terms of its expression (Java) and its
implementation (non-native universal rendering of widgets).
EXTENSIBILITY:

Swing is a highly partitioned architecture, which allows for the "plugging" of


various custom implementations of specified framework interfaces: Users can
provide their own custom implementation(s) of these components to override the
default implementations. In general, Swing users can extend the framework by
extending existing (framework) classes and/or providing alternative
implementations of core components.

COMPONENT-ORIENTED :

Swing is a component-based framework. The distinction between objects and


components is a fairly subtle point: concisely, a component is a well-behaved
object with a known/specified characteristic pattern of behaviour. Swing objects
asynchronously fire events, have "bound" properties, and respond to a well-known
set of commands (specific to the component.) Specifically, Swing components are
Java Beans components, compliant with the Java Beans Component Architecture
specifications.

CUSTOMIZABLE:

Given the programmatic rendering model of the Swing framework, fine control
over the details of rendering of a component is possible in Swing. As a general
pattern, the visual representation of a Swing component is a composition of a
standard set of elements, such as a "border", "inset", decorations, etc. Typically,
users will programmatically customize a standard Swing component (such as a
JTable) by assigning specific Borders, Colors, Backgrounds, opacities, etc., as the
properties of that component. The core component will then use these property
(settings) to determine the appropriate renderers to use in painting its various
aspects. However, it is also completely possible to create unique GUI controls with
highly customized visual representation.

CONFIGURABLE:

Swing's heavy reliance on runtime mechanisms and indirect composition patterns


allows it to respond at runtime to fundamental changes in its settings. For example,
a Swing-based application can change its look and feel at runtime. Further, users
can provide their own look and feel implementation, which allows for uniform
changes in the look and feel of existing Swing applications without any
programmatic change to the application code.

LIGHTWEIGHT UI :

Swing's configurability is a result of a choice not to use the native host OS's GUI
controls for displaying itself. Swing "paints" its controls programmatically through
the use of Java 2D APIs, rather than calling into a native user interface toolkit.
Thus, a Swing component does not have a corresponding native OS GUI
component, and is free to render itself in any way that is possible with the
underlying graphics APIs.

However, at its core every Swing component relies on an AWT container, since
(Swing's) JComponent extends (AWT's) Container. This allows Swing to plug into
the host OS's GUI management framework, including the crucial device/screen
mappings and user interactions, such as key presses or mouse movements. Swing
simply "transposes" its own (OS agnostic) semantics over the underlying (OS
specific) components. So, for example, every Swing component paints its rendition
on the graphic device in response to a call to component.paint(), which is defined
in (AWT) Container. But unlike AWT components, which delegated the painting to
their OS-native "heavyweight" widget, Swing components are responsible for their
own rendering.

This transposition and decoupling is not merely visual, and extends to Swing's
management and application of its own OS-independent semantics for events fired
within its component containment hierarchies. Generally speaking, the Swing
Architecture delegates the task of mapping the various flavors of OS GUI
semantics onto a simple, but generalized, pattern to the AWT container. Building
on that generalized platform, it establishes its own rich and complex GUI
semantics in the form of the JComponent model. A review of the source of
Container. java and JComponent.java classes is recommended for further insights
into the nature of the interface between Swing's lightweight components and
AWT's heavyweight widgets.

LOOSELY-COUPLED/MVC:

The Swing library makes heavy use of the Model/View/Controller software design
pattern, which conceptually decouples the data being viewed from the user
interface controls through which it is viewed. Because of this, most Swing
components have associated models (which are specified in terms of Java
interfaces), and the programmer can use various default implementations or
provide their own. The framework provides default implementations of model
interfaces for all of its concrete components.

Typically, Swing component model objects are responsible for providing a concise
interface defining events fired, and accessible properties for the (conceptual) data
model for use by the associated JComponent. Given that the overall MVC pattern
is a loosely-coupled collaborative object relationship pattern, the model provides
the programmatic means for attaching event listeners to the data model object.
Typically, these events are model centric (ex: a "row inserted" event in a table
model) and are mapped by the JComponent specialization into a meaningful event
for the GUI component.

For example, the JTable has a model called TableModel that describes an
interface for how a table would access tabular data. A default implementation of
this operates on a two-dimensional array.

The view component of a Swing JComponent is the object used to graphically


"represent" the conceptual GUI control. A distinction of Swing, as a GUI
framework, is in its reliance on programmatically-rendered GUI controls (as
opposed to the use of the native host OS's GUI controls). This distinction is a
source of complications when mixing AWT controls, which use native controls,
with Swing controls in a GUI.

Finally, in terms of visual composition and management, Swing favors relative


layouts (which specify the positional relationships between components) as
opposed to absolute layouts (which specify the exact location and size of
components). This bias towards "fluid"' visual ordering is due to its origins in the
applet operating environment that framed the design and development of the
original Java GUI toolkit. (Conceptually, this view of the layout management is
quite similar to that which informs the rendering of HTML content in browsers,
and addresses the same set of concerns that motivated the former.)

LOOK AND FEEL:


Swing allows one to specialize the look and feel of widgets, by modifying the
default (via runtime parameters), deriving from an existing one, by creating one
from scratch, or, beginning with J2SE 5.0, by using the skinnable synth Look and
Feel (see Synth Look and Feel), which is configured with an XML property
file. The look and feel can be changed at runtime, and early demonstrations of
Swing frequently provided a way to do this.

RELATIONSHIP TO AWT:
Since early versions of Java, a portion of the Abstract Window Toolkit (AWT) has
provided platform-independent APIs for user interface components. In AWT, each
component is rendered and controlled by a native peer component specific to the
underlying windowing system.

By contrast, Swing components are often described as lightweight because they do


not require allocation of native resources in the operating system's windowing
toolkit. The AWT components are referred to as heavyweight components.

Much of the Swing API is generally a complementary extension of the AWT rather
than a direct replacement. In fact, every Swing lightweight interface ultimately
exists within an AWT heavyweight component because all of the top-level
components in Swing (JApplet, JDialog, JFrame, and JWindow) extend an
AWT top-level container. However, the use of both lightweight and heavyweight
components within the same window is generally discouraged due to Z-order
incompatibilities.

The core rendering functionality used by Swing to draw its lightweight


components is provided by Java 2D, another part of JFC.

NETWORKING BASICS:
Ken Thompson and Dennis Ritchie developed UNIX in concert with the C
language at Bell Telephone Laboratories, Murray Hill, New Jersey, in 1969. In
1978, Bill Joy was leading a project at Cal Berkeley to add many new features to
UNIX, such as virtual memory and full-screen display capabilities. By early 1984,
just as Bill was leaving to found Sun Microsystems, he shipped 4.2BSD,
commonly known as Berkeley UNIX.4.2BSD came with a fast file system, reliable
signals, interprocess communication, and, most important, networking. The
networking support first found in 4.2 eventually became the de facto standard for
the Internet. Berkeleys implementation of TCP/IP remains the primary standard
for communications with the Internet. The socket paradigm for inter process and
network communication has also been widely adopted outside of Berkeley.

SOCKET OVERVIEW:

A network socket is a lot like an electrical socket. Various plugs


around the network have a standard way of delivering their payload. Anything that
understands the standard protocol can plug in to the socket and communicate.

Internet protocol (IP) is a low-level routing protocol that breaks data


into small packets and sends them to an address across a network, which does not
guarantee to deliver said packets to the destination.

Transmission Control Protocol (TCP) is a higher-level protocol that


manages to reliably transmit data. A third protocol, User Datagram Protocol
(UDP), sits next to TCP and can be used directly to support fast, connectionless,
unreliable transport of packets.

CLIENT/SERVER
A server is anything that has some resource that can be shared. There
are compute servers, which provide computing power; print servers, which
manage a collection of printers; disk servers, which provide networked disk space;
and web servers, which store web pages. A client is simply any other entity that
wants to gain access to a particular server.

In Berkeley sockets, the notion of a socket allows as single computer


to serve many different clients at once, as well as serving many different types of
information. This feat is managed by the introduction of a port, which is a
numbered socket on a particular machine. A server process is said to listen to a
port until a client connects to it. A server is allowed to accept multiple clients
connected to the same port number, although each session is unique. To mange
multiple client connections, a server process must be multithreaded or have some
other means of multiplexing the simultaneous I/O.

RESERVED SOCKETS:

Once connected, a higher-level protocol ensues, which is dependent


on which port you are using. TCP/IP reserves the lower, 1,024 ports for specific
protocols. Port number 21 is for FTP, 23 is for Telnet, 25 is for e-mail, 79 is for
finger, 80 is for HTTP, 119 is for Netnews-and the list goes on. It is up to each
protocol to determine how a client should interact with the port.

JAVA AND THE NET:

Java supports TCP/IP both by extending the already established stream I/O
interface. Java supports both the TCP and UDP protocol families. TCP is used for
reliable stream-based I/O across the network. UDP supports a simpler, hence faster,
point-to-point datagram-oriented model.
INETADDRESS:

The InetAddress class is used to encapsulate both the numerical IP


address and the domain name for that address. We interact with this class by using
the name of an IP host, which is more convenient and understandable than its IP
address. The InetAddress class hides the number inside. As of Java 2, version 1.4,
InetAddress can handle both IPv4 and IPv6 addresses.

FACTORY METHODS:

The InetAddress class has no visible constructors. To create an


InetAddress object, we use one of the available factory methods. Factory methods
are merely a convention whereby static methods in a class return an instance of
that class. This is done in lieu of overloading a constructor with various parameter
lists when having unique method names makes the results much clearer.

Three commonly used InetAddress factory methods are shown here.

static InetAddress getLocalHost( ) throws UnknownHostException

static InetAddress getByName(String hostName) throws


UnknowsHostException

static InetAddress[ ] getAllByName(String hostName)

throws UnknownHostException

The getLocalHost( ) method simply returns the InetAddress object


that represents the local host. The getByName( ) method returns an InetAddress for
a host name passed to it. If these methods are unable to resolve the host name, they
throw an UnknownHostException.
On the internet, it is common for a single name to be used to represent
several machines. In the world of web servers, this is one way to provide some
degree of scaling. The getAllByName ( ) factory method returns an array of
InetAddresses that represent all of the addresses that a particular name resolves to.
It will also throw an UnknownHostException if it cant resolve the name to at least
one address. Java 2, version 1.4 also includes the factory method getByAddress( ),
which takes an IP address and returns an InetAddress object. Either an IPv4 or an
IPv6 address can be used.

INSTANCE METHODS:

The InetAddress class also has several other methods, which can be
used on the objects returned by the methods just discussed. Here are some of the
most commonly used.

Boolean equals (Object other)- Returns true if this object has the
same Internet address as other.

byte[ ] getAddress( )- Returns a byte array that represents the objects


Internet address in network byte order.

String getHostAddress( )- Returns a string that represents the host address


associated with the InetAddress object.

String getHostName( )- Returns a string that represents the host name


associated with the InetAddress object.

boolean isMulticastAddress( )- Returns true if this Internet address is


a multicast address. Otherwise, it returns false.
String toString( )- Returns a string that lists the host name and the IP
address for conveneince.

Internet addresses are looked up in a series of hierarchically cached servers.


That means that your local computer might know a particular name-to-IP-address
mapping autocratically, such as for itself and nearby servers. For other names, it
may ask a local DNS server for IP address information. If that server doesnt have
a particular address, it can go to a remote site and ask for it. This can continue all
the way up to the root server, called InterNIC (internic.net).

TCP/IP CLIENT SOCKETS:

TCP/IP sockets are used to implement reliable, bidirectional, persistent,


point-to-point, stream-based connections between hosts on the Internet. A socket
can be used to connect Javas I/O system to other programs that may reside either
on the local machine or on any other machine on the Internet.

There are two kinds of TCP sockets in Java. One is for servers, and the other
is for clients. The ServerSocket class is designed to be a listener, which waits for
clients to connect before doing anything. The Socket class is designed to connect to
server sockets and initiate protocol exchanges.

The creation of a Socket object implicitly establishes a connection


between the client and server. There are no methods or constructors that explicitly
expose the details of establishing that connection. Here are two constructors used
to create client sockets:

Socket(String hostName, int port) Creates a socket connecting the


local host to the named host and port; can throw an UnknownHostException or
anIOException.
Socket(InetAddress ipAddress, int port) Creates a socket using a
preexisting InetAddress object and a port; can throw an IOException.

A socket can be examined at any time for the address and port
information associated with it, by use of the following methods:

InetAddress getInetAddress( )- Returns the InetAddress associated


with the Socket object.

int getPort( )Returns the remote port to which this Socket object is
connected.

int getLocalPort( ) Returns the local port to which this Socket object is
connected.

Once the Socket object has been created, it can also be examined to
gain access to the input and output streams associated with it. Each of these
methods can throw an IOException if the sockets have been invalidated by a loss
of connection on the Net.

InputStream getInputStream( )Returns the InputStream associated with the


invoking socket.

OutputStream getOutputStream( ) Returns the OutputStream associated with


the invoking socket.

TCP/IP SERVER SOCKETS:


Java has a different socket class that must be used for creating server
applications. The ServerSocket class is used to create servers that listen for either
local or remote client programs to connect to them on published ports.
ServerSockets are quite different form normal Sockets.

When we create a ServerSocket, it will register itself with the system as


having an interest in client connections. The constructors for ServerSocket reflect
the port number that we wish to accept connection on and, optionally, how long we
want the queue for said port to be. The queue length tells the system how many
client connection it can leave pending before it should simply refuse connections.
The default is 50. The constructors might throw an IOException under adverse
conditions. Here are the constructors:

ServerSocket(int port) Creates server socket on the specified port with a queue
length of 50.

Serversocket(int port, int maxQueue)-Creates a server socket on the


specified port with a maximum queue length of maxQueue.

ServerSocket(int port, int maxQueue, InetAddress localAddress)-Creates a


server socket on the specified port with a maximum queue length of maxQueue.
On a multihomed host, localAddress specifies the IP address to which this socket
binds.

ServerSocket has a method called accept( ), which is a blocking call that will
wait for a client to initiate communications, and then return with a normal Socket
that is then used for communication with the client.

SYSTEM TESTING
The purpose of testing is to discover errors. Testing is the process of trying
to discover every conceivable fault or weakness in a work product. It provides a
way to check the functionality of components, sub assemblies, assemblies and/or a
finished product It is the process of exercising software with the intent of ensuring
that the Software system meets its requirements and user expectations and does not
fail in an unacceptable manner. There are various types of test. Each test type
addresses a specific testing requirement.

TYPES OF TESTS
Unit Testing
Unit testing involves the design of test cases that validate that the internal
program logic is functioning properly, and that program inputs produce valid
outputs. All decision branches and internal code flow should be validated. It is the
testing of individual software units of the application .it is done after the
completion of an individual unit before integration. This is a structural testing, that
relies on knowledge of its construction and is invasive. Unit tests perform basic
tests at component level and test a specific business process, application, and/or
system configuration. Unit tests ensure that each unique path of a business process
performs accurately to the documented specifications and contains clearly defined
inputs and expected results.

Integration Testing
Integration tests are designed to test integrated software components to
determine if they actually run as one program. Testing is event driven and is more
concerned with the basic outcome of screens or fields. Integration tests
demonstrate that although the components were individually satisfaction, as shown
by successfully unit testing, the combination of components is correct and
consistent. Integration testing is specifically aimed at exposing the problems that
arise from the combination of components

Functional Testing
Functional tests provide systematic demonstrations that functions tested are
available as specified by the business and technical requirements, system
documentation, and user manuals.

Functional testing is centered on the following items

Valid Input - identified classes of valid input must be accepted


Invalid Input - identified classes of invalid input must be
rejected
Functions - identified functions must be exercised
Output - identified classes of apps outputs must be
rejected

Organization and preparation of functional tests is focused on requirements,


key functions, or special test cases. In addition, systematic coverage pertaining to
identify Business process flows; data fields, predefined processes, and successive
processes must be considered for testing. Before functional testing is complete,
additional tests are identified and the effective value of current tests is determined.

System Testing
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An
example of system testing is the configuration oriented system integration test.
System testing is based on process descriptions and flows, emphasizing pre-driven
process links and integration points.
White Box Testing
White Box Testing is a testing in which in which the software tester has
knowledge of the inner workings, structure and language of the software, or at least
its purpose. It is purpose. It is used to test areas that cannot be reached from a black
box level.

Black Box Testing


Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as
most other kinds of tests, must be written from a definitive source document, such
as specification or requirements document, such as specification or requirements
document. It is a testing in which the software under test is treated, as a black
box .you cannot see into it. The test provides inputs and responds to outputs
without considering how the software works.

DATABASE DESIGN

Database design is the process of producing a detailed data model of a database. This
logical data model contains all the needed logical and physical design choices and physical
storage parameters needed to generate a design in a data definition language, which can then be
used to create a database. A fully attributed data model contains detailed attributes for each
entity. The term database design can be used to describe many different parts of the design of an
overall database system.

However, the term database design could also be used to apply to the overall process of
designing, not just the base data structures, but also the forms and queries used to part of the
overall database application within the database management system(DBMS).
The process of doing database design generally consists of a number of steps which will
be carried out by the database designer. Usually , the designer most:

Determine the relationships between the different data elements.


Superimpose a logical structure upon the data on the basis of these relationships.

Design Process

Determine the purpose of the database This helps prepare for the remaining steps.

Find and organize the information required Gather all of the types of information to record
in the databases, such as product name and order number.

Divide the information into tables Divide information items into major entities or subjects,
such as Products or Orders. Each subject then becomes a table.

Turn information items into columns Decide what information needs to be stored in each
table. Each item becomes a field, and is displayed as a column in the table.

Specify Primary keys Choose each tables primary key.

Setup the table relationships Look at each table and decide how the data in one table is
related to the data in other tables.

Refine the design Analyze the design for errors. Create table and add a few records of sample
data. Check if results come from the tables as expected.

INPUT DESIGN
The input design is the link between the information system and the user. It comprises the
developing specification and procedures for data preparation and those steps are necessary to put
transaction data in to a usable form for processing can be achieved by inspecting the computer to
read data from a written or printed document or it can occur by having people keying the data
directly into the system. The design of input focuses on controlling the amount of input required,
controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The
input is designed in such a way so that it provides security and ease of use with retaining the
privacy. Input Design considered the following things:

What data should be given as input?


How the data should be arranged or coded?
The dialog to guide the operating personnel in providing input.
Methods for preparing input validations and steps to follow when error occur.

OBJECTIVES

1. Input Design is the process of converting a user-oriented description of the input into a
computer-based system. This design is important to avoid errors in the data input process and
show the correct direction to the management for getting correct information from the
computerized system.

2. It is achieved by creating user-friendly screens for the data entry to handle large volume of
data. The goal of designing input is to make data entry easier and to be free from errors. The data
entry screen is designed in such a way that all the data manipulates can be performed. It also
provides record viewing facilities.

3. When the data is entered it will check for its validity. Data can be entered with the help of
screens. Appropriate messages are provided as when needed so that the user

will not be in maize of instant. Thus the objective of input design is to create an input layout that
is easy to follow

OUTPUT DESIGN
A quality output is one, which meets the requirements of the end user and presents the
information clearly. In any system results of processing are communicated to the users and to
other system through outputs. In output design it is determined how the information is to be
displaced for immediate need and also the hard copy output. It is the most important and direct
source information to the user. Efficient and intelligent output design improves the systems
relationship to help user decision-making.

1. Designing computer output should proceed in an organized, well thought out manner; the right
output must be developed while ensuring that each output element is designed so that people will
find the system can use easily and effectively. When analysis design computer output, they
should Identify the specific output that is needed to meet the requirements.

2.Select methods for presenting information.

3.Create document, report, or other formats that contain information produced by the system.

The output form of an information system should accomplish one or more of the following
objectives.

Convey information about past activities, current status or projections of the


Future.
Signal important events, opportunities, problems, or warnings.
Trigger an action.
Confirm an action.

IMPLEMENTATION
It making the new system available to a prepared set of users (the
deployment), and positioning on-going support and maintenance of the system
within the Performing Organization (the transition). At a finer level of detail,
deploying the system consists of executing all steps necessary to educate the
Consumers on the use of the new system, placing the newly developed system into
production, confirming that all data required at the start of operations is available
and accurate, and validating that business functions that interact with the system
are functioning properly. Transitioning the system support responsibilities involves
changing from a system development to a system support and maintenance mode
of operation, with ownership of the new system moving from the Project Team to
the Performing Organization.

System implementation is the important stage of project when the theoretical


design is tuned into practical system. The main stages in the implementation are as
follows

Planning
Training
System testing and
Changeover Planning
Planning is the first task in the system implementation. Planning means
deciding on the method and the time scale to be adopted. At the time of
implementation of any system people from different departments and system
analysis involve. They are confirmed to practical problem of controlling various
activities of people outside their own data processing departments. The line
managers controlled through an implementation coordinating committee. The
committee considers ideas, problems and complaints of user department, it must
also consider;

The implication of system environment


Self selection and allocation form implementation tasks
Consultation with unions and resources available
Standby facilities and channels of communication
The following roles are involved in carrying out the processes of this phase.
Detailed descriptions of these roles can be found in the Introductions to Sections I
and III.

Project Manager
Project Sponsor
Business Analyst
Data/Process Modeler
Technical Lead/Architect
Application Developers
Software Quality Assurance (SQA) Lead
Technical Services (HW/SW, LAN/WAN, TelCom)
Information Security Officer (ISO)
Technical Support (Help Desk, Documentation, Trainers)
Customer Decision-Maker

The purpose of Prepare for System Implementation is to take all possible


steps to ensure that the upcoming system deployment and transition occurs
smoothly, efficiently, and flawlessly. In the implementation of any new system, it is
necessary to ensure that the Consumer community is best positioned to utilize the
system once deployment efforts have been validated. Therefore, all necessary
training activities must be scheduled and coordinated. As this training is often the
first exposure to the system for many individuals, it should be conducted as
professionally and competently as possible. A positive training experience is a
great first step towards Customer acceptance of the system.
During System Implementation it is essential that everyone involved be
absolutely synchronized with the deployment plan and with each other. Often the
performance of deployment efforts impacts many of the Performing Organizations
normal business operations. Examples of these impacts include:

Consumers may experience a period of time in which the systems that they
depend on to perform their jobs are temporarily unavailable to them. They may be
asked to maintain detailed manual records or logs of business functions that they
perform to be entered into the new system once it is operational.

Technical Services personnel may be required to assume significant


implementation responsibilities while at the same time having to continue current
levels of service on other critical business systems.Technical Support personnel
may experience unusually high volumes of support requests due to the possible
disruption of day-to-day processing.

Because of these and other impacts, the communication of planned


deployment activities to all parties involved in the project is critical. A smooth
deployment requires strong leadership, planning, and communications. By this
point in the project lifecycle, the team will have spent countless hours devising and
refining the steps to be followed.

During this preparation process the Project Manager must verify that all
conditions that must be met prior to initiating deployment activities have been met,
and that the final green light is on for the team to proceed. The final process
within the System Development Lifecycle is to transition ownership of the system
support responsibilities tothe Performing Organization. In order for there to be an
efficient and effective transition, the Project Manager should make sure that all
involved parties are aware of the transition plan, the timing of the various
transition activities, and their role in its execution.

Due to the number of project participants in this phase of the SDLC, many
of the necessary conditions and activities may be beyond the direct control of the
Project Manager.

Consequently, all Project Team members with roles in the implementation


efforts must understand the plan, acknowledge their responsibilities, recognize the
extent to which other implementation efforts are dependent upon them, and
confirm their commitment.

CONCLUSION

This work reports an efficient dimensionality reduction approach for the class prediction related
to the human activity recognition data composed by several active ties, such as lying down,
walking, sitting, and standing, ascending and descending stairs. Dimensionality Reduction is
usually achieved on the feature space by accepting one of the prescribed methods that fall under
the chosen technique. Data pre-processing is an approach in which these irregularities are
detected, analyzed, and processed by using certain behavioral predictions and modifications to
alter the inapplicability present in the record. Our framework expands the applicability to high-
dimensional problems while maintaining their interpretability and their potential to provide
practical insights.
REFERENCES:

[1] M. Salathe, M. Kazandjieva, J.W. Lee, P. Levis, M.W. Feldman,

and J.H. Jones, A High-Resolution Human Contact Network for

Infectious Disease Transmission, Proc. Natl Academy of Science of

the United States of Am., vol. 107, no. 51, pp. 22020-22025, 2010.

[2] W. Ma, Y. Fang, and P. Lin, Mobility Management Strategy

Based on User Mobility Patterns in Wireless Networks, IEEE

Trans. Vehicular Technology, vol. 56, no. 1, pp. 322-330, Jan. 2007.

[3] Third Generation Partnership Project, Technical Specification Group

Radio Access Network; Stage 2 Functional Specification of User

Equipment (UE) Positioning in UTRAN, Technical Specification

3G TS 25.305 v. 7.3.0 (2006-06), 2006.

[4] M.-H. Tsai, Y.-B. Lin, and H.-H. Wang, Active Location

Reporting for Emergency Call in UMTS IP Multimedia Subsystem,

IEEE Trans. Wireless Comm., vol. 8, no. 12, pp. 5837-5842,

Dec. 2009.

[5] M.C. Gonzalez, C.A. Hidalgo, and A.L. Barabasi, Understanding

Individual Human Mobility Patterns, Nature, vol. 453, pp. 779-

782, 2008.

[6] Y.-B. Lin and A.-C. Pang, Wireless and Mobile All-IP Networks. John
Wiley and Sons, 2005.

[7] E.D. Lazowska, J. Zahorjan, G.S. Graham, and K.C. Sevcik,

Quantitative System Performance Computer System Analysis Using

Queueing Network Models. Prentice-Hall, 1984.

[8] Y.-C. Lai, P. Lin, and S.-M. Cheng, Performance Modeling for

Application-Level Integration of Heterogeneous Wireless Networks,

IEEE Trans. Vehicular Technology, vol. 58, no. 5, pp. 2426-

2434, June 2009.

[9] N. Caceres, J.P. Wideberg, and F.G. Benitez, Review of Traffic

Data Estimations Extracted from Cellular Networks, IET Intelligent

Transport Systems, vol. 2, no. 3, pp. 179-192, 2008.

[10] D. Gundlegard and J.M. Karlsson, Handover Location Accuracy

for Travel Time Estimation in GSM and UMTS, IET Intelligent

Transport Systems, vol. 3, no. 1, pp. 87-94, 2009.

Screen shot
SAMPLE SOURCE CODE

Server.java
import java.awt.Color;

import java.awt.Component;

import java.awt.Container;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import java.io.BufferedInputStream;

import java.io.BufferedOutputStream;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.ServerSocket;
import java.net.Socket;

import java.net.UnknownHostException;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.Vector;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextArea;

import javax.swing.JTextField;

import javax.swing.SwingUtilities;

import javax.swing.event.TableModelEvent;

import javax.swing.event.TableModelListener;

import javax.swing.table.DefaultTableCellRenderer;

import javax.swing.table.TableColumn;

public class Server implements ActionListener


{

private static final long serialVersionUID = 1L;

private static final int BLINKING_RATE = 1000; // in ms

private boolean blinkingOn = true;

public JFrame jf;

public static Container c;

public JLabel bf= new JLabel();

public JLabel IMAGE= new JLabel();

public JLabel IMAGE1= new JLabel();

public JLabel IMAGE2= new JLabel();

public JLabel IMAGE3= new JLabel();

protected static InteractiveTableModel tableModel;

public JLabel usr1disable = new JLabel("User1 Disconnected");

public JLabel usr2disable = new JLabel("User2 Disconnected");

public JLabel usr1enable = new JLabel("");

public JLabel usr2enable = new JLabel("");

public JLabel usrimg1= new JLabel();

public JLabel usrimg2= new JLabel();

public JLabel usrimgf1= new JLabel();


public JLabel usrimgf2= new JLabel();

public JLabel testclientip1 = new JLabel("ENTER IP ADDRESS:");

public JLabel testclientipA = new JLabel("ENTER IP USER 1:");

public JLabel testclientipB = new JLabel("ENTER IP USER 2:");

public JLabel warninglbl = new JLabel("Warning! User left from the safe region!");

public JButton ipconnect = new JButton("");

public JPanel jp = new JPanel();

public JPanel jp1 = new JPanel();

public JTextField textip = new JTextField("127.0.0.1");

public JTextField textip1 = new JTextField("127.0.0.1");

public JTextField textip2 = new JTextField("127.0.0.1");

public JTextField textfld=new JTextField("");

JScrollPane pane;

String data1[][] = {};

Vector v=new Vector();

static JTable table;// = new JTable(model);int g=1;String comsendfile;

String len,conn="";

String t1str;

String
event1="null",event2="null",event3="null",event4="null",event5="null",event6="null",event7="
null",event8="null",event9="null";

public int length;

BufferedOutputStream bos = null;


public int min;

private Connection con;

public Font fo= new Font("Rockwell" , Font.BOLD , 16);

public static final String[] columnNames = {

"Id", "X", "Y", "Name","Category","Cat-id","Road","Place","City",""

};

private static JScrollPane scroller;

@SuppressWarnings("unchecked")

Server()

jf = new JFrame("server");

c = jf.getContentPane();

c.setLayout(null);

jf.setSize(815, 730);

bf.setIcon(new javax.swing.ImageIcon("server.png"));

bf.setBounds(0, 0, 799, 699);

jf.setResizable(false);

IMAGE2.setBounds(650,200,128,128);

IMAGE2.setIcon(new javax.swing.ImageIcon("satellite-icon128.png"));

IMAGE3.setBounds(450,400,256,256);

IMAGE3.setIcon(new javax.swing.ImageIcon("Server Asia.png"));

usrimg1.setBounds(50,240,30 ,30);
usrimg1.setIcon(new javax.swing.ImageIcon("green.png"));

usrimg2.setBounds(50,280,30,30);

usrimg2.setIcon(new javax.swing.ImageIcon("green.png"));

usrimgf1.setBounds(50,240,30,30);

usrimgf1.setIcon(new javax.swing.ImageIcon("grey.png"));

usrimgf2.setBounds(50,280,30,30);

usrimgf2.setIcon(new javax.swing.ImageIcon("grey.png"));

usr1disable.setBounds(70,400,160,30);

usr2disable.setBounds(260,400,160,30);

usr1enable.setBounds(90,240,230,30);

usr2enable.setBounds(90,280,230,30);

warninglbl.setBounds(350, 240, 250, 30);

textfld.setBounds(90,240,230,30);

jp.setBounds(30,30,750,645);

jp.setBackground(Color.darkGray);

jp1.setBounds(30,200,750,450);

jp1.setBackground(Color.GREEN);

testclientip1.setBounds(100,250,200,30);

testclientipA.setBounds(100,300,150,30);

testclientipB.setBounds(100,350,150,30);
textip.setBounds(300,250,100,30);

textip1.setBounds(300,300,100,30);

textip2.setBounds(300,350,100,30);

ipconnect.setBounds(200,500,120,30);

ipconnect.setIcon(new javax.swing.ImageIcon("connectblue.png"));

testclientip1.setForeground(Color.ORANGE);

testclientipA.setForeground(Color.ORANGE);

testclientipB.setForeground(Color.ORANGE);

testclientip1.setFont(fo);

testclientipA.setFont(fo);

testclientipB.setFont(fo);

usr1disable.setForeground(Color.RED);

usr2disable.setForeground(Color.RED);

usr1enable.setForeground(Color.green);

usr2enable.setForeground(Color.green);

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:MB","sa","test");

// Class.forName("com.mysql.jdbc.Driver");

// con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mb","root","");

ResultSet rs = (con.createStatement()).executeQuery("Truncate table


locationtemp");
if(rs!= null){

System.out.println("deleted ");

} catch (ClassNotFoundException e) {

// TODO Auto-generated catch blockif

e.printStackTrace();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

initTable();

//Table coding

// JTableHeader header = table.getTableHeader();

// header.setFont(fs3);

// header.setForeground(new Color(120,0,0));

// pane = new JScrollPane(table);

table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

table.setShowGrid(true);

table.setEnabled(true);

table.setForeground(Color.BLUE);

// table.setFont(fs3);

scroller.setBounds(48,400,700,200);
jf.setUndecorated(false);

table.setAutoResizeMode(1);

scroller.setVisible(false);

jp.setVisible(false);

IMAGE.setVisible(false);

IMAGE1.setVisible(false);

IMAGE2.setVisible(true);

IMAGE3.setVisible(true);

usrimg1.setVisible(false);

usrimg2.setVisible(false);

usrimgf1.setVisible(false);

usrimgf2.setVisible(false);

usr1enable.setVisible(true);

usr2enable.setVisible(true);

warninglbl.setVisible(false);

usr1disable.setVisible(false);

usr2disable.setVisible(false);

textfld.setVisible(false);

c.add(textfld);

c.add(scroller);

c.add(testclientip1);
c.add(testclientipA); c.add(testclientipB);

c.add(textip);

c.add(textip1); c.add(textip2);

c.add(ipconnect); c.add(IMAGE3);

c.add(usrimg1); c.add(usrimg2);

c.add(usrimgf1); c.add(usrimgf2);

c.add(IMAGE1); c.add(IMAGE2);

c.add(usr1disable); c.add(usr2disable);

c.add(usr1enable); c.add(usr2enable);

c.add(warninglbl);

c.add(bf);

ipconnect.addActionListener(this);

jf.show();

jf.addWindowListener(new WindowAdapter()

public void windowClosing(WindowEvent win)

{
System.exit(0);

}});

int[] ports = new int[] {8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511};

for (int i = 0; i < 12; i++)

Thread t = new Thread(new PortListener(ports[i]));

t.setName("Listener-" + ports[i]);

t.start();

public static void initTable() {

// TODO Auto-generated method stub

tableModel = new InteractiveTableModel(columnNames);

//tableModel.addTableModelListener(new InteractiveTableModelListener());

table = new JTable();

table.setModel(tableModel);

table.setSurrendersFocusOnKeystroke(true);

scroller = new javax.swing.JScrollPane(table);

table.setPreferredScrollableViewportSize(new java.awt.Dimension(600, 300));

TableColumn hidden =
table.getColumnModel().getColumn(InteractiveTableModel.HIDDEN_INDEX);
hidden.setMinWidth(2);

hidden.setPreferredWidth(2);

hidden.setMaxWidth(2);

SwingUtilities.updateComponentTreeUI(c);

c.repaint();

//hidden.setCellRenderer(new
InteractiveRenderer(InteractiveTableModel.HIDDEN_INDEX));

class InteractiveRenderer extends DefaultTableCellRenderer {

protected int interactiveColumn;

public InteractiveRenderer(int interactiveColumn) {

this.interactiveColumn = interactiveColumn;

public Component getTableCellRendererComponent(JTable table,

Object value, boolean isSelected, boolean hasFocus, int row,

int column)

Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus,


row, column);

if (column == interactiveColumn && hasFocus) {


if ((tableModel.getRowCount() - 1) == row &&

!tableModel.hasEmptyRow())

tableModel.addEmptyRow();

highlightLastRow(row);

return c;

private void highlightLastRow(int row) {

// TODO Auto-generated method stub

int lastrow = tableModel.getRowCount();

if (row == lastrow - 1) {

table.setRowSelectionInterval(lastrow - 1, lastrow - 1);

} else {

table.setRowSelectionInterval(row + 1, row + 1);

table.setColumnSelectionInterval(0, 0);

}
public class InteractiveTableModelListener implements TableModelListener {

public void tableChanged(TableModelEvent evt) {

if (evt.getType() == TableModelEvent.UPDATE) {

int column = evt.getColumn();

int row = evt.getFirstRow();

System.out.println("row: " + row + " column: " + column);

table.setColumnSelectionInterval(column + 1, column + 1);

table.setRowSelectionInterval(row, row);

class PortListener implements Runnable {

ServerSocket server;

Socket connection;

BufferedReader br = null;

int port;

public PortListener(int port) {

this.port = port;

public void run() {

try {
server = new ServerSocket(port);

while (true) {

connection = server.accept();

br = new BufferedReader(

new InputStreamReader(new BufferedInputStream(

connection.getInputStream())));

String strLine;

StringBuffer buffer = new StringBuffer();

while ((strLine = br.readLine()) != null) {

// System.out.println(strLine);

buffer.append(strLine + "\n");

String a1=buffer.toString();

br.close();

connection.close();

length=a1.length();

// NODE A

if (this.port == 8500 ) {

usrimg1.setVisible(true);
usr1enable.setVisible(true);

usr1disable.setVisible(false);

//jcb1.setEnabled(false);

//intr1();

if (this.port == 8501 )

usrimg1.setVisible(true);

usrimgf1.setVisible(false);

usr1enable.setVisible(false);

if (this.port == 8502 )

usrimg1.setVisible(true);

usrimgf1.setVisible(false);

usr2enable.setVisible(true);

//intr2();

if (this.port == 8503 )

usrimg1.setVisible(true);

usrimgf1.setVisible(false);

textfld.setVisible(false);

usr1enable.setText(buffer.toString());
usr1enable.setVisible(true);

catch (IOException e) {}

finally {}

//look and feel

public static void main(String[] args)

// TODO Auto-generated method stub

// TODO Auto-generated method stub

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {


java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);

new Server();

void call12()

Socket client = null;

byte[] byteArray;// =str.getBytes();

try {

client = new Socket(event2,1500);

bos = new BufferedOutputStream(client.getOutputStream());

byteArray = textfld.getText().getBytes();

bos.write(byteArray, 0, byteArray.length);
bos.flush();

bos.close();

client.close();

} catch (UnknownHostException e1) {

e1.printStackTrace();

} catch (IOException e1) {

e1.printStackTrace();

} finally {

if (bos != null) {

try {

bos.close();

} catch (IOException e1) {

e1.printStackTrace();

void call13()

Socket client = null;

byte[] byteArray;// =str.getBytes();


try {

client = new Socket(event2,2500);

bos = new BufferedOutputStream(client.getOutputStream());

byteArray = textfld.getText().getBytes();

bos.write(byteArray, 0, byteArray.length);

bos.flush();

bos.close();

client.close();

} catch (UnknownHostException e1) {

e1.printStackTrace();

} catch (IOException e1) {

e1.printStackTrace();

} finally {

if (bos != null) {

try {

bos.close();

} catch (IOException e1) {

e1.printStackTrace();
}

void username()

public void actionPerformed(ActionEvent e)

byte[] byteArray;// =str.getBytes();

if(e.getSource()== ipconnect)

conn="Connect";

if(textip.getText().equals(""))

JOptionPane.showMessageDialog(null,"please, Give valid IPAddress!", "Message Box", 1);

else

JOptionPane.showMessageDialog(null,"Connecting IP Address!!", "Message Box", 1);

event1=textip.getText().toString().trim();

event2=textip1.getText().toString().trim();

event3=textip2.getText().toString().trim();

JFrame f = new JFrame("Server Tracking Window");


Moving m;

try {

m = new Moving();

f.add(jp);

f.add(m);

f.setSize(815,730);

f.setVisible(true);

m.timera.start();

m.timerx.start();

} catch (ClassNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

scroller.setVisible(true);

ipconnect.setVisible(false);

textip.setVisible(false);

textip1.setVisible(false);

textip2.setVisible(false);

testclientip1.setVisible(false);

testclientipA.setVisible(false);
testclientipB.setVisible(false);

jp1.setVisible(false);

usrimg1.setVisible(false);

usrimg2.setVisible(false);

usrimgf1.setVisible(true);

usrimgf2.setVisible(true);

jp.setVisible(true);

IMAGE2.setVisible(false);

IMAGE3.setVisible(false); }

User.java
import java.awt.Color;

import java.awt.Container;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import java.io.BufferedInputStream;

import java.io.BufferedOutputStream;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;
import java.net.ConnectException;

import java.net.ServerSocket;

import java.net.Socket;

import java.net.UnknownHostException;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTextArea;

import javax.swing.JTextField;

import sun.tools.jar.Main;

public class User implements ActionListener {

public JFrame jf;

public Container c;

public JLabel bf= new JLabel();


public JLabel unauthorised = new JLabel("You are an unauthorised user in Community,
Your profile has blocked!");

public JLabel loginicon = new JLabel("");

public JPanel jp = new JPanel();

public JPanel jp1 = new JPanel();

public JLabel testclientip1 = new JLabel("ENTER IP ADDRESS:");

public JTextField jtf= new JTextField("127.0.0.1");

public JButton ipconnect = new JButton("");

public Font f = new Font("Rockwell" , Font.BOLD , 14);

public Font fo= new Font("Rockwell" , Font.BOLD , 16);

public JLabel errlbl = new JLabel("Sorry, This user is not connected with current user. ");

String conn="";

int length;

String len;

int t1len;

String t1str;

BufferedOutputStream bos = null;

String event2="null";

@SuppressWarnings("deprecation")

User()

{
jf = new JFrame("Establish Connection with Server");

c = jf.getContentPane();

c.setLayout(null);

jf.setSize(815, 730);

bf.setIcon(new javax.swing.ImageIcon("userlogin.png"));

bf.setBounds(0, 0, 799, 699);

jf.setResizable(false);

jp.setBounds(500,430,100,150);

jp.setBackground(Color.darkGray);

loginicon.setBounds(320,480,180,180);

loginicon.setIcon(new javax.swing.ImageIcon("interconnect.png"));

testclientip1.setBounds(250, 350, 150, 30);

testclientip1.setForeground(Color.ORANGE);

testclientip1.setFont(f);

ipconnect.setBounds(330,430,120,30);

ipconnect.setIcon(new javax.swing.ImageIcon("connectblue.png"));

jtf.setBounds(400,350,150,30);

unauthorised.setBounds(50, 450,700, 50);

unauthorised.setForeground(Color.RED);

unauthorised.setFont(fo);
errlbl.setBounds(200, 450,600, 30);

errlbl.setForeground(Color.RED);

errlbl.setFont(f);

errlbl.setVisible(false);

jf.setVisible(false);

jp.setVisible(false);

unauthorised.setVisible(false);

loginicon.setVisible(true);

//combobox.setEditable(true);

c.add(loginicon);

c.add(errlbl);

c.add(testclientip1);

c.add(jtf);

c.add(ipconnect);

c.add(unauthorised);

// c.add(scrpane,BorderLayout.CENTER);

c.add(bf);

ipconnect.addActionListener(this);

jf.show();
jf.addWindowListener(new WindowAdapter()

public void windowClosing(WindowEvent win)

System.exit(0);

}});

int[] ports = new int[] {9001,1500};

for (int i = 0; i < 2; i++) {

Thread t = new Thread(new PortListener(ports[i]));

t.setName("Listener-" + ports[i]);

t.start();

}}

public static void main(String[] args) {

// TODO Auto-generated method stub

// TODO Auto-generated method stub

// TODO Auto-generated method stub

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(User.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(User.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(User.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(User.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

new User();

class PortListener implements Runnable

ServerSocket server;

Socket connection;
BufferedReader br = null;

int port;

public PortListener(int port)

this.port = port;

public void run() {

try {

server = new ServerSocket(port);

while (true)

connection = server.accept();

br = new BufferedReader(new InputStreamReader(new


BufferedInputStream(connection.getInputStream())));

String strLine;

StringBuffer buffer = new StringBuffer();

while ((strLine = br.readLine()) != null) {

// System.out.println(strLine);

buffer.append(strLine + "\n");

br.close();

connection.close();
String a1=buffer.toString();

length=a1.length();

if(this.port==1500)

unauthorised.setVisible(true);

catch (IOException e) {

finally {

@Override

public void actionPerformed(ActionEvent e)

// TODO Auto-generated method stub

if(e.getSource()== ipconnect)

conn="Connect";

if(jtf.getText().equals(""))

JOptionPane.showMessageDialog(null,"please, Give valid


IPAddress!", "Message Box", 1);
}

else

JOptionPane.showMessageDialog(null,"Connecting IP
Address!!", "Message Box", 1);

event2 = jtf.getText().toString().trim();

new User1();

testclientip1.setVisible(false);

jtf.setVisible(false);

ipconnect.setVisible(false);

jf.setVisible(false);

jp.setVisible(false);

call11();

void cal() {

// TODO Auto-generated method stub

Socket client1 = null;

byte[] byteArray1;// =str.getBytes();

try {

client1 = new Socket(event2,8501);

bos = new BufferedOutputStream(client1.getOutputStream());


byteArray1 = jtf.getText().getBytes();

bos.write(byteArray1, 0, byteArray1.length);

bos.flush();

bos.close();

client1.close();

} catch (UnknownHostException ue)

ue.printStackTrace();

catch (IOException e)

e.printStackTrace();

finally

if (bos != null) {

try {

bos.close();

catch (IOException e1)

e1.printStackTrace();

}
try {

client1.close();

catch (IOException e1)

e1.printStackTrace();

// view.setEnabled(false);

// unauthorised.setVisible(true);

void call11()

Socket client = null;

byte[] byteArray;// =str.getBytes();

try

client = new Socket(event2,8500);

bos = new BufferedOutputStream(client.getOutputStream());

byteArray = jtf.getText().getBytes();

bos.write(byteArray, 0, byteArray.length);

bos.flush();

bos.close();

client.close();
}

catch (ConnectException ex)

System.out.println(ex.getMessage());

JOptionPane.showMessageDialog(null, "Connection refused!!! connect user


after restart the server");

System.exit(0);

catch (IOException e1)

e1.printStackTrace();