530 likes | 635 Views
Info Dissemination over the WEB. I502 Lecture 8. Outline. Web based IM systems Oracle structure and data manipulation Usability Analysis Exam Review. WWW as C/S Platform. Why?
E N D
Info Dissemination over the WEB I502 Lecture 8
Outline • Web based IM systems • Oracle structure and data manipulation • Usability Analysis • Exam Review
WWW as C/S Platform • Why? • Can easily serve the needs of local and remote users (wide-spread availability of client tools) - both intranet and Internet needs • WWW provides a cheap & easy way to maintain client software • Alternative to installing expensive client software (half the client is there already!)
WWW as C/S Platform • How? • Need to acquire web server software • Need to develop scripts based on Common Gateway Interface (CGIs), or use some other middleware • Need to develop user interfaces using HTML, extended tags, or JAVA / JAVA-like codes
WWW as C/S Platform • Limitations • Security becomes challenging if Internet accessibility is supported • Client-tools supported by third party and separate from actual content served • Client-tool technology varies and changes...
Communicating with a DBMS over WWW client HTTP over TCP/IP WWW server CGI or DLLs using server APIs Middleware Service e.g. CF ODBC/JDBC Back-end Service e.g. Oracle
Database Drivers • Hides native data types and other DB system specific features from clients • Provides clients with the independence to query using a standard language (SQL)
JDBC • Java Database Connectivity is a standard set of functions known as an Application Programming Interface (API) used by clients or middleware services to communicate with diverse database environments using Java
JDBC • Operational View of Client-JDBC Sybase driver1 Java Code Oracle driver2
Oracle – DB Structure • Oracle DB structure is made up several logical units: • A Database contains: • Several Tablespaces, each containing • One or more Datafiles, each containing • One or more Tables
Oracle DB Logical Structure Doe, Jane A Line (Data) A Page (Table) Drawer (Tablespace) Folders (Datafiles) Filing Cabinet (database)
Oracle DB Physical Structure Database System tablespace User tablespace data1.ora 1 MB data2.ora 1 MB data3.ora 4 MB datafile Each datafile is associated with a single tablespace Total storage capacity of the database is 6 MB
Oracle Basic Data Types • Variable length character • VARCHAR2 • Maximum is 4000 bytes and minimum is 1 • Date • from January 1, 4712 BC to December 31, 9999 AD
Oracle Data Types Contd. • Number • Binary data • BLOB (binary large object) • Can contain 4 gigabytes -84 127 number – 10 – 10 with precision up to 38 decimal places
Oracle – Creating a Database • Database creation commands • create database webtraffic • Tablespace • CREATE TABLESPACE tabspace_5 DATAFILE'diskb:tabspace_file1.dat' SIZE 500K REUSE AUTOEXTEND ON NEXT 500K MAXSIZE 10M;
Oracle – Creating Tables • Creating tables with constraints: • CREATE TABLE emp • (empno NUMBER PRIMARY KEY, • ename VARCHAR2(10) NOT NULL, • job VARCHAR2(9), • mgr NUMBER CONSTRAINT fk_mgr • REFERENCES emp(empno), • hiredate DATE DEFAULT SYSDATE, • sal NUMBER(10,2) CONSTRAINT ck_sal CHECK (sal > 500), • comm NUMBER(9,0) DEFAULT NULL, • deptno NUMBER(2) NOT NULL, • CONSTRAINT fk_deptno REFERENCES dept(deptno) ) tablespace users;
Oracle – Creating Tables • Creating table in an existing database (default tablespace) • create table staff ( ssn varchar2(11), last_name varchar2(30), first_name varchar2(30), mid_name varchar2(1), date_emp date, salary number );
Oracle – Data Dictionary Query • To show the content of a table: • SQL> describe staff • Name Null? Type • ------------------------------- -------- ---- • SSN NOT NULL VARCHAR2(11) • LAST_NAME VARCHAR2(30) • FIRST_NAME VARCHAR2(30) • MID_NAME VARCHAR2(1) • DATE_EMP DATE • SALARY NUMBER
Viewing the Tables from the Data Dictionary SQL> select table_name from user_tables; TABLE_NAME ------------------------------ ASSIGNMENT BUILDING WORKER
Oracle - Insert • To insert records: • SQL> insert into staff values ( '223-45-7896', 'Tribso', 'Daniel', 'J', '4-Dec-1995', 4568.50);
Case of commands and content • Note that Oracle is case insensitive to SQL commands • But, case sensitive to actual content of fields
Oracle - Update • To add a new column to a table: • Alter table staff add (date_dep date); • To modify a column data type: • Alter table staff modify (date_dep number); • To drop a table: • DROP TABLE test_data;
Oracle - Update • To update record/s in a table: • update staff set salary=999 where ssn='111-22-3333';
Oracle - Delete • To delete record: • delete from staff where ssn='111-22-3333';
Oracle - Retrieve • To retrieve records: • Select * from staff; • Will show all records and all fields • Select ssn, salary from staff; • Will only show two fields
Oracle – Formatted Retrieval • select to_char(start_date, 'yyyy') "year" from assignment;
Oracle – Making Changes Permanent • Must use commit command to finalize the actual update • SQL> commit;
Servlets • Java’s servlet architecture aid in designing applications that run on the network • Servlets can be used to create applications that take advantage of the server machine’s resources
Servlets Server Apache Servlet Client Store files Retrieve files Explorer
Servlets • Servlets are currently supported by the following web servers: • Netscape web servers • Microsoft’s IIS • Jigsaw by W3C • Apache
DB Server Oracle Web Server Apache Servlet Client Conduct database manipulation over the WWW Explorer
Servlets • Can be used to create multi-tiered applications • Client to - WWW server to - Database
Servlets • Servlet architecture also allows for the creation of “thin clients” – requires no VM on the client side • Servlets can generate dynamic HTML output based on user’s demands/requests
Creating Servlets • 1) Create the HTML “front-end” • Keep track of variables that you used with the form elements • 2) Create the servlet/s to be invoked when the submit button is clicked
Servlet Structure – Relevant Packages • Need to use the two main servlet packages: • javax.servlet and javax.servlet.http
Servlet Structure • The HTTPServlet class is extended • When a request arrives at the server (WWW) the server creates a “HTTPServletRequest object” and passes that on to the servlet’s service method • The service method – part of the superclass HTTPServlet – calls the doGet or doPost methods
Servlet Structure • doGet • Information sent from the client to the server is minimal … part of the URL • doPost • Information sent from the client when the user fills out large amount of information on a form … not appended to the URL • The service method of the superclass calls doGet or doPost accordingly
Servlet Structure – Basic Process • Basic steps in the servlet program • doGet or doPost method • Process input • Generate HTML output • The servlet overrrides the doGet or doPost method
HTML Front-End <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>BookStore</title><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"></head> <body> <p align="center"><img src="title.gif" width="645" height="53"> </p> <center> <table width="650" border="0" cellspacing="5" cellpadding="10"> <tr> <td width="200" bgcolor="#99CC99"> <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Search by Title:</strong></font> <form method="post" action="http://mentor.ucs.indiana.edu:10713/servlet/TitleServlet"> <input name="title" value=""> <input name="submit" type="submit" value="Submit"> </form> <form name="form1" method="post" action=""> <strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <a href="search.html">Advanced Search:</a> </font></strong> </form> <p> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Search by Category:</strong></font> <form method="post" action="http://mentor.ucs.indiana.edu:10713/servlet/CategoryServlet"> <select name="category"> <option value="java" SELECTED>Java</option> <option value="perl">Perl</option> <option value="javascript">JavaScript</option> <option value="web_server">Web Server</option> <option value="html">HTML</option> </select> <input type="submit" name="Submit" value="Submit"> </form>
Servlet Code Fragment: TitleServlet import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.sql.*; public class TitleServlet extends HttpServlet { /** * Initialize global variables */ public void init(ServletConfig config) throws ServletException { super.init(config); } /** * Process the HTTP Post request */ /** * Process the HTTP Post request */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String title = request.getParameter("title"); response.setContentType("text/html"); PrintWriter out = new PrintWriter (response.getOutputStream()); out.println("<html>"); out.println("<head><title>Title Search</title></head>"); out.println("<body><table border=1 cellpadding = 5 cellspacing = 0>"); try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@dbserv.uits.indiana.edu:1521:oed1","username","password"); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT pict, year, title, author FROM book where title like '%" + title + "%'"); ResultSetMetaData rsmd = rs.getMetaData(); int nCols = rsmd.getColumnCount(); int i; for (i=0; i<nCols; i++) out.println("<th>"+rsmd.getColumnName(i+1)+"</th>"); out.println("</tr>"); while (rs.next()) …
Usability Analysis • HCI Usability • Usability is a sub-field of HCI: Relates to methodologies for establishing utility of a system
Why Conduct Usability? • Designers can become so entranced with their creations that they may fail to evaluate them adequately. • Experienced designers have attained the wisdom and humility to know that extensive testing is a necessity. • The range of costs might be from 10% of a project down to 1%. • Sheneiderman, B. DTUI
Usability Plan • The determinants of the evaluation plan include: • stage of design (early, middle, late) • novelty of project (well defined vs. exploratory) • number of expected users • criticality of the interface (life-critical medical system vs. museum exhibit support) • costs of product and finances allocated for testing • time available • experience of the design and evaluation team
Different Levels of Usability Evaluation • Expert Reviews • Usability Lab • Evaluation During Active Use • Formal experiments • Long-term use - surveys
Specific Criteria for Usability • The goals of usability evaluation generally are: • Establish user efficiency: time, errors, completions • Establish user satisfaction
Conducting Usability • To collect data on efficiency and satisfaction use two types of instruments: • Efficiency: Benchmark comparison • Satisfaction: Set of specific criteria • Shneiderman Chapters: • http://www.awl.com/DTUI/webres/ch4.html • http://www.awl.com/DTUI/toc.html
Establishing Efficiency Benchmark • Create a set of questions/tasks that “exercise” all the major features of your interface • Time yourself: How long does it take to accurately complete each task and answer the questions. • Also establish number of steps involved (if appropriate)
Collecting data before and during sessions • Select subjects with varied background • Collect appropriate demographic/background information: age, gender, academic background, level system experience • Ask subjects to conduct the benchmark tasks and collect data (time, errors, completions, and steps)
Collecting data after the session • Using online QUIS • After the tasks are completed by the subject display the QUIS form in a browser • Help the user fill up name of the system and the email • Ask them to complete the rest of the form and click on “mail data” button • Collect the data from the email account and tally it