pop up description layer
Last modified: 20101021:090359/add link to PEP257

FIT2022 AJH-2010-22

Assignment 1

Assignment 1: A Python Image Server | Support Materials | Submission

Due Date: 27 Aug 2010, at 12 noon

Assignment 1: A Python Image Server

Much of computing is concerned with providing services to users, often through connections to remote servers. This assignment is about a) building clients for use in a client-server environment, and b) using threads to achieve quasi -parallel exceution in the client.

Your primary task is to write a python program that displays images from a server. While displaying images, the program must accept input from the user to determine how the image is displayed. The program should also be persistent, in the sense that it remembers all data (including over previous invocations) entered by the user.

This means that you should use threads to set up (at least) three quasi-parallel processes, one to display images and sleep for an appropriate length of time, one to read user input and respond to the user's requests, and the third to save state. The third process can be triggered either by user entry, quitting the program, or at some predetermined interval.

One of the parameters associated with each image is a score. The score is an indication of how long the image should be displayed. A score is a number in the range 0-10, and is a floating point number. Users can enter scores for each image, and the server will maintain an average of all scores entered for that particular image.

Subtasks

UserInput
One of the threads of the client program should monitor keyboard input, to see what the user wants to do. As a minimum, you should implement the following inputs:
h
display the previous user entry history. This should work over previous invocations of the program, i.e., it should give a persistent history.
s n
score the current image with value n. n must be be a floating point number, although integer values should be accepted. n must lie in the range 0 to 10.
p
display the previous image
n
display the next image
q
quit the program
DisplayTime
Devise a suitable algorithm to map scores into display times. Generally speaking, non-linear relations will be more effective.
UserManual
Write a short User Manual describing your program. Take care to write it for a user who may not be thoroughly computer literate!

You may make various design decisions in implementing your system, but you must document these decisions in your program documentation. For example, you may make the maximum length of history saved some fixed limit, but make sure that the variables used to define this are documented in the code.

The Image Server

The image server is located at

http://dimboola.infotech.monash.edu.au/~ajh/cgi-bin/imageServer.py
It uses the HTTP protocol to deliver a supply of images. The server may be viewed through a browser, or accessed through python library calls. There are three parameters to a GET operation through the HTTP port (port 80). These are:
task
The task to be performed by the server. There are four defined tasks:
image
return a given image
score
return the score for a given image
putscore
update the score for a given image
maximum
display the maximum image number
number
The number of the image to be retrieved. This is an integer number between 0 and maxImage, where maxImage is the maximum image number.
data
A value to be passed into the server. The format of this item varies, depending upon the task performed. There is only one task for which data is required: putdata, when data must be formatted as a floating point number between 0 and 10.0 (inclusive).

Examples

http://dimboola.infotech.monash.edu.au/~ajh/cgi-bin/imageServer.py?task=image&number=2477
display image number 2477
http://dimboola.infotech.monash.edu.au/~ajh/cgi-bin/imageServer.py?task=score&number=2477
display the score for image number 2477
http://dimboola.infotech.monash.edu.au/~ajh/cgi-bin/imageServer.py?task=maximum
display the maximum image number
http://dimboola.infotech.monash.edu.au/~ajh/cgi-bin/imageServer.py?task=putscore&number=2477&data=10.0
update the score for image number 2477
If you now re-display the score for image number 2477, you will note that it has changed. If it hasn't, try this!
http://dimboola.infotech.monash.edu.au/~ajh/cgi-bin/imageServer.py?task=putscore&number=2477&data=0.01

Support Materials

Check the Wiki Page for helpful hints. For example, this program might be useful!

A marking quide will be made available.

Submission

Use of SVN

Use the SVN server supplied to submit your assignment, with repository fit2022-your authcate ID. Make sure you include all relevant files (.py files, .pdf files, literate program files, etc.), and place them in a directory called Assignment1.

Your assignment will be retrieved from that repository for marking. If the file is not correctly named, it will not be retrieved, and hence you will not get any marks for the assignment!

NO WORD DOCUMENTS are to be submitted - if you want to use Word, please convert to a pdf file before submission (there are free convertors available, see for example http://www.doc2pdf.net/). If you submit Word documents, they will be ignored.

Please note that you must not put any assignments in the public space of the svn repositories! Not only is this contrary to the instructions given in lectures about the use of svn, it also contravenes university policy.

Students whose work is found in the public areas will have the work removed, and will receive NO marks for the assignment.

Documentation

Your submitted program must contain its own documentation, either in the form of comments in the code, or using the Python documentation format (also RER257), or as a literate program. There are different maximum marks attached to these three alternatives, as described in the Marking Guide. As a bare minimum, you should include one comment section to describe the overall program, and comment sections for each key subsection of the program.

Your submission must also include a short User Manual, describing the use of the program for the casual user.

Marking Guide

An explanation of the marking strategy is included in the Marking Guide


Document History

20101021:090359 3.1.2 ajh add link to PEP257
20100803:123653 3.1.1 ajh add submission details from marking guide
20100802:121625 3.1.0 ajh final form released
20100802:103754 3.0.2 ajh add history task and documentation parameters
20100727:161245 3.0.1 ajh release draft version to students
20100726:173213 3.0.0 ajh first draft version for 2010

This page maintained by John Hurst.
Copyright Monash University Copyright Policy
31 accesses since
01 Feb 2012
My PhotoTrain Photo

Generated at 20120515:1417 from an XML file modified on 20101112:1626
Maintainer use only; not generally accessible: Local Server Work Server CSSE Server

104 accesses since 09 Aug 2010, HTML cache rendered at 20120517:1657