16. Frequently Asked Questions
First, be aware of the common information resources like
Yahoo and search engines like
Alta Vista available on
the Web. Also be aware of frequently asked questions (FAQs) lists. A
comprehensive collection of FAQs is available at
Internet FAQ Archives and
is arranged by Usenet newsgroups. Also ask your friends.
We have found the following sites useful for some common topics of interest:
16.1 Computing
What software can do Markov Chain Monte Carlo?
You are free to write your own, but BUGS and MCSim are of some use
here. BUGS is extensively documented. Be sure to visit the
Bugs Home Page.
How can I call a C or Fortran program from S?
See the
Programs of my web page for some detailed documents.
I created my S objects on Machine A. How can I move them toMachine B?
See the
Programs section of my web page for some detailed documents.
What is the name of our fortran compiler?
It is called f77. See the man page for it. The fortran 90
compiler is called f90.
What is the name of our C compiler?
It is called cc. See the man page for it.
What is the name of our C++ compiler?
It is called CC. See the man page for it.
How do I read and print data in FORTRAN?
The following is an example. Suppose we have a data file fish.dat in the format
0.482039
-0.787066
0.751999
-0.166888
...
In FORTRAN, first open the data file:
open (2, file='fish.dat')
Read the data by calling
read (2, *) variable1
read (2, *) variable2
...
Finish by closing the file:
close(2)
To print the read-in data on screen, do:
write(9, 15), 'variable=', variable
15 format( / a, f8.5)
"9" is the port number of the screen, and "15" is the label of
print format description line.
The C compiler cc complains that it can'tfind /usr/local/include/f2c.h/.
Compile f2c generated c programs with something like:
cc -I/usr/local/include -Wl,-rpath,/usr/local/lib -o foo foo.c -L/usr/local
/lib -lf2c -lm
An explanation of the above invocation might help. It says that the
compiler should look in /usr/local/include for include files
and in /usr/local/lib for libraries in addition to the
standard places. The -Wl,-rpath,/usr/local/lib switch
tells that when the program is actually invoked, it should find
dynamic libraries in the directory /usr/local/lib. This is
necessary since we use shared libraries on our machine whenever
possible. If this option is not specified, the program will compile,
but not run since the linker will not find the libraries at
runtime.
How can I produce color PostScript plots in SPLUS?
The example below illustrates the steps (Thanks to my good friend
Brett Presnell
for help.)
- Set up PostScript options using
ps.options.
- Open the PostScript device.
- Build plots
- Close PostScript device.
You can get help on ps.options in Splus. The PostScript
printer model has a lot of colors and there are at least two
ways to choose colors. I shall only discuss the RGB model, so
called because all colors are specified via those primary
colors: Red, Green and Blue.
Suppose we want to make a scatterplot using colors red, blue,
green and black. First, we select those as our colors.
Splus > ps.options(colors=ps.colors.rgb[c("red","blue","green","black"),])
Now, the parameter col=1 means the color red, col=2
means the color blue, and so on. So here we go with a complete
example.
Splus > x <- 0:10
Splus > y <- x*x
Splus > z <- y*x
Splus > w <- z*x
Splus > PostScript(file="junk.ps")
Splus > plot(x, w, type="n", col=4) # plot only axes in black.
Splus > points(x, y, col=2) # plot (x,y) pairs in blue.
Splus > points(x, z, col=1) # plot (x,z) pairs in red.
Splus > points(x, w, col=3) # plot (x,w) pairs in green.
Splus > dev.off()
Now the file junk.ps should be in color as the command
ghostview junk.ps at the shell prompt will show.
16.2 Editing (with Emacs)
I cannot seem to use Emacs when I log either usingtelnet or using a modem. What should I do?
Invoke Emacs as emacs -nw. Emacs works best under X
windows and when you are logging in the fashion described, you don't
have the X window system running on your local machine. Therefore, you
have to tell Emacs not to assume the X window capabilities. You
lose some functionality this way, most notably, the use of the menus.
Is there a good way to revise papers, documents, or programs sothat you can easily keep track of previous versions and changes?
Yes. One uses a revision control system. If you use Emacs as your
editor, there is an interface to revision control system built in. Use
the Info documents in Emacs to read about it.
I firmly believe that one should use revision control on every
document.
How can I see all the ``hidden'' control characters when editing afile in Emacs?
Use
M-x find-file-literally
Why does Emacs now not show the control-M's in files that are created in dos?
This is now an option. To open a dos text file with control-M's
showing, use C-x RET c undecided-unix C-x C-f
You can insist that no conversions be done by C-X t. For more
information, see the coding system section in the Emacs manual.
16.3 Hooking up personal machines
How should I go about hooking up my own pc?
First make sure your pc has network capabilities. Either it should
have a network card in it or if it is a laptop you should have a
PCMCIA network card. You can buy these at the local bookstore or
Fry's.
Next, you should request an ip-address from the system
administrator. This request should be made via e-mail. In your e-mail,
you must provide the following information.
- Whose machine is it?
- The make, model and information on the machine.
- How long is it going to be used thus?
- Are you a visitor or a student in the department?
The system administrator will assign an ip number and send you
relevant information via e-mail. It is assumed you know how to set up
your PC. The system administrator's job responsibilities does not
extend to helping visitors set up their personal computers.
If you want to use your PC to remotely log in to Leland or the
department system, you should also install Kerberos, which is a
security feature to protect your password. This is discussed in the
section on
Security Issues.
I am a visitor and need some help!
Please consult with the help desk (phone 5-HELP on campus) after
noting down all the information your system administrator provided.
16.4 Web, Netscape
How can I change my Netscape Fonts?
Use the Edit menu to change your preferences. I recommend setting
the default font size to be 14 points and the teletype font size to 12
points.
How can I merge my old bookmarks with my new ones inNetscape?
Go to your bookmarks menu and edit them. Then using the File
menu, invoke the import facility.
Every time I invoke Netscape, it complains that anothercopy of it is running, yet I see no such beast. What should I do?
This happens sometimes when Netscape isn't terminated properly
due to a variety of reasons. You need to remove a lock file that is
created by the Netscape process. Use
rgmiller 1% rm ~/.netscape/lock
and invoke Netscape again.
When I visit some web pages, Netscape bombs!
Indeed it does.
What is the difference between Netscape Communicator andNetscape Navigator? Are they even different?
Yes, they are different. Communicator is a far bigger package than
Navigator. Communicator includes tools for publishing on the Web,
E-Mail, etc. However, Navigator is only a web browsing tool. I mostly
use Navigator.
Where are the department Web pages physically located on ourmachine?
In the directory /home/www/ from rgmiller.
How can I restrict access to my web pages?
Lots of useful stuff is available from our Leland server regarding
this and other related topics. Visit their
Frequently Asked Questions page.
16.5 TeX, LaTeX
Any serious user of TeX and LaTeX must have the
TeX Users' Group web page bookmarked
in their web browser. It is a tremendous resource with links to online
guides among other things.
In addition, our local installation of TeTeX has
Help on Installed Packages that you can view. Beware that if you are the
first viewer of these documents, some fonts might need to be
generated. In that case, you'll get a series of dialog boxes from
Netscape which you can dismiss safely.
What should I use? TeX, LaTeX, or AMSTeX, or AMSLaTeX?
You are almost always better off using the LaTeX version of things as
they are far easier to work with. In addition, many journals have
their own LaTeX style files that they distribute for use in
publications and using LaTeX will prepare you well.
If you are using many mathematical constructs in your document, you
should probably use
AMSLaTeX.
Before you start, you should look at
TeX User's Group Links.
What is the best way to edit a TeX or LaTeX file?
Without a doubt, using
AucTeX in Emacs or XEmacs. Next in preference
comes
Lyx (see above). All other approaches will be tedious.
Where can I find a free version of TeX/LaTeX for my pc?
See the
TeX User's Group Links.
web page.
Is there a WYSIWYG version of LaTeX?
Look into
Lyx Home Page. Lyx is installed on our machine and we even
have a local guide for it. It is surprisingly good.
How can I convert my LaTeX file to HTML?
Use a tool like latex2html. To use this program effectively,
you'll have to use good LaTeX style, and read the manual.
Also see the
TeX Users Group Web Page for alternatives.
How can I convert my Word file to LaTeX?
See the
TeX User's Group Links.
web page.
How do I use the departmental letterhead in my letters?
An example document is available in the directory
/usr/local/doc/letterhead. Look at newletter-example.tex and
newnarasletter.sty (Naras' customizations). The old letterhead
(without the prefix "new") remains and should still work. The
letterhead now includes our street address as well as a slot for inserting
your Web URL if you wish. Make a copy and change it to your taste. Note
however, that you cannot view this document nicely using xdvi
since the Stanford Logo is not available as a METAFONT program. (Well,
even
Don Knuth
did not know of a METAFONT version when I asked him. He did give me an
interesting account of how the original logo was scanned in, though.)
When I LaTeX or TeX a file, I get an error saying that TeX capacityis exceeded and that a wizard should enlarge TeX. What is wrong?
Frequently, it happens that files transferred from Macs or
PC's contain additional carriage return characters that cause this
problem. This includes the embedded postscript figures. With newer
versions of Emacs, these characters are not shown while editing the
TeX or LaTeX file and therefore one never suspects that they are
there. One way to see these extra characters in Emacs is to use the
command
M-x find-file-literally
which will show all the characters. Then you can do a query-replace
the offending characters.
For your convenience two commands are available: stripCR and
replaceCR. If you transferred the file from a PC, then stripCR
is probably the one for you, while replaceCR is for files transferred
from a Mac. Use as:
rgmiller 1% stripCR *.tex *.jpg *.ps
or
rgmiller 1% replaceCR *.tex *.jpg *.ps
Both commands save backup copies of your files just in case.
How can I create transparencies in LaTeX?
In pre-LaTeX2e versions, slitex, a separate program, had to be
invoked, but now one just uses
\documentclass{slides}
The commands are the same as in slitex. SliTeX is documented in the
Lamport book. The term slides, in this instance, is a bit of a
misnomer since it actually refers to transparencies.
Another package is becoming increasingly popular these days for making
transparencies. This is a very powerful package called seminar
and relies heavily on PostScript. It is documented both online as well
as the in the LaTeX Companion book. Take a look at the examples in the
directory /usr/local/doc/examples.
How can I create slides with LaTeX?
For this I recommend using the seminar package by Timothy Van
Zandt. I can do no better than refer you to the superb web page
Seminar Notes.
How can I create labels with LaTeX?
Create the following LaTeX source file and name it (say) labels.tex:
\documentclass[12pt]{article}
\usepackage{labels}
\normalsize\sf
%\LabelGridtrue
\LabelInfotrue
\TopBorder=8pt
\BottomBorder=3pt
\LeftBorder=18pt
\RightBorder=18pt
\LabelRows=8
\LabelCols=3
\begin{document}
\labelfile{labels.dat}
\end{document}
Make a data file labels.dat with the following format:
Mariam A. Kh. Ali
P.O. Box 17161
Stanford CA 94309
Zeeshan M. Ali
910 Mockingbird Lane
Palo Alto CA 94306
...
After this, run latex and then dvips in the usual way:
latex labels
dvips -o labels.ps labels.dvi
The above assumes that you are using a label sheet which has stickers
arranged in 8 rows by 3 columns. There is a box of such label sheets in
the department supply room labelled "XEROX 24-Up Copier Labels." If you
use those, you have two label-printing options: either feed the label
sheet into the laser printer and print the PostScript file
labels.ps onto it directly, or print the PostScript file on plain
paper and use the copier to produce as many sets of labels as you need.
How can I change the way LaTeX numbers my equation?
Depends on how you want it. The most common request seems to be that
people would like equation numbers to be prefixed with the section
number and a period with the counter being reset every time a new section
starts.
Add the following to your preamble.
\makeatletter
\@addtoreset{equation}{section}
\makeatother
\renewcommand{\theequation}{\thesection.\arabic{equation}}
An even better way is to use the amsmath package. Then you can
replace all of this with
\numberwith{equation}{section}
How do I change the name of the heading that LaTeX gives forBibliographies such as ``References'' or ``Bibliography''?
You need to redefine the heading. If you are using article class, use
\renewcommand{\refname}{Your favorite Title}
or if you use the book style, use
\renewcommand{\bibname}{Another Title}.
in the preamble.
How can I get a list of all labels I have used in a document?
The easiest way I know of would be use AucTeX and use a labelling
scheme to associate labels with equation. I've seen many people use
things like
\label{eq:ten}
completely defeating any nice way
of remembering what equation ten was. One simple technique you can use
is to give equations meaningful labels. Remember that an equation can
be given multiple labels.
\begin{equation}
\label{eq:one}
\label{eq:eulers-eq}
e^{i\pi} + 1 = 0
\end{equation}
That said, there are several packages that let you view the labels.
- showkeys
-
Just add
\usepackage{showkeys}
to the
preamble of your document, latex it, and view it.
- showlabels
-
Just add
\usepackage{showlabels}
to the
preamble of your document, latex it, and view it.
In the Lamport book, he recommends a way using a file lablist,
which I naively mentioned in earlier versions of this guide. The
methods described above are far better.
When I preview my documents with xdvi, it looks like bad. AndI get errors saying ``some overstrike characters ....''. Why?
Quit Netscape, and run xdvi again. Then you can run Netscape if you
want. Netscape is a hog. Here is an excerpt from the xdvi FAQ.
This is because your video setup has only a limited number (typically 256)
of different colors that can be displayed at any given time, and netscape
is using most of them. There are several ways around this problem:
- Start xdvi before netscape. This should eliminate the problem for
that copy of xdvi (only).
- Invoke netscape via "netscape -ncols 130" This limits netscape's
color usage to 130. Other numbers may be used as well.
- Invoke netscape via "netscape -install" This causes netscape to run
with its own colormap. A disadvantage of this approach is that
netscape's colors will be bizarre when the cursor is outside netscape's
window, and conversely all other colors on the screen will look funny
when the cursor is in the netscape window.
The screen output looks so grainy because xdvi is not able to use its
anti-aliasing features without enough colors.
How can I make pictures for inclusion in LaTeX?
You can use any tool that will produce a picture in encapsulated
PostScript format and include it in your document. The PostScript
produced should conform to the Adobe Document Structuring conventions
or you'll find yourself pulling your hair out. Graphical drawing tools
that will allow you to draw on our systems are xfig, xmgr,
xpaint, gnuplot, showcase, just to name some common
ones. A METAFONT-like program called Metapost (mp) is available
as well; see the manual available in the usual places.
There are also powerful macro facilities for use with LaTeX, such as
pstricks, xypic. Again, refer to the documentation.
One utility that is of use in annotating postcript figures with
mathematical symbols is
PSFrag. It comes with a guide. Also see the LaTeX Graphics
Companion book.
How can I use XFIG to create a picture and use mathematical symbols to annotate the picture?
XFIG is actually quite powerful and has a number of features that are
insufficiently played up, in my opinion. For example, you can import
GIF, JPEG, PS files directly into XFIG if it was built with such
support. There is of course some loss in the conversion, but I have
gotten surprisingly good results with it.
To create a picture with mathematical symbols in it, draw the picture
as usual. When you come to the annotating part, you will have to
go into text drawing mode by clicking on letter ``T''. Choose the
LaTeX fonts with the default setting. Then click on the Text Flags
button in the bottom row . You should set the Special flag to
Special and optionally, the Hidden flag to Hidden. The
latter sometimes helps when you have long strings of LaTeX commands
and don't want to see them in all their glory. Now you can type TeX
sequences like $\alpha_1$ etc. After typing, if you hit return,
then a place holder will be shown instead of the string, if you had
the hidden flags on.
Next, you have to do two things: (a) export the file as Combined
PS/LaTeX (PS part) and (b) export the file again as Combine
PS/LaTeX (latex part). The second part will contain the actual
LaTeX code that you will use in your LaTeX document to get the figure
typeset.
I've noticed that XFIG uses the epsfig macros to include the
PostScript file. If you don't have them, you can use the standard
epsf package that comes with dvips without problems by making a
few adjustments. Typically, you will have to add
\usepackage{epsf}
to your preamble and replace occurrences
of the form epsfig{file=...} with epsffile{...}.
I have a PostScript figure someone else created and I don'twant to redraw it. However, I want to add some things to it andannotate it. How can I do this?
In XFIG, import the picture by clicking on the Picture Object button
and dragging out an area of the canvas with your mouse. XFIG will then
prompt you for the name of the file and type, etc. Then proceed as in
the previous question.
How can I create tables in LaTeX?
For reasonably simple tables, I've found that Lyx is handy. Use it to
create a temporary document with the table and cut and paste that
table into your document.
Alternatively, you'll have to do it by hand. AucTeX is of great help
here. See some examples of tables that are available in
/usr/local/doc/examples>.
If I have a table that is too wide for the page in portrait mode,how can I rotate it to be in landscape mode?
In LaTeX,
\usepackage{rotating}.
Do something like:
\documentclass[12pt]{article}
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}[htbp]
\begin{center}
\leavevmode
\caption{Comparison of estimates obtained by reweighting
with actual estimates.}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
&\multicolumn{8}{|c|}{Breast Cancer Data, Radiation Only}\\
\cline{2-9}
% \multicolumn{1}{|c|}{Time}
&\multicolumn{2}{|c|}{$M=1$}
&\multicolumn{2}{|c|}{$M=20$}
&\multicolumn{2}{|c|}{$M=40$}
&\multicolumn{2}{|c|}{$M=60$}\\
\cline{2-9}
&\multicolumn{2}{|c|}{Gamma Shape}
&\multicolumn{2}{|c|}{Gamma Shape}
&\multicolumn{2}{|c|}{Gamma Shape}
&\multicolumn{2}{|c|}{Gamma Shape}\\
\multicolumn{1}{|c|}{Time}
&\multicolumn{1}{|c|}{$150$}
&\multicolumn{1}{|c|}{$200$}
&\multicolumn{1}{|c|}{$150$}
&\multicolumn{1}{|c|}{$200$}
&\multicolumn{1}{|c|}{$150$}
&\multicolumn{1}{|c|}{$200$}
&\multicolumn{1}{|c|}{$150$}
&\multicolumn{1}{|c|}{$200$}\\
\hline
12 &.798(.033) &.798(.033) &.764(.032) &.774(.031)
&.748(.040) &.763(.037) &.753(.046) &.771(.041)\\
&.796(.032) &.796(.032) &.772(.029) &.772(.030) &.755(.039)
&.756(.039) &.745(.046) &.745(.046)\\
\hline
\end{tabular}
\label{tab:comparison}
\end{center}
\end{sidewaystable}
\end{document}
I have created my own LaTeX macros and Bibliography files. How canI ask LaTeX and BibTeX to use these files in addition to the defaultlocations?
The nicest way to organize your macros and bibliography files is to
dedicate some directories for this purpose. For example, you can have
a directory called LaTeX-Macros in your home directory where
you can organize your macros. Similarly for your bibliography
databases, create a directory called BibTeX-Files. Then add
the following two lines to your .mycshrc:
setenv TEXINPUTS /home/joe/LaTeX-Macros:
setenv BIBINPUTS /home/joe/BibTeX-Files:
The colon at the end is important, otherwise, the default places will
not be searched in addition to your directories.
These settings will become effective at your next login. Or you can
force these settings by doing the following at the shell prompt.
rgmiller 1% source ~/.mycshrc
Do we have any software for Bibliography searching?
Yes, we have the CIS (Cumulative Index to Statistics) database
online.
rgmiller 1% cis
*******************************************************
* This is the keyword access to 1995 CIS database. *
* Department of Statistics, Stanford University *
* Stanford University, CA 94305 *
*******************************************************
For manual page, use "man CIS" at Unix prompt.
Type '?' for online help.
=>
You can search for articles and books using keywords. This is also
available on the
Web.
The searching software has the capability of producing BibTeX
databases for a search. Invoke the software as cis -B.
There is a wonderful collection of bibliographies on various subjects
gathered by
Nelson Beebe.
I find myself typing in bibliographical references over and overagain? How can I rid myself of this chore?
Use BibTeX. A BibTeX database can be created for all important
articles you frequently refer to. You only need to create such a
database once and identify each article with a unique key. Once
this is done, you can use the key in your document to refer to the
article. Note that our bibliography searching software, cis, is
capable of producing citations in BibTeX format. Be warned, however,
that it does produce some junky entries and they must be hand-edited
to confirm to the strict format that BibTeX demands. The Emacs
BiBTeX mode will help you track down wayward entries easily. In fact,
some of the references to books in this very document are displayed as
BibTeX entries.
The effort spent in creating BibTeX databases for your use is worth
every minute---see the next question below.
16.6 E-Mail
I want to forward a copy of my e-mail to a new address temporarilybecause the connection is bad. How should I do this?
You need to use a procmail recipe in your home directory file
/.procmailrc as follows:
# Preamble for our system
MAILDIR = $HOME/Mail # You'd better make sure it exists
DEFAULT = $MAILDIR/inbox/.
LOGFILE = $MAILDIR/procmail.log
LOCKFILE= $HOME/.lockmail
#
# Forward a copy to me at you@wherever.com
#
:0 c
* ^From.*
! you@wherever.com
Make this your first recipe, or it might not work since other recipes
could already deliver the mail! The preamble can be omitted if you
already have it in your .procmailrc.
16.7 Unix
Help, I can't login! My password doesn't work!
Unix passwords are case-sensitive. Make sure you are using the correct
password.
Help! I cannot do an rcp on my Unix machine!
- If the machine is your personal machine, make sure you installed
the Leland
rcp correctly as discussed in the installation
instructions.
- Make sure you have a valid ticket.
- Make sure you are using the Leland version of
rcp. Many vendors
have their own versions of rcp that will not work. If your machine
is an afs client, the correct version of rcp is always available as
/usr/pubsw/bin/rcp. One way to check is to run the command
which rcp. This will tell you which command is invoked when
you type just rcp.
I want to save keystrokes typing long commands. How can Icreate shortcuts?
Use the alias facility. For example, I can alias the command
ls -lt to lst via
rgmiller 1% alias lst "ls -t"
If at a later point, you want to undo this, you can use
rgmiller 1% unalias lst
Note that when you log out, your aliases vanish. So if you need to
have permanent aliases, you want to include such entries in the
.mycshrc file in your home directory. Take a look at mine
~naras/.mycshrc for example.
How can I find a file with a particular name under my directorytree.
To find all files that have a .txt extension, use
rgmiller 1% find . -name '*.txt' -print
The find command is extremely useful; see the man page.
How can I delete all files named core in my directory andsubdirectories?
rgmiller 1% find . -name core -exec rm {}\;
How can I move a whole directory tree from one machine toanother?
Two commands help here: tar and gzip. You should read the
man page for both. The latter is strictly for compression and cuts
down on transmission time over networks. To make a single archival
file of all the files and directories under a directory called
foo use
rgmiller 1% tar -cvf foo.tar foo
This will create a file called foo.tar that contains all your
files and directories under foo. Then compress it:
rgmiller 2% gzip foo.tar
If you have the
Free Software Foundation (FSF) tar program, you can do this in one shot:
rgmiller 3% tar -cvzf foo.tar foo
This file can now be transferred wherever you want, perhaps using
ftp, and untarred.
bluefish 1% gunzip -c foo.tar.gz | tar -xvf -
Again with the FSF tools this can be accomplished in one shot.
bluefish 1% tar -xvzf foo.tar.gz
The v option in all these commands is strictly my preference; it
gives verbose messages.
Help! I deleted my file. Do we have backups?
Backups of the entire file system are made once every weekday around
11pm. On weekends (Saturday and Sunday) no backups are made. If you
create and lose a file between backups, you are out of luck---there is
nothing that can be done. On the other hand, if the file has been
available for over 24 hours during a weekday, then the last version
can be recovered.
Please note that file recoveries are tedious chores and rate an
extremely low priority. If you request recovery of files frequently,
you'll quickly earn yourself a prominent spot the system
administrator's bad books.
How can I find out the disk usage on various partitions?
Use the df -k command. This will report usage in Megabytes.
The behavior of this command differs from machine to machine. Read the
man page.
How can I find out how much space a directory contents are using?
Use the du -k command. The du command has a silent option
(-s) that is quite useful. Again read the man page if you see
something other than what you are expecting.
Help, I am (almost) over quota!
You can find out your disk usage by typing quota -v.
Here are some strategies to reduce your disk usage. Assume that your
username is joe.
- Find your largest files.
In your home directory, type
rgmiller 1% du -a | sort -n > joe.files
This generates a new file joe.files that contains a list of all your
files sorted in ascending order of size. Naturally, if you are already
over quota, you cannot write to your home directory. In that case, replace
the above command by
rgmiller 1% du -a | sort -n > /tmp/joe.files
The file generated will now be in the /tmp directory.
Go through the contents of joe.files to see which files
take up the most space. Delete those that you do not need.
After you are done, remove the file joe.files.
- Emacs users.
If you use emacs, you will often have backup files called xxxx~. I
usually delete all of them. As a safety check, first run the following
command in your home directory
rgmiller 2% find . -name \*~
to see what these files are. If you really do not need any of them, run
the command
rgmiller 3% find . -name \*~ -exec rm {} \;
to delete them.
- SPlus users.
If you use SPlus, you might have (object) files in your .Data
directories. Some of them can be quite large. If you do not need those any
more, simply delete them. It is a good idea to clean up at the end of
every SPlus session by listing your objects (
objects()) and removing
those that you do not need (rm(...)).
-
Look out for image files.
Text files typically are small. The big files are usually those with
extensions .ps, .pdf, .dvi, .tif, .jpeg, .gif etc. If you got your .dvi
and .ps files from a TeX file which you still have, you can delete them
and just keep the .tex file. You can always generate the .dvi, .ps files
later.
In fact, running tex or latex often generates .log files, which can be
deleted as well.
-
Delete unwanted e-mails.
This is especially true for e-mails with large attachments.
-
Compress your files.
Suppose you have a directory that you think you will never look at for a
long time, for example, one containing your e-mail correspondence in
1990. Suppose the name of this directory is old. You may save some
disk space by compressing your files in old. Do this by
rgmiller 4% tar -czf old.tar.gz old
In some cases, the savings can be well over 50%. To uncompress, do
rgmiller 5% gzip -dc old.tar.gz | tar -xvf -
This restores your old directory. The file old.tar.gz is not
removed.
The tar command has many options; see its man or info pages (info
tar) for more information and examples on its use.
If you need more quota, let Naras know.
If you have any suggestions or comments, please let me (hktang) know.
I ftp'd a file from a PC to my unix account, and there are allthese ugly control characters at the end of every line. How can I get ridof them?
When a file is transferred from a PC to a workstation, a symbol
``control-R'' could be added at the end of every line. To strip them off,
type
rgmiller 1% stripCR FILENAME
To process multiple files, you can, for example, type
rgmiller 2% stripCR FILENAME1 FILENAME2 FILENAME3
You may use a wild card * in the file name. For example, to apply the
action to every file with the extension .txt in the current
directory, type
rgmiller 3% stripCR *.txt
To view Naras' Perl script stripCR, type
rgmiller 4% cat `which stripCR`
How can I print? How can I print on two sides of the paper? How canI not print on two sides of the paper?
See the section on printing tips.
sec:printingtips
I got a PostScript file sent to me with a paper size that is not the normal "letter" size. How can I print it?
See the section on printing tips.
sec:printingtips
How can I convert a text file or postscript file to print several pages on one page?
Use enscript with the -U option.
See the section on printing tips.
sec:printingtips
Help! Pine has destroyed my previously kept folders! They are important to me....
Relax, no such tragedy has taken place. Pine uses a customization
file .pinerc in your home directory to locate things. You can store
your mail folders in several directories. These directories can be
specified via the folder-collections variable. For example, to ask
pine to look in mail as well as Mail for folders, use
folder-collections=Mail/[], mail/[]
in your .pinerc (This file can be edited in any editor).
Then you can choose which collection you want to see by using the
arrow keys.
Help, my Mail doesn't seem to be working. When I bring up pine, it says no file "Mail/incoming" exists. I created one and it says I have new mail, but I don't find anything.
Once again, relax. mail is working fine. Actually, this message
usually means that in the first place, no one sent you mail since
your account was first created.
It is a bad idea to create these directories (Mail and incoming)
yourself. For, they have to have the correct permissions and it is
most likely that you don't know what they are. If you put in the
wrong permissions, you may have the whole world reading mail meant for
you. You don't want that, do you?
The reason you got the message "You have new mail" is precisely due
to your creating these files or modifying them in some way. If you
are so inclined, you can amuse yourself all day by editing the
Mail/incoming file, saving it without making any changes. The
system will bombard you with spurious notifications that you have
new mail. (In the latter case, you have a more serious problem
anyway).
The program that notifies you of new mail is not a genius---it
merely uses time-stamps to do its work. Any time the time-stamp
changes, it thinks you have new mail.
16.8 Macintosh
How can I rename the printer I see in my Mac chooser?
Use the laserjet utility.
Why has my printer disappeared from my chooser in the Statistics zone?
This sometimes happen when power outages occur. To fix this,
restart your printer Jet-Direct card. This is done by unplugging
its power supply and then plugging it back again.
16.9 X windows
How do I cut and paste on our machines?
Select text by clicking on the left mouse button at the start of the
text and dragging the mouse. Then clicking the middle mouse button at
a spot will paste the selection at that spot.
On a pc with two mouse buttons, the middle mouse button is emulated by
pressing both the left and right mouse buttons simultaneously.
How do I change the colors of my windows?
Most X applications accept the following options -fg and
-bg, and -cr which affect the foreground, background and
cursor colors respectively. To get a window with a black background,
white foreground and a yellow cursor, use
rgmiller 1% xterm -bg black -fg white -cr yellow &
To get a list of all colors available and their names, you can use a
tool called showrgb which can be invoked from the shell prompt.
How can I choose a better font for my windows?
You can use a tool called xfontsel that will allow you to choose
any of the font available on our system. One thing to note that
fixed-width fonts work well for most windows since using
proportionally spaced fonts like Helvetica, Times, etc., will cause
things not to line up correctly. Once you have chosen a font using
xfontsel, use the select button to copy the long string that
uniquely identifies the font to the clipboard. Then you can paste that
name anywhere you want. Here is an example.
rgmiller 1% xterm -fn '-adobe-courier-bold-r-*-*-14-*-*-*-*-*-*-*' &
The "BEEP!" from my/my neighbor's terminal is driving me crazy. How can I turn it off?
Run the command xset b off. To turn it back on, run xset b
on. You can even change the volume, pitch and duration. Type xset to
see a list of options.
I would like to run some X window applications on the machinebluefish.some-u.edu and display the graphics and windows on my Xterminal. How can I do this?
Basically you have to inform the remote machine bluefish that
your display is the X-terminal you are sitting. This is via done an
environment variable called DISPLAY. On many modern machines, if
this variable has already been set, it is propagated to other new
machines you might log into. However, that doesn't happen always. For
example, to set the display to seq9, you can use
bluefish > setenv DISPLAY seq10.stanford.edu:0
How do you know the name of the terminal you are sitting at? On the
local machine you can use
rgmiller 1% echo $DISPLAY
seq9:0.0
The above example also shows you a security loophole. Anyone can
open a window on your X terminal! Here is a favorite trick.
A window with a login prompt is displayed on your X terminal and you, in
your absent-mindedness, think that you opened this window and type in
your username and password. Instead of being logged to a machine, you
are politely informed that you'd typed a wrong password and that you
should try again in another window. The window then disappears, but
the harm has been done: the person who opened the window on your
terminal now has your password!
One can have stricter controls than this with machine instead of
terminals. For example, if you want to display applications from the
machine bluefish above to your local machine redfish here,
then a two-way street has to be established. First you have to tell
machine redfish to allow machine bluefish to open windows.
redfish 1% xhost bluefish.some-u.edu
bluefish.some-u.edu being added to access control list.
Then, you'll have to also set the display on bluefish.
bluefish > setenv DISPLAY redfish.stanford.edu:0
Even this is not a good scheme, since it offers access control per
machine only. That is, any user on the machine bluefish can open
windows onto machine redfish by just setting their DISPLAY
variable.
A reasonably secure mechanism is to use the xauth facility. As
you can expect, it is a bit more involved, but not that much more. It
uses a magic cookie that is generated for every login session. I
recommend this method. Here is how one would redo the Dr. Suess
bluefish, redfish example above.
redfish %1 xauth nextract - $DISPLAY
This prints our a long string of hexadecimal digits on your
screen. Using your mouse, copy this whole string without a mistake. On
the remote machine do the following.
bluefish %1 xauth nmerge -
Now paste the string you copied above and hit return. Then set your
display and proceed merrily along. The above steps just transferred
the magic cookie from redfish to bluefish.
This is a per session cookie and so provides a secure connection. Of
course, this magic cookie can, in theory, be intercepted during
transmission, but that is not trivial to do.
Note that you only need to get the first window from the remote
machine to display locally to get started. Subsequent applications run
from that window will all display locally.
16.10 Windows 95/98/NT stuff
Do we have Microsoft Word/Excel on our system?
No. Nor do we have SoftWindows that emulates an Intel machine on our
SGI. If you really need to use these applications, use the PCs.
How do I display X applications on my Windows 95/98/NT pc?
On the old PC in the department, we have an Exceed X server
running. So you basically need to click on say, the RGMiller icon
twice to spawn an xterm window and invoke other applications from that
window. Note, however, that there are also shortcuts available for
invoking Emacs and XEmacs directly from the PC.
If you need an X server for your PC, check out
Xwin32 for
starters. Also check out
Exceed
and
NCD.
Apr '99 Update
Currently, all of the PCs in the lab have Exceed installed, which means
you can run xterm, emacs, or any other X-windows program on your PC after
using PC-Samson to log on to Leland or rgmiller. Please read the section
on
displaying X applications.
How can I print to our printers from the PC?
- Step 1
-
Click on the Network Neighborhood icon. Double
click on RGMiller. You will be asked to log in with your
userid and password. Once you do this, you have access to all
department resources.
- Step 2
-
Proceed as usual and when you want to print, choose
laserjet (which refers to hp) or lw as your
printers
for printing. If you don't use step 1, you will get an error in
which case, just redo step 1. You can set up any of these printers
as the default printer for you.
Apr '99 Update
The PCs in the lab are all hooked up to nhp and hp, the latter
being in the lab itself.
How can I access files on our departmental server?
Read answer to previous question. Basically, you need to log into
our server tt/RGMiller/. Once that is done, when you click on
Network Neighborhood you'll see RGMiller as well as other
machines. Double click on \texttt{RGMiller} and you'll see many
printers as well as a folder containing your home directory which
can be used exactly like any other Windows directory.
What is the name of our PC? How should I refer to it on the network?
The pc is known to the world as statpc-001.stanford.edu. You
should be able to refer to it like any other machine. However,
remember that you cannot ftp to the workstation from another
machine. You can ftp from the pc to other machines around the
world.
Update
Please note that this PC died in early December 1998. The new computer
lab has 21 PC's for the use of our department.
How can I transfer files to and from other machines?
For transferring files from the pc to any other machine, use
ftp; see section
Transferring Files.
For transferring files from another machine to the pc,
either use ftp or click on the Network Neighborhood
icon. For
the latter to work, the machine must give our PC access to its
resources. Our server, RGMiller, for example, does so, provided you
log in.
Tranferring files from our server to the PC directly is also
possible, by using a program called smbclient from the
Samba suite of tools.
This is a bit involved and requires you to read the man page. I will
not bother teaching you how to use it as it is not very friendly.
How can I send mail from the PC?
It is possible to do so, but don't. Use our department mail servers.
I am using Eudora or Netscape for mail from my homeand using my pop account me@stat.stanford.edu to read mymail. How can I keep my mail on our department server?
By asking Eudora not to suck all the mail from our server down to
the PC. In other words, use the option in Eudora that tells it to
leave the mail on the mail server. I've not determined whether
this is an option in Netscape.
How can I backup my PC files?
Copy them to a floppy. Or using the information given above, move
them to your home directory or subdirectory thereof on our
department server.
Why do I get warnings about my password expiring on the PC? What should I do?
Passwords expire after some time. You should periodically
update them with good ones.
How should I log off on the PC?
Use the Start button and choose Shut down. Make sure you
have the Close all programs and log in as different user
checked. Then click OK.
16.11 Miscellaneous
What is a SUNet userid or Leland userid?
A SUNet userid is the same as a Leland userid. It identifies you to
the entire Stanford University Computing infrastructure. It also
entitles you to privileges within the Stanford University System.
It is common for people to refer to your SUNet userid as your Leland
userid as well.
What is meant by the term Leland Systems?
These are some machines which people can use with a SUNet
account. Please note that the machines in the Leland Systems change
almost every year. The current machines are described in the document
Leland Systems. These are maintained by the Leland Systems Group and
provides a key infrastructure to the university.
I have a directory full of files that have upper casenames. How can I rename all of them to lower case?
Use something along the lines of:
rgmiller 1% foreach file (*)
foreach? mv $file `echo $file | tr "[:upper:]" "[:lower:]"`
foreach? end
I have a directory full of files that have the extension.foo. How can I rename them all so that their extensions are.bar?
Use something along the lines of:
rgmiller 1% foreach file (*)
foreach? mv $file `basename $file '\.foo'`.bar
foreach? end
I have a file called foo.zip. How can I recover the contents?
Use the unzip program.
My HP X terminal is not responding. How should I reboot it?
Rebooting is not something you do routinely. However, if the situation
so demands, press the sunken button located on the left of the base
unit, wait about 10 seconds and then press it down again. It takes
about a minute or two for the terminal to reboot during which time
you'll hear a series of beeps.
How can I convert a picture or PostScript file from format A toformat B?
Your best bet is to use the
Image Magick set of tools. Examples follow.
rgmiller 1% convert foo.gif foo.jpeg
rgmiller 2% convert foo.gif foo.ps
rgmiller 2% convert foo.xbm foo.jpg
See the man page for convert. Another alternative is to use the
program xv to view the picture and save it in various formats
from there.
How can see pictures on the screen?
The program xv will work. For postcript pictures use either
ghostview or gv. Please refer to the man pages.
How can I read news?
You can read Usenet news via many programs like xrn trn,
Netscape etc. I personally like Gnus available within
Emacs or XEmacs.
How can I find out what software is available on our system?And where?
If you know the name of the software, just invoke it. If this doesn't
work, look in the directory /usr/local/depot where our system
administrator keeps all sources for packages. When that doesn't
work either, try the AFS tree at /afs/ir.stanford.edu. If you
really think we ought to have some software, let the system
administrator know.
Note, however, that if the system administrator wishes software to be
available to everybody, you will be able to invoke it without any
special steps.
The commands which and whereis are also useful.
How can I transfer all files from my account to anothermachine?
See the section
Transferring Files.
When I printed out a PostScript file, I got all gibberish textand all the paper was wasted. Why?
Most printing filters use the first line of a file to detect if it is
PostScript. Since PostScript files are also text files, a conforming
PostScript file begins with the first two characters
%!. Sometimes, when people send you PostScript files by mail, it
is easy to add an additional empty line to the file when saving the
PostScript part. When you then print the file, the printer assumes
that the file is straight text and spews it out in gory detail.
Microsoft programs are among the worst offenders sticking in all kinds
of junk before the %!. You must make sure that all that junk is
removed before sending it to our printers.
This is actually an example where attachments can help. If this is
happening to you often, ask your friend to send the PostScript file to you
as an attachment and let the mail program extract it correctly. Of
course, if the PostScript file was created on a Windows machine then you
still have to remove the gibberish mentioned above before sending the
attachment.
How do I view pdf files?
Invoke acroread or xpdf on the file. The former is
guaranteed to work.
How do I view ps files?
Invoke ghostview or gv on it.
How can I convert a PostScript file to a pdf file?
The safest way is to use the Adobe Distiller, available on Girshick.
We don't have a distiller on RGMiller and I can't for the life of me
figure out why hpux but not IRIX!
girshick 1% distill foo.ps
You will be asked a few questions. It is best to be safe and use the
2.1 compatibility mode. This program also creates an file with an ugly
name AcrobatDistiller in your home directory containing your
preferences. If you delete this file no harm will be done except that
you'll be asked the compatibility questions again.
On RGMiller, you run the ps2pdf utility pretty much the same
way. However, ps2pdf does not handle hyperlinks.
How can I convert a pdf file to a PostScript file?
Invoke acroread on the file:
rgmiller 1% acroread foo.pdf
Click on File, then Print..., then in the dialog box that comes up, choose
Print To File (instead of the default Print To Printer). Specify a
filename, say foo.ps, and then click OK.
The pdf file created from my ps file using ps2pdflooks ugly in acroread. Why?
This is a common problem if the original source was a TeX/LaTeX
file. This is because computer modern fonts are stored as bitmaps in
the ps file and bitmaps don't scale well. So, one way around this
is to use the native PostScript fonts, such as times, or palatino
using something like
\usepackage{times}
in the preamble of the LaTeX document.
During the next set of upgrades for TeX/LaTeX, we will be exploring
using native PostScript fonts for use with dvips and xdvi which might
render the results far more suitable for conversion to PDF. It is
reported that a downside to this is the size of the PostScript files
is substantially larger. Another solution being investigated is
pdftex. See
pdftex.
How can I create a pdf file from my TeX/LaTeX file?
Use the command pdftex or pdflatex as appropriate, for example:
rgmiller 2% pdflatex foo.tex
The alternative
rgmiller 3% latex foo.tex
rgmiller 3% dvips -o foo.ps foo
rgmiller 3% ps2pdf foo.ps
often produces a very poor quality pdf file (see
ps2pdf).
How can I create a pdf file from my TeX/LaTeX file that onlycontains specific pages?
There is a rather convoluted workaround to avoid using ps2pdf
directly.
- Generate your
pdf file with pdftex or pdflatex (see
pdftex).
- Use
acroread to save your pdf file in PostScript format
(see
pdftops). You can choose
which pages you want.
- Now run
ps2pdf over the generated ps file. This should produce
pdf files as ``good'' as the one produced by pdflatex.
The alternative methods are:
- Use dvipdfm, which converts dvi files to pdf and has an option to
select pages. However, this program is not available widely, on the
Leland systems for example.
- Use distiller, which is a commercial program.
What spreadsheets are available on our system?
We don't have Excel except on PCs. On our Linux systems,
gnumeric or ooffice will open Excel files.
Recently due to the
GNOME project and
KDE Project new
free office tools are becoming available for Unix. They will be
installed when they come of age.
16.12 Splus
How do I convert my old Splus 3.4 objects to Splus 6.x?
Please see
this link.
16.13 Reference Letter Generation
I am planning to apply for
jobs. What is the best way to arrange for a number of recommendation
letters to be sent to the places where I am seeking a position?
The typical situation is that you have a bunch of addresses and your
advisor has one letter that he is going to send to all those
places. The main trick is to avoid making this a chore for the actors
involved. A bare-bones example is described first, followed by some
variations that can be used with the department letterhead.
The essential steps are
- You create a file containing addresses and salutations. Let us
call this file
myaddresses.tex. Here is an example for
two addresses that you can cut and paste.
\begin{letter}{
College of Mathematics\\
Ivy University\\
Office of Graduate Affairs\\
701 West 2000th St.~Rm 1729\\
Gotham, NY 10000\\
}
\date{\today}
\opening{Dear Prof. Al.~G.~Bra,}
\input letterfile
\end{letter}
\begin{letter}{
Faculty Search
Statistics Department\\
Driveby University\\
89 Boondock Street\\
Utopia, NY 10000\\
}
\date{\today}
\opening{Dear Dr.~Estimable:}
\input letterfile
\end{letter}
- You create another file, named say,
all-letters.tex, containing exactly the following.
\documentclass[11pt]{letter}
%% Start of lines for fixing up labels %%
\usepackage[avery5160label]{envlab}
\makeatletter
\def\@toaddressfont{%
\tiny\sffamily\selectfont}
\makeatother
%% End of lines for fixing up labels %%
\makelabels
\begin{document}
\input myaddresses
\end{document}
- Your advisor writes a single letter and names the file
letterfile.tex. (You can change the name of the file,
but it is then
your responsibility to ensure that the file in step 1 above uses
the correct name or your letter is almost certain to
contain a remark on your deficient TeX skills.) For a testable
example, here is some content you can use. Be sure to save it in a
file named letterfile.tex.
It is a pleasure to recommend myself to the advertised vacancy. In
my unbiased opinion, I am the best candidate.
\signature{Full~F.~Myself}
\closing{Sincerely,}
- The file
all-letters.tex can now be latexed. Go ahead
and try it. This will produce a 3 page document of which page 3 is a
set of labels. When printing, the pages containing the labels can
be printed on AVERY 5160 label sheets that the department
has. These label sheets contain stick-on labels that can be peeled
and affixed to the letter envelope.
The above steps generate a vanilla letter that is quite bland looking.
Most commonly, your advisor will already have the equivalent
of the file all-letters.tex in step 2 above that he/she has
customized for a department letterhead, his/her titles etc. For example,
mine goes somewhat like this:
\documentclass[11pt]{letter}
%%
%% For color, in next line, change statdeptletter to statdeptlettercolor
%%
\usepackage{statdeptletter}
\usepackage{narasletter}
%% Start of lines for fixing up labels %%
\usepackage[avery5160label]{envlab}
\makeatletter
\def\@toaddressfont{%
\tiny\sffamily\selectfont}
\makeatother
%% End of lines for fixing up labels %%
\makelabels
\begin{document}
\input myaddresses
\end{document}
To make this example complete, here is what I have in the file narasletter.tex.
\pagestyle{headings} % so that second page gets some identification
\name{Balasubramanian Narasimhan}
\position{Senior Research Associate}
\telephone{(650) 725-6163 \\ Fax: (650) 725-8977}
\streetaddress{390 Serra Mall}
\email{me@nospam.com}
\myurl{http://www-stat.Stanford.EDU/~naras}
\signature{Balasubramanian Narasimhan\\ \fromposition}
You can edit these, substitute, and experiment to see the effects.
16.14 Using VNC
VNC allows you to run a desktop on a remote machine. Here are the
steps. Note that step 1 is done typically only once,
unless a previously created display was closed for some
reason. Creating many displays is a wanton waste of resources, in
our opinion.
- Log into a remote server such
as
miller.stanford.edu, typically via SSH and
start a vnc server by typing the
command vncserver on the command line. You will
be asked to setup a password one time. As always, choose a
good one. The server will inform you as to which display it
allocated it for you, such as display number 05
or 30. You will need this info to connect later.
- Using an SSH client, one tunnels the traffic for this VNC
display through SSH. Details differ
between Windows
and Macintosh and are provided
below.
- Using a VNC client, one connects to the display created in
step 1.
Windows Instructions
It is assumed that you have downloaded and installed the free
Windows SSH
client putty.exe
and a VNC client such as the free edition of Real
VNC. The instructions here assume putty
version 0.60.
You need to first configure the SSH client as follows.
- Configure host.
- Configure your login info.
- Configure SSH to compress traffic
- Create a tunnel for VNC traffic by forwarding ports. Here
you will have to replace the port number 59xx by 5900
+ the display number you received when you ran
the
vncserver to create the display. Thus,
display 04 would yield 5904 and display 30 would yield 5930.
It should also be obvious now that if you destroy the
VNC display corresponding to the port number you used here,
and created a new one, these port numbers need to be
adjusted once again to reflect the new display!
Do not forget to click the Add button so
that the display looks as shown below
- Save the session so as to avoid going through these steps
once again.
Connecting
To connect to your VNC session, start up the SSH connection
and log in. Then run the VNC client and provide the display as
localhost:59xx and enter the password when
requested.
Note that you need to login using the SSH session you
created---only one such session need be active---before running
the VNC client because you are tunneling VNC through the
SSH connection.
Macintosh Instructions
It is assumed that you have downloaded and installed the free
Macintosh VNC client Chicken of the VNC. (Google it.)
Any other VNC client will also work.
- Connect using SSH to the server.
% ssh you@miller.stanford.edu -L 59xx/localhost/59xx
Remember to replace 59xx with 5900 + the display number you
got.
- Launch Chicken of the VNC and
use
localhost for host, xx for display, and type in
your password.
That's it.
 |