Final Exam Review

Download Report

Transcript Final Exam Review

Final Exam
Tues 6/8/10 @ 4-5:50pm
(normal class time and room)
worth 35% of your course grade
17 Questions
All short answer questions
No Multiple Choice
No Programming
No questions about language syntax
1
Topics Covered
•
•
•
•
•
•
•
•
•
•
•
Client/Server Web Programming
Basic Web Development Concepts
Web Server Concepts – Apache, Tomcat
NO – HTTP, HTML, XHTML, Form Controls or CSS
JavaScript
PHP
Perl
CGI
Python
JSP and Servlets
Internet Databases Concepts and JDBC
• No JavaBeans and No Java Programming Language Questions
2
INFORMATION FROM LECTURES
No questions from:
• Lecture 4, 5, 6, 7, 8, 14
No programming questions.
No language syntax or symantec questions.
Read (questions are from):
• Lecture 1, 2, 3, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20,
21 and 22.
3
Some of the Course goals:
 Understand the technology and protocols underlying the World Wide
Web
 Become familiar with common tools and techniques for developing
Web-based applications, both client-side and server-side
 Develop a working knowledge of various scripting web languages as
languages for developing Web applications
 Have an understanding of what technologies can be used for various
web projects and what makes the technology appropriately suited for
the desired application.
 Become familiar with some of the challenges and issues related to
Internet Development.
4
Client-side programming
can download program with Web page, execute on client machine
 simple, generic, but insecure
JavaScript
 a scripting language for Web pages, developed by Netscape in 1995
 uses a C++/Java-like syntax, so familiar to programmers, but simpler
 good for adding dynamic features to Web page, controlling forms and GUI
Java applets
 can define small, special-purpose programs in Java called applets
 provides full expressive power of Java (but more overhead)
 good for more complex tasks or data heavy tasks, such as graphics
5
Server-side programming
can store and execute program on Web server, link from Web page
 more complex, requires server privileges, but secure
CGI programming
 programs can be written to conform to the Common Gateway Interface
 when a Web page submits, data from the page is sent as input to the
CGI program
 CGI program executes on server, sends its results back to browser as
a Web page
 good if computation is large/complex or requires access to private data
Active Server Pages, Java Servlets, PHP, Server Side Includes
 vendor-specific alternatives to CGI
 provide many of the same capabilities but using HTML-like tags
6
Lecture 3
This lecture introduces the web technologies of SQL,
ASP, ADO, ODBC, JDBC, PHP, CGI, Java Applets,
JavaScript, Servlets, JSP.
Only 4 question from this lecture.
No questions on .NET or Java Webstart.
7
Client vs. Server Side Scripting Technologies
Lecture 9 - Client-Side JavaScript
Lecture 10 - Server-Side Java Servlets
Lecture 11 - JSP
4 questions from these lectures.
8
Lecture 9 - JavaScript
client-side programming with JavaScript
JavaScript is not Java
•
•
•
•
JavaScript is a very simple scripting language.
Syntax is similar to a subset of Java.
Interpreted language.
Uses objects, but doesn't really support the creation
of new object types
10
Scripts vs. programs
a scripting language is a simple, interpreted programming language
 scripts are embedded as plain text, interpreted by application
 simpler execution model: don't need compiler or development
environment
 saves bandwidth: source code is downloaded, not compiled
executable
 platform-independence: code interpreted by any script-enabled
browser
 but: slower than compiled code, not as powerful/full-featured
11
Common scripting tasks
adding dynamic features to Web pages
 validation of form data
 image rollovers
 time-sensitive or random page elements
defining programs with Web interfaces
 utilize buttons, text boxes, clickable images, prompts, frames
limitations of client-side scripting
 since script code is embedded in the page, viewable to the world
 for security reasons, scripts are limited in what they can do
e.g., can't access the client's hard drive
 since designed to run on any machine platform, scripts do not contain platform
specific commands
 script languages are not full-featured
e.g., JavaScript objects are crude, not good for large project development
12
JavaScript
JavaScript code can be embedded in a Web page using SCRIPT tags
 the output of JavaScript code is displayed as if directly entered in HTML
<html>
<!-- js01.html -->
<head>
<title>JavaScript Page</title>
</head>
<body>
<script type="text/javascript">
// silly code to demonstrate output
document.write("Hello world!");
document.write("<p>How are <br />" +
"<i>you</i>?</p>");
</script>
<p>Here is some static text as well.
</p>
</body>
</html>
document.write displays text in page
text to be displayed can include HTML
tags
the tags are interpreted by the browser
when the text is displayed
as in C++/Java, statements end with ;
JavaScript comments similar to C++/Java
//
starts a single line comment
/*…*/ enclose multi-line comments
13
The Python Programming Language
From lectures 19, 20, and 21
Only 1 question about python
14
PHP
See lecture 18
Only 1 question on PHP
15
What is this “PHP” thing?
Official description:
“PHP, which stands for "PHP: Hypertext Preprocessor"
is a widely-used Open Source general-purpose
scripting language that is especially suited for Web
development and can be embedded into HTML. Its
syntax draws upon C, Java, and Perl, and is easy to
learn.
16
What does PHP do?
Most commonly: used inside a web server to
parse pages and dynamically generate content.
Differs from a language like Javascript in that it is
Server Side (processed on the server)
17
PHP Document
In order to be correctly read and processed, must be
parsed through a server capable of parsing PHP code.
Server processes code: formats a standard HTML
document out of the PHP code, then transfers via
HTTP to client browser. No client software required
(other than web browser).
18
Simple Transfer of Normal HTML
Server
.HTML HTML
File
Web
Server
Application
(Apache)
Client
HTML
Client’s
Browser
(MSIE,
Netscape,
Etc)
19
Simple Transfer of PHP
Server
.PHP
File
Web
PHP
PHP HTML
Server
&
Parsing
Application
HTML Module
(Apache)
Client
HTML
Client’s
Browser
(MSIE,
Netscape,
Etc)
20
What does a PHP file look like?
<html>
<p>Hello
<?php
echo “world!”;
?>
</p>
</html>
21
Parsing…
<html>
<p>Hello
<?php
echo “world!”;
?>
</p>
</html>
<html>
<p>Hello
world
</p>
</html>
22
CGI Programming
See lecture 15
Only 2 question on CGI
23
Client-side recap
JavaScript provides for client-side scripting
 source code is downloaded with the Web page
 interpreted by the browser as the page is loaded
 simple execution model, language is closely integrated with HTML
Java Applets provides for client-side programming
 source code is compiled into Java byte code on server
 byte code is downloaded with the Web page
 interpreted by the Java Virtual Machine in the browser
 more complicated model, requires compiler on server
 (slightly) faster execution, full-featured with extensive library support
both approaches yield platform independence
 requires JavaScript/Java enabled browser for desired platform
24
Server-side vs. client-side programming
instead of downloading the program and executing on the client,
 have the client make a request
 execute the program on the server
 download the results to the client
advantages
 cross-platform support
browser variations/bugs yield differences with JavaScript & Java applets
with server-side, only have to test & optimize program for server platform
 more options for applications
server-side program not limited for security reasons, can access files & databases
 increased power
server machines tend to be more powerful, better tools
 code integrity
do not have to give client access to source code or data in order to execute
25
Common server-side applications
search engines
 must maintain a large database of links & documents
 must be able to index, sort data, perform complex searches
 requires lots of storage, optimum performance  server-side
database access
 Web page can serve as front-end to a database
 make requests from browser, passed on to Web server, calls CGI
program to access the database, sends the results back to the browser
chat & bulletin board services
 user enters messages in a Web interface, passed on to server
 chat: CGI program distributes messages to all connected users
 bulletin board: CGI program adds to accessible database of messages
26
CGI programming
CGI (Common Gateway Interface)
 protocol for input/output of a server-side program
 program can be written in any language as long as it accepts input
and produces output as specified by CGI
 server must be able to recognize a URL as being a CGI program
generally done by placing program in special cgi-bin directory
to execute a CGI program
 server receives a request
 server must recognize that the URL maps to a program, not a
document
 server executes program
• feeds data from request message to program as output
• takes program output, adds appropriate HTTP headers, and
sends back
27
CGI output
The output of a CGI program consists of
 HTTP headers
 blank line
 program output to be displayed/downloaded
At minimum, HTTP header must specify content type
 which is then passed on by the Web server as an HTTP header
e.g.,
Content-Type: text/html
At minimum, output can be plain text
 which is passed on by the Web server as the HTML document
e.g.,
Hello and welcome to my page
28
CGI example
// hello.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Content-Type: text/html" << endl
<< endl;
cout << "Hello and welcome to my page " << endl;
return 0;
}
executable is stored in the
cgi-bin under the name
hello.cgi
GET request executes the
program
29
Introduction to Perl
See lecture 16
2 questions on Perl
30
What is Perl?
Practical Extraction and Report Language
A scripting language which is both relatively
simple to learn and yet remarkably powerful.
31
Introduction to Perl
• A “glue” language. Ideal for connecting things
together, such as a GUI to a number cruncher, or a
database to a web server.
• Has replaced shell programming as the most popular
programming language for text processing and Unix
system administration.
• Runs under all operating systems (including
Windows).
• Extremely popular for CGI and GUI programming.
32
Why use Perl ?
• It is easy to gain a basic understanding of the
language and start writing useful programs quickly.
• There are a number of shortcuts which make
programming ‘easier’.
• Perl is popular and widely used, especially for system
administration and WWW programming.
33
Why use Perl?
Perl is free and available on all computing platforms.
 Unix/Linux, Windows, Macintosh, Palm OS
There are many freely available additions to Perl
(‘Modules’).
Most importantly, Perl is designed to understand and
manipulate text and lists.
34
A Simple Perl script
#!/usr/bin/perl
#This script prints a friendly greeting to the screen
print “Hello World\n”;
• Scripts are first “compiled” and then “executed” in the order in
which the lines of code appear
• You can write a script with any text editor. The only rule is that
it must be saved as plain text.
35
Database Connectivity and Internet Technologies Overview
Lecture 22 – This is a nice summary lecture that provides a lot of Server
Technology conclusions.
No questions on Cold Fusion, No questions on Server Tiers. This is just a
good summary lecture.
There are 5 scenario questions asking you to pick scripting languages
and/or server technologies to solve a problem.
36
Class Summary questions to ponder…
•
•
•
•
•
•
What technologies are available for the internet?
Why would you want to use a particular scripting languages?
How does one language support something another does not?
The difference between client side and server side applications.
What are the basic parts of an HTML, Perl, PHP, CGI document?
How would you use these technologies to accomplish a task or
provide a solution to a problem?
• If given a scenario, which language and/or technology would you
choose and why?
37
Final Exam
Tues 6/8/10 @ 4-5:50pm
(normal class time and room)
worth 35% of your course grade
17 Questions
All short answer questions
No Multiple Choice
No Programming
No questions about language syntax
38