Welcome to CSCI N343 / Informatics I210
The purpose of this course is to provide you with a comprehensive
understanding of the tools and problem-solving methodologies related
to computer programming. Our primary focus will be underlying
problem-solving and information-management techniques. The lecture will
discuss general concepts and syntax, whereas the lab will focus upon
implementation and practice. The specific language implementation will
be in Python, a language known for its straightforward syntax and wide
extensibility.
Spring 2007 Information
Instructor:
Andy Harris, email
aharris@cs.iupui.edu
I'm in my office (SL 280) Tuesday and Thursday mornings from 11:00
until 12:00 or email me for another appointment.
Email is the best way to reach me. Phone messages are not usually
recieved in time.
Schedule
Lecture: TR 12:00 SL 251
Informatics Students
This class is cross-listed as CSCI N343 (Object-Oriented Programming
for the web) and INFO I210 (Information Infrastructure I.) The
informatics section is 4 credits and the CSCI section is 3 credits, so
INFO students will be assigned an extra paper around midterm to make
up for the extra credit hour.
Server-side programming in Python
Setting up a practice session
To use Python as a CGI environment, first you need to set up your
system. Fortunately, everything you need is supplied with
Python. Here's the steps to practice on your Windows machine...
- Open a DOS shell. Use start menu-run and type "command" in the
box. (note it's the older "command" you should use, because "cmd"
doesn't seem to work if Python is installed in the program files
directory.)
- Navigate to the directory you want to use as a web root with cd
commands.
- Start the built-in python server with this command:
python -m CGIHTTPServer
- Keep the resulting DOS window open. It will provide feedback,
especially if there are errors in your code
- Point a web browser to localhost:8000 You should see a list of
the files in your current directory
- Create your CGI programs in a directory called cgi-bin directly
under the main web root
Example CGI programs
Note these programs are not currently operational on this server -
they are simply source code. Copy them to your own cgi-bin directory
and run under your own server to test.
-
hiCGI.py
Hello world done in CGI and python
-
hiCGI.py
Source of hiCGI
-
askName.html
HTML page that interacts with sayHi.py. View source to
see how page is organized with form and inputs.
(calls sayHi.py)
-
source of sayHI.py
Retrieves data from askName.html and reports it back.
(run by calling askName.html)
-
qAndA.py
A program that creates its own form if necessary
-
qAndA.py
Source of qAndA.py
- dvd.db
The SQLite database used in previous examples. Used to
demonstrate cgi and sql combined
- CGI_DB.py
Use a cgi script to interact with an SQL database