Use your icarus account from any computer connected to the internet. You can do this from Greece, the South Pole of even from home. You may need to first go to the ACCC webpage and activate your icarus account. It is assumed that you may not finish all of the lab procedure during the lab time. If you do not finish during lab time then you should finish the procedure in your own time.
Note
lines beginning with ">" indicate that you should enter the given command at the command prompt >.
0. Logon to a computer in the pc-lab. From the pc-lab you can connect to another machine named icarus.uic.edu. All students have an icarus account but you may need to activate it. Use a web browser and go to http://www.uic.edu/depts/accc/home/ACCTS.html In the New Accounts section select Accounts - Open an ACCC Account and open your icarus account.
From the pc-lab (or from any computer) connect to your icarus account. This can be done using web utilities found in a folder on the pc Desktop. Both icarus and Macs use a unix operating system. To learn about many commonly used unix commands you should start with the ACCC tutorial http://www.uic.edu/depts/accc/software/unixgeneral/unix101.htmlOnce you are logged onto icarus using a terminal window, type
something on the command line and then try to back space to change what
you typed. It does not work. This is not convenient. You open a window
within the original login window called a bash shell. In a bash shell,
you can back space on the command to fix typos and use the up/down
arrows to re-use commands you entered earlier.
Once you are logged into icarus here is how to open a bash shell.
>bash --later you will need to exit the shell before you exit icarus
>ls -l --note: lines beginning with "d" indicate a directory and "-" a file.
2. Make a directory mcs260 , cd into it , make a directory named firstlab and cd into it.:
>mkdir mcs260
>cd mcs260
>mkdir firstlab
>cd firstlab
Note, on unix you can enter more than one command on a line if seperated by a ";". Try it.
3. Type the python code to test the gcd algorithm. The algorithm will be explained later in a lecture. Use the pico (or vim or emacs) text editor to create the following file named gcd.py:
> pico gcd.py
Now type the following python code, save it and exit pico. In
Python, it is very important that you get your indentation right.
Some programmers claim that computer code is easiest to read if 4
spaces are used for each indention level.
# file: gcd.py
# your name, mcs260, Spring 2008
# an example of using python to implement the gcd algorithm
def gcd(m,n):
while n != 0 :
r = m % n
m = n
n = r
return m
def main():
print 'find gcd(m,n)'
m = input('enter m: ')
n = input('enter n: ')
print 'gcd(',m,n,') = ', gcd(m,n)
main()
Now run the program at the command prompt. If you get any error messages use pico to fix your typing errors and try again.:
> python gcd.py
Did the program give the correct answer?
4. Practice submitting your python program by sending it to
yourself. On icarus you can use the pine email program and include
gcd.py as an attached file. Once you send the file to yourself as a
file attached to an email, you should be able to use webmail from a
browser to see the email with attached file. Save the file to the
Desktop on the pc. Now see if you can open the file using idle. Idle is
a python program that can be used to edit, debug and run python
programs.
Note, if you have problems using pine on your icarus account, then
you can first use sftp or some other file transfer program to transfer
the file to the pc-lab and then use
webmail to both send and receive the email with attached file.
Here is how to use pine on icarus. Start the pine email program by
entering pine at the command line.
> pine
Select COMPOSE to create and
send an email
to yourself with the file gcd.py attached. Try to figure out how to do
this on
your own. If you get stuck ask for help.
Now exit pine and and use webmail to see if the email was sent to you.
Now exit icarus:
> exit --to exit the bash shell you started earlier
> exit --to exit icarus and return to the lab operating system
5. It is often more convenient to work on the PC in the lab and
save your work
to either your icarus account, a flash drive, or your mounted webdisk
before logging
off. Later in the semester, you will be using a machine named raphael
instead of icarus. In your
next session you can copy the files saved on icarus or webdisk back to
the Mac
and continue working on your projects.
Create a new folder named mcs260 on the Desktop (or somewhere on the
pc) and go into it. Use a text editor that is available on the pc and
create the source
file gcd1.py. Type the same code as before. You can use Notepad,
Wordpad, Idle (python editor and interpreter) and others. You can
use Word but
make sure you save your program as a text file and not a Word
file. After you create your python program, try running it using
the python interpreter in the lab.
You can now save your program by transferring it to icarus, your
mounted Webdisk, a
flashdrive (plug
it in) or sftp (a secure file transfer program). The file
transfer program sftp can often be used form the command line. However,
the command line on the windows pc labs is disabled for security
reasons. There several free programs that you can download for
transfering file from one computer to another. If you look in the web
folder on the pc Desktop you will find one. Try to send your file from
the pc to your icarus account. You can also transfer files from icarus
to the pc-lab. Ask your TA for help if you need it.
If you want to connect to icarus from your home computer you can
download a free program called putty. Google it. Putty lets you connect
to another computer through a terminal window. On the putty download
page you will find another putty program that can be used to sftp files
between computers. You might find this useful.