@www.csse.monash.edu.au |
| Assessment | Contacts | Laboratories | Lectures | Resources | Timetables | Tutorials | Unit Outline |
| Last modified: 20100721:150907/first version for 2010 | FIT2022 AJH-2010-16 |
Introduction to Lab 1 | Objectives | Introduction to Python | The Mutual Update Problem | Introduction to Subversion (SVN) | The Mutual Update Problem, Part the Second | Reflections
NOTE: The ftp instructions have changed. See section 4.1
This practical has seven sections, with four sections that require lab activities. This first section will help you understand the relationship between these sections.
In all the work you do for this subject, there will be a set of Objectives. These you should read through before starting work on anything else. They are designed to help you see why you have been asked to do this task, and where it is heading. Read through them, and ask your demonstrator or tutor if any seem unclear. The second section defines the objectives for this lab session.
The next four sections describe the work that should be completed in the lab itself. Generally there are more questions here than people can do in a 3 hour laboratory unless you already know it all. So, prepare before your laboratory class and spend some time on the computers out of hours if necessary. In the lab, pace yourself so that you try each section. There are time indicators to show you how you should be going. It is more important that you start each section than you finish any of them! So if you get to the end of the alloted time for a section, stop it, make some notes in your journal, and then move on to the next section.
You are encouraged to finish the laboratory sheet out of hours. Each lab will have some group work and assignment work associated with it, and you will need to spend time outside the scheduled class time completing this work. All the work that you do for the laboratory should be written up and recorded in your Lab Journal. Guidelines on how to write up your journal are available.
In the first lab work section Introduction to Python, we look at an introduction to Python. For all subsequent practical classes, Python will be used in the implementations. Therefore, it is important for the student to gain a competent understanding and command of the language.
The second lab section introduces the Mutual Update Problem. In this section, we look at what happens when you have several people trying to update a file simultaneously, using the older technology of FTP (File Transfer Protocol).
The next section introduces the Subversion version control system (SVN). Since version control systems are an important part of any large scale software development, it is appropriate that students gain some appreciation of how version control systems support on-going software development.
The last lab section looks at the Mutual Update Problem again, this time using SVN rather than FTP.
Finally, you are asked to reflect on the work you have done in the lab session. You can do this section after the lab, if necessary, but you will need to show it to your tutor before the next lab session to complete the satisfactory hurdle. It is suggested that you work with your partner on this, entering your reflections into your laboratory journal, that you must keep in your SVN repository. Both you and your partner should email your tutor when you have completed this, together with a link to your svn entry. You will also need these reflections at the end of the semester, and there will be examination questions on them!
What is the Mutual Update Problem? A brief introduction can be found at on-line
Python is essentially a real programming language that is simple to use, that offers structure and support for large programs. It is a very-high-level language with high-level data types built in. Python allows the splitting up of programs into modules that can be reused in other Python programs.
Python is an interpreted language, no compilation and linking is necessary and the interpreter can be used interactively. This means that it can provide excellent error messages.
pythonto the shell.
python example.py
python -c command [arg] ...which executes the statement(s) in command.
import sys
sys.exit()
>>> monty_python = 1
>>> if monty_python:
... print "Monty Python's Flying Circus!"
...
Monty Python's Flying Circus
>>> 100 + 100 200 >>> height = 50 >>> length = 100 >>> height * length 5000
>>> income = 25000 >>> tax = 3.75/21.75 >>> income * tax 4310.34482759 >>> round(_, 3) 4310.345
>> fact_or_fib = "Is it really true that\n\ ... fish is\n\ ... brain food?\n" >>> print fact_or_fib Is it really true that fish is brain food?
>>> print """
... Who says so?
... Simon says so!
... And who does Simon think he is?
... """
Who says so?
Simon says so!
And who does Simon think he is?
>>> flying = 'circus' >>> flying[0] 'c' >>> flying[5] 's'
>>> flying[2:4] 'rc' >>> flying [2:] 'rcus' >>> flying[:2] 'ci' >>> flying[-3] 'c'
>>> a = ['spam', 'banter', 881, 5] >>> a ['spam', 'banter', 881, 5] >>> a[0] 'spam' >>> a[:3] ['spam, 'banter', 881] >>> a[:2] + ['boo'] ['spam', 'banter', 'boo'] >>> a[3] = a[3] + 100 >>> a ['spam', 'banter', 881, 105]
>>> a[0:2] = [1, 3] >>> a [1, 3, 881, 105] >>> a[1:2] = [] >>> a [1, 3, 105]
>>> # Fibonacci series: ... # the sum of two elements defines the next ... x, y = 0, 1 >>> while y < 10: ... print y ... x,y = y,x+y ... 1 1 2 3 5 8
>>> #Measure the lenth of some strings: ... a = ['Monty', 'Python', 'Flying', 'circus'] >>> for x in a: ... print x, len(x) ... Monty 5 Python 6 Flying 6 Circus 6
>>> range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(5, 10) [5, 6, 7, 8, 9] >>> range(0, 20, 4) [0, 4, 8, 12, 16] >>> range(-10, -30, -5) [-10, -15, -20, -25]
>>> def fibo(n): # write Fibonacci series up to n ... "Print a Fibonacci series up to n" ... x, y = 0, 1 ... while y < n: ... print y, ... x, y = y, x + y ... >>> #Now call the function that we have just defined: ... fibo(2000) 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
>>> def fibo2(n): # return a Fibonacci series up to n ... "Return a list containing the Fibonacci series up to n" ... result = [] ... x, y = 0, 1 ... while y < n: ... result.append(y) ... x, y = y, x + y ... return result ... >>> f100 = fibo2(100) # call it >>> f100 # write the result [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
Try this if you have completed all the above, and still have time.
Write a simple Python program for the following simple guessing game. The computer will generate a random number between 0 and 100. The user will try to guess the number, with each guess, the computer will let the user knows know if the user is getting closer or further. At the end of the game (it doesn't matter if the user guesses the correct time or chooses to quite the game), the total time taken will be displayed together with the number of tries.
This section is about what happens when you have several people trying to update a file simultaneously. This is a common scenario in Operating Systems (et al), and the lab will show you how this problem arises, and how it might be solved. It also introduces you to some basic file maintenance protocols.
For an explanation of the Mutual Update Problem, see the Mutual Update Problem web page
FTP stands for File Transfer Protocol. According to the Macquarie Dictionary, a protocol is a (set of) customs and regulations dealing with the ceremonies and etiquette of the diplomatic corps. Well, it is not quite the same definition in computing use, but if you think of a computing protocol as a set of rules or regulations, you are not far wrong.
The FTP protocol defines the rules by which a file may be transferred from one computer system to another, across the Internet. These rules are necessary, because there is a variety of different forms of traffic on the internet, and they need to be kept apart so that they don't interfere.
There are a number of on-line tutorials about FTP. Here are a few:
Here the basic instructions you'll need to know. Start the program off with a command line like:
ftp dimboola.infotech.monash.edu.au
The web site The Basics of FTP may be useful to you here.
SVN is a version control system. It is used to record the history of the source files. Essentially, SVN stores all the versions of a file in a single file in a clever way that only stores the differences between versions. This is opposed to saving every version of file that has been created, which could lead to an enormous waste of disk space.
SVN also helps if you are a part of a group of people working on the same project. SVN insulates different developers from each other where every developer works in this own directory. At the end of which, SVN merges the work each developer is done.
You will be using SVN for exercises in the subsequent practical sessions.
You should visit these links before the lab, not during!
Well, that is a good question. Imagine you have completed your degree, and are now working for a small software company. Your boss says to you "I've heard about this new software called SVN. Can you check it out for me, and tell me all about it?" What do you do?
At his stage you remember one of your lecturers at uni told you this was going to happen. Fortunately, he prepared you for this event by getting you to do a very similar exercise in the lab sessions for his unit. That exercise is the one you are about to do.
Your boss (let's call her Versa) will want to know this.
Find out the basic command set for SVN. Document it in your lab journal.
Now that your boss knows some of the basic commands, she asks you "What can I do with these?" So you show her a few simple examples.
You will need to know that there is a working SVN server at:
Your tutor will help you to set up your SVN directory if you need assistance.
Create a working copy directory somewhere in your file system. cd into this subdirectory, and then checkout the svn repository with the command
Basically, this exercise is about repeating the steps of Exercise 16, this time using SVN rather than FTP
How confident do you feel about reading a Python program? What about writing one?
How might you develop your Python skills further?
Compare and contrast the two systems, FTP and SVN, when used to transfer and maintain files across the net. Pay particular attention to the problems of supporting multiple editing users.
Why were protocols such as FTP developed in the first place? Does every country in the world have to use the same FTP protocol? Why? What can you say about the use of standards in the IT industry? (As a counter example, you might also reflect upon the use of Microsoft Word as a de facto industry standard for information exchange.)
What would happen to the FAQ described in section 6.2 if someone deleted the content of the file
Where would the need for a SVN style protocol occur
What are the conflicts that arise in the cases identified under section 7.2? Can you generalise across them? Can you specialise them to the activities performed in an Operating System?
| 20100721:150907 | 3.0.0 | ajh | first version for 2010 |
| This page maintained by John Hurst. Copyright Monash University Copyright Policy |
|
![]() |
|
Generated at
20120505:0433
from an XML file modified on
20100727:1616 | |||