Revision Lecture: HTML, CSS and XML Perl/CGI, Perl/DOM, Perl/DBI, Remote Procedure Calls Dr. Andrew C.R. Martin

Slides:



Advertisements
Similar presentations
Web forms and CGI scripts Dr. Andrew C.R. Martin
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
W EB A PPLICATION D EVELOPMENT A PPLICATION T O B IO -I NFORMATICS -III Vicky Khanna M-Tech Bioinformatics.
1. Content – Collective term for all text, images, videos, etc. that you want to deliver to your audience. 2. Structure – How the content is placed on.
Tutorial 6 Creating a Web Form
HTML Hypertext Markup Language –First proposed by CERN in 1989 –It is non-linear so it allows you to jump from place to place –Markup refers to the structure.
Tutorial 6 Working with Web Forms
Lecture 2B: HTML and CSS IT 202—Internet Applications Based on notes developed by Morgan Benton.
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
Introduction to Web Interface Technology (CSE2030)
Tutorial 11 Creating XML Document
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Web Design Basic Concepts.
Perl/XML::DOM - reading and writing XML from Perl Dr. Andrew C.R. Martin
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Creating a Basic Web Page
DAT602 Database Application Development Lecture 14 HTML.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
Introduction to InfoSec – Recitation 7 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Python CGI programming
Biocomputing II Andrew C.R. Martin Adrian Shepherd Lorenz Wernisch.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
USING PERL FOR CGI PROGRAMMING
CSE 190: Internet E-Commerce Lecture 5. Exam Material Lectures 1-4 (Presentation Tier) –3-tier architecture –HTML –Style sheets –Javascript –DOM –HTTP.
Lecture 15 Introduction to Web Services Web Service Applications.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Website Development with PHP and MySQL Saving Data.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
ITCS373: Internet Technology Lecture 5: More HTML.
HTML Basics BCIS 3680 Enterprise Programming. Web Client/Server Architecture 2  Your browser (the client) requests a Web page from a remote computer.
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
XML Basics A brief introduction to XML in general 1XML Basics.
XML Engr. Faisal ur Rehman CE-105T Spring Definition XML-EXTENSIBLE MARKUP LANGUAGE: provides a format for describing data. Facilitates the Precise.
Introduction to JavaScript CS101 Introduction to Computing.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
S O A P ‘the protocol formerly known as Simple Object Access Protocol’ Team Pluto Bonnie, Brandon, George, Hojun.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
HTML Forms.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
National College of Science & Information Technology.
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Introduction to XHTML.
Using Access and the Web
Microsoft Office Illustrated
Remote Procedure Calling
Lecture 1: Multi-tier Architecture Overview
Presentation transcript:

Revision Lecture: HTML, CSS and XML Perl/CGI, Perl/DOM, Perl/DBI, Remote Procedure Calls Dr. Andrew C.R. Martin

Exam questions  You will not be expected to write significant amounts of code or HTML  Short answer questions  HTML/Perl fragments -  spot errors  explain what they do  fill in the gap  Make changes to code/HTML/XML  Simple discussions –  'What are the problems with...'  'Explain how...'

HTML, CSS and XML

HTML This text is in bold tag closing-tag

HTML My bioinformatics page attribute

HTML  Some tags do not require an end tag  the tag is started with

The most useful HTML tags

  …  ,,,  ,,, ,, 

Cascading style sheets (CSS)  Separation between content and presentation  Easier to produce consistent documents  Allows font, colour and other rendering styles for tags to be defined once

Cascading style sheets (CSS)  Can create ‘classes’ offering further control and separation: { text-align: right; }. { font-weight: bold; }

XML eXtensible Markup Language  Simply marks up the content to describe its semantics  XML is much stricter than HTML:  case sensitive,  balanced tags with correct nesting  attributes always have values in inverted commas

Pros and cons Pros  Simple format  Familiarity  Straightforward to parse  parsers available Cons  File size bloat  though files compress well  Format perhaps too flexible  Semantics may vary – what is a 'gene'?

 Case sensitive  Opening tags must have closing tags  Tags must be correctly nested  Attributes must have values  Attribute values must be in inverted commas HTML4.0 (XHTML) New standard is now described in XML and therefore much more strict..foo....foo.. illegal illegal illegal

Problems of the web Data Web page Extract data Data Partial data Semantics lost Errors in data extraction Extract data Provider Consumer Visual markup Partial (error- prone) data

Web forms and CGI scripts

The Internet FTP News The Web Remote access RPC The Internet

CGI Script How does the web work? Send request for page to web server Pages External Programs RDBMS Web browser Web server CGI can extract parameters sent with the page request

What is CGI?  Common Gateway Interface  the standard method for a web server to interact with external programs  CGI.pm is a Perl module to make it easyto interact with the web server  The majority of forms-based web pages use CGI.pm

Creating a form A simple form: Enter your sequences in FASTA format: To submit your query, press here: To clear the form and start again, press here: How data are sent to the server The CGI script to be run on the server Buttons and text boxes

A simple CGI script #!/usr/bin/perl use CGI; $cgi = new CGI; $val = $cgi->param('id'); print $cgi->header(); print <<__EOF; Print ID Parameter __EOF print “ ID parameter was: $val \n”; print “ \n”;

Perl/XML::DOM - reading and writing XML from Perl

XML Parsers  Assemble complete document from different sources of data  Handle different character encodings  Check for syntax and validation errors  Read stream of characters  Optionally replace entity references  (e.g. < with <)  Pass data to client program Good parser will:

Summary - reading XML Create a parser $parser = XML::DOM::Parser->new(); Parse a file $doc = $parser->parsefile( ' filename ' ); Extract all elements matching tag-name $element_set = $doc->getElementsByTagName( ' tag-name') Extract first element of a set $element = $element_set->item(0); Extract first child of an element $child_element = $element->getFirstChild; Extract text from an element $text = $element->getNodeValue; Get the value of a tag’s attribute $text = $element->getAttribute( ' attribute-name');

Perl/DBI - accessing databases from Perl

CGI Script Why access a database from Perl? Send request for page to web server Pages External Programs RDBMS Web browser Web server CGI can extract parameters sent with the page request

Why access a database from Perl? Populating databases  Need to pre-process and re-format data into SQL  Intermediate storage during data processing Reading databases  Good database design can lead to complex queries (wrappers)  Need to extract data to process it

DBI Architecture  Multi-layer design Perl script DBI DBD Database API RDBMS Database Independent Database Dependent

DBI Architecture DBD::pg Driver Handle Database Handle Statement Handle $dbh = DBI->connect($datasource,... ); $sth = $dbh->prepare($sql);

Data sources $dbname = “mydatabase”; $dbserver = “dbserver.cryst.bbk.ac.uk”; $dbport = 5432; $datasource = “dbi:Oracle:$dbname”; $datasource = “dbi:mysql:database=$dbname;host=$dbserver”; $datasource = “dbi:Pg:dbname=$dbname;host=$dbserver;port=$dbport”; Format varies with database module $dbh = DBI->connect($datasource, $username, $password); Optional; supported by some databases. Default: local machine and default port.

SQL commands with no return value  From Perl/DBI:  e.g. insert a row into a table: $sql = “INSERT INTO idac VALUES (‘LYC_CHICK’, ‘P00698’)”; $dbh->do($sql);

SQL commands that return a single row $sql = “SELECT * FROM idac WHERE ac = = $dbh->selectrow_array($sql);  Columns placed in an array  Could also have been placed in a list: ($id, $ac) = $dbh->selectrow_array($sql);

SQL commands that return a multiple rows NB: statement handle / fetchrow_array rather than db handle / selectrow_array $sql = “SELECT * FROM idac”; $sth = $dbh->prepare($sql); if($sth->execute) { while(($id, $ac) = $sth->fetchrow_array) { print “ID: $id AC: $ac\n”; }

Remote Procedure Calling

What is RPC? A network accessible interface to application functionality using standard Internet technologies Network RPC Web Service

Why do RPC?  distribute the load between computers  access to other people's methods  access to the latest data

Ways of performing RPC  screen scraping  simple cgi scripts  custom code to work across networks  standardized methods  (e.g. CORBA, SOAP, XML-RPC)

Screen scraping Network Screen scraper Web server Extracting content from a web page

Fragile procedure...  Trying to interpret semantics from display-based markup  If the presentation changes, the screen scraper breaks

Pros and cons Advantages  'service provider' doesn’t do anything special Disadvantages  screen scraper will break if format changes  may be difficult to determine semantic content

Simple CGI scripts (REST) Extension of screen scraping  relies on service provider to provide a script designed specifically for remote access Client identical to screen scraper  but guaranteed that the data will be parsable (plain text or XML) Server's point of view  provide a modified CGI script which returns plain text  May be an option given to the CGI script

Standardized methods  Various methods. e.g.  CORBA  XML-RPC  SOAP

Advantages of SOAP ApplicationXML messageApplication Information encoded in XML  Language independent  All data are transmitted as simple text

Advantages of SOAP HTTP post  SOAP request HTTP response  SOAP response  Normally uses HTTP for transport  Firewalls allow access to the HTTP protocol  Same systems will allow SOAP access

Exam questions

 You will not be expected to write significant amounts of code or HTML  Short answer questions  HTML/Perl fragments -  spot errors  explain what they do  fill in the gap  Make changes to code/HTML/XML  Simple discussions –  'What are the problems with...'  'Explain how...'

Lecture notes