Getting started

There are many ways you can work on the assignments if you already have some experience with computers and programming. We do not wish to enforce any given method for you to work on them, and if you feel confident you can do it your own way, please use the tools you're familiar with. On the other hand you can also try one of our methods in order to broaden your knowledge of tools. For those who wish to try something different, and for those who are not familiar with computers, we are going to present the two different methods that we recommend for working on the assignments. But first we will get everyone acquainted with the available resources from School of Computing.

I. UNIX account

You should have registered for an SoC UNIX account by the time you are reading this. This account is distinct from your NUSNET one, even if you used the same identifier. The passwords can (and should be, security-wise) different. Your UNIX account resides on a machine called sunfire, hosted by SoC. This machine has two services that are of interest to us. The first service is SSH (Secure SHell) which gives you access to a command line interface, and is available at the sunfire.comp.nus.edu.sg address. The second service is the Apache web server, reachable at the www.comp.nus.edu.sg address.

II. First login

Use the SSH Secure Shell program available under Programs → SSH Secure Shell → Secure Shell Client in the lab, click on the Quick Connect button and provide the following information:
Host Name: sunfire.comp.nus.edu.sg, Authentication Method: Password
and connect on it. The first time you connect from a given machine, you will be asked to confirm that the server to which you are connected is the right one, by verifying its fingerprints. Please refer to the SoC document repository's relevant article if you feel the need to verify them: If you feel confident enough, or once you have verified the authenticity of the server, click on Yes:
Fingerprints
If you feel confident enough, or once you have verified the authenticity of the server, click on Yes, then enter your SoC UNIX account's password in the next dialog box and validate.
If everything goes well, you should now have access to a shell looking this way:
SSH Secure Shell 3.2.9 (Build 283)
Copyright (c) 2000-2003 SSH Communications Security Corp - http://www.ssh.com/

This copy of SSH Secure Shell is a non-commercial version.
This version does not include PKI and PKCS #11 functionality.


Last login: Mon Jan 14 12:51:58 2013 from kister-d980.d2.
_________________________ANNOUNCEMENTS(common)_________________________________

DR3 & DR4, book at https://aces01.nus.edu.sg/fbs/jsp/index.jsp

Win8 and Printing: please see https://docs.comp.nus.edu.sg/node/2184#32
_______________________________________________________________________________
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have 0 New mail(s) in your Inbox.
Last login on sunfire0.comp.nus.edu.sg at Monday, January 14, 2013 12:51:58 PM SGT
kister@sunfire0:~[484]$
Now type the following commands (the $ symbol is the prompt, which tells you that the machine is ready for you to type a command):
$ echo "umask 022" >> .profile
$ source .profile
This commands ensure that everytime you create a file, the web server will be able to read and display it. The web server will only display the files from the public_html directory, so you have to create it:
$ mkdir public_html
The last step consists in downloading the Cascading Style Sheet (CSS) files used by the assignment web pages. These files are used to describe to your web browser what style (fonts, colours, margins, and much more) to apply to the contents of a web page. For a striking example, you can visit the CSS Zen Garden.
$ cd public_html
$ wget http://www.comp.nus.edu.sg/~gem1501/year1213sem2/assignments/assign.css
$ wget http://www.comp.nus.edu.sg/~gem1501/year1213sem2/assignments/highlight_js.css

III. Working on an assignment

A. Retrieving the file

If you want to work on the first assignment, numbered 00, you must connect to your account by SSH and type the following commands (if you already are working in the public_html directory, ignore the first command):
$ cd public_html
$ wget http://www.comp.nus.edu.sg/~gem1501/year1213sem2/assignments/assignment00.html
The first command changes the working directory to public_html, the second command downloads the assignment file from the web server.

B. Visualizing your file

In order to see the result of your modifications to your file, you have to use a web browser (Mozilla, Chrome, Opera, IE) and connect to your account. If your Soc UNIX account is for instance u123456, it will be available at (don't forget the ~ character):
http://www.comp.nus.edu.sg/~u123456/

C. Editing your file

1. jEdit, the easy way

JEdit is a very complete text editor written in Java. You can download and install it by going to the following address: http://www.jedit.org/index.php?page=download. One particularly useful feature of jEdit is the ability of one of its plugins to transparently work over SSH, which means that you can edit directly the files on the sunfire machine from any other machine on which you installed jEdit.
In order to install the plugin, start jEdit and from the menu, open Plugin → Plugin Manager, select the Install tab and write ftp in the filter. You should be able to select the FTP plugin:
Image of Plugin Manager
Install the plugin and Close the Plugin Manager. Now, in order to open a connection to your account, click on Plugin → FTP → Open from Secure FTP Server… and fill the following form with the same values than in Section II of this document:
Image of connection dialog box
Just like in Section II, the first time you use jEdit on a given machine to connect to sunfire, you will be asked to verify the fingerprints:
Image of fingerprints confirmation
Once you clicked Yes, you will be connected to your UNIX account and will be ready to work on your assignments.

2. Command line interface, the less easy way

Alternatively, you can edit the file in the shell with editors such as vim or pico.

D. Miscellaneous

File handling

If you want to restart your assignment from scratch, you must first delete the file then download it again (otherwise wget will add an extension to the file in order to avoid overwriting it):
$ rm assignment00.html
$ wget http://www.comp.nus.edu.sg/~gem1501/year1213sem2/assignments/assignment00.html
If you want to try something new without losing your other changes, you can create a backup copy of the file:
$ cp assignment00.html assignment00.html.backup
Later if you realize your new idea was no good, you can restart using the previous version by doing a copy the other way around:
$ cp assignment00.html.backup assignment00.html
There are many more commands available that are beyond the scope of this document, you can find a short listing here, for instance. There are many resources available for learning UNIX commands.