FAQ
Guidelines
on using CASE computer
Users
responsability and roles
Setting up CASE computers
A. Getting an account
theis{serre} 21: set a=1
theis{serre} 22: while ($a<10)
? echo $a.hpp > $a.hpp
? @ a += 1
? end
theis{serre} 23: ls
1.hpp 2.hpp 3.hpp 4.hpp 5.hpp 6.hpp 7.hpp 8.hpp 9.hpp
theis{serre} 24: more 1.hpp
1.hpp
Back to: A. File management and editing
How to rename each x.hpp file to x.h:
theis{serre} 25: foreach x (*.hpp)
? mv $x $x:r.h
?end
theis{serre} 26: ls
1.h 2.h 3.h 4.h 5.h 6.h 7.h 8.h 9.h
Back to: A. File management and editing
How to copy each x.h file to x.H and replace each instance
of a "hpp" string with a "h" string:
theis{serre} 27: foreach x (*.h)
? cat $x | sed -e 's/hpp/H/g' > $x:r.H
? end
theis{serre} 28: ls
1.H 2.H 3.H 4.H 5.H 6.H 7.H 8.H 9.H
1.h 2.h 3.h 4.h 5.h 6.h 7.h 8.h 9.h
theis{serre} 29: more 1.H
1.H
Back to: A. File management and editing
How to grab each instances of the string "hpp" in all
the *.h files?
How to find all the *.o files in all your directories ?theis{serre} 30: grep hpp *.h 1.h:1.hpp 2.h:2.hpp 3.h:3.hpp 4.h:4.hpp 5.h:5.hpp 6.h:6.hpp 7.h:7.hpp 8.h:8.hpp 9.h:9.hpp
Back to: A. File management and editing
theis{serre} 31: find ~/. -name '*.o'
/users/serre/./crap/marc.o
How to delete all *.o files from all your directories?
theis{serre} 32: rm `find ~ -name '*.o'`
Back to: A. File management and editing
makefile example 2 (from COMP121: Introduction to Data Structure)What's another make file (Example 3):
makefile example 3 (from COMP121: Introduction to Data Structure)What's another make file (Example 4, might not work):
makefile example 4 (from COMP121: Introduction to Data Structure)
Back to: B. Make files
How to clock different part of a program:% hpm myprogram < mydata.dat > & outfile.out
Use the clock() function in time.h. Here is a C++ example:
#include <time.h> #include <iostream.h>
main()
{
int i,ni;
clock_t t1,t2,t3;
double tdiff1,tdiff2;
ni=3456;
cout << "calculating loop one: "<<endl;
t1 = clock();
for (i=0; i<ni; i++) {
cout << (int)(100*i/(ni)) << "\%\r" << flush;
//your calculation
}
t2 = clock();
tdiff1 = double ( t2 - t1 ) / CLOCKS_PER_SEC ;
cout << tdiff1 << " sec " << endl;
ni=4567;
cout << "calculating loop two: " << endl;
for (i=0; i<ni; i++) {
cout << (int)(100*i/(ni)) << "\%\r" << flush;
//your calculation
}
t3 = clock();
tdiff2 = double( t3 - t2 ) / CLOCKS_PER_SEC ;
cout << tdiff2 << " sec " << endl;
}
To compile the above program, assuming that the above text is in a file called clockExample.C, just type:theis{serre} 59: CC -o clockEx clockExample.CThe output of the above example would look like that:theis{serre} 60: clockEx calculating loop one: 0.17 sec calculating loop two: 0.27 secFor more advance techniques, check this web page by Phil Calvin about the Chronograph class, which does timing routine.
Back to: C. Evaluating program performance
How do I untar the tar file dir_name.tar in some target directory? Answer:theis{serre} 10: ls -F dir_name/theis{serre} 11: tar -cvf dir_name.tar dir_nametheis{serre} 12: ls -F dir_name/ dir_name.tarBack to: D. Automated tar-ing and zip-ing of files.
How do I tar and zip the directory dir_name and all its contents into the compressed tar file dir_name.tar.gz? Answer:theis{serre} 20: ls -F dir_name.tartheis{serre} 21: tar -xvf dir_name.tartheis{serre} 22: ls -F dir_name/ dir_name.tarBack to: D. Automated tar-ing and zip-ing of files.
How do I untar and unzip the compressed tar file dir_name.tar.gz in some target directory without wihtout erasing dir_name.tar.gz? Answer:theis{serre} 10: ls -F dir_name/theis{serre} 11: tar -cvf - dir_name | gzip - > dir_name.tar.gztheis{serre} 12: ls -F dir_name/ dir_name.tar.gzBack to: D. Automated tar-ing and zip-ing of files.
How do I copy a directory and all its contents without changing the dates or the ownership? Answer:theis{serre} 20: ls -F dir_name.tar.gztheis{serre} 21: gunzip -c dir_name.tar.gz | tar -xvf -theis{serre} 22: ls -F dir_name/ dir_name.tar.gzBack to: D. Automated tar-ing and zip-ing of files.
geek{edhill} 29: tar -cvf - dir_name | ( cd some_other_dir ; tar -xvf - )
Back to: D. Automated tar-ing and zip-ing of files.
How to I tar and zip a bunch of subdirectories and
send them to the magneto-optical disk without using temporary storage?
Answer:
boffin{edhill} 29: foreach x (*)
? if (-d $x) tar -cvf - $x | (cd /mo/edhill2; gzip - > $x"_070396.tar.gz")
? end
Back to: D. Automated tar-ing and zip-ing of files.
Display the "cool" picture on the screen. Then start the program xview, which is installed in Stockes, to grab the picture, and save it in the format .gif or .jpg. From Theis, you would have to type:
theis{serre} 40: xhost +152.2.152.21
theis{serre} 41: telnet stokes
[type your user name and password, and press Enter]
stokes{serre} 41:setenv DISPLAY 152.2.152.19:0.0
[correct for your workstation]
stokes{serre} 42:/usr/bin/X11/xv
Back to: E. Pictures
What's the most simple way of plotting an x-y curve?
Use xgraph!What's a simple CAD program that lets me draw lines, circles and put text?The data to plot must be in a data file with x y rows. Two different curve must be separated with a blank line. Legend for each curve must start with a ". Here is an example:
theis{serre} 43: cat - >data.xg "line 1 0 1 2 3 "line2 0 1.5 2 2.5 [Ctrl D to get out of cat and create the data.xg file] theis{serre} 44: /usr/local/bin/xgraph data.xgBack to: E. Pictures
Use tgif![Mac] I want to insert a Matlab plot into a Word document. What do I do?tgif lets you draw line, polylines, circles, add text and color, and saves files in all kind of file formats, including .gif, .html, .latex, .eps, and many others! To start tgif, just type:
theis{serre} 45: /usr/local/bin/X11/tgifBack to: E. Pictures
Follow these simple steps:
1) Within Matlab, create a .eps file of your plot. The easiest way to do this is to issue a command like>> print('-deps','filename.eps')for the current plot. Type "help print" if interested in more options.2) Tranfer the file from the AFS system to your Mac using some file transfer program.
CAUTION: If you use the "Fetch" software set *explicitly* the transfer mode to "Text" or Word will not be able to convert the .eps file properly.3) Go to the Word 5.1 document where you wish to insert the plot. From the menu bar choose: "Insert"-"File" or "Insert"-"Picture" and pick your .eps file. For Word 98 choose instead: "Insert"-"Picture"-"From File".
4) When inserted, your figure may be exceeding the Word page limits. If this is the case, or if you just want to rescale the inserted figure, hold down the "Shift" button on your Mac while clicking on the figure frame and scale it as desired.
Back to: E. Pictures
theis{serre} 50: lp filename.txt
[a2ps] How do I print a text file and save paper?
theis{serre} 51: a2ps -l -2 filename.txt
[lp]How do I print a postcript file (extension .ps)?
theis{serre} 52: lp filename.ps
Back to: F. Printing Files
[ghostview] How do I view a postcript file?
theis{serre} 53: ghostview filename.ps
[dvips] How do I print a dvi file (extension .dvi)?
theis{serre} 54: dvips filename
[xdvi] How do I view a dvi file?
Use xdvi!
theis{serre} 55: xdvi filename.dvi
Back to: F. Printing Files
How do I print to the HP LaserJet 4?
As per email from Ed Hill on 18 Nov 1996:How do I print n pages of postcript per pages?A new 600dpi printer has been added to our network and the print quality is very nice. You can access it using : HPs : print ......... lp -dHP_4_PS FILE check queue ... lpstat kill job ...... cancel JOB_NAME SGIs : print ......... lp -dHP_4_PS FILE where "FILE" is the name of a file and "JOB_NAME" is provided as a list by the "lpstat" command. As always, make sure to send postscript files that have a ".ps" extension our you will probably print out a hundred or so pages of noise.Back to: F. Printing Files
Use psnup!How do I print to the HP DeskJet1200C color inkjet printer?As per email from Ed Hill on 20 Feb 1997:
The executable is located in "/usr/local/dbin/bin" and the man pages are located in "/usr/local/dbin/man" so you may want to make sure that these entries are included in your environment path and manpath variables, respectively. To turn "annrev96.ps" into a four-pages-per-page "annrev96_4.ps", use
psnup -n 4 annrev96.ps > annrev96_4.psalso, you can filter whatever postscript files you want to send to the printer usingpsnup -n 2 annrev96.ps | lpIf you want to run psnup on pamlico, you may choose between the version in "/usr/local/dbin" or a newer version in the "/opt" directory heirachy. If you have any questions or problems, see me or Phil. Enjoy! EdBack to: F. Printing Files
lp -dHP_DJ1200C file.ps
on any of the HP machines. *PLEASE* make sure that you include the ".ps" extension on the postscript files that you send, our you will likely print out >50 pages of junk (raw postscript commands).
In addition, its now possible (with a little help from ftp & telnet) to print color files such as those produced by PowerPoint from any PC or Mac without getting up out of your seat. To do this:
1) print the PowerPoint or other document to a postscript file with the name "file.ps",
2) use ftp to copy "file.ps" to your account on any HP machine,
3) then telnet to the HP machine and print it using "lp -dHP_DJ1200C file.ps".
Please keep in mind that there is a restriction on file size that can be printed due to the limited (2Meg?) RAM on the printer. I understand that Lee will be buying more RAM, so this limit may soon disappear.
If you need any help, see Lee Ballard or see me. Ed Hill, 3/12/97
Back to: F. Printing Files
Here's the process for making a new set of gwaternum.bib and gwatername.bib files (As per email from Phil Calvinl) :1. On the PC (the P-120) in Room 105, do the following: Open the gwater.dat database in Procite. It should open up automatically as teh default when you start Procite. Choose View-Sort-by-Authors to get it in alphabetical order. Select all records and then "Mark" them. "Mark" refers to the box on the far left side, and marked records have 'X' in the box. Then select the top 50 or so records that have empty author fields and "Unmark" them. These won't work in bibtex, so they need to be excluded.
2. Choose "Print bibliography" to "word processor file". When the dialog boxes come up for options, check the following details:
-under "Reference," make sure the box to number references is blank. We don't want to number the references.
-under "Fields," choose yes to "show record numbers" and make sure nothing else is checked.
-under "Page," no page numbering Save the file in the "database" directory as a text-only file named "gwater.bib"
4. FTP "gwater.bib" as an ASCII file to /usr/local/TeX/lib/tex/bib on geek.
5. Telnet onto geek (or go log in on it) and do the following:
a) cd /usr/local/TeX/lib/tex/bibb) make sure you have a copy of the bibtool resource file in your home directory. You can get one by copying it from the current directory, changing the name (from bibtoolrsc to .bibtoolrsc) in the process by doing the followingcp ./bibtoolrsc ~/.bibtoolrscc) Execute the following commands:mv gwaternum.bib gwaternum.old mv gwatername.bib gwatername.old rm *.old.gz gzip *.old cp gwater.bib gwaternum.bib bibtool -F gwaternum.bib -o gwatername.bibThe last command takes a couple minutes to execute, and when working correctly, should give you response of about 20 lines, telling you how many of each type of entry were processed. For example:--- STRING 0 read 0 written --- PREAMBLE 0 read 0 written --- COMMENT 0 read 0 written --- Article 9219 read 9219 written --- Book 394 read 394 written --- Booklet 0 read 0 written --- Conference 0 read 0 written --- InBook 0 read 0 written --- InCollection 337 read 337 written --- InProceedings 1502 read 1502 written --- Manual 0 read 0 written --- MastersThesis 10 read 10 written --- Misc 3 read 3 written --- PhDThesis 44 read 44 written --- Proceedings 0 read 0 written --- TechReport 207 read 207 written --- Unpublished 7 read 7 writtenIf you get anything except for this result (warnings or errors), please make a note of it, and tell Phil or Lara.You should now have the two databases (gwatername.bib and gwaternum.bib) which are about 4.5 megabytes in size, and the older versions gzipped down to about 0.8-1.0 megabyte in size. If they are not there or are the wrong size, something went wrong! Call Lara, Phil, Clint, or someone to help you. If everything went well, you can now delete gwater.bib (the file you transferred from the PC): rm gwater.bib
6. If you were sucessful with the above steps, make sure Casey has the updated versions by ftp'ing the files (gwaternum.bib and gwatername.bib) to pavo.sph.unc.edu, putting them in the /bibliography/bibtex/ directory.
Back to: G. Tex Stuff
(( nice +10 processName < input.file > output.log ) >& error.log ) &
1. If you are not Superuser ask somebody for assistance who is.
2. Login in as root.
3. Open a terminal.
4. Try to access your AFS space at the ATN using your user account:
/usr/afsws/bin/klog usernameIf you get a message that the clocks are not synchronized proceed, otherwise try something else.
5. Type:
rdate -s clock1.unc.edu
setclock6. Redo item 4. This should work now.
7. Finish session and login to Linux box using your user account.
Maybe your disc quota is exceeded. In order to fix that do the following:
1. Telnet to one of the ATN machines from any accessible machine by typing:
telnet isis.unc.edu2. Enter your user name and your pass word.
3. Get a unix prompt if you end up in the isis menu.
4. Type
fs quota5. If you obtain the message
disc quota exceedremove files in your home directory until you do not get this message. We reinstalled Linux and my headphones do not work. What to do ?