Welcome to the laboratory programme for the MSc in Computing Science course at Imperial. Here you'll find introductory information on the languages you will be using, as well as primers for some of the various editors you might want to use.
The following resources from the department will help you get started using the computers in the labs:
- Lab Information Pack
- An Introduction To Unix (Dr. Knottenbelt)
- Linux and Unix user guide (CSG)
- Windows user guide (CSG)
You can also find more information on using linux and unix systems by following the external links below:
Electronic Coursework Submission
You will be using the CATE system throughout the year to obtain information about the various assessed exercises and more importantly to submit your work electronically or to retrieve cover pages for hardcopy submissions.
Access to CATE is done by authentication i.e. you must type your login and password when prompted for.
In the timetables section, the “Autumn Term” is already pre-selected, just click on the button “View” and the timetable for the Autumn Term will be presented to you. Locate the relevant module and within it, the white coloured box labelled with the name of the exercise.
Click on the icon “D” (for data supplied). You'll be presented with a page that contains the specification for this exercise and, further down, the data files, if any.
To submit click on the “H” icon
Programming Language Resources
You will learn a number of programming languages on the course. Below, you can find some useful resources to support your learning.
- The introductory lecture notes and exercises
- C++ FAQ
- The C++ Resources Network
- The Boost Libraries
- Quick C++ tutorial for programmers who already know C
While the 'make' tool is standalone, and can be used to compile programs written in all sorts of languages, you will use it mostly when writing C++ programs.
It's a good idea to spend some time picking a text editor that you like, as being familiar with your tools can save an enormous amount of time and effort. Here are some common Linux editors you might like to try. Don't worry if you're not a Linux command-line guru; you don't have to memorise a million keyboard shortcuts to speed up your work (although learning a few might not hurt).
Broadly speaking, editors come in two types; graphical editors and text-mode ones. The former (unsurprisingly) appear in a graphical window on your desktop, while the latter run directly in your console (i.e. they fill the window your command prompt was showing in). While text-mode may sound a bit primitive, it does have some benefits, particularly when remotely connecting to department machines over the internet.
It's a good idea to have a passing familiarity with at least one text-mode editor, because you will almost certainly at some point find yourself needing to edit a text file without full access to a GUI. T here are many horrible ways to experience vi for the first time (some would say they are all horrible), but without question the very worst is when dialling in to a college computer to try and fix the typo you just noticed in your project, five minutes before the submission deadline expires.
Here are some common editors, all found on the standard depar tment Linux installation. Give them a try, and see which you like best.
Vi/Vim is a text-mode editor, and if you've not come across it before, has a rather steep learning curve. It's referred to as a “modal” editor, because it operates in two modes - “insert” and “command”. In command mode, your keystrokes are interpreted as commands to the editor itself, while in insert mode the text you type becomes part of the document. This is why if you open a file and try to start typing, nothing happens; you're in command mode. The idea of this is to cut down on the chord-style commands found in Emacs and the like, which some people believe can cause RSI.
vi is far too powerful to helpfully describe here, so here are just a couple of commands to get you started. Remember you must be in command mode for these to work - press escape a couple of times if you're not sure.
|a||enter insert mode (inserts after cursor)|
|i||enter insert mode (inserts before cursor)|
|escape||exit insert mode (returns to command mode)|
|:w||write file to disk (the colon is important)|
|:q||quit (will give an error if unsaved changes exist)|
|:wq||save and quit all at once|
|:q!||quit without saving|
That's enough for now; should you want to know more, these links contain much more information (particularly “Learning the vi editor”):
Why, oh WHY, do those #?@! nutheads use vi? (a bit evangelistic)
GNU Emacs is a much more complex graphical editor, but almost infinitely customisable. It has editing modes for every programming language you've ever heard of, plus most of the ones you haven't. These can be very useful, as the better ones are sufficiently intelligent that if you spot them highlighting or indenting something in a way that doesn't seem right, it's often a sign that you've made a mistake (catches a lot of missing semicolons, this).
Its command system is based heavily around “chords”, i.e. combined keypresses like ctrl-C. It takes this to rather more complex levels than you'll have seen before, though. For example, C-w means “hold Ctrl and press w” (so far, so simple). C-x s means “hold Ctrl, press x, then let go of Ctrl and press s”. C-x C-c means “hold Ctrl, press x then c and let go of Ctrl”. Here are some common commands to get you started:
|C-x C-f||find (load) an existing file, or create a new file (hit tab to see a list of all files in the directory)|
|C-x C-w||save as… (you will be prompted for a filename)|
||see a list of currently open files (or “buffers” in emacs-speak)|
|C-space||sets the “mark” (see below)|
|C-w||cut, or “wipe”. Deletes highlighted text and keeps it in a temporary buffer.|
|C-y||paste, or “yank” (as in, “yank the text from the temporary buffer and put it here.”)|
|C-g||exit command. Very useful if you've got yourself into a mess with other commands, and want to start again.|
The “mark” mentioned above is how you highlight text without using the mouse. Rather than holding shift and using the arrow keys as in many graphical editors, you use C-space to set a mark, then move the cursor; text between the cursor and mark will be highlighted, and can then be manipulated with other commands.
Here are some proper references should you decide you like Emacs and want to learn it properly:
Prolog Mode: Emacs can be used as a fairly full-featured IDE for Prolog, by enabling the Prolog mode. To do this you'll need to edit the .emacs file in your home directory (create one if it doesn't already exist). Full instructions on how to do this can be found at the Sicstus website. The Prolog mode enables syntax highlighting, hooks to run sicstus within emacs and some basic editing shortcuts. These features will be enabled by default for the Lexis tests.
NEdit is a relatively simple window-based editor that will be familiar to anyone who's used the more common editors for Windows (the basic keyboard shortcuts are very Windows-y). It has some basic syntax highlighting for things like C and C++, a tabbed user interface for multiple files, and a macro recording and editing facility. It doesn't have Prolog syntax highlighting as standard, though. There's a patch you can download, but it's not particularly sophisticated.
Pico is a much (much) friendlier text-mode editor, having a list of common commands at the bottom of the screen, and only one mode to remember. However, it doesn't really have any of the features you'll need for heavy programming use, having been init ially designed as an editor for writing emails. Handy for some very light editing when you don't have a graphical terminal, though.