1. Information and Introductions

What We Will Cover

Exercise 1.1

Instructions

Use the next 10 minutes to complete the following.

  1. Join a group of 3-4 people and prepare an answer to one of the following questions.
  2. Select one member from your group as a representative to describe your answer to the class.

Exercise Questions

  1. What "burning questions" do you have about the course outline?
  2. What do you hope to learn by the time you complete this course?
  3. How do you plan to balance the work required by this course with the other activities in your life?

Note: You do not have to turn in the answers to this exercise. However, you are expected to submit answers to subsequent exercises.

1.2: Surviving Linux

Learner Outcomes

At the end of the lesson the student will be able to:

  • Start and stop the classroom computers
  • Browse the Linux file system
  • Create text files
  • Save a file to a floppy disk

Exercise 1.2

Instructions

Use the next 10 minutes to complete the following.

  1. Start a text file named exercise1.txt
    You will be adding to this file during the lesson, so save it often.
  2. Prepare the exercise header as described in the HowTo on submitting exercises
  3. Label this exercise: Exercise 1.2
  4. Do not submit exercises until all from today's lesson are finished
  5. Complete the following exercises and write answers to any questions.

Exercises and Questions

    Save the exercise1.txt file in your home directory. Close your text editor and then restart it. Open the exercise1.txt file and view the contents.

  1. Was the file information saved and retrieved correctly?
  2. Which disk drive do you select on your classroom computer?
  3. Why did you choose to use your particular text editor?
  4. How do you run gedit?

1.3: Technology Tour

Learner Outcomes

At the end of the lesson the student will be able to:

  • Describe how documents are located on the Internet.
  • In general terms, describe how web applications work
  • Name the software component that is required on the client of any web application.
  • Name the two software components that are usually required on the server of any web application.
  • Distinguish between HTML and HTTP.
  • Distinguish between static web pages and dynamic web pages.
  • Locate the servers running on their computer
  • Describe how the web server, PHP and MySQL interact

1.3.1: The Internet

What is the Internet?

  • Networking is about moving data from one computer to another
  • Internet: a set of networks connected together with routers
  • Routers: special computers that move data between networks
  • All computers on the Internet talk to each other using the Internet Protocol (IP)

Brief History of the Internet

  • 1969: Internet started by US DOD with 4 computers -- called ARPANET
  • 1983: Internet (1000 computers) split into two parts -- military and university
  • 1987: High-speed backbone added to solve performance issues (10K computers)
  • 1989: World-Wide Web and HTML invented by Tim Berners-Lee at CERN
  • 1992-3: US Government decides to commercialize Internet
  • 1993: first graphical browser invented by Marc Andreessen
    • While a student at the University of Illinois
  • 1998 - E-commerce becomes a "hot" technology

What's My IP Address?

  • Computers need some way of identifying other computers on the Internet
  • Computers can contact each other using what is known as the IP address
  • You can determine the address of your computer on the network
  • On Linux/UNIX, run the ifconfig program
    • Open a command prompt (e.g. Terminal Emulation in Linux)
    • Make sure you are the super user
      su -l root
    • Type ifconfig at the command prompt
  • On Windows, run the ipconfig program
    • From the Start menu, select Run
    • Type in command for Win98/ME or cmd for NT/2000/XP
    • At the command prompt, type ipconfig

1.3.2: Resolving an Address

  • An IP Address is like a telephone number
    • Often, a telephone number is not enough to contact someone
    • You also need their telephone extension
  • a port number is like a telephone extension
  • Together they connect you to a unique destination on the Internet
    • Client applications are expected to know the port number
  • Common port numbers include the following:
  • Service Port Number
    FTP 20, 21
    Telnet 23
    SMTP (e-mail) 25
    HTTP 80
  • More information on common port numbers available here

Names are Easier to Remember

  • When a client sends a request, it usually uses a name for the address
  • Domain Name Server (DNS) is used to resolve the name to an IP address
  • Usually one DNS per subnet, campus or company

The Story of Ping

  • Ping is used to test whether or not a networked machine is reachable:
C:\>ping www.cabrillo.edu

Pinging moose.cabrillo.edu [207.62.187.7] with 32 bytes of data:

Reply from 207.62.187.7: bytes=32 time=1ms TTL=63
Reply from 207.62.187.7: bytes=32 time=1ms TTL=63
Reply from 207.62.187.7: bytes=32 time=1ms TTL=63
Reply from 207.62.187.7: bytes=32 time=1ms TTL=63

Ping statistics for 207.62.187.7:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms

  • Click on the picture
  • Scroll down the page and read the Customer Comments on The Story About Ping

1.3.3: URLs

Uniform Resource Locator (URL): a standard way of specifying an address on the Internet.

  • URLs consist of two main parts separated by a colon
  • Part before the first colon specifies the access scheme or protocol
  • Part after the colon is interpreted according to the access scheme
  • Usually, two slashes after the colon (//) introduce a hostname
  • Hostnames usually end in a top-level domain name, such as .com
  • Hostnames can be followed by a colon and a port number, for example:
  • http://java.sun.com:80/
    
  • Usually a port number is omitted and the standard port number is used
  • After the hostname comes the pathname
    • Usually related to the pathname of a file on the server

Finding Localhost

  • Servers running on your computer respond to a special IP address of 127.0.0.1
  • Hostname for a server running at 127.0.0.1 is localhost
  • Can access the web server on your own machine by typing the address:
  • http://localhost
  • Since http:// is assumed by most browsers, you can shorten this to:
  • localhost

1.3.4: Web Applications

  • Web applications are a set of web pages generated in response to user requests.
  • Users interact with the web application using client software called a web browser.
  • Web servers are programs that provide web documents.
    • Often run on dedicated computers, also known as web servers.
  • Web server software runs constantly in the background waiting for requests.
  • When a request is received, the server locates and sends the requested document.
  • For most web applications, the server computer also runs a database management system (DBMS).

How Web Applications Work

  • When you access a file on the Web several steps occur
  • Many of these steps are invisible to the user
  1. A user enters a query (URL) into a client (browser)
  2. The client connects to server and sends query
  3. The server analyzes the query, computes results and respond with information
  4. The client receives the results and displays them to the user

How Static Web Pages Work

  • Hypertext Markup Language, or HTML, is the language that the web browser converts into the web pages of a web application.
  • A static web page is an HTML document that’s stored in a file and does not change in response to user input.
  • Hypertext Transfer Protocol, or HTTP, is the protocol that web browsers and web servers use to communicate.
  • A web browser requests a page from a web server by sending the server a message known as an HTTP request. For a static web page, the HTTP request includes the name of the HTML file that’s requested.
  • A web server replies to an HTTP request by sending a message known as an HTTP response back to the browser.
  • For a static web page, the HTTP response includes the HTML document.

How Dynamic Web Pages Work

  • A dynamic web page is an HTML document that’s generated by a web application. Often, the web page changes according to parameters that are sent to the web application by the web browser.
  • When a web server receives a request for a dynamic web page, the server passes the request to the web application. Then, the application generates a response, which is usually an HTML document, and returns it to the web server.
  • The web server, in turn, wraps the generated HTML document in an HTTP response and sends it back to the browser.
  • The browser doesn't know or care whether the HTML was retrieved from a static HTML file or was dynamically generated by the web application.
  • Either way, the browser displays the HTML document that is returned.

1.3.5: PHP as the Web Application Software

  • Web applications require special software that runs on the server
  • This server-side application software is responsible for:
    • Generating the HTML documents for the client
    • Connecting the application to the database
  • In this course, we will use PHP as the application software

PHP Hypertext Processor

  • PHP is a programming language that can run on a Web server
  • Running on the Web server provides several advantages:
    • Processing is done in a known environment, unlike Javascript
    • Avoids many browser incompatibilities by returning "standard" HTML
    • Can tailor HTML and client-side script to a browser type
    • Can isolate common page elements in one file to apply changes everywhere
    • Can connect to databases to take advantage of their power
  • Many server-side technologies developed -- including PHP
  • PHP stands for PHP Hypertext Processor

Brief History of PHP

  • 1994 - Rasmus Lerdorf created PHP
    • Used it to keep track of who was looking at his online resume
  • 1995 - Other people started using PHP
  • 1997 - About 50,000 users of PHP world-wide with many contributors
  • 2000 - PHP 4 released
  • 2002 - Most popular scripting language on the Web
  • 2005 - PHP 5 released

Advantages of PHP

  • Easy to use
    • Simplifies building web applications
    • Similar syntax to languages such as Perl, C and C++
    • Also easy for non-programmers to learn
  • Open source
    • Available for free download over the Internet
    • Has a large user community for support and ongoing development
    • Program source code is available to view and change
  • Runs on multiple platforms
    • UNIX/Linux
    • Windows
  • Supports many database systems including MySQL

Determining What is Popular

  • Web documents have a suffix that identifies their type to the Web server
  • home.html
  • Scripting languages use that suffix to identify themselves
  • Server-Scripting Language Suffix
    Active Server Pages .asp, .aspx
    ColdFusion .cfm
    Java Server Pages .jsp
    PHP Hypertext Processor .php, .php3, .phtml

  • Can use a search engine to find the number of pages on the Web for each type
  • For example:

1.3.6: Database Systems

About Databases

  • Database is an organized collection of logically-related data
    • Data are numbers, characters, sounds or images that can be stored in a computer for processing or transmitting
    • Information is the knowledge obtained from processing the data
  • Data is organized so a computer can quickly select desired pieces of data
  • Many types of database software
    • File-based systems: widely-used for simple data sets (e.g. spreadsheets, text-files)
    • Relational database systems: most widely used general-purpose database
    • Object-oriented systems: less widely used
  • Database Management Systems (DBMS) provide tools to work with databases
    • Creating and removing databases
    • Adding, deleting and updating data
    • Controlling user access to data
  • DBMS is also responsible for:
    • Ensuring data is stored properly and that the rules for defining data are not violated
    • Maintaining relationships between data entities residing in the database
    • Providing some level of disaster recovery by which data can be restored to a consistent state
  • Note that "database" is often used as a synonym for DBMS
    • Must understand in context

About MySQL

  • DBMS we will use for this course is called MySQL
    • Pronounced "my-sequel" or "my-es-que-el"
  • MySQL web site (http://www.mysql.com/) provides latest information
  • Why did the instructor choose MySQL?

Cost

  • Most database vendors charge $5,000-$50,000+ fee
  • By contrast, MySQL is available free for GPL open source applications
    • Can purchase support or a commercial license if desired

Speed and Reliability

Popularity

Locating phpMyAdmin

  • Since this course uses PHP, how are we going to communicate with MySQL?
  • Good example of a PHP application is phpMyAdmin
  • phpMyAdmin located on our computers at: localhost/phpmyadmin

Exercise 1.3

With your partner, take 10 minutes to complete the following:

  1. Label this exercise: Exercise 1.3
  2. Do not submit exercises until all of them from today's lesson are finished
  3. Complete the following exercises and answer any questions.

Exercises and Questions

  1. How are computers identified on the internet?
  2. List four URLs you can type into the address bar to access the localhost web server running on your computer.
  3. Why would a Web-application developer use a database to store information?
  4. Write one "50 point test question" combining the following topics:
    • The Internet
    • The Web and HTML
    • Web Servers
    • PHP
    • Databases

1.4: Succeeding in This Course

Learner Outcomes

At the end of the lesson the student will be able to:

  • Describe how to study effectively for this course
  • Use computers in the CTC for homework
  • Install software used in this course at home

1.4.1: Elements of Success

  • Main purpose of grading is to motivate you to learn the course material
  • Secondary purpose is to evaluate how well you completed the course work
    • Not the same as how well you know the material
    • Also must complete the course work on time
  • Can look at the grading policies to analyze what must be done to succeed

In-Class Exercises

  • Complete them during the allotted time in class
  • Discuss them with partners or the instructor
    • Especially if you get stuck or confused
  • Submit them to WebCT before you leave the classroom
    • Can always unsubmit if you want to change them during the week
    • Ensures that something is turned in on time
  • Graded on a best-effort basis
    • Full credit for just attempting to complete the exercise

Homework Assignments

  • Homework designed to have you apply the lecture concepts in more detail
  • Also designed to have you explore ideas in more depth
  • Homework includes assignments, quizzes and reading
  • Average homework time expected of an "A" student:
    • 9 hours on assignments
    • 3 hours on reading and quizzes
  • If you get stuck on an assignment:
    • Reread the assignment instructions
    • Review the lecture notes
    • Read the textbook
    • Contact the instructor
  • Submit homework to WebCT at least the day before it is due
    • Even if you are not done, turn it in
    • Get credit for what you did complete
    • Make sure to state an accurate status in the README.txt file
  • Note that homework deadlines are real -- late homework is not accepted
  • Most homework has extra credit possibilities

Project

  • Choose a project that interests you
  • Throughout the course you will work on your project
  • Most homework assignments apply toward your project

Quizzes

  • Most weeks, you will have the opportunity to take a quiz
    • Covers the previous lessons and homework assignments
  • Preparing for a quiz is quite straightforward
    • Use the same approach as the instructor
  • Quizzes are based on the learner outcomes
  • Quizzes try to determine whether you can do what the learner outcomes call for
  • Most of the time I will have a set of review questions
  • Make sure you can answer the review questions before taking the quiz

1.4.2: Using the CTC for Homework Assignments

  • First you will need to get an account
  • You can use either Linux or Windows computers for your assignments
  • CTC set up like the class room with dual-boot computers
  • For more information on the CTC, follow the link to the CTC homepage

1.4.3: Can I Run This On My Own Computer?

  • All the technology we use runs on most any computer
    • Web server such as Apache
    • PHP scripting language
    • MySQL database management system
    • phpMyAdmin: Web-based MySQL administrator
  • An easy method way to install at home is to use a Linux distribution such as Red Hat
    • Install Apache and PHP along with the operating system
    • Will still need to install phpMyAdmin
  • Otherwise, easiest method is to use one of the following installation kits
  • Note that we will be using PHP version 4.2.2 in the classroom
  • Even though PHP 5.0 has been release, most ISP's still offer only version 4.X

Linux Installation Kits

Windows Installation Kits:

Mac OS X Installation

1.4.4: Summary

  • Four elements to success in this course
    1. Submit the in-class exercises
    2. Do your homework assignments and turn them in on time
    3. Choose a project that interests you
    4. Review before you take a quiz
  • You can complete homework assignments in the CTC
  • You can also install the necessary software at home (or work)

Exercise 1.4

Instructions:

Use the next 10 minutes to complete the following.

  1. Label this exercise: Exercise 1.4
  2. Do not submit exercises until all of them from today's lesson are finished
  3. Complete the following exercises and write answers to any questions.

Exercises and Questions

  1. List the elements of success for this course
  2. What is the average time you can expect to spend outside the classroom on this course?
  3. Where do you plan to work on your programming assignments?

Wrap Up

Review Questions

  1. When are assignments due?
  2. How do you start and stop the computers in the classroom?
  3. How do you create text files using Linux?
  4. What software is needed on a client computer to use a web application?
  5. What software components are usually required on the server of any web application?
  6. How do you locate documents on the Internet?
  7. What is the difference between HTML and HTTP?
  8. What is the difference between static and dynamic web pages?
  9. How should students prepare for a quiz?
  10. What do you need to do to install the software for this course at home?

Home | WebCT | Announcements | Course info | Expectations | Schedule
Project | Help | FAQ's | HowTo's | Links

Last Updated: February 08 2006 @17:17:37