Frequently Zephyred Questions...

This document is a collection of questions which appear frequently on zephyr. The questions are organized by category, and most have answers.

Send better answers and/or more questions to sprite@cs.cmu.edu.

...concerning technical topics other than zephyr.

This page contains questions that concern technical topics other than zephyr itself.

PostScript

What is the PostScript incantation to make an A4 file print on 8.5x11 paper?
What you want to do is to scale each page by .94. To do this, put the following before your first page:
0.94 0.94 scale
/showpage {showpage 0.94 0.94 scale} bind def
      
I did this and the printer still demands A4 paper.
"Those commands... do an acceptable job of scaling the image, but they do not and cannot handle all of the different possible mechanisms for requesting a4 paper tray. The only way is to read and understand the [postscript] source."
What if I need to submit something on A4 paper?
You could print on 8.5x11 and then photocopy onto A4. Someone has also succeeded this way: "I printed on stone after editing the postscript to do one-sided manual feed. I then fed in a4 paper, constructed by taking paper and getting it cut to size."
What are the dimensions of A4 paper?
297 x 210 mm
How do I concatenate postscript files?
/usr/local/bin/psmerge foo.ps bar.ps baz.ps | lpr
      
note that psmerge requires the files to have been created using the same application, with the same device setup and resources (fonts, procsets, patterns, files, etc) loaded.
- 20 Aug 1998
or you can use distill to convert to pdf, and merge using acroexch (then print to a ps file from acroread). contorted, but works in cases where psmerge won't.
- 12 Mar 2001
I have 400 pdf graphs and want to do merging on the command line. How do I use pdflatex to concatenate pdf files?
There are several ways:
1) Run this through pdflatex:
\documentclass{article}
\usepackage[pdftex]{graphicx}
\begin{document}
\includegraphics{foo.pdf}
\includegraphics{bar.pdf}
\end{document}
You can also only include particular pages
\usepackage[pdftex]{graphicx}
\includegraphics[page=4]{...}
2) The command line
texexec --pdfarrange --result=doc3.pdf doc1.pdf doc2.pdf

- 21 Jun 2001
How do I print PostScript 4-to-a-page?
man psnup
psnup -n4 -Pprinter file
New: use psxup
- 27 Jan 1996
How can I convert man pages to postscript?
groff -Tps -man foo.1,
or since the -Tps is by default, just
groff -man foo.1
- 31 Jan 1997
Is there a tool that can automagically figure a bounding box for a postscript image, or do I have to futz by hand? (How do I figure it out by hand?)
Many tools will write a bounding box for you when you output the article originally.
Or "ps2epsi (on platforms which have gs4.03) works great"
(By hand: print it out or use ghostview; measure the lower left and upper right corners of the image, using the lower left corner of the paper as origin.)
- 31 Jan 1997
If I have a 20 page postscript file that has a half-page figure on page 9, and I want to include that figure into a FrameMaker document, what's the best way to do it? I've used psselect to get page 9, edited the BoundingBox to the figure, run ps2epsi, and then imported that into FrameMaker, but I get the entire page instead of just the figure.
The bounding box does not actually do the clipping, it is just for scaling and positioning. If you have
%%BoundingBox l b r t
      
you should put:
l b r l sub t b sub rectclip
      
as the first line of your postscript.
- 10 Mar 1997
Postscript code for adding a citation at the top of a paper?
suggested for first page:
288 756 moveto  /Helvetica findfont 12 scalefont setfont
(Submitted to foo) show
      
suggested for every page:
/megabiteme {
  /Times-Roman findfont 12 scalefont setfont 288 756 moveto (Submitted to Blah) show
} def

megabiteme
/showpage {showpage megabiteme} bind def
      
(Tweak the "288 756" until it's where you want it, e.g., for the bottom of the page, you might want "72 54". 72 = 1 inch.)
- 30 Mar 1998
Does anybody know a way of getting gif images out of postscript suitable for a shell script? Obviously, "pstogif" doesn't exist by default...
There used to be a ps2gif, but gs no longer supports patended GIF. There is a ppm device, though, which can be fed into ppmtogif.
There's also "pstopnm | ppmtogif".... footopnm converts foo to one of pbm/pgm/ppm. (pnm isn't a format) ppm is upwardly compatible with pgm and pbm.
- 4 May 1998
How do I import Windows-generated postscript for LaTeX documents?
See Peter Dinda's recommendation of wmf2eps, or if that fails, Jim Stichnoth's tips.
See also further discussion in the zarchive.
- 5 Oct 1998
Latex with some packages (such as seminar) generates seascape slides instead of landscape. As a result, when printed two to one, the slides appear in the wrong order. How can I rotate the pages?
use 'psxup -r' for seascape slides (should be ok for 2up but is said to overlap pages for 4up.)
or try 'portland' package for latex2e (no positive first-hand reports.)
for 4up, try
pstops "4:0u@.47(4.2in,5.6in)+1u@.47(8.2in,5.6in)+2u@.47(4.2in,10.6in)+3u@.47(8.2in,10.6in)" slides.ps 4.ps

- 22 Jan 1999

LaTeX

What is this latex vs latex2e business?
There is more than one latex around, and they are not particularly compatible. The default latex is old, to prevent sudden trauma to those who depend on it. Some people feel traumatized by the default and have aliased latex to latex2e. (There are various archived questions for which the answer is "use latex2e.") See the SCS LaTeX and TeX Intro or the local LaTeX and TeX FAQ (or even the 30 Aug 1996 archive around 1430.)
- 10 Oct 1996
How do I get a tilde in LaTex? Is there a way to make TeX print a tilde? What's the best way to get a tilde (over nothing) in latex (for, e.g., a URL)?
Try one of these. (Yes, the space before bovik is important. It is what the tilde is over.)
\tilde{\ } bovik    ->    ~bovik
\char"7E bovik    ->    ~bovik
      
That didn't work for me (in old latex.) It prints just the first half of the ~.
\~{} should work fine for both 2e and 209. If you don't mind it being in \tt, you can use \verb|~|
- 30 Jun 1998
In any case, if you are typesetting URLs you will probably want to add a \usepackage{url} and then use \url{foo.bar.baz/quux} to typeset a URL.
- 20 Mar 2002
Why does latex make it so difficult to print a simple ^ symbol?
is $\wedge$ what you want, or maybe \char"5E ?
\^{} works fine for me, as does \textasciicircum (in latex2e).
- 1 May 1998
How can I include a postscript figure in a LaTeX document?
[I don't know whether this is the best method--will check when I have time. There's also "psfig", see the including-frame question below]
  Put this at the top of your .tex file:
    \input epsf

  then to do a figure, do something like this:

    \begin{figure}
    \centerline{\epsfbox{fig1.ps}}
    \caption{yadda yadda yadda}
    \label{fig:multi}
    \end{figure}
      

- 31 Jan 1997
How can I get LaTeX to put my figures where I want them?
 \renewcommand{\topfraction}{1}
 \renewcommand{\bottomfraction}{1}
 \renewcommand{\textfraction}{0}
 \setcounter{topnumber}{50}
 \setcounter{bottomnumber}{50}
 \setcounter{totalnumber}{100}
 \renewcommand{\floatpagefraction}{0.8}
	  
This tells latex to ignore some rules like "only the top 25% of the page can be occupied by floats". (see pp.176-178)
See also /afs/cs/user/sippy/lib/tex/here.sty
In latex2e, you can use uppercase H/T/B/P to say you really mean it (overriding whatever better idea it thinks it has.)
- 10 Oct 1996
I really really want my figures to be one per page, all at the end of the document. How can I convince latex2e to do this?
To produce journal-style papers with all floats (figures and tables) on separate pages at the end of the document after a list of figures page, try the "endfloat" style, which is available from ftp://ftp.duke.edu/tex-archive/macros/latex2e/contrib/supported/endfloat/ and should also be on other ctan sites.
(Although it has a 30+ page manual, this package seems to Just Work.)
To eliminate the default in-text markers, which is probably not what you want, use the package like this:
\usepackage[nomarkers]{endfloat}
Also, the nolists option will eliminate the list of figures, if you don't want that.
- 10 Nov 1998
Latex appears to correctly number my figures in their captions (1, 2, 3), but when I refer to them in the text (from section 3) it calls them 3.1, 3.2 and 3.3. How do I escape from this lamport-induced hell?
Make sure the label is within (or I suppose after) the caption.
\label always refers to the last counter-setting command... in your case, that would probably have been the previous \section.
- 31 Jan 1997
Is there some tool that will diff two documents and then put change bars in the margins to mark changes?
"the latex changebars package comes with a shell script that will diff two files and put changebars in the appropriate places"
- 31 Jan 1997
Is there an easy way to get a word count on a latex file (disregarding the latex commands)? Any way to convert latex to ASCII or dvi to ASCII?
"there is detex, but it isn't that good", converts tex to unformatted ascii. you can convert dvi to ps, and then use ps2ascii. there's also dvitype. And for hpux, pmax_mach, sun4_mach:
   /afs/cs/usr/sippy/bin/dvi2tty
   /afs/cs/usr/sippy/lib/tex/txt.sty
      

- 19 Apr 1997
For latex to ascii, you can also do latex2html, then use lynx or netscape to save it as text...
- 4 Aug 1997
In latex2e, how can I make the text body wider on a \documentclass{article} article? (What is the latex2e replacement for cmu-article? 'article' has too wide margins and not enough spacing between paragraphs.)
documentclass[12pt]{article}
\usepackage{fullpage}
(and for paragraph spacing, you can mess with \parsep, \partopsep)
- 31 Jan 1997
How do I get latex2e to do double spacing?
"you'll need to use the doublespace.sty package."
(in non-2e latex, you could also do \renewcommand{\baselinestretch}{2})
- 31 Jan 1997
I have used \renewcommand{\baselinestretch}{1.5} to get double spacing in the document. How do I turn off double spacing inside a figure/table? Just saying \renewcommand{\baselinestretch}{1} inside the \figure environment does not work.
try "\renewcommand{\baselinestretch}{1} \normalsize". the \baselinestretch is only looked at when latex is recalculating the leading for some reason -- such as when changing the font size.
Is the scope of the \renewcommand restricted to the innermost environment? (It very nicely retained the double line spacing outside the figure environment without my having to add another \renewcommand
yes.
- 12 Mar 1998
How do I change the spacing of list items? I want compact lists.
You have to redefine itemize since "latex firmly believes that separation beteen items is equal to separation between paragraphs." "Here are my compact lists... you can probably define your own based on these. look at the artXX.sty files to see what the defaults are." (latex2e itemize is in /afs/cs/local/tex/src/latex2e/base/ltlists.dtx)
% define my compact itemized list
\newcounter{ecount}
\newenvironment{ecompact}{
  \begin{list}%
    {\arabic{ecount}}{\usecounter{ecount}
    \parsep 0pt plus 1pt
    \partopsep 0pt plus 1pt
    \topsep 2pt plus 2pt minus 1pt
    \itemsep 0pt plus 1pt}}%
  {\end{list}}

\newenvironment{icompact}{
  \begin{list}{$\bullet$}{
    \parsep 0pt plus 1pt
    \partopsep 0pt plus 1pt
    \topsep 2pt plus 2pt minus 1pt
    \itemsep 0pt plus 1pt}}%
  {\end{list}}
      
Sample invocation:
\begin{icompact} \item foo \item bar \item baz \end{icompact} 
      

- 4 Aug 1997
I want to find a random package that is listed in e.g. the latex companion but isn't installed in SCS.
"Try at ftp://ftp.cdrom.com/pub/tex/ctan/macros/latex2e/contrib/supported/
(the CTAN search facilities are worse than useless -- why give a search facility when you don't contain a full CTAN archive?)"
- 10 Feb 1997
I'd like to put a figure and a table side by side to save some space. How can I do this? (I'm using \psfig).
To put a figure and a table side-by-side, you need to put the table in a minipage. The psfig is treated as one glob (not the proper (La)TeX) term) and the minipage as another, so you can then have something like \hf\psfig{...}\hf\minipage[3in]{...}\hf\\ where \hf is \hspace*{\fill} (and then the psfig and minipage are both centered on the page)
- 10 Feb 1997
In LaTex, how do i stack one symbol on top of another symbol so that the symbols are not too far apart and they are the same size? (Note that arrays fail the 1st requirement and \stackrel fails the 2nd requirement.)
Try fiddling with \arraystretch ?
- 10 Feb 1997
How can I include pictures made in Frame into LaTeX? ps2epsi doesn't seem to work. Also, how do I scale an included picture?
Short answer:
 /usr/local/bin/ps2epsi frame.ps frame_epsf.ps
      
and in the tex file use
 \documentstyle[psfig]{article}
 ...
 \psfig{file=frame_epsf.ps,clip=,width=4in}
      
This will scale the drawing so that it is 4in wide. If you specify both height and width, then the drawing will be stretched appropriately.
-- 10 Feb 1997
In latex2e: Is it possible to have footnotes automatically placed at the end of a document (using a mechanism similar to \listoffigures which collects figure captions)?
In '2e, footnotes have turned into endnotes. Add the following before \begin{document}:
 \usepackage{endnotes}
 \let\footnote=\endnote
      
And the following where you want the notes to appear:
 \newpage
 \begingroup
 \parindent 0pt
 \parskip 2ex
 \def\enotesize{\normalsize}
 \theendnotes
 \endgroup
      

- 10 Mar 1997
bibtex doesn't like it when I use \ss (as specified in the latex book) to get a German double-S in an author's name. Is there any way around this?
"Can't search on \ss. Why not just type in ss, which is the universally recognized form?"
"you want Ke{\ss}ler or Ke\ss ler (the former is probably more robust)"
- 31 mar 1997
Is there an SCS tech report style for latex2e yet?
Yes,
\documentclass{report}
\usepackage{cmu-titlepage}
      

- 7 Mar 1997
(see /afs/cs/misc/tex/common/omega/doc/examples/cmu-techreport.tex for example.)
Could anybody give me a latex template for thesis writeup !
"For SCS, there is no defined style. Take a look at mine if you like
/afs/cs/user/bnoble/thesis/diss
It's set up as one chapter per directory; you can either build the whole thing at once, or individual chapters."
- 21 Jul 1998
Following requests, as a service to humanity ( you know who you are ), a template structure for writing your thesis in latex2e is at
/afs/cs/user/josullvn/Public/thesis_template
- 9 Sep 1999
Easiest way to center a chunk of verbatim text in a figure?
put in minipage, put in center env
- 7 Mar 1997
Ok, now I'm inspired. How do people put nicely formatted quotes at the front of each latex[2e] chapter?
\newenvironment{chapquote}
{\begin{flushright}\begin{minipage}{3.5in}\begin{flushright}\it}
{\end{flushright}\end{minipage}\end{flushright}\bigskip}
\def\who#1{\par---\rm #1}
      
Use:
\begin{chapquote}
  Since it is known that the machine models we were considering can
  ``efficiently'' simulate a PRAM, we saw no theoretical reason why a
  good implementation could not be achieved.
  \who{Dyer, Nash and Dew~\cite{Dyer95}}
\end{chapquote}
      

- 29 Apr 1997
in my list of figures, latex uses the whole f------ caption as the description. this is nuts.
use "\caption[foo]{bar}" (bar is in text, foo is in toc)
- 21 Apr 1997
How do I cite ...
a comment at my thesis proposal?
"personal communication."
a newsgroup post?
"cite the newsgroup post by author, newsgroup, and date. That's archived. Subject line is sometimes also included, but not mandatory."
a webified document? (not static text)
include date read, or last-modified date?
URLs? is there a standard format?
"As far as I know, there is no "standard" for when or how or whether to include URLs. I say, just roll your own." (opinions vary regarding when to include URLs.)
a paper I read on the web, which according to the page also appears in a journal.
(If you haven't actually verified the paper is in the journal, you are not supposed to give the journal citation, but that doesn't stop most people.) You might cite the journal version and add "Also available as <url>"

- 29 Apr 1997
I want to put URLS in my bibliography file. How can I get latex to hyphenate them sanely? (This problem may be a latex2e thing.)
Put this command in your latex file:
\newcommand{\D}{\discretionary{}{}{}}
      
Then change URLs like this:
{\tt ftp://ftp.cray.com/product-info/program_env/program_model.html}
      
into this:
{\tt ftp://\D ftp.cray.com/\D product-info/\D program_\D env/\D program_\D model.html}
      
This will allow "hyphenation" at any of the \D spots, by just breaking the line there and not even adding an annoying hyphen. Use the shorter \D rather than \discretionary{}{}{}, otherwise you'll surely get bitten by bibtex's naive line-breaking algorithm.
- 11 Apr 1997
Is there an easy way to cite websites in bibtex (like a website class or something)?
\url{...} and in your .tex file, \usepackage{url}
or e.g.
@Booklet{FibreChannel2000, title = {T11 Home Page}, author = {{NCITS Technical Committee T11}}, howpublished = {\url{http://www.t11.org}}, note = {Accessed April 2000} }
(you might need the url package, which doesn't seem to be in the tetex collection).
- 5 Oct 2001
I did the latex/bibtex/latex/bibtex eternal dance, and my citations have numbers now, but there's no page that has the bibliography on it. Do I have to insert a \makebib somewhere or something?
\bibliographystyle{acm}
\bibliography{thesis}
      
(where the "thesis" names the file containing the bib, ala thesis.bib)
- 22 Apr 1997
Ok, that worked, but bibtex has decapitalized my acronyms.
Use {} to enclose anything you want to be capitalized.
- 22 Apr 1997
In bibtex, how do you make (e.g.) that frenchy c with the little dangly spooge under it [cedila]?
If it's for an author or title (or probably booktitle), just like you would in the paper. so, for a cedila, "cy\c{c}les"
- 22 Apr 1997
What's the magic to get the page number for the bibliography into the table of contents?
this works:
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{bib}
      

- 22 Apr 1997
Is there a special latex document style for CMU theses?
no. Most people do it in 12 pt times + book + fancyheadings.
- 18 Jun 1997
Any online references for LaTeX2e?
[Buy the Latex Companion]
- 13 Aug 1997
How do I make my subsections 2a, 2b, 2c, etc. instead of 2.1, 2.2, 2.3?
\renewcommand{\thesubsection}{\thesection\alph{subsection}}
"This is covered well in the LaTeX companion. \thesubsection is used to produce the numbers for section numbers. Renewing the command will make it that way everywhere." (so from then on you use \subsection as usual.)
"In any case, the commands \the(sectioningcommand) produce the section labels. So, if you want, say, capital letters for sections, do: \renewcommand{\thesection}{\Alph{section}} And then section-lowercase roman numerals (like A-ii) for subsections: \renewcommand{\thesubsection}{\thesection-\roman{subsection}} And so on. \Alph, \alph, \Roman, \roman, and \arabic are available."
- 29 Oct 1997
Is there a way of accessing the number of pages in a document within the document. I want to replace the "6" in
\rhead{\small Harry Bovik, Page\,\ \thepage{}\,\ of\,\ 6}
"I use:"
\rhead{\scriptsize Page \thepage\ of \pageref{lastpage}}
...
\label{lastpage}
\end{document}

- 9 Dec 1997
How do I get three dots in a triangle:
 .
. .
"/therefore". you may need to include the amssymb package.
"page 217 or so of the LaTeX companion has a chart of most of the mathematical symbols. I think it's actually the most useful section of any of the documentation."
- 9 Dec 1997
How do I insert latex math symbols like $\infty$ in a .fig file ?
In xfig, use Text Font "Latex", set Text Flags "special flags" and export as Combined PS/Latex (postscript) *and* Combined PS/Latex (latex). In your .tex file, \input the latex file (which automatically adds the ps file too).
- 2 Feb 1998
Correct way to put authors' institution on the title page of an article?
You can put it in a footnote with \thanks. People don't seem to want it this way though. Here are some multi-author non-footnote alternatives:
\author{
  Harry Bovik \\
   School of Computer Science\\
   Carnegie Mellon University\\
   5000 Forbes Avenue, Pittsburgh
   PA 15213 \\
  \small\tt bovik@cs.cmu.edu
%
\and
%
  Jack Florey \\
   School of Computer Science\\
   Some Other University\\
   Yadda Yadda \\
   MA 02139 \\
  \small\tt florey@fnord.edu
}
      
You might want two authors from the same institution...
\author{{\protect\rm Harry Bovik\hspace{1.25in} Mary Bovik}\\
	\mbox{\small\it
	      \begin{tabular}{c}
	      Computer Science Department\\
	      Carnegie Mellon University\\
	      \{hbovik,mbovik\}@cs.cmu.edu
              \end{tabular}}}
      
"i think the forced \rm and \it there were to conform to somebody's style guidelines." Anyway, you can take these and run with it.
- 25 Feb 1998
Easiest way to get a word printed in Helvetica Italic?
{\sffamily\itshape word}
assuming you don't need helvetica literally, just a sans-serif font. If you're using a prehistoric latex (e.g. 2.09) this won't work; you can still do it by fiddling with \font, but "you might as well switch and get it over with."
- 16 Apr 1998
When I change "\usepackage{times}" to "\usepackage{helvetica}" all I get is an error. Assuming I really do want helvetica, what do I need to do?
Try "helvet" instead of "helvetica.. I think helvetica.sty only works with latex209. Also, add a \sffamily near the top.
- 13 May 1998
what do ya'll use to pretty-print C code in tex? isn't this impossible to do correctly without using a tokenizer and parser for C code?
Something called c++2latex exists and has been briefly investigated. "c++2latex is pretty freaky. it comes with lex files. it works pretty well, but i fear it." It's available via ftp from ftp://ftp.germany.eu.net/pub/packages/TeX/support/pretty/C++2LaTeX-3.02.tar.gz.
- 15 Sep 1998
how would i write an official cmu letterhead with latex? packages? pointers?
Please feel free to look at /afs/cs/user/moore/WordMark/LaTeX2e/
- 6 Oct 1998
(or maybe not. try one of these.)
/afs/cs/local/tex/common/vendor/omega/lib/texmf/tex/cmu/cmuwordmark.ps
/afs/cs/local/tex/common/vendor/omega/lib/texmf/tex/cmu/cmuwordmark-color.ps
- 12 Jan 1999
Is there such a thing as dvi2gif or dvi2jpeg? I want to convert a zillion little latexisms into gifs and put them on the web.
Not that I know of, but you can build your own with
dvips -f
pstopnm
ppmtogif
Note that pstopnm will produce foo001.ppm foo002.ppm etc, one file for each page of the postscript document.
Why not just use latex2html?
- 13 Dec 1998
online reference?
andrej says:
I am creating a latex quick reference in the form of web pages. Please submit your wishes about what it should contain. So far it looks like this:
http://andrej.com/latex
Will also add various templates that people can pull off and use (for writing a paper, etc), and explain how to set up funky latex mode in emacs.
The motto is: no babbling, just quick and easy-to-find examples of things.
= 9 Dec 1999
How do I get a footnote that doesn't correspond to any specific point in the text (i.e. just put a footnote at the bottom of a page), without any markers.
\makeatletter\long\def\unmarkedfootnote#1{{\long\def\@makefntext##1{##1}\footnotetext{#1}}}

\unmarkedfootnote{.....}

- 7 Sep 2000
is there any utility to convert dvi directly to pdf w/o an intermediate ps stage?
i've now learned of 'pdflatex', which seems to be the thing.
http://www.tug.org/applications/pdftex/pdfTeX-FAQ.pdf
ftp://ftp.muni.cz/pub/tex/local/cstug/thanh/pdftex/
- 12 Feb 2001
is it possible to include pdf files with this sophisticated document processing software?
Sure.
\usepackage[pdftex]{graphicx}
...
\includegraphics{foo.pdf}
And, you shouldn't really need the [pdftex] because includegraphics should be smart enough to do that itself.
16 Jul 2001

Emacs

How do I make emacs autosave to local disk instead of to AFS?
For an example of how to do this, see /afs/cs.cmu.edu/user/mthomas/elisp/mthomas:autosave.el
- 21 Nov 1997
Is emacs susceptible to a word-macro-like virus?
[interesting discussion] Maybe. But, in emacs, you can turn that off. E.g.
(setq enable-local-variables 'ask)
or
(setq enable-local-variables nil)
- 31 mar 1997
How do I stop the hateful "secure" M-x telnet behavior when xemacs spots a Password: prompt? The thing locks up for 3 seconds, flips the screen color, lets me type in my password (veryyyy slowwwwly), then locks up for another 3 seconds.
Try turning this off to make read-passwd faster:
passwd-invert-frame-when-keyboard-grabbed
- 10 Mar 1997
How do I cause the same emacs search & replace to occur on a list of files without having to open and close each?
tags-query-replace
(you'll need to do an "etags <all my files>" first, from the shell)
- 11 Mar 1997
How can I save myself from the pain of typing ^X^C when I meant to type ^C^C?
(defun prompt-before-exiting ()
  (read-string "Exiting emacs; <RET> to confirm, C-g to abort: "))
(setq kill-emacs-hook 'prompt-before-exiting)
     

- Apr 4 1997
How do i set up a client-server emacs connection? where the client is an extension of the server's emacs...
Check out /afs/cs/user/andrzej/emacs/attach.README
M-x gnuserv-start
/afs/cs/user/andrzej/bin/gnuattach
to stop, "M-x detach-current-tty" or "C-x C-z"
- 1 Feb 1999
The other question: how to stop gnuserv?

- 2 May 1997
In xemacs, is there any way that I can see messages that get sent to the minibuffer but are overwritten/obscured by other messages before I can read them?
see buffer " *Message-Log*" (note space).
"try C-x b SPC * TAB to see what other "hidden" buffers you have."
- 25 Jun 1997
In xemacs, after I do edit-faces (on the Options menu) to set up everything the way I like, how do I tell it to save my changes so that they are permanent?
Save Options from the Options menu. (saves a bunch of stuff in ~/.xemacs-options and adds a conditional load to ~/.emacs)
- 21 Jul 1997
What's the variable that tells emacs to put a temporary buffer in the current frame? I'm sick of running grep and then having to search through all my frames to find the output.
  (setq pre-display-buffer-function nil)
     
will cause buffers (e.g. *grep*) to be displayed in the selected frame even if they already appear in other frames.
- 9 Sep 1997
does anyone know how to map ctr key in emacs to caps lock? i have to do it in emacs proper, because i am logging in remote and the xwindows interface wont let the caps lock behave like ctr (it gets 'stuck' in the latched position the way caps lock should)
"can't be done within emacs itself. but remapping capslock as another ctrl works fine for me in linux w/xfree. put this in a file, and then "xmodmap that_file":
clear Lock
keysym Caps_Lock = Control_R
add control = Control_R
     
(you can also do this on the command line, but i forget the details.)"
- 10 Mar 1998
How do I keep emacs from saving undo state? I need to delete huge chunks of a huge file and don't have enough memory.
"buffer-disable-undo" and "delete-region" should work.
- 8 Jul 1998
XEmacs spontaneously crashing with no apparent stimulus (the window wasn't even selected!)
My xemacs used to crash regularly when doing colorizing "complicated" buffers until I upped the stacksize. Try
unlimit stacksize
- 23 Jul 1998
What do I do to be able to find-file on .gz files and have emacs automatically decompress to edit/recompress to save?
(require 'jka-compr)
(toggle-auto-compression)
to force it on:
(toggle-auto-compression 1)

- 12 Aug 1998
Anyone know if and how you can make special characters (like vowels with accent marks over them) in emacs?
"M-x iso-accents-mode M-x standard-display-european C-l" ....Beware that BOTH of these functions are TOGGLES, so run them exactly once (or give them the argument "1")
"C-h f iso-accents-mode" to get the list of things it can do.
" ~ / and some others are now hot keys that try to accentify the next character you type... " gives you umlauts i.e. typing "u gives you ü, and so forth.
(the simple approach if you only use these chars once in a while is just to kill/yank from /afs/cs/user/dkindred/tmp/latin1)
- 9 Sep 1998
I hate html-mode. Is there a cure?
"html-helper-mode sucks less. You can snarf a copy from /afs/cs/user/rochberg/src/lisp/html-helper-mode/ if you want."
- 8 Oct 1997
;; fix html mode.  this doesn't completely stop all the pain, however.
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.htm$" . html-helper-mode) auto-mode-alist))
(setq-default html-helper-build-new-buffer nil)
(setq-default html-helper-do-write-file-hooks nil)
(setq-default html-helper-indentation-list "")
(add-hook 'html-helper-mode-hook
	  '(lambda ()
	     (define-key html-helper-mode-map [return] 'newline)
	     (font-lock-mode 1)))

- 9 Sep 1998
What variable do i set so the html-mode part of psgml-mode doesn't prompt me for my mail address?
See the above question if you hate multiple parts of html-mode; otherwise,
(setq query-user-mail-address nil)
You may observe that this is a variable controlled by "f-cking custom.el" and is therefore difficult to set. Suggested methods: (Points in favor of custom.el: "i've actually found it quite useful in the few environments where it was applicable." "makes it easy to see what has changed, variable-wise, between versions.")
- 9 Sep 1998
How do I change tabs to spaces?
M-x untabify. or something like that.
- 6 Oct 1998
I would like to find out what key combination I just hit by mistake, since the result was particularly (cool, evil; choose one.)
"M-x view-lossage" or, more usefully, "C-h l" will display the last few things you typed.
- 7 Dec 1998
What must I do to make emacs/xemacs treat dos files correctly: i.e. don't display the ^M and add them automatically when it detects it is a dos-file?
xemacs: if you (require 'crypt) in XEmacs, buffers whose lines end in ^M^J will be put into Dos minor mode; when you save the file, you'll be asked to save it as a plain file (n saves as DOS, y saves as UNIX)
emacs: Emacs should handle it invisibly using DOS mode in 19, and built in foo for 20.
nt emacs: the NT emacs has an internal hack for this.
- 3 Mar 1999

Printing

What printer should I use for color slides / transparencies?
crayon and slide1, in the 3rd floor machine room, are both loaded with slides. They print differently so you should not mix slides from them. The current incarnation of crayon is a 600 dpi deskjet, "excellent for detail work." (Same kind as the "paper" printer palette.) slide1 is currently a "1200dpi CMYK color" Tektronix Phaser 560. (Same kind as the "paper" printers prism and sunbow.) "The Phaser 560 uses a laser technology allowing it to print five times faster than the old printers while allowing a maximum 1200x1200 dpi resolution."
(chrome uses wax transfer and has the best colors, but is "expensive as hell" and would have to be loaded with slides first. To use chrome, call the operator to tell them what (paper, transparencies, legal size, etc.) to load it with, and expect to wait a long time because it is slow.)
See also facilities printing info.
- 5 Oct 1998
Ok, so slide1 is much much faster than crayon?
Yes. Slide1 is around 5 times faster than Crayon.
- 5 Oct 1998
Rule-of-thumb for time it takes to print color slides?
Upper bound: "i think slide1 can do between 1 slide per minute and 1 slides every 80 seconds. yesterday i printed out about 40 slides and it took at most about 50 minutes to an hour."
Lower bound: "Slide1 actually prints around 5-10 pages per minute."
(Any way you slice it, it is less than the 2-3 minutes per slide of a couple years ago.)
- 9 Oct 1998
anyone know how to get spectrum to print slides, i.e. how do i select which tray it should use?
  /usr/local/bin/spectrum-transparency

(This program is a script, much like /usr/local/bin/double-sided)
- 4 Aug 1999
What printer should I use for black & white slides?
Print to a 600dpi b/w printer, then copy to slide stock using (e.g.) 8th or 4th floor copier. (If you like to produce b/w slides on short notice, it helps to have some slide stock hoarded in your office.)
See also facilities printing info.
- 16 Oct 1996
Does anybody know where the printer "granite" is?
In the veal fattening pens at the end of the 3400 corridor. Go to the stairwell in the 3400 corridor, and go in that door there. (The room number is WeH 3601B.)
- 19 May 1997
Color copier in Wean?
"There used to be one next to slate in the 3100 corridor. Probably requires special access code."
"I don't know if CS has an accessible color copier (is rainbow a copier as well as a printer?) but campus printing has one---they're downhill from the navy building."
- 19 May 1997
I heard something about a funky new printer?
"PRINTER UPDATE...A new HP DesignJet 755CM printer named Mannochmore, donated by Garth Gibson and the PDL, is now located in the Wean 3rd Floor operators station. It prints with the same quality as the HP DeskJet 1600CM, the model of the [Crayon and Palette] printers, but can produce a document up to 3 feet wide x 9 feet long (we're talking big!). To use this printer, contact SCS Facilities at x2607. The operator will enable the printer and load the correct media (transparenies, paper...) you request. Mac users will need to load a special printer description file onto their system."
- 1 Jul 1997
Someone said "instead of using Monolith to print, I just send the files directly to the print servers (using lpr)." I've never gotten lpr to work properly on NT 4.0. what's the magic chant to do so?
try 'lpr -S tpb.srv.cs.cmu.edu -P iron'. similarly with lpq.
- 26 Nov 1997
How do I get a print-out of posters etc.?
Mannochmore in Wean 3610 can print pages upto 72" X 72". It can print in colour too. You must have a postscript file that can generate this large-size. This is costly, and must be used sparingly. It is generally kept off, call operations at 2607 to switch it on before use.
- 23 Feb 1998
Wasn't the 3rd floor terminal room destroyed? Where is it now?
The new terminal room is 3501 -- on the right as you get off the elevators.
- 17 Mar 1998
Are there any scanners in the dept. Flatbed preferred, color not needed.
In terminal room, hooked up to macs. WeH 3501
- 23 Feb 1998
If you want hi-res scans of negs, you want the film scanner in the CFA cluster. It scans slides too. Just head up to the cluster and ask the cluster-dude(ette) to let you use the slide scanner. they might want your ID. (Also, for some reason, the copy of photoshop on that Mac has a hard-coded recommended mem size of 16M, so you have to copy it and up the size to something more reasonable.)
- 12 Oct 1998
How do I force lpr to print my postscript file single sided (on only one side of the paper)?
'man singlesided'
singlesided filename.ps | lpr -Pmyprinter
- 16 Mar 1998
Fun fact:
if iron is demanding A4 paper, you can (sometimes?) hit <on line> to get it to consider other choices. (<select> letter.)
- 14 Oct 1998
what do I do to print a ".pdf" file on iron?
acroread foo.pdf .... "Print ..."
or try "pdf2ps"
gv can handle most .pdf also, and you can "Print" from it.
- 16 Nov 1998
How do I print out a manual (man) page?
You can do one of these two to the source file (in some man directory)
nroff -Tascii -man <sourcefilename> | lpr
groff -man <sourcefile> | lpr
Or if that is too much work you can try:
man <command> | col -b | lpr
On Ultrix and sun4_413 you can do:
/usr/local/bin/man -t <command>
On alpha_dux40, you can do:
man - <command> | lpr
"groff -Tps -man /usr/man/man1/pwd.1 will pretty print (on this linux box)"
- 21 Jul 1999

netnews

<Anything to do with netnews> ?
Consensus seems to be that you're better off using the beta netnews servers now.
- 2 Jun 1997
The servers formerly known as beta are now omega.
"We have normality ... Anything you still can't cope with is therefore your own problem."
If you put a "collection.release beta netnews" line in /usr/local/depot/depot.pref.local, you can take it out now if you like. If you have been using r.gp as your news server you should switch back to (spiffy upgraded) dnntp.srv.cs.cmu.edu.
- 14 Aug 1997
How can I find and read an andrew graffiti bboard?
(First, get some advil.) You can:
  • use cyrus and read the news as an IMAP mailbox; you can use pine as an imap client
  • use an AMS client: ezmail, batmail, cui, vui, messages....
  • look in /afs/andrew/usr0/bb/.MESSAGES/graffiti/bboard/name/

- 10 Jun 1997
what am I supposed to use to read andrew bboards now that messages is going away?
run pine andrew-side. hate it. the second step's optional, but hard to avoid.
if 'ml' or 'simeon' exist on the andrew machine you're using, they might be less painful.
- 10 Sep 98
What's the cmu.cs equivalent of the Andy-side bb+<foo> addresses? In other words how can I post to "cmu.cs.<mumble>" by sending e-mail?
see below
I hear that gnus with "adaptive scoring" is the newsreader that will save my sanity (if there is any left). Please jump-start me.
if you put
(setq gnus-use-adaptive-scoring t)
(setq gnus-default-adaptive-score-alist
  '((gnus-unread-mark)
    (gnus-ticked-mark (from 4))
    (gnus-dormant-mark (from 5))
    (gnus-del-mark (subject -10))
    (gnus-read-mark (subject 5))
    (gnus-expirable-mark (subject -1))
    (gnus-killed-mark (subject -30))
    (gnus-kill-file-mark)
    (gnus-catchup-mark (subject -10))))
(add-hook 'gnus-summary-prepare-hook '(lambda ()
  (gnus-summary-sort-by-score)))
into your emacs setup, gnus does the following:
  • whenever you read a message, its score goes up by a lot. whenever you don't read a message (skip, kill, or catchup in the group) its score goes down.
  • new messages to a thread inherit the score of the other messages in the thread.
  • messages are sorted by score when you come into a group.
the effect is that threads you have read show up at the top of the subject window automatically, and threads you have ignored show up at the bottom. new threads show up in between.
"eventually, what you find is that you are never reading anything in a group, and you just turn off news forever. this setup is very old. i don't read news anymore"
(so maybe `gnus-thread-sort-functions' instead of `(add-hook 'gnus-summary-prepare-hook '(lambda () (gnus-summary-sort-by-score)))')
- 14 Sep 1999

Mail

How do I get zephyr notification of mail delivery?
To get a zephyr when new mail arrives, put this in your .maildelivery:
*    -    pipe    R    "/usr/local/bin/zrcvalert $(size)"
      
What's the .maildelivery line to nuke stuff from (e.g.) jerk@evilspammers.com?
One of
sender   "@evilspammers.com"              destroy A -
sender   "jerk@evilspammers.com"          destroy A -
      
(Use the second if there is someone else at evilspammers that you actually want mail from.)
The maildelivery man page has some other examples.
You may also be interested in /afs/cs/user/jch/.maildelivery or /afs/cs/user/mthomas/bin/maildelivery.[pl,pl4]
- 16 Oct 1996
What are socially acceptable means of wreaking vengeance on spammers?
Opinions vary; please don't do something you'll regret, like bounce 20 corefiles back to yourself.
- 16 Oct 1996
(If you are receiving email-virus spam from clueless relatives/acquaintances, try re-education.)
How do I get zephyr to *not* notify me of filtered spam?
there's no need to write your own zrcvalert, unless you also want to track down what address spammers are using for you...
default	-	pipe	R	/usr/local/bin/zrcvalert $(size)
has the same effect as
*	-	pipe	?	myfunkyzrcvalert $(size)
where myfunkyzrcvalert returns an error (the trick is default vs * ... 'default' says only fire this rule if the message hasn't yet matched. so you put the zrcvalert line after the set of lines which match messages for which you don't want to get alerted.)
- 10 Jun 1997
I changed my maildrop and location of my .maildelivery, and now I'm not being alerted of incoming mail, even though I am receiving mail ok.
mmdf doesn't understand AFS file protection and only looks at the standard protection bits. If your .maildelivery appears to be world-writable, rather than deliver your mail to somewhere insecure (someone might have modified the .maildelivery), mmdf just drops it straight in your mailbox. If this is the problem, chmod og-w <dir> will fix it.
If this is not the problem, maybe system:friendlyhost does not have read access to the file. "the mail delivery program does not run with kerberos tickets, so files you access in AFS need to be readable by system:friendlyhost (or system:campushost or system:anyuser)"
- 10 Jun 1997
How do I forward my mail?
use jeeves
- 10 Jun 1997
Why doesn't my ~/.maildelivery file match mail sent to username+foo@some.host.cmu.edu ?
Make sure your forwarding address includes a plus sign before the @, e.g., username+@some.host.cmu.edu
If there is no plus sign, change your forwarding address with jeeves.
Otherwise, check the permissions of your ~/.maildelivery file as discussed above.
- 13 Aug 1998
What's the cmu.cs equivalent of the Andy-side bb+<foo> addresses? In other words how can I post to "cmu.cs.<mumble>" by sending e-mail?
news+post-name.of.group@cs.cmu.edu is our e-mail to news gateway
- 10 Jun 1997
Some people claim it should be "netnews+post" instead of "news+post". If neither works, you could try post+name.of.group@andrew.cmu.edu or check out /afs/cs/user/mthomas/perl/bin/inews_mail
- 10 Aug 1998
How do you quote a message in a reply using standard mh?
(not easily. you need a filter.) "my setup is like this:"
.mh_profile contains:
repl: -filter repl_filter -form repl_form

Mail/repl_filter contains:
body:component="> "

Mail/repl_form contains:
%(lit)%(formataddr %<{reply-to}%|%<{from}%|%<{sender}%|%<{return-path}%>%>%>%>)\
%<(nonnull)%(void(width))%(putaddr To: )\n%>\
%(lit)%(formataddr{to})%(formataddr{cc})\
%<(nonnull)%(void(width))%(putaddr cc: )\n%>\
%<{subject}Subject: Re: %{subject}\n%>\
From:Corey Kosak <kosak@cs.cmu.edu>
fcc:inbox
--------
"Or you can use mhl: put the following in mhl.reply"
width=80,overflowtext="> ",overflowoffset=5
date:nocomponent,formatfield="On %{text}"
from:nocomponent,formatfield="%{text} wrote:"
:
body:component="> "

- 9 Dec 1997
Any good way to unpack a mime (application/ms-tnef) file on Unix?
shovel the message into metamail as stdin.
-w gives you raw file output, which may be "safer" than letting metamail try to intuit file types via mailcap.
- 27 Feb 1998
I need to convert my mail format: From BAGS to CMU elm or non-CMU elm.
You may be interested in packf or packmbox (/usr/local/lib/mh/packmbox.) Here is a handy chart:
single file		|   MH directory 	| single file
separation by ^A's	|  separation by files	| separated by From

  elm/MMDF/VM		|      MH		|  elm/sendmail/uucp

                      <--- packf         packmbox--->
      
You may also be interested in lclmail (/usr/local/lib/lclmail).
Also, packf takes a "-file foo" option, whereas packmbox does not, and will write its output to stdout instead.
- 30 Jun 1998
So first I need to convert from BAGS into MH format - how do I do that?
"BAGS messages are basically in MH format -- with the exception of how they are named, and most mh tools are not going to want to touch them until you rename them to reasonable numbers, as opposed to the 10 digit starting with 0 things bags has."
See conversion script /afs/cs/user/jeliza/Projects/bags-convert/bags-convert.pl
"basically, just rename them to 1,2, ... n and then run sortm on 'em to get them in chronological order." Poof, you have MH.
- 30 Jun 1998
Are there any programs for converting MMDF to standard berzerkley format? Netscape only supports berkeley ("From"), and I have some mmdf stuff.
[what the diagram above is missing is] you can go from separation by ^A^A^A^A to separation by files by doing an ``inc -file <name> -notruncate'', you then run packmbox on that to get the "From Format"
"vm-convert-folder-type seems simpler"
/afs/cs/user/mthomas/perl/bin/mmdf2from should convert a Control-A separated mmdf-folder to a from-format-berkeley-folder. (requires /usr/local/bin/whenis)
- 31 Aug 1998
How do I arrange .maildelivery to save messages to folders without opening the folder directories to world?
"system:friendlyhost ilk" is the minimal set of permissions you need to get a script to write your mail into an AFS directory with each message being saved in a separate file. Note that the MH funcution themselves will work but they will also leave a bunch of lock files in the directory; the MH functions cannot remove the lock files unless you add `d' permission to the directory.
If you are using the maildelivery `file' mechanism, you'll have to add `wr' to the above permissions since `file' will need to read to the end of your folder and then write the new mail to it.
- (answer from 17-Feb-1997)
- 16 Sep 1998

HTML

What's the syntax for identifying a specific spot in a page? I want to be able to href "foo.html#mark-this-spot". I thought I needed to insert <a name="mark-this-spot">blah</a> in foo.html, but it doesn't seem to be working. Clues?
Make sure that you spelled 'mark-this-spot' consistently.
Also, make sure that you did not type 'name="#mark-this-spot"'. instead of 'name="mark-this-spot"'. (Spelling and extra # are common mistakes.)
- 25 Sep 1997
How do I convert Frame to HTML?
Here is the long answer courtesy of Ralph. The short answer is that you have four options, and you should be prepared for pain.
- 4 Feb 1997
a new opinion: "framemaker++ does an amazing job when you say "Save as HTML" it converts the document into readable html (including turning tables to tables and graphics to gifs) *and* saves out an appropriate CSS file to keep the appearance as similar as possible. and it didn't ask me a single question in annoying dialogs - it just silently did the right thing. some days you win."
- 24 Sep 1998
How do I convert a random format to HTML?
Try the TOM conversion service at http://tom.cs.cmu.edu/. "TOM is way cool." You don't even have to know what format the file is in, though it helps.
- 31 Jan 1997
In HTML, can I nest an <a name="foo"> and an <a href="bar">? Does it matter in which order I nest them?
Just use <a href="..." name="...">
(Hm, looks like emacs w3 can't deal with it. Eit.)
- 3 Feb 1997
How do I get an emdash in HTML?
All possible answers:
  • Get everybody to support html3.0. Sorry. (Feel free to muse upon the sadness of things.)
  • You can overstrike forced spaces: <S>&nbsp;&nbsp;&nbsp;</S> (Best classed as a party trick     it looks odd in lynx and won't work on all platforms.)
  • "When I really needed proper dashes, I used a dash gif" with alt="--". Looks ok in lynx but really odd in an graphical browser with image-loading off.
  • "I do <img src="single-pixel-black.gif" width=10 height=1>, but then I'm from hell." (Another good party trick.)
the approved answer: Use -- and rejoice in your portability.
- 19 Sep 1997
Is there an HTML expression similar to an include file, so that you can say something like
<incl>file1.html</incl>
<incl>file2.html</incl>
      
and get the same results as having the two files concatenated? Or am I wishing for too much?
You want server-side includes. "There's nothing in HTML to let you do that generically. There are lots of server-side hacks to do it for random servers." On the CS web server, you want to call your file foo.https and then crib from nat's home page
<!--#include virtual="/~magus/includes/footer.html" -->
      
For the server to parse your included files, you need to either name them something.shtml or add the following line to the .htaccess file for the directory:
AddHandler server-parsed .html
      
This stuff will work for anyone who accesses the page through the www.cs server; it (obviously) won't work for people who read it out of AFS. Note also that we're running an old version of apache on www.cs (some people might say "stable") so the 1.2 extensions for that stuff that you find in the apache documentation won't workl.
- 5 Aug 1998
How do I restrict access to a subset of my web pages, so only CMU sites can access them?
The key word you are looking for is ".htaccess", e.g. see the file /afs/cs/user/sprite/www/Zephyr/.htaccess, which looks something like:
<Limit GET>
order deny,allow
deny from all
allow from .cmu.edu
</Limit>
This restricts access to all the files in the www/Zephyr directory (as well as I believe subdirectories.)
- 4 Sep 1998
Can someone tell me how to (or point me to a web site that) automatically redirects to another web page? (As in, "This web page has moved. You will be automatically brought to the new page <blah> in 10 seconds.")
You can use a meta refresh directive, like this.
<HTML> <HEAD> <TITLE>poof</TITLE>
<META HTTP-EQUIV="refresh" CONTENT="10; URL=http://my_new_site">
</HEAD> <BODY>
This web page has moved.  You will be automatically brought to the new
page <A HREF="http://my_new_site"> blah </A> in 10 seconds.
</BODY> </HTML>
(Yes, the quotes in that META look odd. Just remember it has only two fields, 'http-equiv' and 'content'. see, the 'url' bit in 'content' is actually "optional", such that if you leave it out, it will reload the current page every 10 seconds. I think that is supposed to be a feature.)
Change the "10" to however many seconds you like (allow enough of a delay to let someone click the "Back" button twice.) The example body includes a link to the new page because not all browsers support this meta jive. And remember always to use your new powers only for good, never evil.
...If you're writing your own CGI script, you can issue a "Location: my_new_site" field instead.
...If you want to redirect without the intervening page, use a Redirect rule in ".htaccess".
- 31 Aug 1999
do I want a shockwave plug-in badly enough to "register with Netscape Netcenter"? I doubt it.
registring with netcenter will do little to help anyway, for a unix box. Go to http://www.hubbe.net/~hubbe/plugger.html to stock up on unix (linux, solaris) plugins.
- 15 Nov 1999

Perl

How do I install my own perl5 modules? (How do I find this CPAN thing and get it to install into '/usr/pdl/rhinocerous' instead of '/usr/local/bin'?)
See mthomas's excellent answer.
- 11 May 1998
"I don't install them, and do
use lib /my/dir

- 3 Nov 1999
How do I convert to lowercase in perl?
in perl4:
$foo = "\L$foo";
      
in perl5:
lc("FOO");
      

- 3 Feb 1997
Is there a perl builtin, or a useful phrase, that removes any trailing whitespace from a string?
$var =~ s/\s*$//;
- 10 Jun 1997
Is it possible to write c/perl code to read ./netscape/history.db ? What format is it in?
A really good perl program for reading the contents of your .netscape/history.db can be found at http://perl.com/perl/scripts/ggh.
- 10 Feb 1997
Except that they've reorganized the site. Try http://language.perl.com/scripts/ggh.gz.
- 11 May 1998
How can I tee into 2 processes instead of a file and a process? I want the output of process A to flow to both B and C.
use perl:
foo | perl -e 'open(BAR,"|bar"); open(BAZ,"|baz"); $|=1; while(<STDIN>) { print BAR; print BAZ; }'

You mean this can't be done in sh/csh/whatever?
not in sh/csh anyway afaik. they don't do any splitting of streams.
that $|=1; above is useless. if it's important to get data flushed after each line, replace it with "use FileHandle; BAR->autoflush(1); BAZ->autoflush(1);" (and use perl5)
and every time you get the urge to write a shell script, write it in perl instead.
- 28 Apr 1998
easiest way to find the newest files in a directory tree? ("ls -lR | sort -k51n -k47M" fails, and I'm too bitter to dink with sort now.)
Here's some perl instead..
#!/usr/local/bin/perl5
# find files < 1 day old
require "find.pl";
# Traverse desired filesystems
&find('.');
exit;

sub wanted {
    (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
    (int(-C _) < 1) &&
    print("$name\n");
}
      
You can also modify it to make perl collect all the file names and sort them by access time. Try this.
open(FIND,"find . -type file -print|");
while() { chop; $f[$i++] = $_;}
@g = sort { (-C $a) <=> (-C $b) } @f;
foreach (@g) { $t = (-C $_) ; print $_ . " $t\n";}
      

- 1 May 1998
Perl is great but I actually want to use Java instead.
"here's a free pure Java library that claims to provide 100% compatible Perl5 regular expressions."
"hee hee. If you really want to write Perl in Java, check out this."
- 10 Jun 1998
what's the right way to locate the perl binary on someone's machine?
#! /usr/bin/env perl
will run whatever "perl" is first on the users path.
there are also tricks where you put the body of the perl program after __END__ and then use the area before __END__ to try and find the correct perl.
if you're packaging perl script for distribution, you may want to consider using ExtUtils::MakeMaker.
- 9 Mar 2001

Hardware

What's the general advice for when sweet liquid (e.g. Coke) is spilled on a keyboard?
"I'm told that one can put some keyboards in the dishwasher." "I think I've tilted to drain, let dry and then clean up later (it sucked). I think someone has suggested running distilled water in the past."
Result: "I gave the keyboard a shower of distilled water. No ill effects so far."
- 30 Jun 1997
How do you burn a CD here?
acm reports "For the logs, here's how I burned my CD (in painful detail):"
  1. I made an iso9660 image with mkisofs on my linux box
  2. I acquired a CD caddy
  3. I acquireed Recordable CDs (Sony 650 MB jobs)
  4. I went to the terminal room (3501 now) to use the Mac there that has a CD burner
  5. I ftp'd my image to the Mac
  6. I used "Find" to find Adaptec Toast v3.5 - accept no immitation Toasts (there's also Toast v.2.5.6 and v.2.5.10 on the Mac - don't use them!)
  7. I closed all other apps on the Mac
  8. In one of the middle pull-down menus, I selected "Disc Image"
  9. In another pull-down (something under preferances?) I selected 2x write speed
  10. I loaded my image in the program
  11. I did a simulation/test run to make sure the Mac was fast enough
  12. I burned the CD - I think I clicked on "Create Session" rather than "Create CD" so perhaps I can create another session on that disc?
  13. I verified the CD (default action)
"In other words, the key item is remembering to use Adaptec Toast rather than one of the other CD burning programs installed."
- 28 Aug 1997
i want to burn my winnt file system onto a recordable cd. i have the cd and the cradle. the only cd recording box i saw in the terminal room is attached to a mac. anyone have a suggestion on how to proceed?
There is a CD-RW on an NT machine there as well, at the far right. It looks just like an ordinary internal cdrom drive, but is actually cd-rw.
Use file sharing to mount your filesystem.
Look for a program to run the burner on the drive of the burner machine.
Since you're copying the files over a (potentially congested) network, you probably want to tell the machine to make an image (collection of the bits its going to burn) and then burn the image.
Or ftp the tree first, whatever's the most convenient.
- 30 Jul 1999

Radio Free Wean

What is RFW / Radio Free Wean and why should I care?
The phrase "radio free wean" appears in the logs as early as Nov. 1996 but the current implementation is more recent (Feb. 1999.) The idea is that
someone (several people actually) in the dept multicasts music over the net from his computer and we all listen to it
Why should you care? Some people find it entertaining. Maybe you will too.
- 26 Feb 1999
How can I find out what is currently playing?
Subscribe to the "rfw" class ("now.playing" instance.)
- 26 Feb 1999
The address has been moving around a lot lately. How do I find out where to listen to?
"The server will now make periodic zephyr announcements (on class rfw, instance status) about the current multicast address in use (as well as the number of unicast clients). It will make these announcements once every ten minutes while there is an active source, and should be quiet otherwise."
Use that address in place of the example "224.3.1.4:6677" in the examples you see below.
- 29 Nov 1999
Where do I access rfw?
You need to run a multicast receiver stub thingy (assume for this example that the current address is 224.3.1.4:6677) and then point a player like mxaudio at the right port:
  /afs/cs/usr/tmwong/bin/micecastd 224.3.1.4 6677 8111
  mxaudio http://localhost:8111/
- 11 Mar 1999
/afs/cs/usr/pdinda/public/receiver.exe is a working multicast receiver for nt/95/98. (run from dos prompt with those same "224.3.1.4 6677 8111" arguments; meanwhile start up winamp or whatever and tell it to listen to http://localhost:8111/)
- 11 Aug 1999
How do I listen to this?
"Winamp, xmms, and I think mpg123." "mxaudio (for linux)."
A list of streaming MP3 players: http://www.worldservice.net/infotech/archives.html
mpg123 will "kinda work" if you crank the buffer up a lot, but it decides it's "done" after songs sometimes...
(some people have random stuff built for random platforms, you may want to consult the zephyr logs before duplicating their pain.)
- 26 Feb 1999
Can i get linux2 instructions for experiencing rfw?
unpack /afs/cs/user/magus/xaudio.x86-unknown-linux.tar.gz. or, just run "/afs/cs/user/magus/bin/mxaudio http://asylum.trust.cs.cmu.edu:8900/" (for unicast.) if you want multicast action, there are instructions in the zarchive.
- 26 Feb 1999
i386_linux3: xmms http://224.3.1.4:6677 (or whatever the current address is; see above)
(now includes multicast action thanks to kw's patches)
- 5 Oct 1999
multicast stuff?
Hacked version of receiver.c is reincarnated as micecastd, the multicast icecast daemon. It runs in the background, and will take connections from multiple clients. Use it to:
1. Bridge over to a net segment that doesn't have mcast.
2. Run on your own machine, and switch away from and back to Howard's rfw without having to restart the receiver process.
Usage:
micecastd <mcast IP address> <mcast port> <ucast port>
Source:
/afs/cs/user/tmwong/src/micecastd.c

- 26 Feb 1999
xmms is a collection in afs now, micecastd not necessary if you use the collection version.
- 4 Aug 1999
how can I rip cds to mp3 so I can inflict my unique tastes on rfw?
(0. If you're on linux and you've got a scsi cdrom, you need to compile 'generic scsi' into your kernel)
  1. build and install cdparanoia.
  2. build and install cda
  3. build and install poole's 8hz-mp3
  4. place these programs in your path
  5. run /afs/cs/user/rochberg/cbin/ripper.pl
Step 2 is unfortunately annoying.
cda gets the table of contents from the CD and then uses the cddb servers to generate a track listing. rochberg's script does cddb lookups to name albums and tracks appropriately.
There's also a ripper at /afs/cs.cmu.edu/user/tmwong/.bin/i386_linux2/ripenc
The faster solution is to hand your CD to one of the people on zephyr who already have all this stuff set up.
- 26 Feb 1999
for windows, try "musicmatch jukebox". "It rips an album in 12-15 minutes on my PC."
- 3 Nov 2000
Yeah yeah whatever. I have MP3s. Now what.
You need the shout binary and a dj perl script.
dj.pl, and shout compiled for linux3, are available at /afs/cs/user/kw/pub/shout
(Or you may want /afs/cs/usr/kw/pub/throttle-1.0.tar.gz ... throttle is like shout but happy with variable-bit-rate)
Then you can run
shout eureka.learning -P <3L33T_SECRET_PASSWORD> -e 8900 -D dj.pl
after you discover from some elite zephyrite what the password is (and confirm that eureka is still the right machine.)
- 3 Nov 2000
where did this word "rip" come from anyway?
"In the game cracking circles, "ripping" is any technique that extras audio from a source that does not want to give the audio. Examples were people who "ripped" the music out of game data files. The term applies to the extraction of bits via CDDA, which is not a friendly format for digital extraction."
- 26 Feb 1999
what do I do to get my windows netscape to `play' mp3 files? it offered me quicktime3 and I installed that, but it doesn't help.
www.winamp.com
- 26 Feb 1999
what's rfw-cpanel?
/afs/cs/user/dkindred/bin/rfw-cpanel displays currently playing selection, and for mxaudio users, provides stop/play button and "skip this tune" button. "could potentially auto-filter based on dj, song title, a "category" tag, etc."
- 9 Mar 1999
This is great. Can I set something up to mirror and share it with the world?
No. The legality (lack thereof) of rfw is bad enough without it leaving the cs network.
- 26 Feb 1999
I hear we are looking into BMI/ASCAP fees?
See zephyr logs for 2pm 7/14/99, instance rfw.ALERT (this entry to be updated when a decision is made, which might involve Passing Of The Hat.)
- 14 Jul 1999
Or passing of the buck.

Other CS related

How do I find out what shared libraries are used by an executable?
sunos/linux: ldd <executable>
hpux: chatr <executable>
osf/1, irix: odump -Dl <executable>
aix: dump -H <exectuable>
- 10 Oct 1996
Is there any way to make grep look through an entire directory structure? Or do I need the magic (gack) of find?
Yea, though I walk through the Valley of the Shadow of Find, I will fear no recursion...
find . -type f -print | xargs grep string-to-look-for
      
Or if you want to be exceedingly correct it is
find . -type f -print | xargs grep string-to-look-for /dev/null
      
That way if find returns zero files, the grep will search through /dev/null instead of waiting for input from stdin, and if it returns only one file you still get the name of the file.
- 31 Jan 1997
Also, "agrep" isn't quite the same as grep, but it's often close enough. It takes the "-r" option to recursively grep through subdirectories. And hey, no xargs.
- 29 Aug 1997
"Here's yet another correction ... I had to do this on Linux after getting obscure "xargs: unmatched single quote" message. Dunno if it works the same way elsewhere."
If you have files or directories with whitespaces in them, you better
find . -type f -print0 | xargs -0 grep string-to-look-for

- 21 Apr 1999
In afs, is there a way to set the permissions of a directory and all its subdirectories?
Here you do need the magic of find.
find . -type d -print | xargs fs sa -acl system:anyuser rl -dir
or
set the toplevel directory the way you want it
then:
find /afs/cs/foo/bar -type d -exec fs copyacl /afs/cs/foo/bar {} \;

- 2 Mar 1999
easiest way to find the newest files in a directory tree? ("ls -lR | sort -k51n -k47M" fails, and I'm too bitter to dink with sort now.)
see perl section above
How do I convert a file, or online document or web page, from Useless-Format-X to Usable-Format-Y? (Where "format" is something like acrobat, binhex, dvi, html, jpeg, mif, powerpoint, ppm, rtf, wav, word, among others.)
Try the TOM conversion service at http://tom.cs.cmu.edu/. "TOM is way cool." You don't even have to know what format the file is in, though it helps.
- 31 Jan 1997
What Unix tools do people use to draw stacked bar graphs?
The Latex Companion has lots of examples of bar graphs.
jgraph will do it too.
"The answer turns out to be 'write a perl script that spits out \put\framebox statements for the latex picture environment'. Quick, easy, and it works."
- 31 Jan 1997
Can anyone give me a crash course on gnuplot so I can plot simulation data? I need to know what format the data should be in and what the magic incantation is to get gnuplot to graph it.
Use perl to put data into a 2 col. file like this:
x y
x y
x y
      
(yes, numbers of the form 5.37e-05 are ok.) Then say
gnuplot
> plot "file"
      
or
gnuplot <<EOF
plot "file"
EOF
      

- 4 May 1998
How do you get the plots in gnuplot to go somewhere besides a display window?
gnu> set term post
gnu> set output "foo"
gun> replot
      

- 12 Dec 1997
How can I find out what's changed since my last 'cvs update'?
run cvs tag to tag the versions you have checked out, then diff the tagged files against the HEAD. e.g.
cvs tag bovik-working-copy
cvs diff -rbovik-working-copy -rHEAD
cvs tag -d bovik-working-copy


or, script
- 14 Mar 2001. (Happy pi day.)
Is the network always so bad?
Sometimes it's worse.
Meaning of local acronym?
/afs/cs.cmu.edu/user/ph/www/acronym
Anyone have an address for a webster server that works?
Merriam-webster seems to have stomped on 'em. If you want to look up a word, you can use http://www.m-w.com/netdict.htm or /afs/cs/user/dkindred/bin/mweb.
"I know of no publically-accessible servers for the 'webster' protocol. you can use http://c.gp.cs.cmu.edu:5103/prog/webster for bsy's gateway to a server that speaks a different protocol, based on an early-1900's dictionary."
"New and improved (i.e., working, I hope): /afs/cs/user/terra/emacs/webster.el Ought to work with Emacs (needs lynx) and Xemacs (needs W3). Has colour and mouse support. Note: Miriam Webster might not like such direct access to their WWW site (bypassing their ads). Telling all the world about it could make them change the format or remove it altogether."
- 8 Apr 1997
There's a live webster server! WEBSTER_PATH=2627@128.100.1.105 "dunno what db it's using -- not m-w.com's and not the 1913 one..."
- 10 Mar 1998
Speaking of www.m-w.com, apparently you can get to a reverse-search page there.
You can get there by clicking the "search" button without entering a word. From this page you can:
  • search in definition text, etymology, etc. (goodbye, hapless reverse dictionary...)
  • find rhymes, homophones, or `phonetic anagrams'.
  • search with "?" and "*".
  • search for anagrams, anagrams with repetition of letters, or words accessible through a monoalphabetic substitution.

- 6 May 1998
lislook doesn't work anymore? it sets there for a while, then just exits.
Yeah, LIS was "phased out". Apparently text interfaces are passe.
"All of the University Libraries' catalogs and databases are available on the Web from the "Other Library Catalogs and Databases" page."
If you don't like m-w.com or the password-required WebZ, see:
/afs/cs/user/dkindred/bin/mweb <word>
	

- 10 Aug 1998
(in C) Is there any way I can set an enum up to be short or smaller? Or do I have to cast it to a short or something... (Blecch)
"If you used C++, you could at least use const shorts."
are you using gcc, heh heh? if you use -fshort-enums, you get the following totally beautiful behavior:
Allocate to an enum type only as many bytes as it needs for the de- clared range of possible values. Specifically, the enum type will be equivalent to the smallest integer type which has enough room.

- 5 May 1997
(in C) Is there gcc syntax for building a macro like:
#define TAGME(x) fprintf (stderr, "About to execute x at line ###\n"), x
      
...I'm in a real-time OS with no decent debugger.
In any ANSI C compiler,
#define TAGME(_str_) fprintf(stderr, "About to execute %s at line %d\n", #_str_, __LINE__)
      
If non-ansi, replace #_str_ with "_str_"
- 6 Aug 1998
"You know, if rm -r goes through the directory tree in the same order as tar, then this big tar to move this tree is far enough along that I could probably fire off the rm now without losing any data." Or, "in what order does tar tar files?"
"rm -r is postorder and tar preorder. good luck."
- 5 May 1997
Tar order is "preorder traversal in the order than readdir returns entries, I think." (ls -f should list files in readdir order, which is whatever order they are stored on the disk.)
- 29 Aug 1997
What is the RPM translation of "tar xfvz foo.tar.gz"? I want it to tell me what it's going to do when I install, without doing it.
"rpm -qlp foo.rpm" (-qlvp if you also want the file sizes and modes.)
- 18 Aug 1999
(about a gif) Hmmm. I should figure out how to make the background transparent.
two solutions offered:
pbmtext | ppmtogif -transparent white

pbmtext -builtin fixed $date | pnmcrop | ppmtogif -transparent rgb:FF/FF/FF >! $WDIR/$OUTFILE.gif
      

- 6 May 1997
Better yet,
giftrans -t #ffffff file.gif > transparentfile.gif
      

- 11 Aug 1997
The way to get afs on linux is to fill out the computer club's little form at which point they give you access to some archive, yes?
Used to be. Now you should instead check out
/afs/andrew.cmu.edu/system/archive/transarc/afs3.4a-patches-ports/binary/linux-afs/README
- 9 Nov 1998
NT and RedHat Linux on the same disk?
keywords: zarchives, Adaptec, SCSI, RedHat 5.0, 7880, Intel R440LX
see jch's answer
- 24 Feb 1997
I am tired of web advertisements, is there a proxy I can use?
try junkbuster.psc.edu, port 8000
- 4 Mar 1998
gs176:8000 for squid/junkbuster (squid is a caching proxy). "Also, gs108.sp:8000. Don't forget that in Netscape you can explicitly name domains that you want direct connections to."
- 24 Sep 1998
what was the name of the environment variable you set to use "less" instead of "more" ?
$PAGER
- 5 Jun 1997
People say less is better than more, but I do not like the default less. When I "q", I want to quit with screen UNcleared.
you want to use "less -X", or
setenv LESS "-X"
- 20 Mar 1998
Is C just glorified assembler?
Yes. No. Yes. Now get on with your life.
- 10 Jul 1997
I'm running NT 4.0. Is there a keystroke combination to send a window to the back, underneath all of the other windows? (Don't tell me to use twm..)
Try Alt-Esc.
"This is documented in
 (Start Menu) NT Help --> Index --> Shortcut Keys
Although, actually it appears to be documented as:
ALT+ESC cycles through the programs in the order they were started.
but I use it for just sending the window to the back, which seems to be what the key combination actually does on the first press."
- 8 Jul 1998
How do I turn caps lock into control under NT4?
Try the NT emacs page. There are various hacks listed there
Also another hacks page.
Also /afs/cs/user/eli/pub/NT-utils/{ctr2cap.zip, swapcaps.zip}, the former is probably the "good one".
- 10 Sep 1997
Somebody here on zephyr pointed me to a web page where you can download such a utility for windows 95. Now I need it again (actually for windows 98) I can't search the zarchive now (it's asking username and password). Can somebody help me?
try http://www.bmrc.berkeley.edu/people/chaffee/winntutil.html
see if Microsoft has a "kernel toys" for 98. _mayyybe_ the 95 one will still work.
btw, ask dkindred for a zarchive password.
- 5 Feb 1999
does anyone know how to map ctr key in emacs to caps lock? i have to do it in emacs proper, because i am logging in remote and the xwindows interface wont let the caps lock behave like ctr (it gets 'stuck' in the latched position the way caps lock should)
See emacs section above, although really it can't be done in emacs itself.
How do you burn a CD here?
see hardware section above
quick expression for "number of low-order zero bits"?
count_bits((x&-x)-1)
"looks good. gimme the simplest possible count_bits. speed irrelevant."
i=0;
while(x) {x>>=1; i++;}
return i;
or alternatively
i=0;
for(tmp=x; tmp; tmp&=tmp-1,i++) ;
"hmm, i wonder if the binding of comma is right in the above"
- 12 Apr 1998
How can I tee into 2 processes instead of a file and a process? I want the output of process A to flow to both B and C.
See perl section above.
I'm having trouble accessing stuff in this Andrew directory. I checked with "fs la" that I have [read, write, whatever] permissions there as "me@cs.cmu.edu", and I am still authenticated from a recent kinit, but it is nonetheless treating me like Joe Anyuser.
Try "cklog andrew.cmu.edu" to get the necessary cross-realm AFS tokens. Or try klog.
also, you won't get the "a" in "rwdlika". That's administrate.
- 28 Apr 1998
(gmake, make) Here's my metagoal. I have a list of targets FOO and I want to have the same rule:
foo: foo.o same_stuff
	command foo.o -o foo
      
for each foo in FOO. Is there some obvious way to do this that I am missing?
Use that $< and $@ stuff.
FOO=target1 target2 target3

$(FOO):%:%.o same_stuff
	command $< -o $@
      
You may ask "what does $(FOO): mean?" The answer is, apply this pattern rule only to things in $(FOO).
- 4 May 1998
I want to write a makefile to allow me to build multi-target-platform binary trees from within the same source tree. I've done this in gmake before with a minor amount of pain. Is it worth smoking the requisite amount of crack to figure out how to use imake?
Consensus is: stay far away from imake. Learn autoconf and automake, "it's EASY."
autoconf is the thing that writes configure scripts. See the info pages in xemacs (or "capsule summary" in 7/20/98 zephyr logs.)
- 20 Jul 1998
does ftp still send passwords in the clear? what should I use instead? scp? is there kerberized ftp?
YES, ftp sends passwords in the clear. You could use scp - "scp is inherently not interactive". There is no kerberized ftp.
What you probably want to do is "use kerberized telnet, open up any .anonr or .anonw directories you need, use anonymous ftp, close those directories." For more about anon ftp, see this How-To doc.
- 20 Jul 1998
iMac telnet: "The Facilities pages are a bit confusing on this ... What is the preferred method of kerberized telneting in over a dialup from an iMac? (Or other Mac.) There are NCSA, Nifty, and "better"? telnet available from the appleshare area. (For the record, the built in PPP seems to work well with SCS.)"
"you want niftytelnet. you also want to ignore the facilities help pages as much as possible, since they're hideously out of date."
"NiftyTelnet works well for me, using the v1.09a Authentication Manager to provide the kerberos support."
"Actually NCSA telnet should work just fine; nifty telnet is the current andrew solution. If you find a page in the facilities help tree that is out of date, you should e-mail help+doc, as it is being actively maintained."
"Oh, one other detail: There are several ways to get your Mac to think that the local time is right. At least one of these ways will screw up Kerberos authentication. (I'll have to look at home tonight to find out what the "right" one is.)"
- 26 Apr 1999
How can I make a cron job run with kerberos tickets? How do I get AFS tickets for my cron jobs?
(this is not a very coherent answer at present, just some archive clippings...)
/afs/cs/user/dlc/junk/stuff_ticket/src/newest_ticket.c can be used for cron jobs, at jobs, etc. If you have some valid Kerberos ticket file, then you can use it to do this in a cron script
KRBTKFILE=`$HOME/bin/newest_ticket afs` ; export KRBTKFILE
/usr/local/bin/aklog
This will get your most recent AFS ticket (token) in the kernel. Another creative use would be say you want to run some command on foo.bar.cs.cmu.edu. Then just do
KRBTKFILE=`$HOME/bin/newest_ticket rcmd foo.bar.cs.cmu.edu` ; export KRBTKFILE
rsh foo.bar.cs.cmu.edu some command and args

- (answer from 23-Jun-1995)
if you don't mind stuffing (the equivalent of) your password on the local disk, you can use ksrvutil to create such a file and ksrvtgt to get tickets from it. You might want to get a new kerberos instance (or principal) created for this purpose.
If you run kauthd or have some other means of always keeping a fresh ticket, you can use a program somebody has z'd about in the past called "stuff_ticket" or something, which finds a recent ticket file in /tkt and uses it.
- (answer from 7-Oct-1997)
The basic problem here is that kerberos and AFS generally assume that a user's password (an authenticator that never expires) shouldn't be stored in the filesystem, for obvious security reasons.
If you're willing to trust such an authenticator in the filesystem, you can create a "srvtab" file corresponding to your afs id, and get tickets for your cron/at jobs with a couple of simple commands.
There's been some recent work on AFS-authenticated .maildelivery processing that provides a general solution to this problem. It compromises by storing a never-expiring authenticator for a special AFS identity (rather than your primary one) in the filesystem.
- (answer from 21-Jan-1998)
- 16 Sep 1998
Perl is great but I actually want to use Java instead.
see above.
I've been wondering where the "mv bring pain. PAIN. Use cp and rm instead" mumblings in the back of my brain came from.
It only matters on cross-volume moves. Here's the story:
AFS has different semantics than any other Unix filesystem. If you are writing to a file, the write()s will all suceeed, even if you have gone way over quota. On close() AFS will do a quota check with the server, and if the file doesn't fit then close() will fail, and AFS will erase the file.
The bug: the "mv" command doesn't check the return code on close() before erasing the source file.
- 7 Nov 2000

Last modified: Tue Sep 3 11:37:02 EDT 2002 Thanks to all those who have submitted questions and answers.
sprite@cs.cmu.edu