GOTO: The
Department Guide Setting
up online life
Information on Setting Up Online Life
Contents
Beyond This Page
Once you've read this page, here are some ways to find out more on your
own:
-
Ask other CS grad students - they know a lot, and you want to get to know
them anyway!
-
To find out how to use a software package, read the documentation:
-
Text documentation: Available for most locally installed
Unix commands and libraries.
-
man ls explains the ls command
-
man -k virtual lists all commands whose short description contains
the word virtual
-
man man explains the man command. Make sure you understand
the -s option, which is necessary when multiple commands or functions
have the same name. You will most often want to use man -s1 in
such cases.
Be warned that man will tell you every possible option for the
command, but may not tell you which options are important or explain the
background!
-
Hypertext documentation: Available for some locally
installed packages.
-
Type C-h i inside Emacs, or type info at the command
line
-
This starts the info program; type h for help
-
Web documentation: Often easy to find with a search
engine like Google. For especially
helpful introductory documentation, try including the word "tutorial" or
"howto" in your query. If that doesn't work, try "FAQ," "manual," "reference,"
"specification," or the phrase "how to."
-
Tutorial books: If more than a few people use the software, there is probably
a well-written book to teach it to you. Ask a friend to recommend one.
If you can't borrow a copy from the library
or a friend, bestbookbuys.com
will help you find a cheap price. O'Reilly
and Associates publishes a wide series of books about Unix programming
languages, utilities, editors, and other resources.
-
Hardcopy manuals and tutorials: Check out the bookshelf in the lab (CSB
727A).
Learning Unix
Everything you do for the next four or five years will be done using Unix,
so it is worth your while to make the relationship as productive as possible.
Unix is a powerful operating system based on the philosophy of tools
- the idea that people will build and use simple tools and will combine
these in standard ways to get specific jobs done. This document cannot
possibly describe all of Unix to you. It is up to you to figure out what
is out there and how things work, starting with the
suggestions above. To get started, you might search
for an online Unix tutorial that you like.
There are many good books about Unix, including:
-
``The UNIX Programming Environment'' by Kernighan & Pike (the
original book by the authors of Unix - somewhat out of date but still excellent)
-
``Learning the UNIX Operating System'' by Todnio & Strang
-
``The UNIX C Shell Field Guide'' by Anderson & Anderson
-
``UNIX in a Nutshell'' published by O'Reilly & Assoc
-
``UNIX for the Impatient'' by Abrahams
-
``A Practical Guide to the UNIX System'' by Sobell
George Ferguson's Introduction
to Unix was written for this department in 1993, so it's out of date
but designed for people just like you. He has also written several short
documents about how to configure and use your environment better; see
his README
for a guide.
Be aware that much of your configuration is stored in "dot files."
These are files in your home directory whose names start with a dot, such
as .cshrc, .login, and .emacs. These were set
up with reasonable simple defaults when you got your account, but understanding
and adapting them is a key to success with Unix. George has placed some
excellent sample dot files in /u/ferguson/Newuser,
and you may wish to start with those, using his setup script to
install them. Note that dot files are usually suppressed from directory
listings to avoid clutter; use ls -a if you want them to show
up.
Be warned that if you want to keep some of your files private, you will
need to understand Unix file permissions and the chmod and umask
commands. (You also need chmod to make scripts executable.) If
it's not important that a file be private, consider leaving it public in
case it is useful to someone else.
Learn to use your Unix shell, including
its job control and command-line editing features. To arrange for programs
to start running or continue running when you're not logged in, use at,
batch,
or crontab.
Finally, a word on where executable files are stored here at URCS.
You will need to know this, for example, in order to specify the full pathname
of an interpreter in your own executable script files (via the #!
mechanism).
-
The directory /usr/bin stores many of the programs that come packaged
with Unix.For
example, /bin/csh is the C shell interpreter.
-
Many of the additional programs that are maintained by the URCS staff are
found in /usr/staff/bin. For example, the Perl interpreter is
/usr/staff/bin/perl.
-
Programs installed and maintained by grad students and faculty, rather
than by the staff, are in /usr/grads/bin.
-
People's personal bin directories (/u/*/bin) sometimes contain
useful programs that they have installed for themselves. Use at your own
risk.
-
Look at your PATH variable to see some other important directories
where programs are stored. These directories are automatically searched
when you try to run a program without specifying its directory.
Editing
Emacs
You should use the Emacs editor. Start it by typing emacs. The
opening screen explains notation and tells you several ways to get help;
start with the tutorial.
Emacs is basic equipment around here. You will type many, many
keystrokes into it over the years, so you will gradually want to learn
how to use more of its power. To read the detailed manual (after taking
the tutorial), start the info program as described
above, learn how to use it, and then select the emacs topic.
Anyone can modify Emacs, so there are many add-on packages for
it. Emacs can show you the packages that are shipped with it: type C-h
p to get a hierarchical menu.
Among the Emacs packages are many specialized editing modes. Some
are installed by default: for example, the keys, menus, and indentation
will work somewhat differently when editing HTML, LaTeX, C++, and Perl.
Emacs tries to guess the right mode for you. Use C-h m for documentation
on your current mode, whose name is mentioned in the black status line
at the bottom of the Emacs window.
Note: You can also try xemacs, which is a modified version
of Emacs that has fancier colors and fonts and buttons and stuff.
LaTeX
Emacs is an editor for plain text files (like programs). But suppose you
want a beautifully typeset journal paper with italics, formulas, headings,
footnotes, cross-references, etc.? Then you should use emacs to create
a LaTeX file, which contains the text of the document plus typesetting
commands. Run latex to actually do the typesetting, xdvi
to view the result, and dvips to convert the result into a printable
(PostScript) file.
There is an Emacs package, AucTeX, to help you write Latex. For documentation
use info auctex. To turn it on, put the following
in your .emacs file:
(autoload 'tex-mode "auctex" "Improved TeX/LaTeX mode" t)
(autoload 'latex-mode "auctex" "Improved TeX/LaTeX mode" t)
Anyone can modify LaTeX, so there are many add-on packages of advanced
typesetting commands. Your document can use these following a \usepackage
command. The Latex Companion (see above) describes many packages.
Many are already installed at URCS; you can get others from CTAN.
Especially important is the AMS-LaTeX collection of packages and fonts
from the American Mathematical Society, which can make your life a lot
easier when writing math: for documentation do xdvi /usr/staff/lib/teTeX/1.0/share/texmf/doc/latex/amslatex/amsldoc.dvi.
You should also use BibTeX, which will painlessly
produce LaTeX bibliographies for you, in various formats, from a specially
formatted text database of citations.
Diagrams and Graphs
While you can make certain simple kinds of diagrams directly in LaTeX,
using the picture or (better) eepic environment, this
isn't good for anything complicated. So LaTeX also has a psfig
package for including arbitrary pictures into your document, if they are
stored in EPS (Encapsulated PostScript) format.
A decent GUI program for drawing figures is xfig, and gnuplot
will draw various 2D and 3D graphs of functions or data. Both these programs
can produce EPS (among other formats).
Printing
Learn to use the lp, lpstat,
cancel,
and enscript commands. The main printer in the 6th-floor robotics
lab is called shake. The main printer in the 7th-floor mailroom
is called chaucer, and the expensive, slow color printer there
is called picasso.
Please save paper by using duplex for two-sided printing,
or by reading papers right on the screen. The commands for viewing dvi
(.dvi), PostScript (.ps) and PDF (.pdf) files
are xdvi, ghostview, and acroread respectively.
Posting documents
For distributing documents via the web, you need to create
a PDF file. PDF is a more portable format than PostScript and has extra
features.
pdflatex is a substitute for latex that will
turn your LaTeX file directly into a very nice PDF file with scalable fonts.
An existing PostScript file can be converted to PDF with ps2pdf.
When using pdflatex, you probably want to produce a compressed
PDF file, so include \pdfcompresslevel=9 in the document preamble.
You probably also want internal hyperlinks and a PDF table of contents,
so include \usepackage{hyperref} near the end of the document
preamble.
Another way to distribute LaTeX documents on the web is by converting
them to HTML, using latex2html. The output usually looks worse,
but the advantage is that most search engines will index HTML but not PostScript
or PDF. You can always post both formats!
When posting a paper on the web, make sure you give sufficient information
for a bibliographic citation. It's also a good idea to print citation information
on the first page of the paper itself, so that it can be recovered from
a hardcopy or a direct URL to the paper.
Presentations
When you are giving a talk, you will probably want visual aids. Some people
like to print these onto transparencies that can be displayed with a simple
overhead projector. Other people like to display them using a laptop projector.
More can go wrong with a laptop, but it is easier to jump from slide to
slide, make last-minute changes, and set up special effects.
Some software that may be helpful in producing your visuals:
-
Microsoft Powerpoint - works well and lets you "animate" slides, but must
be created and displayed on a Windows machine
-
OpenOffice - a Unix office suite similar to
Microsoft Office, including a tool similar to Powerpoint: openoffice.org-2.0
-
Keynote - Apple's presentation software.
-
latex - good for simple overheads or heavy
formulas; convert to PDF for easy display.
For drawing figures within LaTeX:
-
dia - wysiwyg diagram editor
- xfig - older wysiwyg diagram editor
- pstricks - drawing package within LaTeX
-
firefox - yes, some people just use HTML pages and display them
with a browser! (no Internet connection required)
Communicating With The World
Web
Ordinarily use firefox to browse the web.
How about creating your own web page? If your name is mud,
then you have the power to create web pages whose URLs begin with http://www.cs.rochester.edu/u/mud/.
You do this by placing files in your personal web directory, /u/www/u/mud,
and making them world-readable with the chmod command.
For example, the URL http://www.cs.rochester.edu/u/mud/pie
refers to the file /u/www/u/mud/pie. (Or, if /u/www/u/mud/pie
is a directory, then the URL will display the full contents of the directory.
To prevent this, put a file called index.html in the directory,
and that will be displayed instead.)
Your home page should be http://www.cs.rochester.edu/u/mud,
stored in the file /u/www/u/mud/index.html.
If you don't know how what to put into these files, there are many
tutorials on how to create well-designed web pages. Also, feel free
to copy the format of other home pages that you like. Netscape's "View
Source" command will let you see the HTML commands behind someone else's
page; start by copying these, and edit to your satisfaction.
Library
The Web is a giant library, but don't forget that we also have Carlson
Library downstairs. (If downstairs is too far away, you can use parts
of the library and consult the extremely helpful librarians without leaving
your computer.) Carlson offers many CS resources beyond the usual books
and journals, including a tech report collection and subscriptions to proprietary
online journals and databases. Bookmark and explore these pages.
Mail
You have your choice of several programs.
-
mutt: Full-screen, terminal-based email client.
-
pine: similar to mutt.
-
Mail: Incredibly old-fashioned but still works.
-
Rmail: A mail system that is fully integrated with Emacs, which
is handy if you use Emacs to edit your messages anyway, or if you like
Emacs's reprogrammability. To get documentation, use info
emacs rmail. Warning: Running Rmail for the first time will convert
your existing mailfile to a new format, although there is an "unrmail"
command to undo this.
-
mh and exmh: A collection of command-line programs for
various mail handling tasks, plus an optional graphical user interface.
You can write scripts that use these programs to handle complex tasks automatically.
For documentation of the command-line programs type man
mh at the command line. Type exmh to start the graphical
interface.
-
mhe: Great interface to mh from within emacs.
-
Gnus: The Gnus newsreader (see below) can also be used to read
mail.
Newsgroups
The central campus NNTP server is
news.cc.rochester.edu.
Set the environment variable NNTPSERVER to news.cc.rochester.edu
to tell your newsreader which server to connect to.
You have your choice of several programs for reading and posting news:
-
slrn terminal-based news reader
-
Gnus is the most powerful newsreader around. It runs within Emacs
and has a baffling heap of features. Start it by typing M-x gnus
from inside Emacs. Type A M ^cs\. to list all URCS newsgroups;
to subscribe to a group, move the cursor to it and type u. For
documentation, use info gnus.
Logging in from home
Some cursory information:
-
The local cable modem service is Road
Runner, the local cable modem service,
and DSL is available from Frontier Telephone.
-
A good free ssh program for Windows is PuTTY.
-
If you want to make your home environment look a lot like your school environment,
you will need to install an X server on your home machine. If you run Linux
at home, you probably already have one installed. If you're running Windows
or MacOS, you can download a free Windows or Mac X server.
-
Some electronic
databases and journals are only available within UR. If you are browsing
from home, you need to use something called VPN
to convince the library that you are really a UR person.
ssh and scp
Use ssh to log in from outside the department,
and scp to copy files over the network.
See info on setting up ssh keys to avoid typing your password.
Programming Languages
This section tells you where to find the programming languages commonly
used at URCS. In some cases I've included a few words about the language,
but mainly the point is to tell you where the tools live.
You can find documentation as described above.
(Check especially for info pages, man pages, and web tutorials or manuals.
There are also many web pages that purport to teach you language X if you
already know language Y.)
Shells
The shell is the special program that provides a command-line interface
to Unix. It allows you to run (and suspend) commands, i.e., other programs.
A command can take several parameters that are specified on the command
line, and it produces an exit status that is an integer (usually 0 for
success).
This may remind you of a function call, and indeed, Unix provides
many simple and complex commands that are like function calls in a programming
language. The shell also provides enough control "glue" to hook those function
calls together into a larger program. If you put such a program into a
file, it is called a shell script. Shell scripts are useful for automating
very high-level tasks.
It is trivial to write a shell script that calls several commands
in sequence: just write the commands one after another. You can also write
tests and loops that condition on the exit status of a command. You can
store simple strings and arrays into shell variables and manipulate them.
Finally, and most importantly, there are several ways of getting the commands
to affect one another: (1) You can use shell variables or the output of
a command as command-line parameters to another command. (2) Most commands
read input and print output: you can "pipe" the output printed by one command
into the input read by another command (a form of function composition).
(3) More generally, you can use the file system as a kind of variable space,
making one command produce files that are later read by other commands.
There are actually several different shells: /bin/sh
(the original), /bin/csh (with syntax resembling C), /bin/ksh
(the Korn shell). /usr/staff/bin/tcsh is a souped-up version of
/bin/csh
with, for example, better interactive command-line editing.
You can treat a shell script like any other program if you use
the #! mechanism. Take the file that contains the script, make
it executable with chmod +x, and make the first line #!/bin/csh
(for example) to specify which shell should be used to interpret the script.
Note: For certain kinds of tasks that involve automatically creating
or recreating files, make may be a better tool than a shell language.
It excels at conditional file updates. The GNU version of make can even
automatically schedule parallel updates (on a multiprocessor machine).
Always use the right tool for the job ...
Perl
Perl programs are executed just like scripts: the first line should be
#!/usr/bin/perl
-w to specify the Perl interpreter (-w turns warnings on).
But Perl is a full programming language that rolls together various
features of shell scripting languages, text processing languages, the Unix
system calls, and (more recently) object-oriented ideas. Programs of some
interest can be written easily and quickly in Perl, thanks largely to built-in
features such as hash tables, a database interface, and powerful regular
expression features. These features are highly optimized. Many extension
libraries are also available.
It is reasonable to use Perl for most scripting, file management,
and text munging tasks. (``Manipulating text with C is like trying to shuffle
cards while wearing boxing gloves'' - Anon.) Some people use it
for all short programs, but be warned that since it is interpreted, it's
not an efficient choice for tight loops (e.g., number crunching). Fortunately,
there are Perl-to-C and C-to-Perl interfaces.
In addition to the usual sources of information, you may be interested
in www.perl.com, www.cpan.org,
and the Unix newsgroup comp.lang.perl.
Here's a good list
of Perl books.
If you plan to write a lot of Perl, consider installing cperl-mode
in Emacs in place of the usual perl-mode. It's fancier.
C and C++
Use gcc and g++ as your C and C++ compilers, respectively.
You should (almost) always compile with the flags -Wall
("all warnings on") and -g ("include symbol names for use when
debugging"). You may also want to use -O3 for maximal optimization.
You should create a Makefile and learn to use the make
command to automate the maintenance of large programs. You might also be
interested in learning version control to manage multiple
versions of files.
The debugger to use is gdb. It is worth using this via
the Emacs interface (M-x gdb), which continually displays where
you are in the source file.
There are many books and web pages devoted to these languages.
If you want the definitive books by the language designers, they are:
-
Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language,
2nd ed., Prentice-Hall, 1988.
-
Bjarne Stroustrup, The C++ Programming Language, 3rd ed., Addison-Wesley,
1997.
Lisp
We have CMU Common Lisp v19c. You can run it as lisp, but
it's better to use the Emacs interface, by running the command M-x
lisp.
In addition to online tutorials, Common
Lisp: The Language, 2nd ed., by Guy Steele, is online in full.
The hardcopy edition from Digital Press (1990) can be found in the lab.
This is the most readable, and even humorous, language specification you'll
ever read.
Other references:
-
Robert Wilensky, Common LISPcraft, W.W. Norton, 1986.
-
Peter Norvig, Paradigms of Artificial Intelligence Programming,
Morgan Kaufmann, 1992. (Note: Somewhat advanced, but very practical.)
Java
The tools from the Sun JDK 1.2 are available in /usr/java/bin.
You use javac to compile your program, and java to run
the compiled classes.
If you write an applet (with no main function), you will have
to create a web page naming that applet, and view it with netscape
or appletviewer.
The API
for the Java standard class library is specified at java.sun.com,
where you can also find much other information including tutorials.
The following references are good if you already know about programming,
although a few functions they teach are now deprecated (so you'll get a
warning if you use them - check their online documentation for the approved
replacements):
-
Cay S. Horstmann and Gary Cornell, Core Java, vols. 1 and 2, Sun
Microsystems Press, 1997.
-
David Flanagan, Java in a Nutshell, 2nd ed., O'Reilly and Associates,
1997.
Prolog
We have SWI Prolog v5.6.23 available as the program prolog. To
start the Emacs interface, use run-prolog. Here's the
manual; or you may prefer the format of the
documentation for Sicstus Prolog, which works almost identically.
References:
-
W. F. Clocksin and C. S. Mellish, Programming in Prolog, 3rd ed.,
Springer-Verlag, Berlin, 1987.
-
L. Sterling and E. Shapiro, The Art of Prolog, 2nd ed., MIT Press,
1994.
-
M. Genesereth and N.J. Nilsson, Logical Foundations of Artificial Intelligence,
Morgan Kaufmann, 1987.
R
For statistical computing: a free version of Splus.
See www.r-project.org.
Matlab
For numerical computation, in particular with matrices.
maxima
For symbolic algebra:
maxima.sourceforge.net.
Getting Organized from the Start
Put it on your electronic calendar so that you'll get a reminder
at the right time. You can manage your calendar with GUI programs like
korganizer,
or the
Emacs diary package.
Version Control
Version-control software manages multiple versions of a file and information
about those versions, without wasting space or cluttering up your directory.
How it works: Basically, it maintains a special write-protected file
that contains both the latest version and a list of changes needed to automatically
reconstruct the previous version, the version before that, etc. So it doesn't
have to store the full text of every version. The special file also contains
version numbers/dates/times and your log notes that describe why you made
the changes.
When you're working on a program, using version control will help you
do the following:
-
figure out how you broke your program that was running 10 min. ago
-
compare the output of different versions
-
keep a log of changes (you enter a message every time you complete a new
version)
-
remember to make changes in logical groups
-
create new versions very frequently - makes it easy to undo stuff
-
repair accidental damage to your file that you didn't notice till several
versions later
-
feel safe about modifying working code
-
feel safe about deleting or replacing stuff you might need again someday
-
collaborate with other people on a project where you are all modifying
the same files
I actually use version-control for many documents and web pages as well
as programs. Almost all of the same reasons apply, plus there may be several
"published" versions that you want to keep without wasting space - the
term paper, the conference submission, the conference publication, the
reformatted web version of the conference publication, and the corrected
web version you put up 2 months later.
The simplest version-control tool is RCS. Its most important commands
are ci, co, and rcs (and some further utilities
are listed on the man pages for these). CVS (command
cvs)
is the tool for more intensive collaborative development - e.g., open-source
projects. CVS is built on top of RCS, but has additional support for multi-file
projects. It expects multiple users to work on the same file at the
same time, and can usually reconcile their changes.
There are web tutorials on RCS and CVS that give
a much clearer and quicker conceptual introduction than the man pages.
Try to find one with hands-on examples.
I almost never use RCS and CVS commands directly - instead I use
Emacs commands that invoke them. Emacs has great support for version control!
So see if you can get away with just reading and using the Emacs stuff.
Use info emacs version for documentation,
or search the web.
Links - Career Advice for CS Grad Students
Use your undergraduate education: "But you go to a great school,
not for knowledge so much as for arts and habits; for the habit of attention,
for the art of expression, for the art of assuming at a moment's notice
a new intellectual posture, for the art of entering quickly into another
person's thoughts, for the habit of submitting to censure and refutation,
for the art of indicating assent or dissent in graduated terms, for the
habit of regarding minute points of accuracy, for the habit of working
out what is possible in a given time, for taste, for discrimination, for
mental courage and mental soberness." -William Johnson Cory (1861)
CSC 400 - Jason Eisner, with contributions from George Ferguson and
Myrosia Dzikovska - $Date: 2006/11/17 22:52:14 $
This page is currently maintained by Xipeng
Shen. Please contact me if you have any suggestion or question.