Assignment 1 - Introduction to Computer for Engineering | 440 127, Assignments of Engineering

Material Type: Assignment; Class: 440 - INT COMPUTER FOR ENG; Subject: GENERAL ENGINEERING; University: Rutgers University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-se8
koofers-user-se8 🇺🇸

5

(1)

10 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Highlights
How to create an account
How to create a program
The EMACS editor
Electronic mail
A UNIX Primer
Introduction to Computers for Engineers
14:440-127
Assignment One
Purpose of this document For those students choosing to use the Fortran 90 compiler on Eden
[Sunsoft Fortran 90] this document contains an exercise that will
familiarize you with the basic functions of Eden. The exercise will take
you through the operating system (unix), the editor (emacs), the Fortran
compiler (f90), and basic electronic mail commands. It is highly
recommended that you try this exercise several times until the
commands become second nature to you. No attempt is made to make
this a complete outline. Instead, what is presented is the barest outline of
what you will need. This will be supplemented as the semester
progresses.
Terminal access There are numerous terminals (called X-terms) that are available
for your use. These are located in the Allison Road Classroom Building
as well as at other locations on other campuses.
These terminals are dedicated, meaning that they all use software called
X-Windows as unix workstations. Some computers run Windows 95 and
a program called EXCEED can be used to access the Eden computer in
an X-terminal emulation mode.
If you have a modem (optional), you may also use your personal
computer to access Eden by using the dialup connections. Refer to the
RUCS help station to obtain information on how to do this and to get a
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Assignment 1 - Introduction to Computer for Engineering | 440 127 and more Assignments Engineering in PDF only on Docsity!

Highlights

 How to create an account

 How to create a program

 The EMACS editor

 Electronic mail

 A UNIX Primer

Introduction to Computers for Engineers 14:440-

Assignment One

Purpose of this document For those students choosing to use the Fortran 90 compiler on Eden [Sunsoft Fortran 90] this document contains an exercise that will familiarize you with the basic functions of Eden. The exercise will take you through the operating system (unix), the editor (emacs), the Fortran compiler (f90), and basic electronic mail commands. It is highly recommended that you try this exercise several times until the commands become second nature to you. No attempt is made to make this a complete outline. Instead, what is presented is the barest outline of what you will need. This will be supplemented as the semester progresses. Terminal access There are numerous terminals (called X-terms) that are available for your use. These are located in the Allison Road Classroom Building as well as at other locations on other campuses. These terminals are dedicated , meaning that they all use software called X-Windows as unix workstations. Some computers run Windows 95 and a program called EXCEED can be used to access the Eden computer in an X-terminal emulation mode. If you have a modem (optional), you may also use your personal computer to access Eden by using the dialup connections. Refer to the RUCS help station to obtain information on how to do this and to get a

list of the most current dialup numbers. All dialups operate with 1 stop bit/full duplex/8 data bits/ no parity. Wake up call When you get to the Allison Road Classroom terminal room, the power should be on, but the screen may be blank. You will first have to wake up the terminal by pressing a key or moving the mouse. The system will respond by displaying a menu similar to that below. If the system still does not work, you will have to reset it by typing the commands a followed by rs. That is, press the L1 key while pressing the letter "a". Then type the letters "rs" followed by a carriage return . Note that you do this ONLY if you need to reset the terminal. When the terminal is awake, you will see the following screen: Move the pointer controlled by the mouse to computer name "eden" in the middle of the screen. Then double click (touch very rapidly twice) the left hand button on the mouse and the following login screen appears:

must wait before continuing. When your account is available, reenter the computer through the login screens shown on pages 2 and 3. This time however, you will be using your own account name and secret password rather than the "makeacct" user identification. Killing the menus When you log in, the eden computer will show you a menu. such as that below: Rutgers Main Menu Commands..... Commands Purpose Help Help with the commands on this menu infoservices Access Online library catalogs & Info mail Send & read electronic mail (e-mail) news Post and read newsgroup articles file File manipulation tools, includes editors userinfo User information commands communications RUNet & Internet access and transfer tools Software tools Quit quits menus Rutgers Main Menu> Unfortunately, this menu system is very limited and will not allow you to do the things you need to do. So we are going to kill the menu system. Please note that the procedure done here only needs to be done once , and you will never have to bother with it again. To kill the menus, type in the command "userinfo" at the bottom of the menu. A second menu will appear. Then type in the command "revert" at the bottom of this menu. The machine will respond "Press return to continue:". Do that and then log out. To logout, move the cursor outside the window you are working in. Hold down the left mouse button and a short menu will appear. Move to the last item ("Exit X-windows session" ) in that menu and release the mouse button. This will close your account and log you out. You may then proceed with the rest of the exercise that follows. Once again, the things that we did in these last two sections are one-time operations and never have to be repeated.

Subsequent logons Since your account has been created in the previous section, there is no need to repeat the process. Instead, you will simply type in your username and password when the login screen appears. After you log in, a new screen will appear: When you see this screen, move the cursor to the box that says "Click here to continue" and click the left mouse button once. This will then complete the login procedure. A new screen will then appear:

Two screens appear, one is the working screen where you will do most of your work. The other screen shows the time. Notice that each screen has four icons (symbols) that allow you to control the screen. The circle icon (upper left corner) closes the screen. The box icon in the upper right corner causes the screen to enlarge to occupy the screen, or if pressed a second time, shrink back to the smaller size. The arrow icon causes the screen to extend only in the vertical direction and the "elbow" shaped icon allows you to stretch the window to any desired size. Try clicking on each of the icons to familiarize yourself with their functions. When this screen appears, move the cursor to the working screen after the system identification (such as er4:/eden/u15/peng> in the above example) and click the left mouse button once. This will place you into that window and prepare you to enter your commands. Getting help There are a number of documents that are available at or near your computer that will be useful to you. Look for the literature distribution center near your terminals. Among the many documents that you should take a copy of are: Dialup Access to RU Computing Services Facilities A Sample makeacct Session Choosing a Secure Password You Can Remember An Introduction to the UNIX Operating System Gnu EMACS Short Form INFO: Rutgers Campus-wide Information System Introduction to mm Electronic Mail at Rutgers Reading Netnews with nn There are many others, but these are the essential ones to have. In addition to the printed documents, there are a number of items available on the system for you to take a look at. You do this with the "man" command, where you type the command followed by the command that you want help with. As an example, if you want information about how to print something, type the command man printers. The mail facility From your new Eden account you can send e-mail to others at Rutgers using any of a variety of mail managers. The Eden system may still support old managers such as mm, but you probably will want to use newer mail software such as Pine or Netscape mail. Netscape mail is my favorite and is very easy to use. Log onto your Eden account, type Netscape at the Eden prompt, and click on the mail icon in the lower right hand corner of the Netscape screen. The

first time you use this, you will have to set up your Netscape mail account, but after that it is very easy. er4%> netscape With any of these mail facilities, you can send electronic messages to people within Rutgers, provided that they have a computer account. All you need to know is their electronic address such as "rllehman@eden", which is my (Prof. Lehman) account. The first part of this address (rllehman) is the username while the second part of the address (eden) is the name of the computer where the account is located. Before you try this part of the exercise, ask your neighbor to give you their e-mail address (not the password!). Then enter the Netscape mail facility and send a message. Netscape is quite user friendly and you should be able to figure out the mail features by exploring the system. If you become confused, ask a fellow student, or the consultant on duty at the computer lab, or ask your TA. The emacs editor The editor is used to create and/or modify your programs. In essence, it is a wordprocessor. Once the program is entered and stored, it is then passed to a compiler and a linker before it can be run. These topics will be covered extensively in class. Right now, we will experiment with the process of editing-compiling-linking-running a program. The program given below has several errors built into it. You do not need to know Fortran to understand what is happening. The important points here are

  • use of the editor to create programs
  • use of the compiler to locate errors and convert programs
  • use of the editor to modify programs Start the editor by typing the command: er3> emacs dummy.f The er3> is supplied by the computer and indicates which of the eden computers you are on (er1 to er 6), so you do not need to type this part of the command. The statement "emacs" indicates you want to start the editor and that you want to work on the file whose name follows. In this case, "dummy" is the name of this little file and it is going to be stored as a Fortran file indicated by the ".f90" extension. A window will now be created at the top of your screen. Move the cursor to the top left corner of the working space within this window

the last part of the command is the name of the file ("dummy.f90") that is to be converted. Note that if we wanted to compile another program with name "joe.f", the command would be: er2> f90 -o joe joe.f Returning to the compilation of the program named "dummy", if there were no errors in the program, the computer would allow you to continue. But of course, there are several errors, which the computer will list along with appropriate diagnostic messages: line 3: Error: Syntax error at or near symbol * Compilation failed. Thus, the computer located an error at line 3 of the program and could not successfully compile the program. It is now your job to go back into the editor and correct them. Don't worry about the fact that you don't understand the error message or the errors themselves. We will spend the next several weeks talking about these. Instead, focus on the process of edit, compile-interpret error messages, re-edit. We have deliberately introduced four errors into the program to give you some practice in using the editor and the compiler. To correct the program, the following changes must be made:

  1. a line was left out between the 2nd and 3rd lines which should read s = 1.
  2. the math statement in the third line should be "x3" instead of "x*3"
  3. the third line should have the number 6 within the first 5 columns 6 sum = sum + (1.0/x*3)s
  4. a line with an "end" statement was left out. Thus, we need an extra line at the end of the program. In Fortran 90 we can use an end statement which identifies the program, such as "end program practice". To make these changes, we must go back into the editor mode and modify the program. Begin by restarting the editor er5> emacs dummy.f The program is now listed as originally stored. In order to make the necessary changes, you must learn to control the cursor. Try the following commands:

opens up a new line p moves the cursor to the previous line n moves the cursor to the next line a moves the cursor to the beginning of the line e moves the cursor to the end of the line k kills the current line y Oops command - undoes an error f moves cursor forward one word b moves cursor back one word You should practice all the above commands and commit them to memory since you will need them frequently. Also, try the arrow keys on your keyboard, since they can sometimes be used in place of the and function keys. The first error to be corrected is line 3. It should read s = 1.0. So move the cursor to the beginning of line 3 and press to open a new line. Then use p to move to the opened line and type s = 1. Remember, all Fortran lines begin with a tab stop (shown as ). The second error to correct is the original line 3 (now line 4). Two corrections must be made. First, the number 6 should appear within columns 1 to 5, and the "" should be replaced by "". It is easier to just kill the whole line and replace it rather than to play around with the other commands. So advance the cursor to the line and type k to kill it. Then type in the new line: 6sum = sum + (1.0/x3)s The final change to make is to add a line at the end of the program. Move the cursor to the end of the program and type: end program practice Note that even the last line of the program must end with a . You have now made all the necessary changes. So leave the editor (x c). Now you are ready to see if the changes have eliminated the errors previously found by the compiler. Do this by recompiling the program er6> f90 -o dummy dummy.f If any error messages appear, you will have to go back and correct them using the techniques just shown to you. Ask your TA for help if this happens. If there are no messages, your program has compiled correctly

Logout When you are finished, be sure to log out. If you don't, the account is still open, even if you turn off the terminal, which can lead to disastrous results. To logout, move the cursor to an area outside of any of the screens. When you do this, the shape of the cursor will change from an arrow to an X. When you see the X, hold down the left mouse button and you will see a menu appear. Drag the cursor down to the last item in the list, which is "Exit X-windows Session". When the box containing this command is highlighted, release the mouse button and the machine will log you out. Note also that this list contains many other commands including the emacs editor. This is a shortcut to execute many of the most common commands.

End of Document