Graduate Software Lab (CS-699)
Autumn 2000

Staff

Time and place

Evaluation

Marks are out!

There will be a series of assignments. We may not be able to assign absolute points for each as they come, but we will try to do this as soon as possible. Grades will be based on these and possibly a viva at the end of the semester. Although IITB does not implement it, an honor code should be in place informally.

There will be no deadline set by the instructor for individual assignments. The final deadline for all assignments will be 2000-11-30. No points will be given for any submission beyond that date. The class and TAs can negotiate deadlines for each assignment as convenient.

Lecture calendar

2000-07-28
Course introduction and quick survey of current skills. Familiarity with unix shells (bash, tcsh or variants) and associated command-line utilities.
2000-08-04
HTML, CSS, and CGI basics. Assignments 1 and 2 released.
2000-08-11
Perl familiarization. Writing CGI scripts using Perl.
2000-09-29
ANSI C++. Additional tutorials available on the Web (some links may be dead): HP STL C++ templates @RPI, HP STL C++ templates @HP, Mumit's STL Newbie guide, C++ Standard Template Library (STL) References, Standard Template Library Programmer's Guide, SGI STL Adapted for VC++5.0, Adapted SGI STL - Note for Visual C++ users, SGI Standard Template Library Adaptation Effort, Standard Template Library Adaptation Page, Another Standard Template Library Adaptation Page, Phil Ottewell's STL Tutorial.
2000-10-06
Building large programs using make; maintaining large projects using RCS and CVS.

Assignments

Assignment 1: Writing your homepage

This assignment is designed to make you familiar with HTML, PHP3, and stylesheets (CSS). Your design should have:

It should be possible to change color and font of section headers as well as the color of the navigation bar by changing just one line in the style file.

Assignment 2: Shell programming

Your script should be invoked as

./bdiff dir1 dir2
Given two directories dir1 and dir2, your script should diff the directories recursively. Directory and file paths found under dir1 but not under dir2 (or vice versa) should be printed as
<d dir1/foo34/bar5
>f dir2/bar7/swlab.ppt
and changes in files should be detected using cksum and printed as
dir1/bar7/p329.tex != dir2/bar7/p329.tex

Make your script incremental. It is now run periodically as

./tdiff dir
and prints out changes since it was last invoked. To do this your script must save some state to the file /tmp/tdiff.<yourRollNumber>; make the size of this state as small as possible.

Assignment 3: Download assistant

Many freeware or shareware sites have a series of forms to fill in to get to the download page, and the downloadable files are not accessible directly; instead they are served upon GETting or POSTing a final form. For large downloads that might timeout, this can be frustrating.

Write a Perl script proxy.pl which acts as a HTTP/FTP proxy between the browser and the upstream connection and records the form filling session and saves it to a named file in any suitable format of your choice. This script is invoked as

proxy.pl replay.txt 3000
if you want to run the local proxy on port 3000. Then you set your browser's proxy to localhost:3000.

A second script download.pl then reads a named replay file and replays what is necessary to get the downloadable file(s). When possible, download.pl should fetch only the remaining portion of the downloadable file(s). Additional options involving monitoring progress, timeouts and retries are encouraged.

We will release later a list of 2--3 sites with download specs for testing your scripts.

Assignment 4: LaTeX practice (Nothing due)

Study carefully last year's samples: sample.tex, sample.bib, and the output sample.ps. The next assignment handin must be typeset using LaTeX.

Assignment 5: ANSI C++ familiarization; graph plotting; typesetting

Write a discrete event simulator using ANSI C++ classes to make your code simple and small. The scenario being simulated is a bank where customers arrive according to a Poisson process. There is one queue and a number of counters. The customer at the head of the queue is assigned to a free counter uniformly at random. Service time at each counter is exponentially distributed.

Your goal is to implement the simulator in as few lines of (your) C++ code as possible, make it efficient, and experiment with various combination of parameter values (arrival rate, number of queues, service time) and plot average queue length, average waiting time, fraction of time that the queue was bigger than a set threshold, etc.

Your C++ program should output the tables to be plotted in tab- or space- delimited text files. These tables are to be converted to graphs and charts in EPS format using Jgraph or Gnuplot or Excel. Additional pictures may be drawn using Xfig or Powerpoint. The EPS files are to be included in a very short report together with all formulae and pseudocode; typeset this report in LaTeX and turn in the PS file.

Assignment 6: Java, applets, servlets

Translate the above code to Java and instead of producing EPS graphs and charts, show a direct visual representation of the events in the system as the simulation progresses. Make it an applet so the TAs can visit the page and see the simulation. (Customers and tellers are 5x5 squares.) The TAs should be able to set arrival and service rates using sliders.

In another version, the TAs will fill out an HTML form with the arrival and service rates and submit the form. This should run a servlet which will send back a suitable applet page to do the above.

Assignment 7: Version control using RCS/CVS (Teams of two)

Check your event simulation code into a version control system. Now change it so that customers who arrive at a queue longer then some given threshold simply leave. Once this code is working check it into the version control system. Give your partner access to the version control data.

Check out the source given to you by your partner. Modify it to have two queues. Arriving customers join the shorter queue (if at all) but do not change queues thereafter. Queues are served alternately. When this version works, check it in and return the code to your partner.

Finally undo only the first change above, i.e., customers always join the shorter queue no matter how long it is. Check in and turn in all files and directories needed to recreate all the revisions of the code.

Assignment 8: SQL and JDBC NEW!

There are two banks each represented by a relational database with only one table

ACCOUNT(name, balance).
Write a JDBC application which asks for an ACCOUNT.name at a source bank, an ACCOUNT.name at a destination bank, and an amount. The application then opens two separate java.sql.Connection-s to the two bank databases and attempts the transfer. Insert sleep statements after every statement in your code so that the TAs can kill the application between any two statements, say by pressing control-C. No matter what happens, money should never be created or lost, balance can never become negative, and the program should give an indication of whether it succeeded or failed. You can use Oracle or DB2.

Note: With a single database and Connection this would be trivial. With multiple databases which may not support a two-phase commit at the JDBC API level, more care may be needed. It is fine to produce a solution specific to this application and/or to use additional tables. Do not use OS locks, files, or devices outside the RDBMS.

Assignment 9: Microsoft Win32 and IDE familiarization

Adapt your C++ source and makefiles so that it compiles on both Linux and Windows NT4 without modification. This assignment has been canceled because we cannot provide Windows PCs to each person in the current class.