Part 1.
Linux comes with an email application called simply mail. Your quiz answers were emailed to your class account. To read your email answers, save them to a file, and print them out, carefully do the following:[111a-t2@beowulf ~/Q1]$ mail Mail version 8.1 6/6/93. Type ? for help. "/var/spool/mail/111a-t2": 1 message 1 new >N 1 apache@maven.smith.e Wed Sep 20 12:37 28/821 "quiz1 Judy Franklin" &The ampersand (&) is the mail program's prompt. Type
& t1and you will see the email. So save it to a file, say quiz1 type
$ s1 quiz1and you will see this:
"quiz1" [New file] &To exit, type
& quitand you will return to the beowulf prompt. How can you view your file now?
Part 2. Installing jes and jython
JES stands for Jython Environment for Students. JES comes with an extensive multimedia API, enabling easy and rapid manipulations of sounds, images, and on some platforms, video. JES was originally designed and implemented by Jason Ergle, Claire Bailey, David Raines, and Joshua Sklare. The second version was implemented by Larry Olson, Toby Ho, Ellie Harmon, Keith McDermott, and Adam Wilson. Jython is a version of the python interpreter that was written in Java. In other words, programmers wrote a program in the Java programming language that runs as a python interpreter. Plain python is generally written in another high-level language called C++.case Linux: # add Linux (PC unix) specific options hereRight after those two lines, cut and paste the following three Linux commands:
set classpath=( $CLASSBIN /usr/java/jdk1.5.0_06/bin ) setenv PATH /usr/java/jdk1.5.0_07/bin:$PATHThe set classpath tells where to look for java library classes. The setenv PATH tells where to look to run the desired version of Java.
Please make sure to work together as partners. After you have installed jes on one partner's account, install it on the other, following the directions above. Do this before moving on to the next part.
- Scroll about halfway down to the heading Source Distribution
- Download: JES-Source.zip
- Back in your terminal window type [111a-XX@localhost ~/Desktop]$ cd Desktop and type [111a-XX@localhost ~/Desktop]$ unzip *.zip
- Now change to the directory JES and list the files [111a-XX@localhost ~/Desktop]$ cd JES [111a-XX@localhost ~/Desktop/JES]$ ls Notice the file jes in the JES folder.
- Open jes with emacs and place a # sign just before the first appearance of the string: "./Sources/JESProgram.py" and save the file. The # makes the rest of the line a comment, just like it does in python. Make sure there is a space before the # sign that you insert.
- You, the user, need to be able to execute (run) the file, so after you exit emacs, type [111a-XX@localhost ~/Desktop/JES]$ chmod u+x jes
- To run jes, in Jython, type just type [111a-XX@localhost ~/Desktop/JES]$ jes You must always be in Desktop/JES to run jes.
- At the jython prompt type >>> print "Hello"
- To exit, type ctrl-d. Sometimes this must be followed by ctrl-c.
[111a@localhost ~]$ cd Desktop/JES [111a@localhost JES]$ jes Jython 2.1 on java1.5.0_07 (JIT: null) Type "copyright", "credits" or "license" for more information. >>>In other words, cd to the right directory and just type jes. and you are running Jython with jes's media library available to you!
>>>from media import *then type
>>> myfile = pickAFile()A chooser box shows up. Choose a jpg file. There are some in the images directory. Then type
>>>mypic = makePicture(myfile)
>>>print mypicand then
>>>show(mypic)
getcopy yodalaff.wavThen restart jes/jython by typing jes and when you call pickAFile, look for the file "yodalaff.wav"
>>> myfile = pickAFile() >>> mysound = makeSound(myfile) >>> play(mysound) >>>
>>> from time import sleep >>> sleep(2) >>> for i in range(10): ... play(mysound) ... sleep(1) ...