CS107 - Lab 1

Due Tuesday 09/14 at the beginning of class.

In this lab you will cover:

The reading for this lab is Chapter 1 in the textbook.

Getting used to the computer

Login to your machine and pick your favorite web browser (a browser is a program that can access documents on the World Wide Web written in HTML) --- Safari, Netscape, Internet Explorer. Note: listed in my order of preference :). You may be used to Internet Explorer, but do try and use Safari for this class---it is the default Mac OS X web browser.

Access the class webpage at http://www.bowdoin.edu/~ltoma/teaching/cs107/spring04/. Browse over the syllabus and the course information, and follow the link to Lab 1. You will be reading this page.

When you log onto the machine, you will see a Macintosh HD folder (corresponding to the local hard disk), and two network folders, one called CLASS'XX (your class), and the other called your-login-name (your home directory on the Bowdoin network). Both these folders should be mounted automatically when you login (you will be asked twice for your password; if you do not enter the password the second time the two folders listed above will not be mounted).

Open a new browser window and open the URL http://www.google.com. Google is computer scientists' favorite search engine. It was developed by two graduate students at Stanford. Now Google is a big company. Try searching for something by typing in some keywords. Everybody likes Google because it is very good at finding information (one of the first few hits is typically what you were looking for).

Using basic Unix commands

Open a Terminal, from you MacintoshHD->Application->Utilities->Terminal. You will get a window and a prompt that looks like this:

bash-2.05a$

or like this

imac213:ltoma%

This is the operating system prompt. On the Macintosh machines in this lab, the operating system is Mac OS X, which is built on top of Unix FreeBSD. Therefore, in the terminal window you can type Unix commands.

Everything you type at the prompt is interpreted as a command and the operating system tries to execute it. If it can, you will see the result, otherwise you will get an error message.

In the terminal window you are working within a current directory (folder). The default directory when you open the terminal is your home directory in this lab (yes, it is a bit confusing that you have two home directories, one on the network and one on the macs, but...hopefully in the future Bowdoin will have a single file system). You will be able to access this home directory from anywhere in the lab. To find out the location of your home directory type:

pwd

To find out what are the current contents of your home directory type ls (comes from list):

ls

We will be using little unix in this class. However, if you would like to learn more about the tree-structure of unix file system and commonly used Unix commands talk to me.

Creating a web page

You can find instructions for setting up your Bowdoin web page here, or follow the steps below.

To create a web page you will need to create in your network home directory a folder (directory) called public_html and inside it a file called index.html or welcome.html. This file will be your "homepage". You should be able to access its contents at http://www.bowdoin.edu/~your-login-name/.

To create this file you need to remotely login onto the Unix server, called polar. To do this, in the terminal window, at the unix prompt, type:

man ssh

The man command displays the manual help page of the command the follows after man. You can use this command whenever you want to find out what a unix command does or how to use it. Read briefly through the ssh man page, and try to get an idea of what it does. Basically ssh lets you login (connect) on a remote machine, securely (ssh stands for secure shell). It is important that the connection is secure, this meaning that the entire communication between you and the remote machine (host) will be encrypted and therefore nobody else can "listen" to it. To connect remotely to polar type at the unix prompt:

$ssh polar

and enter your login name and password. You should get a similar Unix prompt on polar:

polar>

You are now in your network home directory on polar. This is the directory mounted on your desktop. To check this, at the polar prompt, type

polar>ls

and you should see the exact same content as in the folder your-login-name that is mounted on your desktop.

To create the default webpage: at the polar prompt, type

polar> websetup

and follow the instructions. Basically, websetup is a program written by the IT people at Bowdoin that sets up your default initial homepage welcome.html automatically. Look at the default web page that you have just made by typing in the web browser http://www.bowdoin.edu/~your-login-name/.

You can now start modifying your page to make it look the way you like it. To do this, you will need to edit the file welcome.html using a text editor. Modify it, save it, and then re-load the page in the browser to see the changes. A basic file will look something like this. You can use Safari->View->ViewSource from the browser's menu to see precisely how an html file looks like.

Your task for the first lab is to figure out the basics of the html language by looking at the source of this. Which part centers the text? Which part writes the title on the bar? Which part is for the image? To see if your answers are right, edit your welcome.html, save it and re-load it in the browser. The goal is to create a simple webpage which contains some information about yourself and includes a photo. You will update the homepage throughout the semester. When you are done send me an email with the address of your website.

Algorithmmic problem solving

Complete exercises 3, 4, 6, 7, 8, 9 on page 35 and 1, 3, 4, 5 on page 72 of your textbook (3rd edition).

Be sure to justify your answers! You may do this work either by hand or with a word processor (e.g. MS Word). Also, you may choose to do this assignment either by yourself or in a group. However, solutions should be written up individually and handed in on Tuesday, at the beginning of class. Do your best at writing legibly and leave space between problems.

What to turn in:

Also, have your webpage ready by the due date.