Monday, 13 April 2015

Web Technology based Software Engineering Lab (ECS-652)

1.     Write a program in HTML to display your CV on web browser.
2.     Write a program in HTML to design your class time table.
3.     Write a program in HTML to create an image as hyperlink.
4.     Write a program in HTML to design different web pages which are connected using hyperlinks. User can navigate to any webpage using these hyperlinks.  
5.     Create a web page by using Frame tag including internal and external linking with in a page.
6.     Create the registration form for online registration of a student with an Institute/University by using Form Tag and its Components.
7.     Write a program in JavaScript to design a calculator.
8.     Write a program in JavaScript to validate email id and password.
9.     Write a program in JavaScript design animated web pages.
10.                 Write a program in JavaScript to design an objective question paper which will be automatically submitted after one minute.
11.                 Create an XML document for a vehicle, where a vehicle can be classified as two-wheeler, four-wheeler and six-wheeler. Necessary attributes are to be included in the document.
12.                 Perform client-side validations for the registration form for online registration of a student with an Institute/University that was designed in Assignment 2. Flash a message “Form Validated” on the screen as soon as all the fields/controls on the form get validated.
The following validations for different fields/controls are to be done:
a.     Name (First, Middle, Last Name) – must not be blank, must contain only alphabets, length of the  
 Field must not exceed 50 characters.
b.   Father’s Name (same as above)
c.   Sex/Gender – one of the options must be selected
d. Category – one of the options must be selected
 e. Address (Multiple Lines-separate/combined)
          i. Line 1(House No.) - must not be blank
          ii. Line 2 (Street)
          iii. Line 3 (Locality) - must not be blank
          iv. Line 4 (Milestone) - optional
 f. City - one of the options must be selected/ must not be blank, must contain only Alphabets
 g. State - one of the options must be selected/ must not be blank, must contain only Alphabets
h.     Country - one of the options must be selected/ must not be blank, must contain only alphabets
  i. Pin Code - must contain only numeric characters, size must not exceed 6
  j. E-mail – format must be validated
  k. Date-of-birth - format must be validated, must be a valid date (a date prior to a specific date)
  l. Telephone No - must contain only numeric characters, a hyphen or a + sign, size must not exceed 15
  m. Educational Qualifications (Multiple Controls)
           i. Certificate/Degree - must not be blank
           ii. Board/University - must not be blank
           iii. College/Institute - optional
           iv. Year of Passing - must not be blank, only numeric & size not greater than 4
           v. Subjects/Discipline - optional
           vi. Percentage/Grade/Percentile Index - must not be blank, only numeric or a (.)Character
               Submit & Reset Buttons
      Check all validations and set focus to the topmost field not validated after flashing an
     Appropriate error message.
13.                 Create a style Sheet in CSS/XSL and display the document on web browser.
14.                 Perform CASE STUDY on any of the following topics:
(i)                Payroll System.
(ii)             Banking System.
(iii)           Purchase Order System
(iv)           Library Management System.
(v)             Railway Reservation System
(vi)           Bill Tracking System
(vii)        College Admission System
(viii)      School Management system.
(ix)            Office Automation System.
(x)             Hotel Management System
CASE STUDY includes: Feasibility Study, SRS, DFD, ER- Diagram, Test cases and Test plans. 

15.                      Develop a mini web project on your Choice.

Tuesday, 24 March 2015

JSP code to show value from mysql database using type 4 driver

<%@page  language="java" import="java.sql.*" contentType="text/html" pageEncoding="UTF-8"%>


   
       
        JSP Page
   
   
        <%
        Connection con;
        PreparedStatement ps;
        try
        {
          Class.forName("com.mysql.jdbc.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost/school","root","admin");
          Statement st=con.createStatement();
          ResultSet rs=st.executeQuery("select * from login");
          while(rs.next())
          {
              out.print("Name is  "+rs.getString(1));
              out.println("  Pass is  "+rs.getString(2));
              out.println("
");
          }
       
        }
        catch(Exception e){}
        %>
   


JSP code to delete value in mysql database using type 4 driver

<%@page  language="java" import="java.sql.*" contentType="text/html" pageEncoding="UTF-8"%>


   
       
        JSP Page
   
   
        <%
        Connection con;
        PreparedStatement ps;
        String n,c;
        n=request.getParameter("t1");
        c=request.getParameter("t2");
        try
        {
          Class.forName("com.mysql.jdbc.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost/school","root","admin");
          ps=con.prepareStatement("delete from login where uname=? and pass=?");
ps.setString(1,n);
ps.setString(2,c);
                int x=ps.executeUpdate();
if(x==1)
{
out.println("record has been deleted");
}
                else
{
out.println("record not deleted or not found in database");
}
}
catch(Exception e)
{
out.println("check data"+e.getMessage());
}
%>
   


JSP code to insert value in mysql database using type 4 driver

<%@page  language="java" import="java.sql.*" contentType="text/html" pageEncoding="UTF-8"%>

   
       
        JSP Page
   
   
        <%
        Connection con;
        PreparedStatement ps;
        String n,c;
        int x;
        n=request.getParameter("t1");
        c=request.getParameter("t2");
        try
        {
          Class.forName("com.mysql.jdbc.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost/school","root","admin");
          ps=con.prepareStatement("insert into login(uname,pass) values(?,?)");
ps.setString(1,n);
ps.setString(2,c);
x=ps.executeUpdate();
if(x==1)
{
out.println("Record has been saved");
}        
        }
        catch(Exception e){}
        %>
   


Saturday, 1 November 2014

JApplet Program to Display Multiple Images Using Multithreading

import javax.swing.*;
import java.awt.*;
public class Images extends JApplet implements Runnable
{
JPanel jp;
JLabel l1;
String []s={"1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg"};
int i=0;
Thread t1;
public void init()
{
jp=new JPanel();
getContentPane().add(jp);

l1=new JLabel("");
jp.add(l1);
t1=new Thread(this);
t1.start();
}
public void run()
{
try
{
while(true)
{
Icon ic=new ImageIcon(s[i++]);
l1.setIcon(ic);
if(i>=s.length)
i=0;
Thread.sleep(1000);
}
}
catch(Exception e)
{}
}
}
/**

JDBC program logic for Update Password when Username and Password is correct

package studentdb;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import javax.swing.JOptionPane;
{

Connection con;
     
       try
       {
           Class.forName("com.mysql.jdbc.Driver");
           con=DriverManager.getConnection("jdbc:mysql://localhost/college","root","root");
           if(t3.getText().equals(t4.getText()))
           {
           String sq="update student set pass=? where uname=? and pass=?";
           PreparedStatement ps=con.prepareStatement(sq);
           ps.setString(1,t3.getText());
           ps.setString(2,t1.getText());
           ps.setString(3,t2.getText());
         
           int i=ps.executeUpdate();
           if(i==1)
         JOptionPane.showMessageDialog(null,"Password Updated");
           }
           else
           {
            JOptionPane.showMessageDialog(null,"Password not Updated");
           
           }
         
       }
       catch(Exception e)
       {
                    JOptionPane.showMessageDialog(null,"SQl Error");
       }
}

Saturday, 18 October 2014

Decision Trees

Decision Trees

Decision trees are powerful and popular tools for classification and prediction. The attractiveness of decision trees is due to the fact that, in contrast to neural networks, decision trees represent rules. Rules can readily be expressed so that humans can understand them or even directly used in a database access language like SQL so that records falling into a particular category may be retrieved.
In some applications, the accuracy of a classification or prediction is the only thing that matters. In such situations we do not necessarily care how or why the model works. In other situations, the ability to explain the reason for a decision, is crucial. In marketing one has describe the customer segments to marketing professionals, so that they can utilize this knowledge in launching a successful marketing campaign. This domain experts must recognize and approve this discovered knowledge, and for this we need good descriptions. There are a variety of algorithms for building decision trees that share the desirable quality of interpretability. A well known and frequently used over the years is C4.5 (or improved, but commercial version See5/C5.0).

What is a decision tree ?

Decision tree is a classifier in the form of a tree structure (see Figure 1), where each node is either:
    • a leaf node - indicates the value of the target attribute (class) of examples, or
    • a decision node - specifies some test to be carried out on a single attribute-value, with one branch and sub-tree for each possible outcome of the test.
A decision tree can be used to classify an example by starting at the root of the tree and moving through it until a leaf node, which provides the classification of the instance.
Decision tree induction is a typical inductive approach to learn knowledge on classification. The key requirements to do mining with decision trees are:

    • Attribute-value description: object or case must be expressible in terms of a fixed collection of properties or attributes. This means that we need to discretize continuous attributes, or this must have been provided in the algorithm.
    • Predefined classes (target attribute values): The categories to which examples are to be assigned must have been established beforehand (supervised data).
    • Discrete classes: A case does or does not belong to a particular class, and there must be more cases than classes.
    • Sufficient data: Usually hundreds or even thousands of training cases.

Artificial Itelligence Supervised and Unsupervised Learning


Water Jug Problem

Water Jug Problem
Statement :- We are given 2 jugs, a 4 liter one and a 3- liter one. Neither has any measuring markers on it. There is a pump that can be used to fill the jugs with water. How can we get exactly 2 liters of water in to the 4-liter jugs?
Solution:-
The state space for this problem can be defined as

{ ( i ,j ) i = 0,1,2,3,4 j = 0,1,2,3}

‘i’ represents the number of liters of water in the 4-liter jug and ‘j’ represents the number of liters of water in the 3-liter jug. The initial state is ( 0,0) that is no water on each jug. The goal state is to get ( 2,n) for any value of ‘n’.

To solve this we have to make some assumptions not mentioned in the problem. They are

1. We can fill a jug from the pump.

2. we can pour water out of a jug to the ground.

3. We can pour water from one jug to another.

4. There is no measuring device available.




UPTU Artificial Intelligence Syllabus


ECS-801: Artificial Intelligence
Unit-I
Introduction : Introduction to Artificial Intelligence, Foundations and History of Artificial
Intelligence, Applications of Artificial Intelligence, Intelligent Agents, Structure of Intelligent
Agents. Computer vision, Natural Language Possessing.
Unit-II
Introduction to Search : Searching for solutions, Uniformed search strategies, Informed search
strategies, Local search algorithms and optimistic problems, Adversarial Search, Search for
games, Alpha - Beta pruning.
Unit-III
Knowledge Representation & Reasoning: Propositional logic, Theory of first order logic,
Inference in First order logic, Forward & Backward chaining, Resolution, Probabilistic
reasoning, Utility theory, Hidden Markov Models (HMM), Bayesian Networks.
Unit-IV
Machine Learning : Supervised and unsupervised learning, Decision trees, Statistical learning
models, Learning with complete data - Naive Bayes models, Learning with hidden data - EM
algorithm, Reinforcement learning,
Unit-V
Pattern Recognition : Introduction, Design principles of pattern recognition system, Statistical
Pattern recognition, Parameter estimation methods - Principle Component Analysis (PCA) and
Linear Discriminant Analysis (LDA), Classification Techniques – Nearest Neighbor (NN) Rule,
Bayes Classifier, Support Vector Machine (SVM), K – means clustering.
References:
1. Stuart Russell, Peter Norvig, “Artificial Intelligence – A Modern Approach”, Pearson
Education
2. Elaine Rich and Kevin Knight, “Artificial Intelligence”, McGraw-Hill
3. E Charniak and D McDermott, “Introduction to Artificial Intelligence”, Pearson
Education
4. Dan W. Patterson, “Artificial Intelligence and Expert Systems”, Prentice Hall of India,


Friday, 17 October 2014

Java Program of File Access

import java.io.File;
class filedemo
{
public static void main(String args[])
{

File fpath=new File("f:");

System.out.println("  "+fpath.getTotalSpace());
System.out.println("  "+fpath.getUsableSpace());
System.out.println("  "+fpath.getPath());
System.out.println("  "+fpath.lastModified());

String dirlist[]=fpath.list();
int n=dirlist.length;
System.out.println("  "+n);
for(int i=0;i<n;i++)
System.out.println(dirlist[i]);


}
}

JDBC Connectivity With Mysql


package jdbcswing;
import java.sql.*;
public class Jdbcswing {

    public static void main(String[] args) {
        Connection con;
        PreparedStatement ps;
        try
        {
          Class.forName("com.mysql.jdbc.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost/school","root","admin");
          Statement st=con.createStatement();
          ResultSet rs=st.executeQuery("select * from login");
          while(rs.next())
          {
              System.out.print("Name is  "+rs.getString(1));
              System.out.println("  Pass is  "+rs.getString(2));
          }
       
        }
        catch(Exception e){}
        // TODO code application logic here
    }
   
}

Natural language processing

Natural language processing
From Wikipedia, the free encyclopedia
For the processing of language by the human brain, see Language processing.
Natural language processing (NLP) is a field of computer science, artificial intelligence, and linguistics concerned with the interactions between computers and human (natural) languages. As such, NLP is related to the area of human–computer interaction. Many challenges in NLP involve natural language understanding -- that is, enabling computers to derive meaning from human or natural language input.

History[edit]

The history of NLP generally starts in the 1950s, although work can be found from earlier periods. In 1950, Alan Turing published an article titled "Computing Machinery and Intelligence" which proposed what is now called the Turing test as a criterion of intelligence.
The Georgetown experiment in 1954 involved fully automatic translation of more than sixty Russian sentences into English. The authors claimed that within three or five years, machine translation would be a solved problem.[2] However, real progress was much slower, and after the ALPAC report in 1966, which found that ten years long research had failed to fulfill the expectations, funding for machine translation was dramatically reduced. Little further research in machine translation was conducted until the late 1980s, when the first statistical machine translation systems were developed.
Some notably successful NLP systems developed in the 1960s were SHRDLU, a natural language system working in restricted "blocks worlds" with restricted vocabularies, and ELIZA, a simulation of a Rogerian psychotherapist, written by Joseph Weizenbaumbetween 1964 to 1966. Using almost no information about human thought or emotion, ELIZA sometimes provided a startlingly human-like interaction. When the "patient" exceeded the very small knowledge base, ELIZA might provide a generic response, for example, responding to "My head hurts" with "Why do you say your head hurts?".
During the 1970s many programmers began to write 'conceptual ontologies', which structured real-world information into computer-understandable data. Examples are MARGIE (Schank, 1975), SAM (Cullingford, 1978), PAM (Wilensky, 1978), TaleSpin (Meehan, 1976), QUALM (Lehnert, 1977), Politics (Carbonell, 1979), and Plot Units (Lehnert 1981). During this time, many chatterbots were written including PARRY, Racter, and Jabberwacky.
Up to the 1980s, most NLP systems were based on complex sets of hand-written rules. Starting in the late 1980s, however, there was a revolution in NLP with the introduction of machine learning algorithms for language processing. This was due both to the steady increase in computational power resulting from Moore's Law and the gradual lessening of the dominance of Chomskyan theories of linguistics (e.g. transformational grammar), whose theoretical underpinnings discouraged the sort of corpus linguistics that underlies the machine-learning approach to language processing.[3] Some of the earliest-used machine learning algorithms, such as decision trees, produced systems of hard if-then rules similar to existing hand-written rules. Increasingly, however, research has focused onstatistical models, which make soft, probabilistic decisions based on attaching real-valued weights to the features making up the input data. The cache language models upon which many speech recognition systems now rely are examples of such statistical models. Such models are generally more robust when given unfamiliar input, especially input that contains errors (as is very common for real-world data), and produce more reliable results when integrated into a larger system comprising multiple subtasks.
Many of the notable early successes occurred in the field of machine translation, due especially to work at IBM Research, where successively more complicated statistical models were developed. These systems were able to take advantage of existing multilingualtextual corpora that had been produced by the Parliament of Canada and the European Union as a result of laws calling for the translation of all governmental proceedings into all official languages of the corresponding systems of government. However, most other systems depended on corpora specifically developed for the tasks implemented by these systems, which was (and often continues to be) a major limitation in the success of these systems. As a result, a great deal of research has gone into methods of more effectively learning from limited amounts of data.
Recent research has increasingly focused on unsupervised and semi-supervised learning algorithms. Such algorithms are able to learn from data that has not been hand-annotated with the desired answers, or using a combination of annotated and non-annotated data. Generally, this task is much more difficult than supervised learning, and typically produces less accurate results for a given amount of input data. However, there is an enormous amount of non-annotated data available (including, among other things, the entire content of the World Wide Web), which can often make up for the inferior results.

Major tasks in NLP[edit]

The following is a list of some of the most commonly researched tasks in NLP. Note that some of these tasks have direct real-world applications, while others more commonly serve as sub-tasks that are used to aid in solving larger tasks. What distinguishes these tasks from other potential and actual NLP tasks is not only the volume of research devoted to them but the fact that for each one there is typically a well-defined problem setting, a standard metric for evaluating the task, standard corpora on which the task can be evaluated, and competitions devoted to the specific task.
Produce a readable summary of a chunk of text. Often used to provide summaries of text of a known type, such as articles in the financial section of a newspaper.
Given a sentence or larger chunk of text, determine which words ("mentions") refer to the same objects ("entities"). Anaphora resolution is a specific example of this task, and is specifically concerned with matching up pronouns with the nouns or names that they refer to. The more general task of coreference resolution also includes identifying so-called "bridging relationships" involvingreferring expressions. For example, in a sentence such as "He entered John's house through the front door", "the front door" is a referring expression and the bridging relationship to be identified is the fact that the door being referred to is the front door of John's house (rather than of some other structure that might also be referred to).
This rubric includes a number of related tasks. One task is identifying the discourse structure of connected text, i.e. the nature of the discourse relationships between sentences (e.g. elaboration, explanation, contrast). Another possible task is recognizing and classifying the speech acts in a chunk of text (e.g. yes-no question, content question, statement, assertion, etc.).
Automatically translate text from one human language to another. This is one of the most difficult problems, and is a member of a class of problems colloquially termed "AI-complete", i.e. requiring all of the different types of knowledge that humans possess (grammar, semantics, facts about the real world, etc.) in order to solve properly.
Separate words into individual morphemes and identify the class of the morphemes. The difficulty of this task depends greatly on the complexity of the morphology (i.e. the structure of words) of the language being considered. English has fairly simple morphology, especially inflectional morphology, and thus it is often possible to ignore this task entirely and simply model all possible forms of a word (e.g. "open, opens, opened, opening") as separate words. In languages such as Turkish, however, such an approach is not possible, as each dictionary entry has thousands of possible word forms.
Given a stream of text, determine which items in the text map to proper names, such as people or places, and what the type of each such name is (e.g. person, location, organization). Note that, although capitalization can aid in recognizing named entities in languages such as English, this information cannot aid in determining the type of named entity, and in any case is often inaccurate or insufficient. For example, the first word of a sentence is also capitalized, and named entities often span several words, only some of which are capitalized. Furthermore, many other languages in non-Western scripts (e.g. Chinese or Arabic) do not have any capitalization at all, and even languages with capitalization may not consistently use it to distinguish names. For example, Germancapitalizes all nouns, regardless of whether they refer to names, and French and Spanish do not capitalize names that serve asadjectives.
Convert information from computer databases into readable human language.
Convert chunks of text into more formal representations such as first-order logic structures that are easier for computer programs to manipulate. Natural language understanding involves the identification of the intended semantic from the multiple possible semantics which can be derived from a natural language expression which usually takes the form of organized notations of natural languages concepts. Introduction and creation of language metamodel and ontology are efficient however empirical solutions. An explicit formalization of natural languages semantics without confusions with implicit assumptions such as closed world assumption (CWA) vs. open world assumption, or subjective Yes/No vs. objective True/False is expected for the construction of a basis of semantics formalization.[4]
Given an image representing printed text, determine the corresponding text.
Given a sentence, determine the part of speech for each word. Many words, especially common ones, can serve as multiple parts of speech. For example, "book" can be a noun ("the book on the table") or verb ("to book a flight"); "set" can be a noun, verb oradjective; and "out" can be any of at least five different parts of speech. Some languages have more such ambiguity than others. Languages with little inflectional morphology, such as English are particularly prone to such ambiguity. Chinese is prone to such ambiguity because it is a tonal language during verbalization. Such inflection is not readily conveyed via the entities employed within the orthography to convey intended meaning.
Determine the parse tree (grammatical analysis) of a given sentence. The grammar for natural languages is ambiguous and typical sentences have multiple possible analyses. In fact, perhaps surprisingly, for a typical sentence there may be thousands of potential parses (most of which will seem completely nonsensical to a human).
Given a human-language question, determine its answer. Typical questions have a specific right answer (such as "What is the capital of Canada?"), but sometimes open-ended questions are also considered (such as "What is the meaning of life?").
Given a chunk of text, identify the relationships among named entities (e.g. who is the wife of whom).
Given a chunk of text, find the sentence boundaries. Sentence boundaries are often marked by periods or other punctuation marks, but these same characters can serve other purposes (e.g. marking abbreviations).
Extract subjective information usually from a set of documents, often using online reviews to determine "polarity" about specific objects. It is especially useful for identifying trends of public opinion in the social media, for the purpose of marketing.
Given a sound clip of a person or people speaking, determine the textual representation of the speech. This is the opposite of text to speech and is one of the extremely difficult problems colloquially termed "AI-complete" (see above). In natural speech there are hardly any pauses between successive words, and thus speech segmentation is a necessary subtask of speech recognition (see below). Note also that in most spoken languages, the sounds representing successive letters blend into each other in a process termed coarticulation, so the conversion of the analog signal to discrete characters can be a very difficult process.
Given a sound clip of a person or people speaking, separate it into words. A subtask of speech recognition and typically grouped with it.
Topic segmentation and recognition
Given a chunk of text, separate it into segments each of which is devoted to a topic, and identify the topic of the segment.
Separate a chunk of continuous text into separate words. For a language like English, this is fairly trivial, since words are usually separated by spaces. However, some written languages like Chinese, Japanese and Thai do not mark word boundaries in such a fashion, and in those languages text segmentation is a significant task requiring knowledge of the vocabulary and morphology of words in the language.
Many words have more than one meaning; we have to select the meaning which makes the most sense in context. For this problem, we are typically given a list of words and associated word senses, e.g. from a dictionary or from an online resource such as WordNet.
In some cases, sets of related tasks are grouped into subfields of NLP that are often considered separately from NLP as a whole. Examples include:
This is concerned with storing, searching and retrieving information. It is a separate field within computer science (closer to databases), but IR relies on some NLP methods (for example, stemming). Some current research and applications seek to bridge the gap between IR and NLP.
This is concerned in general with the extraction of semantic information from text. This covers tasks such as named entity recognition, Coreference resolution, relationship extraction, etc.
This covers speech recognition, text-to-speech and related tasks.