Tasks

  1. Open up the Terminal application, which is a text-based method of using your computer.

    A terminal is simply a text-based interface to the computer. In a terminal, you can type commands, manipulate files, execute programs, and open documents. Anything you can do in the Finder, you can do in a terminal (the reverse is not true).

    When working in a terminal, the current directory is called your working directory. A terminal will usually start in the home directory of your account.

    In a terminal we often need to specify a file or directory on the hard drive. The complete description of where a directory or file on a computer is located is called its path.

    Directories in a path are separated by a forward slash /. The topmost directory on the filesystem is indicated by a single slash. The directory tree for your computer is all relative to the top level directory. In other words, starting with a /, you can type the complete path to any file on your computer. For example, the following is the path to my home directory.

    /Users/maxwell

    Most of the time, however, you will be specifying paths relative to your current directory. Any path that starts without a slash is relative to your current working directory. Note that paths are case-sensitive, so be sure to use proper capitalization.

    You will use paths, and filenames to change directories, list the contents of directories, and run Python programs.

    Some important terminal commands are the following. We'll walk through how to use them together in lab.

    Some useful terminal properties are the following.

    Some useful (but not as common) terminal commands are the following.


  2. Text editors are the workhorse programs for writing code. You don't want fancy fonts or WYSIWYG layouts, you just want to see lines of text, preferably with syntax highlighting, which means that special words in a language are highlighted to make it easer to read the code. There are many editors to choose from. We'll go over a few in lab together.

    nano/pico - nano (or pico on some systems) is a very simple text editor that works in a terminal. All of the commands use the control key and are listed at the bottom of the screen. To open up a file, just type the name of the editor followed by the name of the file. If the file does not exist nano creates the file.

    nano <filename>

    Open up a file called smart.py and put in the line:

    print 'You are smart'

    Then quit nano and run the file by using:

    python smart.py

    Congratulations, you just ran your first python program. (python humor)

    Some other editors you should know about include the following:


  3. Colby Wiki - a Wiki is a convenient way to put content up on the web quickly and easily. We'll watch a video on how to create your personal space and then go through the process of creating a new page in your space.

    Tutorial Videos

    You can edit any page in your space by going to the Edit tab. There you will find one or two options for editing your page. The Rich-text option (available when using FireFox) lets you do the normal select and point and click type formatting. The wiki markup lets you use the wiki markup language to make your page.

    To make a new page that links from your home page, edit your home page in wiki markup mode and put the name of the new page in square brackets, like:

    [Project 1]

    After saving your page, the link should show up as red text. Clicking on the red text creates the new page and takes you to the editor for it. You can always choose to remove a page in the edit tab using the link on the upper right on the window.

    You should make wiki pages only within your own space. We can link a page in your space to the course wiki page if you put a label on the page. The label field is a text field at the bottom of the page, and is different from the title of your page. Each assignment will specify a label. Once you have labeled a page, it will show up in a list on the course wiki home page.

    Always use a meaningful title for your wiki pages--something like 'CS 151 Project 1'--so that the page content is clear from the title.


  4. Fileservers - a fileserver is a central file system you can access from any computer. It's like having a virtual USB key you can plug into a computer to store your files. Colby maintains several different fileservers we use in this course.

    You can mount your the Colby fileserver directories by going to the Finder and typing cmd-K, or selecting 'Connect To Server...' from the Go menu. It will bring up a dialog box, into which you want to enter the following.

    Mounting the file systems this way should give you access to all of the file systems you can access. The important ones are Personal and Courses. The Personal directory is for your own use, anywhere on campus. It gets backed up regularly, and you can access it from any computer on the Colby network. We strongly suggest you store all of your work for this course into your personal directory. You can, in fact, work directly from your personal directory.

    The Courses directory is where you will hand in your code. You should have access to a directory called CS151, and within that, a directory with your user name. Files that you put into that directory you can edit, read, and write, and the professor can edit, read, and write, but no one else. To hand in your code and other materials, you will create a new directory, such as project1, and then copy your code into the project directory for that week.

    You can also mount your personal directory explicitly, using the the following path in the 'Connect To Server...' dialog.

    smb://filer/personal/<first initial>/<username>