A student asked me what version of the JDK to download from java.sun.com? I would recommend the JDK 1.4 (they call it the J2SE 1.4). I'm using the beta version (1.4.1), but there's no great need to do that yet. ------------------------------------------------------- From leavens@cs.iastate.edu Sat Aug 31 10:44:36 2002 Date: Sat, 31 Aug 2002 10:39:53 -0500 (CDT) From: Gary T. Leavens To: David Pinkston Cc: Gary Leavens Subject: Re: [362] homework 1 - it won't compile!!! David, On Fri, 30 Aug 2002, David Pinkston wrote: > I followed your instructions to the letter, and your files won't compile! I > have no idea what any of this means! > > > popeye:~/cs362/hw1/expressions> tcsh > popeye:~/cs362/hw1/expressions> setenv CLASSPATH ".:/opt/junit/junit.jar" > popeye:~/cs362/hw1/expressions> java ExprTest > Exception in thread "main" java.lang.InternalError: Can't connect to X11 window > server using ':0.0' as the value of the DISPLAY variable. > at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) > at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:1 > 26) Actually, this is not a compilation error, as you're not running the compiler at all, but just the interpreter (java). If you are running java from another department Linux machine, or from a home computer running Linux, or from a home computer running something with the X windows system on it, then the problem is that you need to set and export the shell's DISPLAY variable properly to reflect the screen where you are viewing output. For example, suppose that you have connected to popeye from the machine "titus.cs.iastate.edu" in our department. Then (in tcsh) you should first do: setenv DISPLAY titus.cs.iastate.edu:0 before runing java. If you were on a different machine other than "titus" then you would use that machine's name instead of "titus" above. The same would apply if you were working from a home Linux machine, or a home computer with an X window system driver on it (which is possible). (See the manual page for ssh (run "man ssh") and also see http://support.cs.iastate.edu/faqs.php3?op=unix#10 for an answer to a similar question.) If however, you aren't using the X window system at home (which is the likely case if you are running MS Windows), then you should just download and install Java (from java.sun.com) onto your home computer, and download our files, and run them from home. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------------------------- From chronos@iastate.edu Tue Sep 3 22:36:12 2002 Date: Tue, 3 Sep 2002 19:12:28 -0500 (CDT) From: David Pinkston To: leavens@cs.iastate.edu Subject: [COMS 362] Question I have a question about Java concerning questions 3c and 3d. I can't figure out how to place the buttons; the add("South", quitButton) method only allows one button to be in the south region, so I can't add slowButton. Then I tried something like this: quitButton = new Button ("Quit"); quitButton.setBounds(20, 20, 20, 20); but the button wouldn't show up! How do I place buttons in the window? ----------------------------------------------------------- From tongjie@cs.iastate.edu Tue Sep 3 22:36:46 2002 Date: Tue, 3 Sep 2002 22:19:16 -0500 (CDT) From: tongjie chen To: chronos@iastate.edu Cc: Gary T. Leavens Subject: about your question of 3c and 3d You can place a Panel(say "Button Panel") in the south of the frame. and then put the two buttons ("Quit" and "Slo_mo") to the panel. that probably would solve your problem. ButtonPanel.add(Quit); ButtonPanel.add(Slo_mo); good luck --tongjie ---------------------------------------------------------- From leavens@cs.iastate.edu Thu Sep 5 18:45:26 2002 Date: Thu, 5 Sep 2002 18:44:12 -0500 (CDT) From: Gary T. Leavens To: Evan M Hennis Cc: leavens@iastate.edu Subject: Re: CS 362 Evan, On Thu, 5 Sep 2002, Evan M Hennis wrote: > I tried sending you an email earlier today with my hotmail account and I > am not sure if you got it or not. it's probably in my "rejected" folder... sorry about that... > I was in your office hours this > afternoon and I had a problem compiling and you said that it was because > windows is case sensitive That's certainly was what was causing the error that you showed me. But there might be another one... > so I tried to change that and I am still > getting an error. The error is: "Exception in thread "main" > java.lang.NoSuchMethodError: main". This is because there's no method "public static void main(String[] args)" in the class "BadStack". That makes it not been "application", which is what this area is complaining about. > I also tried to compile the > BadStackTest and I got a lot of errors. The first error on that one said > that the pachage junit.framework does not exist. You have to download and install the JUnit release first, and make sure that's in your CLASSPATH environment variable. That is what this error is complaining about. Actually, you don't need to recompile things if you download the .class files, but it's a good exercise in trying to get things set up on your machine. Note that problem 2 is not due until Monday. We'll talk about it some in class tomorrow. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------------------- From leavens@cs.iastate.edu Fri Sep 6 18:18:38 2002 Date: Fri, 6 Sep 2002 18:17:38 -0500 (CDT) From: Gary T. Leavens To: Evan M Hennis Cc: leavens@iastate.edu Subject: Re: JUnit On Fri, 6 Sep 2002, Evan M Hennis wrote: > I am still having trouble with this JUnit thing. I went to JUnit.org and > I got Junit 3.8.1. I am not sure what goes where. I tried putting the > whole folder in my PATH directory and that didn't work. Then I tried > putting the whole thing where my source code is. Neither of them worked. > Hopefully you can help me out with this. I'm sorry are having trouble. You can always use the version of JUnit installed on the department Linux machines, if necessary. My install of JUnit goes like this. I unzipped JUnit's the file into the directory c:\cygwin\usr\local, so there is a directory named c:\cygwin\usr\local\junit3.8.1 at the top. I rename this directory into c:\cygwin\usr\local\junit, because I don't want to readjust things when new versions of JUnit come out. Then I make sure that c:\cygwin\usr\local\junit\junit.jar is in my CLASSPATH environment variable. You probably would just unzip junit into c:, but also use the directory names when you do that. Then I would rename the directory from c:\junit3.8.1 into c:\junit. Then, make sure the c:\junit\junit.jar is in your CLASSPATH. That should be all that there is to it. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------------------------------------------- From leavens@cs.iastate.edu Mon Sep 9 14:57:40 2002 Date: Mon, 9 Sep 2002 14:50:16 -0500 (CDT) From: Gary T. Leavens To: Com S 362 students and staff -- Brian Wicks , Chintaka Ranasinghe , com_s_362@cs.iastate.edu, Elizabeth Weis , Guy M Howard , Jason Hill , Michael Rivera , Sze-Yiing Tan , Tongjie Chen , Tong Siang Chua Cc: Gary Leavens Subject: Com S 362 homework one problem 2 postponed until Friday Hi, I really wanted to get to more of the example of the statements in class today before the homework was due, so I'm postponing problem 2 of homework one in Com S 362. This problem and the others in homework to will not be due on Friday. HOMEWORK 1: OOP IN JAVA (File $Date: 2002/09/09 19:44:46 $) Due: problem 1, Sept. 6, 2002 (in class at 11AM), problem 2, Sept. 13, 2002 (in class at 11AM), problems 3-4, Sept. 13, 2002 (in class at 11AM). Sorry for any confusion this may call us, but I think this will be best for the class work and your understanding of the material. By the way, if possible, I suggest you do problem 4 using the Swing API instead of directly using the AWT. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ----------------------------------------------------------------- From leavens@cs.iastate.edu Mon Sep 9 16:35:35 2002 Date: Mon, 9 Sep 2002 16:19:49 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Cc: Tongjie Chen , Gary Leavens Subject: Re: Eclipse Question Eric, On Mon, 9 Sep 2002 Erfi80@aol.com wrote: > I was wondering if you could send me an email simply explaining how to run > compiled java programs in Eclipse, but using a command line. I've been > tinkering around with it some and would like to be able to pass in some > values for "String [] args" that we are always seeing in the method main...? Yes, that is possible. To do this, make sure you've opened up the Java perspective, from the window menu, select open perspective... then you click on the Run > Run... menu icon, you get a box that says "launch configurations", and on the left panel of this box, under "Launch Configurations:", select Java application, and then clicking on the "New" at the bottom of that box.then what you need to do is to access the second tab, but one labeled "(x)= Arguments", and fill in the "program arguments" box. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------------------------- From leavens@cs.iastate.edu Mon Sep 9 16:41:33 2002 Date: Mon, 9 Sep 2002 16:40:46 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Cc: Gary Leavens , Tongjie Chen Subject: Re: one more java question Eric, On Mon, 9 Sep 2002 Erfi80@aol.com wrote: > I was also wondering if you could point me to a good Q&A place for java > questions. Right now I just have been searching the index on java.sun.com, > where you click a letter of the alphabet and it sends you to all classes and > methods that start with that letter, but I'm getting a little frustrated > trying to dig THRU all that material to find which class it is I really want. I think the FAQ document referenced from our course web page resources.shtml (http://www.afu.com/javafaq.html) is a good place to start. Also, you can just send us an e-mail... > For instance, I was writing a small program similar to the one you did in > class last week, where you are reading from a file. I went to the website to > find a better "File" class that would easily let me enter text, ints, spaces, > formatting, whatever into a file, and likewise let me read it. I've run into > FileReader, FileInputStream, FileOutputStream, and several more, but I once > did this in java and I could have sworn there was a class out there that > would let me send a .txt file Strings, or possibly read a whole line of a > file and get it back out as a string (so I can tokenize it, and piece it > apart, that's what I really want to do). I think perhaps you're thinking of the StringTokenizer class. That's a standard part of the Java software development kit. For more fancy stuff, you might want to use a parser generator, something like JavaCC, or ANTLR. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------------- From leavens@cs.iastate.edu Mon Sep 9 16:46:21 2002 Date: Mon, 9 Sep 2002 14:50:16 -0500 (CDT) From: Gary T. Leavens To: Com S 362 students and staff -- Brian Wicks , Chintaka Ranasinghe , com_s_362@cs.iastate.edu, Elizabeth Weis , Guy M Howard , Jason Hill , Michael Rivera , Sze-Yiing Tan , Tongjie Chen , Tong Siang Chua Cc: Gary Leavens Subject: Com S 362 homework one problem 2 postponed until Friday Hi, I really wanted to get to more of the example of the statements in class today before the homework was due, so I'm postponing problem 2 of homework one in Com S 362. This problem and the others in homework to will not be due on Friday. HOMEWORK 1: OOP IN JAVA (File $Date: 2002/09/09 19:44:46 $) Due: problem 1, Sept. 6, 2002 (in class at 11AM), problem 2, Sept. 13, 2002 (in class at 11AM), problems 3-4, Sept. 13, 2002 (in class at 11AM). Sorry for any confusion this may call us, but I think this will be best for the class work and your understanding of the material. By the way, if possible, I suggest you do problem 4 using the Swing API instead of directly using the AWT. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ----------------------------------------------------------------- From leavens@cs.iastate.edu Mon Sep 9 17:17:22 2002 Date: Mon, 9 Sep 2002 17:10:33 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Cc: Com S 362 students and staff -- Brian Wicks , Chintaka Ranasinghe , com_s_362@cs.iastate.edu, Elizabeth Weis , Guy M Howard , Jason Hill , Michael Rivera , Satish Kumar Vemula , Sze-Yiing Tan , Tongjie Chen , Tong Siang Chua , Gary Leavens Subject: Re: CS 362, correction to ExprSum and ExprTest for HW1, problem 2 Eric, On Mon, 9 Sep 2002 Erfi80@aol.com wrote: > Also was wondering, on your assignment 1, problem #2, did you intend to give > ExprSum class the method called "testValue()", or did you intend to call it > "isLessThan()"...reason I ask is b/c you have several other classes > inheriting from each other, and overwriting methods called "isLessThan()" but > never "testValue() even though they seem to be intended to do the same thing? > My question is not how to resolve the assignment, I see what you are trying > to show us but did you intend to call that method "testValue()" or > "isLessThan()"? Yes, you're absolutely right. I had intended to change all of these names to isLessThan. I've made that correction to the homework files now; please update your copies of ExprSum and ExprTest. Sorry about that. (It's hard writing bad software. :-) -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 -------------------------------------------------------------------- From leavens@larch.cs.iastate.edu Mon Sep 9 19:05:31 2002 Date: Mon, 9 Sep 2002 19:03:45 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Subject: Re: CS 362 Question Eric, On Mon, 9 Sep 2002 Erfi80@aol.com wrote: > Oh well I guess I'm saying that it seems that I don't have any JUnit classes > at all...I'm getting error messages with the ExprTest.java such as: > > The import junit cannot be resolved -- this is for the line import > junit.framework.*; > > or > > TestCase cannot be resolved or is not a valid superclass. This is for the > declaration line "public class ExprTest extends TestCase { > > Do I need to download the JUnit stuff besides the JDK? or what? > thanks for your help Yes, you need to separately download and unzip JUnit on your home machine, and it also needs to be in your CLASSPATH. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 From leavens@cs.iastate.edu Tue Sep 10 10:24:43 2002 Date: Tue, 10 Sep 2002 09:54:37 -0500 (CDT) From: Gary T. Leavens To: evan@evanrothmayer.com Cc: Gary Leavens Subject: Re: Java compile problems Evan, On Tue, 10 Sep 2002 evan@evanrothmayer.com wrote: > I think I've got everything figured out. Part of the problem was > that I didn't add the current directory to the classpath at first. I > had assumed that it would sort of "automatically add" the current > directory. Ah, good point. > The second part, about xhost, took a while to figure out. It turns > out that they've reorganized the network this year. Last year, dorm > computers were at *.stures.iastate.edu, but this year they moved > them to *.student.iastate.edu . This might be something worth > mentioning in the manual (I didn't notice it being in the course > material). Also, a mention of the xhost command would be helpful, in > case anyone else wants to use linux from home. Thanks, I'll put that in the running_java web page -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 -------------------------------------------------------------------- From leavens@cs.iastate.edu Tue Sep 10 21:40:46 2002 Date: Tue, 10 Sep 2002 21:36:50 -0500 (CDT) From: Gary T. Leavens To: Matthew L. Canny Cc: Gary Leavens Subject: Re: cs362 homework Matthew, On Tue, 10 Sep 2002, Matthew L. Canny wrote: > When trying to run ExprTest and PinBallGame I get warnings stating something > like this: > > Warning: Cannot convert string "someKindofKeyBinding" to type VirtualBinding > > Do you have any idea what's causing this? If this was on Linux, there is some mismatch between the X window system versions and various configuration files. I usually just ignore these, and they don't seem to cause any harm. I'm not sure what they mean. Perhaps someone who knows X better can tell us. Alternatively, you could enter the exact string you got into search of Groups from Google (google.com) and probably find an answer to the probelm. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------------------------------------- From leavens@cs.iastate.edu Tue Sep 10 21:41:13 2002 Date: Tue, 10 Sep 2002 21:39:29 -0500 (CDT) From: Gary T. Leavens To: Matthew L. Canny Cc: Gary Leavens Subject: Re: cs362 hw1.2 Matthew, On Tue, 10 Sep 2002, Matthew L. Canny wrote: > I have a few questions about homework #1 problem 2: > > 1. Considering the following lines of code: > > public class ExprSum{ > protected ExprSum left_arg; > protected ExprSum right_arg; > > How can instances of a class be declared within a class? Why doesn't this cause > an exponential creation of instances as each instance creates two more instances? > It looks that way, but null is a value of every type in Java, and you can thus use null as the initial value for the base cases. However, remember that this is the "bad" version of the program. You should change it to be better... > 2 Considering the following code: > > Super(left, right); > > This is used in several of the constructors. Does this call the constructor of > the superclass? Yes, we mentioned this in class a couple of times, I think. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------------------- From leavens@cs.iastate.edu Thu Sep 12 01:58:57 2002 Date: Thu, 12 Sep 2002 01:57:32 -0500 (CDT) From: Gary T. Leavens To: Kristina P Boysen Cc: cs362s@cs.iastate.edu Subject: Re: Question 3c Kristina, On Thu, 12 Sep 2002, Kristina P Boysen wrote: > In the problem description, it states to "modify the class PinBallGame to > add a new button, and the nested private class MouseKeeper to handle clicks > inside the button's region". Is it ok if I used AWT's ActionListener > classes to implement the closing button instead or do you want us to > specifically use the nested class? I think that using a class from the AWT is fine. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------------------------------------------------- From leavens@cs.iastate.edu Thu Sep 12 17:15:25 2002 Date: Thu, 12 Sep 2002 16:51:28 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Cc: Gary Leavens Subject: Re: CS 362 Hmwk part 2 question Eric, On Thu, 12 Sep 2002 Erfi80@aol.com wrote: > I'm a little confused with this line of the assignment: > > The code should still compile and pass the tests given in the file > ExprTest.java,although you may need to change the declarations of the fixture > variables to get the tests to compile. > > Fixture variables..? What do you mean by that term? Sorry for the jargon, by fixture variables I mean the fields of the JUnit test case class. In this case it's "basic_exps" of ExprTest.java. > Does this mean I can rewrite parts of the ExprTest.java? Yes. > I am assuming I need to, b/c the tests > are passing things into the constructors of my new classes that don't exist > (b/c I had to rewrite the class and the constructors have changed a bit)? Yes that is okay. > And is this assignment still due tomorrow? Yes. I have added a late homework policy to make it possible for you to trade off handing in homework problems late vs. getting them right. I'm happy to have you hand it in slightly late (like next Monday), for a small (10%) penalty. It's easier to grade things that are right. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------------- From leavens@cs.iastate.edu Thu Sep 12 17:15:36 2002 Date: Thu, 12 Sep 2002 16:52:14 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Cc: Gary Leavens Subject: Re: CS 362 Hmwk Question Cont. Eric, On Thu, 12 Sep 2002 Erfi80@aol.com wrote: > To follow up on my previous email, what I am asking is that I did have to > redo the fixture variable, but is it alright then to rewrite the above > tests..? I'm not changing the process in which they work, just adding > .value() to parts of the calls, which is required in my code..I'm guessing we > send you everything including our new test file? Yes, that is okay with me. Thanks. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------------------------------ From leavens@cs.iastate.edu Thu Sep 12 17:15:47 2002 Date: Thu, 12 Sep 2002 17:05:38 -0500 (CDT) From: Gary T. Leavens To: Chase Caster Cc: cs362s@cs.iastate.edu Subject: Re: junit Chase, On Thu, 12 Sep 2002, Chase Caster wrote: > I cannot compile problem 2 in hw 1. It keeps telling me that it can't access > the junit library. I have it on my comptuer. I have tried adding it to the > accespaths of the project in codewarror, I have tried setting it to CLASSPATH > in windows. I have tried using Eclipse. Is there anything else I might try, > so that I can actually do homework 1? First, we only guarantee that you can use the Linux systems at ISU for doing the work. If necessary you should come in to Atanasoff where it does work (or ssh there). Second, I'm sure you can get this to work at home just read the documentation more carefully and look at the debugging tips in the Running Java web page from the course. Here's some more help: If you installed JUnit by unzipping it into C:\JUnit for example, then you should tell Code Warrior that you want to have C:\JUnit\junit.jar in your CLASSPATH. In Eclipse I believe that you don't need to do anything at all to get JUnit to work; it's already part of Eclipse, I believe. Just make a new entry by clicking on the "Run" menu, then on "Run...", you get a box that says "launch configurations", and on the left panel of this box, under "Launch Configurations:", select "JUnit", then change the name "New_Configuration" that appears to something sensible, like the name of the test case class, then browse to select your project, and the test class (ExprTest). Then click apply and run. See the Eclipse documentation for more details. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------------------------------------- From leavens@cs.iastate.edu Thu Sep 12 17:16:13 2002 Date: Thu, 12 Sep 2002 17:15:07 -0500 (CDT) From: Gary T. Leavens To: Erfi80@aol.com Cc: cs362s@cs.iastate.edu Subject: Re: CS 362 Problems with hmwk 3/4 Eric, On Thu, 12 Sep 2002 Erfi80@aol.com wrote: > I'm moving on to the next assignments. My first question is is it possible > that this assignment will be getting pushed back at all? I'm going to do all > I can on it in the next two days, but with it being the big Iowa/Iowa State > game this weekend, that's a lot of pressure. I'm not planning to adjust more in the assignment, but note that problems 3-4 are due Monday not Friday. Also, I've added a late policy so you can take a penalty if you wish more time. See the course web page or the grading policy page. > Secondly, more importantly, I am having NO luck looking at the included .ps > file for viewing the chapter in Tim Budd's book that we need. I downloaded > Adobe Acrobat (I haven't needed it for awhile) and it refuses to open it up. > I also tried going to: > > http://www.cs.wisc.edu/~ghost/ > and that's not happening either. Can you look into this? Maybe post it in > .doc form or something? That works for me. MS Word isn't available for it. If you just download that file, you can print it directly on the Com S department laser printers, as they understand postscript. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ----------------------------------------------------------- From leavens@cs.iastate.edu Thu Sep 12 17:41:46 2002 Date: Thu, 12 Sep 2002 17:39:26 -0500 (CDT) From: Gary T. Leavens To: Matthew L Canny Cc: Gary Leavens , Tongjie Chen Subject: Re: cs362 hw1.2 Matthew, On Thu, 12 Sep 2002, Matthew L Canny wrote: > I'd like to change all of the constructor interfaces to double values: > > i.e. ExprSum(ExprSum left, ExprSum right) > to ExprSum(double left, double right) > > Can I do this? No. An ExprSum node should take two Expression trees as arguments, not two doubles. That wouldn't allow recursive trees, like: new ExprSum(new ExprSum(new ExprConstant(3.1), new ExprConstant(0.5)), new ExprConstant(0.02)); -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------------------------- From leavens@larch.cs.iastate.edu Thu Sep 12 18:40:45 2002 Date: Thu, 12 Sep 2002 18:39:19 -0500 (CDT) From: Gary T. Leavens To: Com S 362 students and staff -- Brian Wicks , Chintaka Ranasinghe , com_s_362@cs.iastate.edu, Elizabeth Weis , Guy M Howard , Jason Hill , Matthew L. Canny , Michael Rivera , Sze-Yiing Tan , Tongjie Chen , Tong Siang Chua Subject: building with JUnit in Eclipse - revised instructions Hi, I'm sorry, I've been telling people that you didn't need to do anything in eclipse to run JUnit, but it's not true. To get the JUnit tests to compile, you have to have JUnit's jar file on the "Java Build Path" (which is the Eclipse version of the CLASSPATH). This means you also have to download JUnit. So to do this for an existing project in Eclipse: - Download JUnit. On the ISU machines it's already in /opt/junit. Suppose you put it in C:\junit on a home machine. - Right click on the project name in the "Package Explorer Window", then select "Properties". Or select the project (for the homework) and the use the File menu's property item. - When you get the project properties, select the middle item on the left, which is "Java Build Path". - Then select the "libraries" tab, and from the buttons on the right, select "Add External JARs...". - Then browse until you can select the jar file junit.jar, e.g., from C:\JUnit\junit.jar if your JUnit copy is installed in C:\junit. - Click the bottom button "OK". This should now make it so JUnit can be imported, and works in your project. Sorry for the confusion I caused on this... -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 From leavens@larch.cs.iastate.edu Thu Sep 12 23:32:47 2002 Date: Thu, 12 Sep 2002 23:25:00 -0500 (CDT) From: Gary T. Leavens To: Stuart Tett Subject: Re: Unable to open pinball.ps Stuart, On Thu, 12 Sep 2002, Stuart Tett wrote: > I'm working on the home work and I wanted to read the postscript file. I tried > opening it in ghostviewer and adobe acrobat on my linux machine and on a > windows machine. Both said that the file was corrupted and could not open it. > This is slowing me down in completing questions 3 and 4. It works perfectly for me under gsview 3.3. I'm including the postscript file as an attachment in the next email. It should work under ghostview on Linux also. You cannot read this with adobe acrobat reader. You would need acrobat distiller, which comes with adobe acrobat, to read it. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------------------------- From leavens@larch.cs.iastate.edu Fri Sep 13 00:39:27 2002 Date: Fri, 13 Sep 2002 00:36:10 -0500 (CDT) From: Gary T. Leavens To: Stuart Tett Subject: Re: Unable to open pinball.ps Stewart, On Fri, 13 Sep 2002, Stuart Tett wrote: > Gary, I'm not sure what the problem is I opened up another poscript file fine > in ghostviewer. When I open this one up it shows pages 46-69, but all it says > in the window is "46". Page 46 is mostly blank as is 47. Advance to the pages with writing on them... > > It works perfectly for me under gsview 3.3. I'm including the > > postscript file as an attachment in the next email. It should work > > under ghostview on Linux also. > > > > You cannot read this with adobe acrobat reader. You would need > > acrobat distiller, which comes with adobe acrobat, to read it. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ----------------------------------------------- From leavens@larch.cs.iastate.edu Sun Sep 15 12:13:51 2002 Date: Sun, 15 Sep 2002 12:11:04 -0500 (CDT) From: Gary T. Leavens To: Evan Rothmayer Subject: Re: Homework 3b Evan, On 15 Sep 2002, Evan Rothmayer wrote: > When you say you want us to describe all inherited functions, does that > stop at the Ball class, or do you want us to trace back through the Java > inheritance tree all the way up to Object? Thanks. Good question. I think it would be good to describe what is inherited from Object, since it's good to look at that at least once. But you don't have to repeatedly list those methods for each type below Ball, just note that the same methods are also inherited in each type. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------------------------------------- From leavens@larch.cs.iastate.edu Sun Sep 15 14:56:07 2002 Date: Sun, 15 Sep 2002 14:55:18 -0500 (CDT) From: Gary T. Leavens To: Evan Rothmayer Subject: Re: Homework 3b Evan, On 15 Sep 2002, Evan Rothmayer wrote: > Thanks for the help on my previous question. Now I'm having a little > difficulty with the graphical objects. I can add the Quit button just > fine, as I just put it in the South section of the BorderLayout. The > problem is when I try to add the SloMo button, it doesn't want to share > the South area, and just wipes out the Quit button. I'm trying now to > just add it straight, and resize it using either the setSize or > setBounds function, but neither seems to be working. Is there a way to > specify the size and position of buttons better, or at least some way to > make them share the South area? Thanks again! Yes, there's a Q & A answer about this already, which is to add a panel in the south area, and to then add the two buttons to it. > You can place a Panel(say "Button Panel") in the south of the frame. > and then put the two buttons ("Quit" and "Slo_mo") to the panel. that > probably would solve your problem. > ButtonPanel.add(Quit); > ButtonPanel.add(Slo_mo); -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 -------------------------------------------------------- From leavens@cs.iastate.edu Sun Sep 15 16:09:37 2002 Date: Sun, 15 Sep 2002 16:08:18 -0500 (CDT) From: Gary T. Leavens To: sytan3@iastate.edu Cc: Gary Leavens , Tongjie Chen Subject: Re: cs 362 ques3 Sze Yiing, On Sun, 15 Sep 2002 sytan3@iastate.edu wrote: > For ques.3c, how do we call the mousekeeper for quit button? do we add a new > variable in the Mousekeeper class? Do you mean what should it's name be? Anything you think is sensible. > for ques. 3d, which animation do we slow down? is it the run class in class > PinBallThread ? Yes. Have it sleep(1000) instead of sleep(10). -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ----------------------------------------------------------- From leavens@larch.cs.iastate.edu Sun Sep 15 19:09:18 2002 Date: Sun, 15 Sep 2002 19:08:43 -0500 (CDT) From: Gary T. Leavens To: beth1@iastate.edu Subject: Re: cs362 hw 1 problems continued Beth, On Sun, 15 Sep 2002, Elizabeth Weis wrote: > When I type: > > java PinBallGame > > in the budds_pinball directory where all the code is, I get the following > errors: > > Exception in thread "main" java.lang.InternalError: Can't connect to X11 > window server using ':0.0' as the value of the DISPLAY variable. > at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) > at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:126) > > ...the list goes on.... That's because you don't have the DISPLAY environment variable set right, and/or you didn't do xhost for your computer. See the Running Java web page for the course. > When I type: "java HelloWorldApp" in my HelloWorld folder, it works fine > though. (Printing out "Hello World!" on the next line in the terminal > window.) > > So it comes back to my previous questions about how to get a graphical > interface to pop up from the terminal window. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------------------------------------- From leavens@cs.iastate.edu Sun Sep 15 21:17:39 2002 Date: Sun, 15 Sep 2002 21:16:30 -0500 (CDT) From: Gary T. Leavens To: compumec@iastate.edu Cc: Gary Leavens Subject: Re: that troublesome homework... Hi, On Sun, 15 Sep 2002 compumec@iastate.edu wrote: > I'm sure you've gotten a mailboxfull of e-mails dealing with > one question or another dealing with the homework, but after looking > at the posted Q&A's, I still am not exactly sure of a few things, > the most important of them being: > > "For each of these > classes, describe > all the methods defined in the class that are > (i) inherited from parent or ancestor classes, and > (ii) for each > method inherited from a class that is not the class's direct > parent, indicate > from which parent class the method's definition occurs." > > We are to describe the methods defined in the class that are > inherited, meaning, tell what the methods DO, and only the methods > which are [re]-defined and inherited from their supernode (from > somewhere up the line)? You can just say what the methods are; you don't have to say anything about them. Sorry, the word "describe" I used is a bit ambiguous. > That I can do... but it sounded in the Q&A like you wanted every > inherited method (All the billions of them) that COULD be used in > the subclass, to be listed... at least for part (ii), and maybe for > part (i) also. Yes, I do want you to say what methods are inherited by each class that COULD be used (i.e., that are part of the interfaces of these objects.) As far as I can tell, there are only 10 public methods in java.lang.Object, and two protected methods, all of which are inherited into every class. It's good to know what they are, but as I noted in an earlier Q&A, you don't have to repeat this list each time, but write it down once and refer to it. > Sorry to bug you at such a late time, but I just want to make sure > that we really are to list out all the inherited functions, all the > way up to Object. Yes. -- Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------------------------