web technologies using the internet to publish data and applications

34
Web Technologies Using the Internet to publish data and applications

Upload: alex-plough

Post on 14-Dec-2015

221 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Web Technologies Using the Internet to publish data and applications

Web Technologies

Using the Internet to publish data and applications

Page 2: Web Technologies Using the Internet to publish data and applications

The Web Development Infrastructure

Page 3: Web Technologies Using the Internet to publish data and applications

Creating Content For The WWW

http://www.htmlprimer.com

Page 4: Web Technologies Using the Internet to publish data and applications

Maxim 15.1

Take the time to learn HTML

Page 5: Web Technologies Using the Internet to publish data and applications

<HTML><HEAD><TITLE>A Simple HTML Page</TITLE></HEAD><BODY>This is as simple a web page as there is.</BODY></HTML>

A Simple HTML Page

Page 6: Web Technologies Using the Internet to publish data and applications

#! /usr/bin/perl -w

# produce_simple - produces the "simple.html" web page using# a HERE document.

use strict;

print <<WEBPAGE;<HTML><HEAD><TITLE>A Simple HTML Page</TITLE></HEAD><BODY>This is as simple a web page as there is.</BODY></HTML>WEBPAGE

Producing HTML

Page 7: Web Technologies Using the Internet to publish data and applications

#! /usr/bin/perl -w

# produce_simpleCGI - produces the "simple.html" web page using# Perl's standard CGI module.

use strict;

use CGI qw( :standard );

print start_html( 'A Simple HTML Page' ), "This is as simple a web page as there is.", end_html;

Producing HTML, cont.

Page 8: Web Technologies Using the Internet to publish data and applications

<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"

xml:lang="en-US"><head><title>A Simple HTML Page</title></head><body>This is as simple a web page as there

is.</body></html>

Results from produce_simpleCGI

Page 9: Web Technologies Using the Internet to publish data and applications

Maxim 15.2

Create static web pages either manually or visually

Page 10: Web Technologies Using the Internet to publish data and applications

#! /usr/bin/perl -wT

# whattimeisit - create a dynamic web page that includes the# current date/time.

use strict;

use CGI qw( :standard );

print start_html( 'What Date and Time Is It?' ), "The current date/time is: ", scalar localtime, end_html;

The dynamic creation of WWW content

Page 11: Web Technologies Using the Internet to publish data and applications

<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"

xml:lang="en-US"><head><title>What Date and Time Is It?</title></head><body>The current date/time is: Mon Aug 25 23:21:55

2003</body></html>

Results from whattimeisit ...

Page 12: Web Technologies Using the Internet to publish data and applications

<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"

xml:lang="en-US"><head><title>What Date and Time Is It?</title></head><body>The current date/time is: Tue Aug 26 08:04:23

2003</body></html>

And some time later ...

Page 13: Web Technologies Using the Internet to publish data and applications

Maxim 15.3

Always enable ``taint mode'' for server-side programs

Page 14: Web Technologies Using the Internet to publish data and applications

$ chkconfig --add httpd

$ chkconfig httpd on

$ locate httpd.conf

Preparing Apache For Perl

Page 15: Web Technologies Using the Internet to publish data and applications

/etc/httpd/conf/httpd.conf

ServerAdmin root@localhost

DocumentRoot "/var/www/html"

/var/www/html/index.html

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

Configuring Apache

Page 16: Web Technologies Using the Internet to publish data and applications

/etc/init.d/httpd start

http://localhost/

Running Apache

Page 17: Web Technologies Using the Internet to publish data and applications

Maxim 15.4

Test your web-site on localhost prior to deployment on the Internet

Page 18: Web Technologies Using the Internet to publish data and applications

$ su

$ cp whattimeisit /var/www/cgi-bin

$ chmod +x /var/www/cgi-bin/whattimeisit

$ <Ctrl-D>

Testing the execution of server-side programs

Page 19: Web Technologies Using the Internet to publish data and applications

The ``Server Error'' web page.

figSERVERERROR.eps

Page 20: Web Technologies Using the Internet to publish data and applications

The ``What Date and Time Is it?'' web page.

figSERVERTIME.eps

Page 21: Web Technologies Using the Internet to publish data and applications

#! /usr/bin/perl -wT

# The 'match_emblCGI' program - check a sequence against the EMBL# database entry stored in the# embl.data.out data-file on the# web server.

use strict;

use CGI qw/:standard/;

print header;

open EMBLENTRY, "embl.data.out" or die "No data-file: have you executed prepare_embl?\n";

my $sequence = <EMBLENTRY>;

close EMBLENTRY;

Sending Data To A Web Server

Page 22: Web Technologies Using the Internet to publish data and applications

print start_html( "The results of your search are in!" );print "Length of sequence is: <b>", length $sequence, "</b> characters.<p>";print h3( "Here is the result of your search:" );

my $to_check = param( "shortsequence" );

$to_check = lc $to_check;

if ( $sequence =~ /$to_check/ ){ print "Found. The EMBL data extract contains: <b>$to_check</b>.";}else{ print "Sorry. No match found for: <b>$to_check</b>.";}

print p, hr,p;print "Press <b>Back</b> on your browser to try another search.";print end_html;

match_emblCGI, cont.

Page 23: Web Technologies Using the Internet to publish data and applications

<HTML><HEAD><TITLE>Search the Sequence for a Match</TITLE></HEAD><BODY>

Please enter a sequence to match against:<p><FORM ACTION="/cgi-bin/match_emblCGI"><p><textarea name="shortsequence" rows="4" cols="60"></textarea></p><p><input type="reset" value="Clear"><input type="submit" value="Try it!"></p></FORM></BODY></HTML>

A Search HTML Page

Page 24: Web Technologies Using the Internet to publish data and applications

The ``Search the Sequence for a Match'' web page

figMERSEARCH.eps

Page 25: Web Technologies Using the Internet to publish data and applications

$ su

$ cp mersearch.html /var/www/html

$ cp match_emblCGI /var/www/cgi-bin

$ chmod +x /var/www/cgi-bin/match_emblCGI

$ cp embl.data.out /var/www/cgi-bin

$ <Ctrl-D>

Installing CGIs on a Web Server

Page 26: Web Technologies Using the Internet to publish data and applications

The ``Results of your search are in!'' web page

figMERSEARCHFOUND.eps

Page 27: Web Technologies Using the Internet to publish data and applications

The ``Sorry! Not Found'' web page

figMERSEARCHSORRY.eps

Page 28: Web Technologies Using the Internet to publish data and applications

print <<MERFORM;

Please enter another sequence to match against:<p><FORM ACTION="/cgi-bin/match_emblCGIbetter"><p><textarea name="shortsequence" rows="4" cols="60"></textarea></p><p><input type="reset" value="Clear"><input type="submit" value="Try it!"></p></FORM>MERFORM

Using a HERE document

Page 29: Web Technologies Using the Internet to publish data and applications

Better version: ``Results of your search are in!'' web page

figMERSEARCHBETTER.eps

Page 30: Web Technologies Using the Internet to publish data and applications

Web Databases

Page 31: Web Technologies Using the Internet to publish data and applications

Searching all the entries in the dnas table

figMERSEARCHMULTI.eps

Page 32: Web Technologies Using the Internet to publish data and applications

The ``results'' of the multiple search on the dnas table

figMERSEARCHMULTIRESULTS.eps

Page 33: Web Technologies Using the Internet to publish data and applications

$ su

$ cp mersearchmulti.html /var/www/html

$ cp db_match_emblCGI /var/www/cgi-bin

$ chmod +x /var/www/cgi-bin/db_match_emblCGI

$ cp DbUtilsMER.pm /var/www/cgi-bin

$ <Ctrl-D>

Installing DB Multi-Search

Page 34: Web Technologies Using the Internet to publish data and applications

Where To From Here