CECS 5100

Survey of Educational Computer Languages

Fall 2003

Need a free MP3 Player to listen to these clips ?

Audio Segments and Illustrations #3
  • Introduction
    Audio (704k 1:30)

  • Tools: WinSCP and Putty
    Audio (928k 1:59)
    1. PuttySSH (http://www.chiark.greenend.org.uk/~sgtatham/putty)
    2. WinSCP (http://winscp.vse.cz/eng)
    3. Mac OSX Users try: Fugu and your terminal program using the ssh command (enter 'man ssh' for details).

  • Accessing Host Server
    1. saturn.cecs.unt.edu
    2. Account is your last name.
    3. password was set by you in class. If you lose your password, send me an e-mail and I can reset it.

    4. http://saturn.cecs.unt.edu/~gjones/index.html is how to access my index page under the directory public_html in my unix account. Replace my account name 'gjones' with your account name to get access to your html files.
      Audio (272k 0:35)

    5. To access cgi scripts that are stored in your cgi directory, use the following URL

  • Unix commands
    1. ls Audio (1.1M 2:32)
      [gjones@saturn gjones]$ ls
      cgi public_html test.html test.pl
    2. ls -lag
      [gjones@saturn gjones]$ ls -lag
      total 48
      drwxr-x--x  4 gjones  gjones  4096 Sep 26 08:55 .
      drwxr-xr-x 30 root    root    4096 Sep 26 08:11 ..
      -rw-------  1 gjones  gjones   953 Sep 27 05:48 .bash_history
      -rw-r--r--  1 gjones  gjones    24 Sep 23 05:28 .bash_logout
      -rw-r--r--  1 gjones  gjones   191 Sep 23 05:28 .bash_profile
      -rw-r--r--  1 gjones  gjones   124 Sep 23 05:28 .bashrc
      lrwxrwxrwx  1 root    root      23 Sep 26 04:39 cgi -> cgi-bin/gjones
      -rw-r--r--  1 gjones  gjones   854 Sep 23 05:28 .emacs
      -rw-r--r--  1 gjones  gjones   118 Sep 23 05:28 .gtkrc
      drwxr-xr-x  3 gjones  gjones  4096 Sep 23 05:28 .kde
      drwxr-xr-x  2 gjones  root    4096 Sep 26 04:16 public_html
      -rw-r--r--  1 root    root      44 Sep 23 06:09 test.html
      -rwxr-xr-x  1 gjones  root      54 Sep 26 09:00 test.pl
    3. cd Audio (504k 1:04)
      [gjones@saturn gjones]$ cd public_html
      [gjones@saturn public_html]$ cd ..
      [gjones@saturn gjones]$
    4. chmod Audio (444k 0:57)
      chmod a+rx test.pl
    5. man Audio (204k 0:26)
      man chmod

  • Creating an index.html home page and uploading it
    Audio (1.5M 3:25)

    1. Create the following HTML using NoteTab
        <h1>Hello World</h1>
    2. Using WinSCP copy the file into your public_html file
        Click on the image to enlarge.
    3. Be sure to set the permissions such that everyone can read the file (chmod a+r index.html or right click on the uploaded file in winSCP and set the premissions to all read).
    4. Using the information above, access your browser and enter the URL to access your page.

  • Creating a .pl PERL program
    Audio (1.6M 3:32)

    1. The following program was called test.pl and stored in your home directory in your satrun.cecs.unt.edu account.
        print "Hello World!\n";
    2. Using PuTTY you entered the following command 'chmod a+rx test.pl' to allow the program to be run.
    3. Making sure you are in your home directory (enter 'cd' if not sure and view the prompt -- see above) enter './test.pl' to execute your example (shown below).

  • Methods for creating PERL programs (NoteTab and PICO)
    Audio (1M 2:15)
  • Three important things to remember
    Audio (808k 1:43)

  • Creating a .cgi PERL program that outputs HTML
    Audio (1.4M 3:14)

    1. Use Notetab to create the following program called test.cgi.
      The "Content-type: text/html\n\n"; tells the system that you are about to receive an HTML file and it then knows how to handle it.
        # there must be a blank line between the #! 
        # and the rest of the program
        print "Content-type: text/html\n\n";
        print "<html><body>";
        print "<h1>Hello World!</h1>\n";
        print "</body></html>";
    2. Use winSCP to copy test.cgi into your cgi directory in your satrun.cecs.unt.edu account.
    3. Using PuTTY change the premission of test.cgi for execution using the command 'chmod a+rx test.cgi'.
    4. Using your browser, I entered 'http://saturn.cecs.unt.edu/cgi-bin/gjones/test.cgi' to call up my example (shown below).

  • Discussion on Debugging CGI programs
    Audio (484k 1:02)
    1. When accessing a CGI by the browser and it gives you an Internal Error or other error, then access the system via PuTTY and run the .cgi program using the command
      If there are any errors in the perl program, running it from the terminal will display the lines and type of the error(s).

    Copyright 2003, Dr. James G Jones