LING 408/508: Programming for Linguists Lecture 16 October 16 th.

Slides:



Advertisements
Similar presentations
1/16 Steven Leung Introduction to HTML/CGI/JavaScript Intro to HTML/CGI/JavaScript How the Web Works HTML: Basic Concept CGI: Basic Concept JavaScript:
Advertisements

Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
20-753: Fundamentals of Web Programming 1 Lecture 11: Web Server Case Study Fundamentals of Web Programming Lecture 11: Web Server Case Study.
Chapter Apache Installation on Linux. Acknowledgement The contribution made by Darrin Morison is acknowledged.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
Outcomes Know what are CGI Environment Variables Know how to use environment variables How to process A simple Query Form Able to use URL Encoding rules.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Web Server Setup WEB SERVER SETUP.
Web Client/Server Communication A290/A590, Fall /09/2014.
APACHE SERVER By Innovationframes.com »
Linux Operations and Administration
1 ‘Dynamic’ Web Pages So far, we have developed ‘static’ web-pages, e.g., cv.html, repair.html and order.html. There is often a requirement to produce.
The Linux Operating System Lecture 5: Apache Tonga Institute of Higher Education.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 10: Basic Apache Configuration and Management Chapter 26: Apache (httpd): Setting Up a Web.
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
LING 408/508: Programming for Linguists Lecture 17 October 21 st.
Web Servers Installation and Configuration May 24, 2001 CIS System Administration Problem Statement The class topic is setting up a Linux server to support.
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
Server-side Scripting Powering the webs favourite services.
Internet / Intranet CIS-536 Class 7. 2 HTML Forms A Method to Allow Users to Pass Information to a CGI Script Forms Allow Information to Be Entered Via:
An introduction to Apache. Different Types of Web Servers Apache is the default web server for may Unix servers. IIS is Microsoft’s default web server.
Sponsored by the National Science Foundation Configuration Management For Experimenters: Ansible Hands-On Sarah Edwards, GPO.
Nic Shulver, Intro: Developing Server Applications What is a server? Many types of server – File server – file: networked file.
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.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 Week 6 The lynx browser Apache Web Server John Wang With materials courtesy of Inge Mclaurin.
Website Development with PHP and MySQL Saving Data.
CGI Programming. What is it? CGI –Common Gateway Interface Standard way to pass information back to the Web Server –GET Query String –POST Standard Input.
Chapter 6 Server-side Programming: Java Servlets
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
Perl: Lecture 2 Advanced RE & CGI. Regular Expressions 2.
Cosc 4750 Configuring httpd, Mysql, And Samba. defaults By default httpd demean will startup and work User directories are turned off Default directory.
LinuxChix Apache. Serving Webpages The layer 7 protocol (HTTP) is what our browsers talk to get us the websites we can't seem to live without. HTTP is.
Form Data Encoding GET – URL encoded POST – URL encoded
WWW: an Internet application Bill Chu. © Bei-Tseng Chu Aug 2000 WWW Web and HTTP WWW web is an interconnected information servers each server maintains.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
LING 408/508: Programming for Linguists Lecture 17 October 28 th.
WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages.
LING 408/508: Programming for Linguists Lecture 18 November 2 nd.
 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.
LING 408/508: Programming for Linguists Lecture 16 October 26 th.
World Wide Web Components Browsers and Servers CGI Processing Model (Common Gateway Interface) © Norman White, 2001.
More than one site? Use multiple configuration files Use multiple configuration files  httpd –d {path}  Assumes “conf/httpd.conf” Logging transactions.
Web Server Apache PHP HTTP Request User types URL into browser Address resolved if nec. We use directly Most browsers request.
Lab 8 Overview Apache Web Server. SCRIPTS Linux Tricks.
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
Planning, configuring, running and maintaining a web server -1.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Apache Web Server v. 2.2 Reference Manual Chapter 2 Starting Apache.
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
Linux, Apache, MySQL, PHP/Python/PERL ● a.k.a. LAMP ● Standard set of tools for configuring a Linux-based web server with database & interfacing capabilities.
Introduction to Dynamic Web Programming
HTTP – An overview.
Unix System Administration
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
World Wide Web Components
SHELLSHOCK ATTACK.
Presentation transcript:

LING 408/508: Programming for Linguists Lecture 16 October 16 th

Last Time Puzzle left over: – use Javascript regex replace to delete all non-heads in:

Last Time Examples: all heads => [X] all labels => X

Last Time Examples: all non-heads => [X] crucially (?=\[) means [ is not part of the match, so next match can begin at the last [ (instead of one character past)

Last Time Examples: all non-heads have been deleted i.e. we have the frontier of the tree delete extra right brackets

Building a Webserver We'll use cgi-bin and bash scripts initially … Apache2 is the most common webserver software – unfortunately, configuration are different on OSX and Ubuntu

Common Gateway Interface (CGI) The glue between a webserver and programs that run on the computer (= server) hosting the webserver Normally, a webserver sends out (static) webpages in response to (URL) requests from a client (your web browser). Sometimes, we want the request to run a program (a script or binary) on the server that does some computation and generates some result to be displayed on the client (as a webpage). generated.html client server: webserver

Apache Webserver on OSX Webpage storage locations: –/Library/WebServer/Documents index.html.en It works! – ~/Sites(/Users/username/Sites) – index.html – cgi-bin: –/Library/WebServer/CGI-Executables – Example: permissions for.cgi should be readable and executable, e.g. chmod 755 test.cgi

Apache Webserver on Ubuntu Ubuntu: – sudo apt-get update – sudo apt-get install apache2 DocumentRoot /var/www/html /var/www/html/index.html CGI binaries: /usr/lib/cgi-bin files must be made executable!

Apache Webserver on OSX Pre-installed on OSX To run cgi-bin files outside of the default /Library/WebServer/CGI-Executables we need to modify the Apache httpd configuration file: /private/etc/apache2/httpd.conf – Uncomment: AddHandler cgi-script.cgi Warning message: – "Could not reliably determine the server’s fully qualified domain name" – Solution: define in httpd.conf: ServerName localhost

Apache Webserver on OSX Apache webserver: – /usr/sbin/apachectl – sudo apachectl -k start|stop|restart Port number: – 80standard (httpd daemon listens on this port) Configuration file: – /private/etc/apache2/httpd.conf Log: – ErrorLog "/private/var/log/apache2/error_log"(see httpd.conf)

Apache2 on Ubuntu Apache webserver: – sudo service apache2 restart|stop|start – sudo apache2ctl -k start|stop|restart(apache2ctl is in /usr/sbin) Port number: – 80standard(httpd daemon listens on this port) Master configuration file: – /etc/apache2/httpd.conf Log: – ErrorLog /var/log/apache2/error_log Configuration files: – /etc/apache2/sites-enabled/000-default.conf – /etc/apache2/conf-enabled/serve-cgi-bin.conf

Apache2 on Ubuntu /etc/apache2/conf-enabled/serve-cgi-bin.conf

Apache2 on Ubuntu Debian-based (e.g. Ubuntu) Apache2: – sudo a2enmod cgi effect is permanent creates symbolic link from mod-enabled to mod-available – sudo service apache2 restart

Sending information: GET HTML form: – – First: – Last: – Information encoded using alphanumeric characters: why? URLs are restricted to alphanumeric characters only bash accesses the URL-encoded string via the environment variable QUERY_STRING program.cgi?first=Sandiway&last=Fong

Sending information: GET program.cgi: #!/bin/bash echo "Content-type: text/plain" echo #echo $QUERY_STRING origIFS=$IFS IFS='=&' set -- $QUERY_STRING IFS=$origIFS echo "1: 2: 3: 4: " In bash: IFS = internal field separator (for arguments) default: space newline tab set – String -- option: positional parameters are set after parsing String