CS 403: Programming Languages Lecture 17 Fall 2003 Department of Computer Science University of Alabama Joel Jones.

Slides:



Advertisements
Similar presentations
IS 6116 Introduction – 10 Jan Lecturer Details Aonghus Sugrue Website: aonghussugrue.wordpress.com
Advertisements

PHP I.
1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
Software Freedom Day th September 2007 Asia Pacific Institute of Information Technology Colombo, Sri Lanka. Nazly Ahmed Scripting The Web.
BY: ALBERTO CABEZAS 4/19/2010. INTRODUCTION: PHP is considered today as one of the most famous scripting languages. PHP is widely used as a general purpose.
PHP CSCE 330 February 6, 2003 Group Members: Antwan B. Phan George Hwang Luat Vu Programming Language Presentation.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Guide To UNIX Using Linux Third Edition
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
PHP PHP: Hypertext Preprocessing. What is PHP? PHP is a server-side scripting language designed specifically for the Web. An open source language PHP.
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
The PHP Story. PHP Story PHP is a programming language. Incorporate(join) sophisticated business logic. Widely used general purpose scripting language.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 03.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled.
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
Week 7 Lecture Web Database Development Samuel Conn, Asst. Professor
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
PHP PHP: Hypertext Preprocessing Preston Brinks and Sean McKenzie.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general- purpose scripting language that is especially.
PHP With Oracle 11g XE By Shyam Gurram Eastern Illinois University.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
PHP and MySQL by Example COMP YL Professor Mattos.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
PHP Features. Features Clean syntax. Object-oriented fundamentals. An extensible architecture that encourages innovation. Support for both current and.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Introduction to CS520/CS596_026 Lecture Two Gordon Tian Fall 2015.
Introduction to PHP Advanced Database System Lab no.1.
WEB DEVELOPMENT WITH PHP/MYSQL. WEB DEVELOPMENT COURSE HAS DIFFERENT NAME IN DIFFERENT INSITUTES, THIS IS A CORE COURSE FOR BS/MS STUDENTS. THIS IS ALSO.
CS 603: Programming Languages Lecture 25 Spring 2004 Department of Computer Science University of Alabama Joel Jones.
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
CS 403: Programming Languages Lecture 18 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
PHP Introduction PHP is a server-side scripting language.
1 CS Programming Languages Class 19 November 2, 2000.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
CGS 3066: Web Programming and Design Spring 2016 Introduction to Server-Side Programming.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
PHP stands for …….. “PHP Hypertext Pre-processor” and is a server-side scripting language like ASP. PHP scripts are executed on the server PHP supports.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Presented By Sushil K. Chaturvedi Assistant Professor SRCEM,Banmore 1.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
A PRESENTATION ON (IN PHP,CSS,HTML)
Introduction and Principles
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Developing Web-Based Applications
PHP / MySQL Introduction
Content of Presentation
PHP.
IntroductionToPHP Static vs. Dynamic websites
Introduction to PHP.
Web Application Development Using PHP
Presentation transcript:

CS 403: Programming Languages Lecture 17 Fall 2003 Department of Computer Science University of Alabama Joel Jones

Lecture 172 Overview Announcements Story Hour, Houser 108, 3PM Friday: Software Security and Exploits

Lecture 173 PHP Eric Mitchell What is PHP? Originally named: Personal Home Page Tools Now stands for: PHP: Hypertext Preprocessor Open-source, server-side, HTML-embedded Web scripting Serves as a “glue” language, making connecting your Web pages to server-side database

Lecture 174 Why learn PHP Free, open-source, full-featured, stable, fast, cross- platform, easy to learn, plays well with others Official module of Apache HTTP Server, runs about 55% of WWW Isn’t tag-based like ColdFusion, it’s a real programming language Popular and Growing

Say no to LSD, and say yes to PHP Joshua Chappelle

Lecture 176 Mainstream uses of PHP Server side scripting Client side GUIs Command line scripting for simple text processing

Lecture 177 Is PHP Portable? Linux and many Unix variants Microsoft Windows Mac OS X RISC OS Apache, Microsoft IIS, Personal Web Server, Netscape and IPlanet Servers, Oreilly Website Pro Server, Caudium, Xitami, OmniHTTPd and other web servers

Lecture 178 Does it have DB support? IBM DB2 Oracle (OCI7 and OCI8) ODBC Informix MySQL Sybase Unix dbm and many others

Python Seth Copeland An object-oriented scripting language Python is interpreted, not compiled It is portable across many platforms (UNIX, Windows, OS/2, Amiga, etc.) Its interpreter can be used interactively Seth Copeland

Lecture 1710 Python Designed for close integration with C Supports embedding in C and data import/export to dynamically loaded C libraries. Block structure is controlled by indentation Seth Copeland

Lecture 1711 Python Slowest and least efficient of the major scripting languages  Cannot compete in raw execution speed  Exhibits runtime type polymorphism Python is best used with medium sized, speed independent projects. It encourages (and even forces) you to produce clean, readable code and its environment can run interactively. It can be integrated with C code and is cross-platform over many environments. Seth Copeland

Lecture 1712 PHP: Hypertext Preprocessor Daniel Pritchett Server-side Web scripting language used by many sites to serve dynamic content Tightly integrated with MySQL, supports other databases as well Most popular module on most popular web server (Apache – check for statistics) Loosely typed C-style syntax can allow for rapid learning and implementation for a C/Java coder Linux, Apache, PHP, and MySQL combine to form a popular free web service suite Detractors say that loose types and weak object model can limit scalability.

Login form for “Popper” web-based POP3 Mail client Popper Login "> : "> : <input type="checkbox" name="set_cookie" <?php if ($poppercookie["user"]) { echo(" checked"); } ?> > "); if ($status_msg == $strings["l_PwdWrong"]) { echo(" $strings[l_LostPwd] "); } ?> ">

Welcome to the World of Python Ishmael Rudolph CS October 24, 2003

Lecture 1715 What is Python? Python is a free, open-source scripting language. It is mainly used in Web applications, primarily to handle CGI scripting tasks. It is also powerful enough to interact with C++ and Java software components, able to combine large applications.

Lecture 1716 Native Data Types Numbers (includes integer, float, etc.) String (typical implementation) List (mutable list of objects) Tuple (immutable list of objects) Dictionary (index-referenced object list)

The Glade Minilanguage A GTK+ User Interface Builder By Robert Reach

Lecture 1718 Glade Development Glade is an interface builder for the open-source GTK toolkit library for X. Glade allows you to develop a GUI interface by interactively picking, placing, and modifying widgets on an interface panel. The GUI editor produces an XML file describing the interface; this, in turn, can be fed to one of several code generators that will actually grind out C, C++, Python or Perl code for the interface. The generated code then calls functions you write to supply behavior to the interface. Glade possesses the transparency and simplicity indicative of a good minilanguage.

Lecture 1719 Pros and Cons Pros o The advantage of Glade is that it specializes in code generation. o This makes it possible to program without so much worry about bugs that you could possibly have from hand coding. o It also saves a lot of time. Cons o Because Glade uses XML, it is extremely verbose and consequently it is difficult to have a "small" program that does something useful. o Links: ScreenshotExample Program (a port scanner)ScreenshotExample Program (a port scanner)

Lecture 1720 Objectives What is logic, specifically, first order logic How logic programming is related to first order logic How Prolog embodies logic programming Introduction to using Prolog

Lecture 1721 Prolog PROgramming in LOGic Algorithm = Logic + Control Logic = relation R(I,O) between input I and output O Control = method of searching for O that satisfies R(I,O), given input I E.g. Find X and Y such that 3*X+2*Y=1 X-Y=4 E.g. find array B such that elements in B are the same as those in A elements of B are in non-descending order

Lecture 1722 What is Prolog Prolog is a ‘typeless’ language with a very simple syntax. Prolog is declarative: you describe the relationship between input and output, not how to construct the output from the input (“specify what you want, not how to compute it”) Prolog uses a subset of first-order logic

Lecture 1723 Classical First-Order Logic simplest form of logical statements is an atomic formula. e.g. man(tom) woman(mary) married(tom,mary) More complex formulas can be built up using logical connectives: , , , ,  X,  X Pair Up: Define each of these symbols

Lecture 1724 Examples of First Order Logic smart(tom)  dumb(tom) smart(tom)  tall(tom)  dumb(tom)  X married(tom,X)  X loves(tom,X)  X [married(tom,X)  female(X)  human(X)] rich(tom)   smart(tom)  X mother(john,X)  X  Y [mother(john,X)  mother(john,Y)  Y=X] Note: A  B  B   A

Lecture 1725 Logic programming is based on formulas called Horn rules. These have the form Examples:  X,Y[A(X)  B(X,Y)  C(Y)]  X[A(X)  B(X)]  X[A(X,d)  B(X,e)] A(c,d)  B(d,e)  X A(X)  X A(X,d) A(c,d) Horn Rules

Lecture 1726 Horn Rules (cont.) Note that atomic formulas are also Horn rules, often called facts. A set of Horn rules is called a Logic Program.

Lecture 1727 Logical Inference with Horn Rules Logic programming is based on a simple idea: From rules and facts, derive more facts. Example 1. Given the facts and rules: 1. A 2. B 3. C 4. E  A  B 5. F  C  E 6. G  E  F From 1, derive E; from 2, derive F; from 3, derive G.

Lecture 1728 Logical Inference Example 2: Given these facts: man(plato) man(socrates) and this rule:  X [mortal(X)  man(X)] derive: mortal(plato), mortal(socrates).

Lecture 1729 Recursive Inference Example, given (1)  X[mortal(son_of(X))  mortal(X)] (2) mortal(plato) derive: mortal(son_of(plato)) (using X=plato) mortal(son_of(son_of(plato))) (using X=son_of(plato)) mortal(son_of(son_of(son_of(plato)))) (using X=son_of(son_of(plato)))

Lecture 1730 Prolog Notation A rule:  X [p(X)  (q(X)  r(X))] is written as p(X)  q(X), r(X). Prolog conventions: variables begin with upper case (A, B, X, Y, Big, Small, ACE) constants begin with lower case (a, b, x, y, plato, aristotle) Query = list of facts with variables, e.g. mortal(X) sorted([5,3,4,9,2], X) sonOf(martha,S), sonOf(george,S) Prolog program = facts+rules+query

Lecture 1731 Prolog Syntax .  :-. .  | | | ( )  |,

Lecture 1732 Constructors like student and “.” are called functors in Prolog Syntax Integers Atoms: user defined, supplied name starts with lower case: john, student2 Variables begin with upper case: Who, X ‘_’ can be used in place of variable name Structures student(ali, freshman, 194). Lists [x, y, Z ] [ Head | Tail ] syntactic sugar for. ( Head, Tail ) [ ]

Lecture 1733 Prolog Introduction /* list of facts in prolog, stored in an ascii file, ‘family.pl’*/ mother(mary, ann). mother(mary, joe). mother(sue, mary). father(mike, ann). father(mike, joe). grandparent(sue, ann).

Lecture 1734 Prolog Introduction (cont.) /* reading the facts from a file */ ?- consult ( family). %family compiled, 0.00 sec, 828 bytes Comments are either bound by “/*”,”*/” or any characters following the “%”. Structures are just relationships. There are no inputs or outputs for the variables of the structures. The swipl documentation of the built-in predicates does indicate how the variables should be used. pred(+var1, -var2, +var3). + indicates input variable - indicates output variable

/* Prolog the order of the facts and rules is the order it is searched in */ /* Variation from pure logic model */ 2 ?- father( X, Y ). X = mike /* italics represents computer output */ Y = ann ; /* I type ‘;’ to continue searching the data base */ X = mike Y = joe ; no 3 ?- father( X, joe). X = mike ; no