Week 2 Questions

Fortran

Will we be able to do other math operations in the future?

Strictly speaking add, subtract, multiply, divide, and exponentiate are about it for math operations. You will however, learn more intrinsic math functions, including some to do operations in linear algebra.

I would like to know how similar Fortran is to the PASCAL language.

I haven't looked at Pascal seriously in 10 to 15 years, so can't comment in detail. However, if you were proficient in PASCAL, and think in terms of the structure of what you did, not the syntax details, you should adapt quickly to Fortran.

I've already learned Pascal and loved it, but my teacher told me Pascal is kind of looked down upon and not used. Why?

As you can see from the above question, I'm not the guy to answer that directly. However, I will pass on a comment by a heavy duty programmer who I respect. He said Pascal is a language designed to prevent inexperienced programmers from doing things that can get them into trouble. I guess the idea is that it is overly constraining for highly experienced and creative programmers. (This is not always a bad thing) There is probably one other reason that Pascal has fallen from favor. The language called ADA (named after Ada Lovelace, and widely used by the Department of Defense) is a more powerful follow-on to Pascal, and is popular with many former Pascal programmers.

What is the major difference between Fortran and C?

Fortran was written for the express purpose of performing scientific and engineering calculations. C was originally written as a language for building computer operating systems and utilities. As a result C is more versatile at handling complex data structures (the gap is not as large with Fortran 90 as with older Fortran versions), and C has more powerful intrinsic functions for processing input/output, and character strings.

Why not use C instead of Fortran?

For new programs, generally, you can use either. The best reason to use Fortran on a new program is for scientific applications with data represented by multidimensional arrays (later in the semester), or when you are doing calculations with complex numbers. Fortran has a clear advantage in these areas. Why not give up on Fortran totally and always use C? Two reasons. The quantity of very useful scientific programming applications written in Fortran is huge. They aren't going away soon, and the cost of converting them to C is astronomical. The second reason is that there are a lot of us old but still vaguely productive programmers who will continue to tinker in the language.

How do you know the difference between Fortran 77 and 90?

Anything in Fortran 77 is contained in Fortran 90. You are always writing Fortran 90. I call out features that are specific to 90 (not in 77), because you may be stuck working somewhere with an older compiler.

I have a question on columns 2-5. What are labels, and why do we need them?

I was afraid someone would ask that question. You should get a clear idea of their use during several lectures over the next 2 weeks.

Unix

I still have a question about how to back-up your work when you are using vi via a telnet.

See some of the FTP questions for backup to floppies. Best Unix backup is to copy your file to one with another name before using vi:

cp hw4.f hw4.f.back

While in vi you should type ":w" from time to time to save your most recent changes to the disk.

I am still really confused about the structure of the directories. Is it like DOS? It seems like you can't have one directory or file with the same name even if they are in different subdirectories.

Yes it is very much like DOS. Within a given directory, you can't have two files, or a file and a subdirectory with the same name. However, files can exist with the same name in different subdirectories. If this keeps bothering you, set up an appointment to do a directory and file tour in my office.

By the way, is the Unix system used widely in Meteorology?

The workhorse computer for large weather programs is a Cray, which operates on a version of Unix called Unicos. Unix Workstations are also heavily used.

To access a file, you just type the file name at the prompt, right?

You do that to execute the file if it contains machine instructions or a Unix shell script (like .cshrc). To open a text file and enter or change a Fortran program you must type "vi" followed by a space followed by the file name.

I'm still not totally sure how to use a Unix Workstation or how to work with it.

The best thing you can do in this situation is to make an appointment with Willie or me to sit down in front of one and work through the details that trouble you.

To save a file into my account do I just go up to the file menu and click on "save"?

I assume that you are talking about files that you are viewing in Netscape. This works. However, remember that it saves the file on whatever computer is running Netscape. If you are sitting at a Hammond Workstation, the file lands on your Unix account disk space. If you are sitting at a PC, the file lands on the PC's disk (using the file name selection menu can route the file to the PC's floppy).

Now that I know how to save Fortran files to disk. How would I save other files to disk, or will I have plenty of room in the account for all the files?

You should have plenty of room. However, you save other files about the same way. Just learn to distinguish between text files and binary files (mainly executable files like "a.out"), and select the appropriate transfer mode in FTP.

Is it more useful to use Autoindent when you have a program that has a lot of comments

I tend not to. However, one trick I use is to type the basic program in autoindent mode, then insert the comments with vi not in autoindent mode.

When on a remote connection what do you do while in vi command mode to correct a mistake?

Backspace only works in insert mode, so you have to use the "x" command to delete characters under the cursor. If you are having trouble with Backspace while in insert mode, get out of vi and type the command "stty erase" followed by a space, then hit the Backspace key, and then hit the Return (Enter) key.

General Computing

How do I save a file onto a disk from the Hammond Lab computer.

First remember that your Hammond lab files are relatively secure on a CAC hard disk until the end of the semester. Best way to save files to a floppy is to sit down at a PC or Mac in the room next door and use FTP. See me for a live demo or two of this process, if you can't follow the menus after clicking on the FTP icon.

When using Unix stations in 316 Hammond, to exit properly, all you need to do is click on the background and quit?

Basically. You point to the background, hold down the right mouse button, and drag down to select the quit (exit?) item from the menu that has appeared. You will be asked to confirm this decision before it actually lets you off.

Is my work saved when I log off of the Hammond workstations?

Yes.

How does one run one of the programs that checks for errors in a Fortran program?

Check my lecture on dbx.

How does FTP work?

Take a look at last year's questions for a description of a terminal session with FTP. Also look at the Cornell Unix Tutorial (connect from the 201 Homepage). It has a tutorial on FTP.

My question, since we haven't really started anything yet, is do we need to get a special disk for the computers we will be using in the Hammond labs or can the disk I use in Macintosh work in the computer science labs as well?

The floppy drives on the Hammond Workstations take DOS formatted floppies, not Mac formatted ones. However, last time I tried, they didn't work properly anyway. Best bet is to sit down at a real Mac, and use FTP to pull files from the Hammond machine hard disk to the Mac floppy. You could do the same thing on a regular PC, if you want to save files on a DOS formatted disk.

Could you explain why telnet works when one of the Internet accessories is minimized and it doesn't when Eudora or Netscape are not accessed?

My best guess is that your telnet is not bright enough to properly fire up the program to manage the TCP/IP communications protocol, but can use it when it's there. One other student was having Window's 95 problems, but these related to Netscape. This student's telnet (the one in the standard CACTWIN) worked fine, but Netscape didn't. The problem there was that the 32 bit Window's 95 Netscape was not compatible with the 16 bit TCP/IP manager used by CACTWIN. The solution was to bring in the normal

Windows (16 bit) version of Netscape. If this continues to drive you nuts, I know the guy who put together CACTWIN, and can probably get some serious help.

How fast is the modem that the school uses when you call in from the phone?

CAC can handle 2400-28800 baud automatically.

How do your get mail while in a telnet session.

The Hammond machines were not setup to do a serious job of taking care of mail. They are configured to run a program called "pine". Type "pine" at the prompt, and follow instructions to work with mail or get help. Your best bet is to shrink the window by clicking one of the buttons in the upper right of the window. Then find and click on the Eudora program to do your mail work.

Can I do the stuff I've seen in class from the PowerMacs?

Yes, as long as you can find a Telnet program. See below.

Can I do all of the homework from a different computer lab as long as I log into the Hammond machines?

Yes. Look below.

I still don't quite understand how to logon to a Workstation computer in Hammond from someplace like Ridefer Computer Lab.

I don't know what equipment is in that lab. On Macs, look for a folder called "Apps". In that folder look for a program called "BYU/NCSA Telnet". Double click on the icon, and when the menu bar changes, click on the first bar item (File or Connect, I can't remember), then find the item to connect to a machine. Type in something like: "h26.ptph.psu.edu".

On IBM PC's click the Internet Access group, and double click the Telnet icon. When it asks for a host type: "h26.ptph.psu.edu".

How can you flip back and forth from telnet and Netscape?

Whatever one you are in click the button in the upper right of the window to switch it to an icon. Then double click the icon for the other.

Sometimes when I was in Unix a comment would come up saying "The System Call Will Be Restarted". What does this mean?

I don't know, the operating system is probably doing something to correct a problem. I've sent a message to the local systems guru to get more information. Watch this space for updates.

Class Procedures

On the homework assignment, do we get arith.f and arithp.f out of the text, or computer, and if we need the computer, how do we retrieve that file?

When in Netscape you can view these files just by clicking the highlighted words. You can then bring them to your computer by choosing the "Save as" item from the File menu. If you are logged into the Hammond computers in person or via telnet you should copy the files from my directory. For example to get arith.f type the command:

cp ~jhm/201/arith.f .

.