Using the Dell Workstation Lab, room 206

William A. Barrett, SJSU

Last revised 1/26/07

NOTICE

 

DO NOT TRY TO USE ANY NETWORK CABLE WITH YOUR LAPTOP.

PLEASE DO NOT DISCONNECT ANY NETWORK CABLE FOR THAT PURPOSE.

 

ALL the network connections in the lab room have been keyed to their particular workstation’s machine number.

·        Consider using a wireless connection with your laptop instead.

·        The new Martin Luther King library is supposed to have a large number of 10base-T internet connectors wired to the university’s internet service.

PLEASE

·        DO report a non-functioning workstation to the lab instructor.

·        DO bring a mousepad with you.  The mice tend to slip on the black lab surfaces.

·        DO report any theft or vandalism promptly to the campus police.  A phone is in the room, and there are campus police phones in the hall.

·        DON'T power down the stations or the monitor.  The monitor goes into a sleep mode automatically after several minutes, reducing power to a minimum. 

·        DON'T move the boxes or monitors around.

·        DON'T disconnect the network, mouse, keyboard, etc.

·        DON'T let the mouse or keyboard fall on the floor.

·        DON'T bang on the keyboards.  Most of these are special and expensive to replace or repair.

·        DON'T bring soft drinks or food into the lab.  These have a way of spilling and leaving sticky goo on the keyboards, tables and mice.

·        DON'T try to repair a non-working station.  Instead, let the lab instructor know about it.

Links to this Document

Lab Configuration

Logging In

Getting Started

Your Account

Unix Tutorials

man Pages in a Console Window

IOstream Documentation

Door Codes

Lab Use at Night and During Weekends

Secure Shell and Secure FTP

Multiple Sessions

Transferring Files To/From Floppies or USB Drives

Converting File Formats

File Transfer Through the Network

Student Complaints

Lab Configuration

This lab is equipped with Debian Linux workstations, running on a Dell PC platform.

The workstations each have a fast CPU, large RAM and other facilities, including a port for a USB flash drive.  These are named ce1, ce2, ce3, etc., starting with the front leftmost station (facing the front of the room), then across toward the right.  The second row is named ce6, ce7, etc. through ce22.

These are NOT PCs, so don't expect to find any Microsoft tools on them.

Logging In

The platform box green light should be lit.  If not, try switching it on with the large power button.  You may have to wait awhile for it to boot up.

Tap the control key.  The LCD monitors should come alive if the station is operating.

The monitor should display a login panel, announcing the station name, for example, ce5.

If you do nothing on the station for about 30 minutes, the screen will be locked.  Enter your password to reopen your screen.  The screen may have been locked by someone else; in that case, ask the instructor to unlock it or choose another platform.

PLEASE EXIT from your environment when you are finished for the day as a courtesy to the next user.

Getting Started

 

Most lab work requires using a console, which is a special terminal window that accepts typed-out shell commands.  These provide the most powerful access to the Unix operating system facilities and tools.  Learning at least a few Unix shell commands will help you become a skilled programmer.  Most professional software developers know all the common Unix shell commands, plus one or two editors, as well as several programming languages.  You will find yourself competing with them if you are hired into a software development group.

Your Account

Your student directories and most of the software tools you'll need are located on a remote server.  You should be able to log into any of the lab stations with the same login name and password to access your directory.

Any files you develop during the semester are kept in your account on the server.  Provided you don't reveal your password to anyone else, they should be safe from alteration by others.

We recommend that you do not change your password.

Unix Tutorials

Try this web sites for an interactive Unix tutorial, i.e. getting started. 

 

http://www.ee.surrey.ac.uk/Teaching/Unix/

 

If it doesn’t work, try the keyword unix and tutorial in the search panel of http://www.google.com, and you'll get a list of additional Unix resources.

 

man Pages in a Console Window

The “man” pages in the console are always provided, whether any special window options are provided.  You may have to use this form from your home computer.

·        Open a console window if you don’t have one available.

·        You need to know a Unix command, system file name or C function to use man effectively.  There’s no “search” feature for keywords

·        The pages are organized in sections.  Usually you can just type this to get information about scanf:

man scanf

·        Some commands are also C function keywords, so you may have to specify the section number, like this: 

man –s 3C scanf

·        Type this for more information about using man:

man man

IOstream Documentation

The C++ iostream (istream, ifstream, ostream, ofstream, ios, etc.) functions are poorly documented in the man pages for g++. 

 

Most students have taken cmpe46 and 126.  Those textbooks have some material on using the iostream classes. 

Be especially wary of using cin for any but the simplest forms of line-oriented input.  It essentially scans input text looking for something that matches the type of the next input object.

Under Unix, cin requires a line feed at the end of something before anything is scanned.  No line feed, no input!

cin skips blanks, tabs and line feeds before it examines anything else.

If the object is a string, it picks up the next character sequence terminated by a space, tab or line feed.  It will not read any blanks in the sequence -- these are skipped. 

If the object is type int, float, or double, it will look for the next sequence that matches one of these.  The scanning rules are not particularly clear from the documentation.

You should avoid using cin for anything but the getline function.  Read a full line with getline (terminated by a line feed) into a string or char array, then write a parser for the objects you need.  This will be more work, but is safe.

One student discovered that by opening a text file containing no line returns, cin.eof() reported TRUE immediately, without reading any characters at all!  This doesn't surprise me, given the poorly specified functionality of this class.  My guess is that it reads the first "line" upon opening, into a buffer.  Since no line return was found, the whole file was pulled into the buffer, setting the EOF flag.  (This is apparently a cin “feature”).

Single-character input in Unix can be done, but is difficult.  cin is inappropriate for that; it needs a linefeed entered before any characters are seen by the program.

You will discover that the character reading function cin.get(ch) works under Unix, but it still requires that line feed before it starts picking any of the characters in the line.

 

Door Codes

If you've been issued a door code to this lab, you have accepted a certain responsibility toward maintaining the lab.  In particular:

·        DON'T prop either door open, except during regular lab periods. 

·        DO remove any door props if you feel comfortable about doing this.

·        DON'T let someone else in the lab, especially late at night or on weekends.  If someone is authorized to use the lab, they should have a door code.  This is especially important for your personal safety as well as helping avoid theft of the computer equipment.

·        MAKE SURE THE DOORS are CLOSED and LOCKED when you leave the lab, even if someone else is still working in it.

·        JOT DOWN the date and time you entered and left the lab in your notebook if you used the lab at times other than regular lab periods.  If there should be a police investigation of some sort later, this can be used as evidence that you were not responsible for the incident.

·        IF YOU NOTICE unwarranted activities going on in the lab, take a good look at the persons responsible, leave the lab promptly and report it to the campus police.  There are police call boxes on every floor, one near room 485

·        If there's a MEDICAL EMERGENCY, call the campus police on the call box next to room 485.

Door Code Form

If you need a door code, here's the form accepted by the CmpE office.  Print and cut it along the borders, please.  Leave the "Code #" blank; the office staff will assign you a code.  Your instructor can authorize the form.

 

 


ACCESS CODE TO CISE LAB

 

Date Assigned:  _____/_____/_____      Room:  ___________     Code #:  _____________

 

Name:  ______________________________________        SSN: ___________________

 

Address:  ________________________________________________________________

 

Home Phone:  _________________________   Work Phone:  ______________________

 

Authorized by:  ________________________________________________

 

I understand that the usage of the above facility is strictly for school activity.  I am aware that this code is assigned only to me and will remain confidential.  Furthermore, I will be responsible for equipment in the area my code has been used for entry.

 

                                                       Student Signature:  ________________________________

 

 

 


Lab Use at Night and During Weekends

A separate pass is required to authorize you (as a student) to be in the lab late at night or on weekends.  Your instructor may or may not authorize a weekend pass.  This pass is issued through the Dean's office.  Since you can log into these platforms through the network, there's usually no good reason to be in the lab at unusual times, but that decision rests with your course instructor.

Secure Shell and Secure FTP

You should be able to log in remotely from a PC running Windows 95/98/NT or Linux.  You need an internet connection or an internet provider.  The university does not provide direct modem dialups to its systems, except through special request to the Washington Square computer center.

Note that the Linux lab systems may not be accessible from an off-campus system, for security reasons -- that access is likely blocked by a college or university firewall, and cannot easily be removed.

You need secure shell installed on your PC.  Go to this web site to acquire a (free) copy of secure shell:

 http://shark.engr.sjsu.edu/ssh/. 

This installation also includes a secure file transfer program.  Secure shell comes with the latest versions of Linux, and should be ready to use.

For those of you with a PC, modem and an internet provider, for example aol.com, make sure that you are connected to your internet provider.  Then click on the SSH icon that should have been created from the ssh installation.  You'll be asked for the URL of the host machine, which should be something like ce15.engr.sjsu.edu (choose one of the platforms in the lab room), your login name and password.  A new command console window will then pop up.

From a Linux or other Unix platform, open a command console, read the man page for ssh, then start it appropriately.  Usually just ssh at the command console will do the trick.  To login as c152t12 to the system ce5.engr.sjsu.edu, enter this at a shell prompt:

 

ssh c152t12@ce5.engr.sjsu.edu

 

Your login name and password will be provided by the account administrator.  For example, for CmpE 152, the login name might look something like this:

c152t12

and your password will be an 8-digit code.  Be sure you enter all the characters with the correct upper/lower case.  The password isn't echoed to the screen, so be careful about entering it.

If successful, you'll get some text announcing your login, like this:

Last login: Fri Feb  2 16:03:55 from x130-65-176-112.

Sun Microsystems Inc.   SunOS 5.7       Generic October 1998

ce1%   

 

You should now be ready to use one of the text editors, enter commands, etc.  You are in a so-called C shell (csh), which recognizes a large number of Unix commands.

ssh provides a compatible shell window that behaves like the console window obtained when at a workstation.

If you are willing to purchase an X terminal emulator for your PC environment, you should be able to obtain the same IDE windows environment on your PC that you normally use when in the lab.

Multiple Sessions

You'll discover that you can open additional ssh windows. ssh is operating as a parallel task on your PC.  You can have as many as you like.  However, they are all sharing the same modem connection, so some performance degradation may occur.

Transferring Files To/From Floppies or USB Drives

Debian Linux makes file transfers rather easy.

Just use the windows access and a drag-and-drop to transfer files to or from one of these external drives.

Be sure to select the MSDOS file format if you need to use your files on a Windows platform.  This won’t guarantee that text files are suitably converted (see next paragraph), but it will make it possible for you to access these files with Windows later on.

Converting File Formats

DOS and Unix text files are different.  A DOS text file has a CR-LF (carriage-return, line-feed) pair of characters at the end of each line, while a Unix text file has only a LF (line-feed).  Copying a DOS file to Unix as a binary file will not make the necessary conversion, and some Unix programs will have difficulties with that extra CR character. 

At the very least, that CR may show up in your vi editor as ^M (control-M).

You can convert a DOS text file to a Unix file with the utility tounix, like this:

tounix  file or list of files

This also makes sure that the file is a text file rather than a binary file before converting it.

For example, this will convert all the files in the current directory, should they need it.  If a file is already in Unix form or is a binary file, it does nothing:

tounix  *

You can change a file back to DOS form with

todos   file or list of files

A Unix text file brought up into most Windows editors will appear as one long first line.  You will usually find it difficult or impossible to fix this in the editor -- run todos instead through a Windows command prompt to fix the problem.  The vim freeware editor is happy with either format, but some compilers and other utilities may not appreciate that absent CR.

By using ftp correctly, these conversions will be made for you during the transfer--read on.

File Transfer Through the Network

You are MUCH better off using secure ftp to transfer files to a PC, then copy them to/from your disk using the usual PC copy commands.   (This also works through a modem, but will be slower).

Secure ftp comes with the secure shell installation.  On a PC, you should find an icon labelled SSH Secure File Transfer.  When you open it, and log in as before, you'll see a directory display much like those under Windows.  You can drag-and-drop files from a Windows file menu into the sftp window.

Under Linux or other Unix platforms, read the man page for sftp.  The file transfers are done through commands once you are logged in.  The command to use for a text file is ASC; sftp will then convert the file appropriately in either direction.   Use BIN for binary files.

Note that ftp is also subject to the firewall restrictions, which may prevent logging into the Unix platform.

Student Complaints

·        A student may complain about "losing all his files".  This usually means he/she can't login to his/her home directory.  Ask the instructor for a cure.  Usually rebooting the station will fix it, or moving to another station.  The problem is usually losing some of the NFS mounts from disconnecting the network cable or a network problem.

·        Another cause of "losing all files" is accidentally setting the home directory permissions to read-only or something worse.  This can only be fixed by server root, since that's where the directories are.  There is no good "field" fix for this, but fortunately it rarely happens.

·        A student may complain that g++ doesn't work.  This suggests a defective mount of one of the /usr directories.  Check for their presence in running df –k.  You should see /usr/local/bin, /usr/include, and /usr/lib at least.

·        If Netscape won't come up, or fails to link to anything, that will most likely be a mount failure or possibly a campus network failure.  (The campus network does sometimes take a holiday, and it's usually hard to decide that's what's wrong).