about initial project reports
play

About initial project reports Your initial report should describe - PDF document

Practical matters About initial project reports Your initial report should describe what you are going to implement well. It should include, Database-enabled web technology the requirements Web Programming your initial database design


  1. Practical matters About initial project reports Your initial report should describe what you are going to implement well. It should include, Database-enabled web technology ◮ the requirements Web Programming ◮ your initial database design Things to think about (while sketching the requirements): Instructor: C ¸a˘ grı C ¸¨ oltekin ◮ who are your user(s)? c.coltekin@rug.nl ◮ do you need multiple user interfaces (e.g., one for end users, Information science/Informatiekunde one for administrators of the system) ◮ do you need to store any sensitive information? (credit card Fall 2011/12 numbers, identities, etc.) ◮ how do you authenticate your users? ◮ are there possible performance issues? Which columns in your database will be used most in typical queries? C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 1/30 Previously in this course . . . Previously in this course . . . So far... A first PHP/MySQL example 1 <?php 2 $host="hostname"; 3 $user="username"; 4 $pass="password"; 5 $db="dbname"; 6 mysql_connect ($host ,$user ,$pass ); ◮ A quick introduction to PHP basics. 7 mysql_select_db ($db); ◮ Another introduction on git version management system. 8 $q = ’select * from book ’; 9 ◮ Review of database design and SQL. 10 $res = mysql_query($q); ◮ An introduction to using SQL from PHP. 11 echo "<table border =\"1\" >"; 12 echo "<tr ><th >ISBN </th ><th >title </th ></tr >"; 13 while ($row = mysql_fetch_assoc ($res )) { 14 echo "<tr ><td >${row[’ISBN ’]}</td >"; 15 echo "<td >${row[’title ’]}</td ></tr >"; 16 } 17 echo " </table >"; 18 mysql_close (); 19 ?> C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 2/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 3/30 The web programming model The web programming model The multi-tier (or 3-tier) architecture Web-programimg model: what runs where Application Presentation Data Client Web Server Web Server DB Server Application Database Client Web server Network Network server server Web browser DB server Presentation tier interacts with the user (e.g., ask the seat Javascript Web server Web server SQL AJAX CGI CGI preference in an airline online check-in system). Stored Java applets PHP PHP procedures Application tier implements the ‘business logic’ (e.g., check and Adobe Flash reserve a seat, possibly using multiple queries and updates). Data tier stores the data (e.g., retrieve and/or update the relevant data records). In this lecture we will study the client–server interaction and In practice, division may not match the figure above. However server-side programming separating presentation from application is always a good idea. C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 4/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 5/30 Web programming: background Web programming: background What happens when you click on a link? Layers in communication C Extract the URL: http://www.rug.nl/let/informatiekunde Web browser Web server C Parse the URL: Host: www.rug.nl, Protocol: HTTP, Resource: HTTP HTTP /let/informatiekunde TCP TCP C Resolve the host name: 129.125.2.51 IP IP C Find the default port number for HTTP: 80 Physical layer Physical layer C Open a TCP connection to the IP:port S Accept the connection C Send the HTTP request: GET /let/informatiekunde HTTP/1.1. . . Network S Read the request, process it S Form a response and send it C Read the response, process it ◮ Web server and web browser talks to each other using HTTP. C Close the connection ◮ The HTTP messages goes through a set of networking layers. This is still an overview, a lot more happens under the hood. ◮ We are mainly interested in HTTP, some aspects of TCP/IP C: Client, S: Server networking is relevant to web programming. C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 6/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 7/30

  2. Web programming: background Web programming: background Three-slide introduction to TCP/IP (1) Three-slide introduction to TCP/IP (2) ◮ The hosts in a TCP/IP network is identified with a unique IP ◮ TCP/IP is the name of the network protocol family used in address. the Internet. ◮ IP(v4) addresses are 4-byte integers, e.g., 129.125.2.51 (New ◮ It is more than TCP and IP. Just to list a few: UDP, BGP, version of IP, IPv6, uses longer IP addresses). DHCP, ICMP, DNS, ... ◮ DNS maps more human readable domain names, like ◮ The IP protocol is connectionless, it does it’s best to deliver a www.rug.nl to IP addresses. network packet to it’s destination. ◮ IP does not guarantee the delivery of every packet. DNS can be used for distributing load: ◮ TCP works on IP, it is connection oriented. With TCP, you do A particular host name can be assigned multiple IP addresses. For not worry about the lost packets. each DNS query, a DNS server will issue one of the IP addresses in a round-robin fashion C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 8/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 9/30 Web programming: background Web programming: background Three-slide introduction to TCP/IP (3) Anatomy of a URL http://www.rug.nl:80/let/informatiekunde ◮ Commonly used services have reserved port numbers, for 1 2 3 4 example 80: HTTP, 443: HTTPS, 22: SSH . . . 1 ◮ A server typically ‘listens’ on a reserved port for client Scheme indicates the protocol. The rest of the URL may be different depending on the scheme. connections. ◮ Clients reserve temporary port numbers. 2 Domain name is the name of the host where the ◮ Each end of a connection is identified by IP address/port HTTP service runs. 3 number pairs. Port number can optionally be given in cases where the service do not run on the default port. ◮ Connection is typically initiated by a client, any of the parties can close the connection. 4 Path typically identifies the (HTML) files on the server, but can express more than a file name. The interpretation is dependent on the web server. C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 10/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 11/30 Web programming: background Web programming: background HTTP: an overview HTTP requests 1 GET / HTTP/1.1 ◮ HTTP is a request-response protocol. Clients asks for an 2 Host : www. rug . n l operation on a resource, possibly with some content, and 3 User − Agent : M o z i l l a /5.0 (X11 ; Linux x86 64 ; rv : 8 . 0 ) . . . server responds, likely with some content. 4 Accept : t e x t /html , a p p l i c a t i o n / xhtml+xml , . . . 5 Accept − Language : en − us , en ; q=0.5 ◮ The requested operation has to be one of 9 HTTP methods, 6 Accept − Encoding : gzip , d e f l a t e like GET , HEAD or POST . 7 Accept − Charset : UTF − 8, ∗ 8 Connection : keep − a l i v e ◮ Response message starts with a status message. 9 Cookie : acceptedLanguages=en ; s n r =1321910886052 . . . ◮ Both request and response can include additional headers, 10 which provide additional information. ◮ HTTP protocol does not encrypt the communication, nor has ◮ First line is the actual request, here using method GET . it any mechanism to verify the identity of server or the client. ◮ The rest of the lines are headers that provide additional ◮ HTTPS is an extension of HTTP that uses Secure Socket information. Layer (SSL). ◮ The empty line (10) is important. It signals the end of headers. C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 12/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 13/30 Web programming: background Web programming: background HTTP response HTTP methods 1 HTTP/1.1 200 OK HTTP standard defines 9 methods, but we are only interested in 2 Date : Wed, 23 Nov 2011 01:11:25 GMT 3 Server : Apache /2.2 GET Typically used to get a static content (e.g., file). But 4 Last − Modified : Tue , 11 Mar 2008 11:35:02 GMT it can also be used for dynamic content (we will 5 Content − Length : 260 return to this). 6 Content − Type : a p p l i c a t i o n / html 7 HEAD It is like GET, but server only responds with headers, 8 < !DOCTYPE html PUBLIC ” − //W3C//DTD HTML . . . no content is transferred. 9 < html > POST is used when client needs to transfer some content. 10 . . . Typically content is the name/value pairs from a HTML form. However, it can be anything that ◮ The first line is the status line. server/client agree on. ◮ Again, server gives us a set of header lines followed by an Others (for the sake of completeness): PUT, DELETE, OPTIONS, CONNECT, empty line and the content. PATCH, TRACE. ◮ The response can also indicate a permanent or temporary error, or a redirection message. C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 14/30 C ¸. C ¸¨ oltekin, Informatiekunde Databases & Web 15/30

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend