Lecture 1: Topics to cover: 1. course info 2. the three topics C, Unix, CGI a. C - a general purpose language for writing programs b. Unix an operating system c. Unix: a programming language d. CGI: a means for running remote programs from web pages 3. What is an example of a program you might want to run remotely? a. Calculations - driving distance from A to B - air fare from A to B - other b. Data Access - retrieve and tabulate data 4. Therefore you need two things: a. How to write programs b. How to run them from web pages Let's get Concrete: You are given a flat file of train schedule data and are asked to answer questions about the data and to write programs. Typical questions [where the specific station could be any station]: 1. When do trains leave from Braintree going to Boston? 2. What is the time of the earliest train from Ashland to Boston? 3. How many trains stop at West Medford on a weekday? 4. List the stations on the Fitchburg line. 5. List all the lines in the system. 6. List the train numbers of all trains passing through Beverly Depot. 7. What station has the most trains on Sunday? 8. Which line has the most stations? 9. During what hour does the greatest number of trains arrive at South Station? 10. When does the last train to Worcester leave Boston? 11. What is the most common train stop time? 12. What is the longest train trip (time, not distance) on the system? Programs: 1. Answer a general form of any of these questions 2. Plan a trip from station A to station B And make all these programs available via the Web. Question: what tools would you use and how long would it take? --------------------------------- Focus: let's see how to solve it using Unix and its toolset Idea: Unix comes with a ton of special purpose tools, and it comes with some scripting languages to glue them together to build new tools and applications. Tools: grep, cut, wc, head, more, uniq, sort Combinations: pipelines and scripts Conclusion: Unix is a programming system that contains a. lots of special-purpose powerful tools b. a scripting language to glue them together c. Most of the tools are written in C d. To learn to solve problems using Unix and C involves learnign to write tools in C and to write scripts to glue them together. --------------------------------- Course Info: special sections, office hours, etc --------------------------------- Unix as an operating system: runs programs, provides storage, manages users and hardware login, files, storage, mail, cat, ls, rm, mv, cp, mkdir, rmdir, logout --------------------------------- Running Programs from Web Pages: Example: Trains leaving X to Boston write it as a shell script: train-times create a web page to prompt user for station and dirction ---------------------------------- Summary: C is used to build engines - tools Unix is used to glue them togther CGI is a method of running a remote program and passing variables from web page forms to the program