|New Mexico Supercomputing Challenge|
Mode TutorialTopics: ssh, Unix, Programming, Web Pages, Email,
Unix Commands: cat, CC, cd, .forward, java, javac, logout, ls, passwd, pico, pine
As long as you have an active internet connection, you may connect to the Mode machine via an ssh application on your computer. You will be prompted for your AiS Challenge username and password.
Connect to Mode using the ssh application on your PC. From the "start" menu in the lower left-hand corner of the screen, select run. Type in "ssh mode.lanl.k12.nm.us" (without the quotes) and click on OK.
You will then be prompted for your username and password. Be aware that your password will not display to the screen as you are typing it in!
Unlike a PC or Mac, Mode does not run a Graphical User Interface (GUI). Mode runs Unix - an operating system which is typically text-based. In order to develop programs, create web pages, and access email, you will need to learn a host of text-based Unix commands and utilities.
Upon connecting to Mode, you are positioned within your home directory (folder). Type the "ls" command at the prompt to see what files and directories you have.
Notice that you have (at least) the following items:
To quickly view the contents of files, you may use the "cat" command.
View the contents of Add.java using the "cat" command. Keep in mind that Unix is case-sensitive!
At this time, you may now change the cryptic password you were supplied with at registration. The "passwd" command will allow you to do this. Be aware that your old/new passwords will not display to the screen as you are typing them in!
If you use the passwd utility, make sure you remember your new password!
Programming utilities are available for the Java, C, C++, and Fortran languages. Others, such as Perl and Python, are also available.
You will not learn how to write a computer program from this tutorial you must learn that on your own. You will, however, learn about the process of editing, compiling, and executing (running) computer programs on the Mode machine.
To create a new file, or to edit an existing file (e.g. files which contain Java or C++ programs), you may use the "pico" utility.
The Java program, Add.java, adds two numbers and displays the results. This program, however, is incomplete you will add in the missing code to make it work!
Use pico to edit the Java program named "Add.java". Compare the file that you have to the complete program shown below. Make whatever changes are necessary so that they look exactly the same keep in mind that Java is a case-sensitive language!
When you are finished, compile the file (i.e. turn the source code into an executable program which can be used) by using the "javac" command:
If you made all of the correct edits, the above command (javac Add.java) will have created a new file named "Add.class". This is the program we can actually execute (run). If you get error messages, it will not create this executable file you must then re-edit the file and try to compile it again.
You now can execute the program by using the "java" command.
Execute the program by issuing the command "java Add NUM1 NUM2" where NUM1 and NUM2 are the actual numbers to be summed up.
Create a C++ Program from scratch! Issue the command "pico add.c" to create the source file for a program named add.c. This program will also add two numbers and display the results to the screen. The code you should enter into the file is shown below:
When you are finished, compile the file (i.e. turn the source code into an executable program which can be used) by using the "CC" command:
If you typed in the program correctly, the above command (CC -o add add.c) will have created a new file named "add". This is the program we can actually execute (run). If you get error messages, it will not create this executable file you must then re-edit the file and try to compile it again.
You now can execute the program by issuing the command "add NUM1 NUM2" where NUM1 and NUM2 are the actual numbers to be summed up.
Mode is also a web server. You may make AiS Challenge related web pages available to the public by placing them in your 'public_html' directory (folder). Use the "ls" command to see that you do indeed have this item.
To move into your public_html directory, use the "cd" command.
Move into your public_html directory, and issue an "ls" command to view the contents. Items in this directory can be viewed over the web with a browser!
View the contents of the file named "index.html" with the cat command. This file is a web page written in HTML. Now, view it over the web by pointing your web browser to:
http://mode.lanl.k12.nm.us/~ch099abc/where ch099abc is replaced with your login name.
Feel free to edit this file using pico. When you save changes to this file (or any web page), you may not see the changes take place immediately on the web until you press the "reload" or "refresh" button on your web browser.
NOTE: "index.html" is a very unique file. To view ANY other web page which resides in this folder, you must point your web browser to:
http://mode.lanl.k12.nm.us/~ch099abc/NAME_OF_FILE.htmlwhere NAME_OF_FILE.html is replaced with the actual file name.
You may test this out by looking at the other file you have in your public_html directory! Point your web browser to:
http://mode.lanl.k12.nm.us/~ch099abc/abstract.htmlwhere ch099abc is replaced with your login name. Note that this "abstract" file is just there for you to practice with. It is not a file that you have to edit and submit to us.
Finally, go back to your home directory by issuing a "cd" command. Simply type cd at the prompt and hit enter.
Every AiS Challenge participant receives an email account for the year. You may access this account via a text-based tool, or by a graphical web-based tool.
NOTE: AiS Challenge email addresses are in the form of "firstname.lastname@example.org", where ch099abc is replaced with your login name.
From the ssh interface, you may read and compose messages by using the "pine" email utility.
Using pine, send mail to your team members to establish a time this week to discuss what you hope to learn at Glorieta. Simply type pine and press enter to begin.
NOTE: If you provided an email address when you registered, we have (or will in the future) put the address into a file in your home directory named .forward
To create/edit this file on your own, enter "pico .forward". Type in your primary email address, like Joeemail@example.com, and save the file (^O ^X). Test it by sending mail to your mode account (i.e. firstname.lastname@example.org) and see if that mail shows up at your other account. If not, re-edit your .forward file and try again.
NOTE: Files that begin with a period (like .forward) will not appear when you issue an ordinary "ls" command! They are hidden files ...
A web-based mail utility is also available for you to use. Simply point a web browser to:
Congratulations! You have finished this tutorial. You may now leave the Mode machine by using the "logout" command.
For questions about the Supercomputing Challenge, a 501(c)3 organization, contact us at: consult @ challenge.nm.org
New Mexico Supercomputing Challenge, Inc.
Post Office Box 30102
Albuquerque, New Mexico 87190
Supercomputing Challenge Board of Directors
Board page listing meetings and agendas
If you have volunteered for the Challenge, please fill out our In Kind form.