BestJewSinceJC 700 Posting Maven

Ron,

I agree with your point that the president's statement was foolish. The president implies that information is a distraction and a diversion. He ignores the key point that the devices he lists (and others that he alludes to) are a means to spread information, and do not control how that information is consumed or how it is interpreted; they only make it possible to spread and view information. In fact, it almost seems like he is personifying these devices, an abstract thing: "Information becomes distracting and a diversion", as if the devices themselves logged onto facebook and posted "Obama wasn't born in America!" rather than a person using the device. Frankly, it is a hypocritical thing for Obama to say, considering that much of his campaign benefited from devices like the ones he mentioned, and that he portrays himself as the 'younger, more savvy president'. I would think it more likely for the opposite statement to come out of his mouth. I'm borderline offended that he said it.

That being said, I have to disagree with you about the Ipad. I don't think he was targeting the Ipad in particular. He was making a sweeping generalization that, while untrue and stupid, was only untrue and stupid because he attributes faults to a device that is incapable of faults...

Just my two cents.

BestJewSinceJC 700 Posting Maven

The only thing I'd change about it is showing the forum listing by default rather than hiding it by default. (Well, I'd actually have less forums and make what you currently have as categories into forums -- what you have would make sense, except the activity in those forums is so low that it might as well be combined)

BestJewSinceJC 700 Posting Maven

You declared an array of "n" College Objects, but you did not initialize it. You must create a new Object at each index before you can call methods on it. Also, post a regular thread in the future, not a code snippet.

BestJewSinceJC 700 Posting Maven

oops, sorry about that.

BestJewSinceJC 700 Posting Maven

It seems like the Hardware forums do not have buttons to start a new thread?

BestJewSinceJC 700 Posting Maven

I was going to post this in the linux/unix board, but there is no 'start new thread' button. Why is that? Anyway, I'm going through a ton of steps to apply a patch file. Everything in the patch file seems to apply seamlessly, with one exception. My patch file is a .tar.gz and, when extracted, it contains a file with the path

/usr/src/linux/arch/x86/include/asm/unistd_32.h

Is there some obvious reason why when I apply the patch, every other file is updated to what I'd expect, but this one is not?

BestJewSinceJC 700 Posting Maven

Use methods. Your example and explanation are convoluted and I can't give more specific advice, but to "do something" under certain conditions (i.e. in a control structure such as a for loop, if statement, etc) you can call a method.

BestJewSinceJC 700 Posting Maven

If you dispose a parent component you also automatically are disposing of all the child components. Presumably you're calling dispose() on the outer JFrame, which is causing the inner one to disappear? If you want to remove the JFrame, you can just call firstJframe.remove(otherJFrame); and it will be removed automatically. You might have to call validate() on the firstJframe in order to get it to redraw itself properly.

BestJewSinceJC 700 Posting Maven

Be clear with your questions, instanceof is a specific java statement that can be used (for example) in the following way:

if (x instanceof y){
   System.out.println("Cool");
} else System.out.println("No runtime error or compiler error here.");

And btw, I did understand your question after I read the quote, I'm just saying to avoid confusing language. Anyway, you can tell what kind of error it will produce by designing a program and attempting to run it. If it won't run it is a compiler error. If it runs but crashes its a runtime error. But with a little knowledge of inheritance you can probably deduce that if you try to instantiate one type (for example, class Whatever) and do something like Whatever c = new OtherThing .. where OtherThing is not a child of Whatever in the inheritance hierarchy, then it should generate a compiler error. Again, one test program is worth a thousand expert opinions, but read about inheritance and you will begin to understand. I could point out one by one what happens in your example above, but that won't help you learn nearly as much as writing a test program and seeing what an actual compiler does after reading a little bit about Java inheritance.

wildplace commented: helps a lot! +1
BestJewSinceJC 700 Posting Maven

All of the buttons are enormous. My first thought was "looks nice" but then I realized that

1. I liked the old colors and the contrast better. This shade of purple is not appealing.
2. Everything, including threads, buttons, etc, is too big now.
3. I can only navigate one page at a time now (or choose first or last page). Before the range of pages I could jump directly to was larger.
4. Did I mention the threads are too big? I agree with Ezzaral - the size of the threads distracts from the site features, since you can view fewer threads at a time now and it draws attention from the other components on the site.

I do like the forum menus better, they look better and pop down faster. The only thing I feel incredibly strongly about is how big the thread names (and the new button) are .. the purple I don't like but I'll get used to it.

BestJewSinceJC 700 Posting Maven
BestJewSinceJC 700 Posting Maven

This problem is teaching you about method overriding and how it is an important part of Inheritance. For example, your baseball's play() method should print "Playing America's past time" to the user, the Basketball class's play() method could print out "Playing Basketball", etc. The same goes for the bounce() method - certain types of balls cannot bounce, so they would just implement the bounce() method so that it says "I don't bounce()!" ...

BestJewSinceJC 700 Posting Maven

Read on google and figure this out yourself. If you know how to pass by reference, declare a function, pass by value, subtract two ints, and use if statements to compare ints, then you can definitely solve this problem. If you can't do any of those things then read any basic C programming tutorial.

BestJewSinceJC 700 Posting Maven

"3. Apple has very bright people and extremely good lawyers that are well-paid out of Apple's 40 Billion Dollar Cash Pile. Any antitrust allegation is just BALONEY. Move on."

That doesn't seem to be what the Department of Justice or the FTC think. Why would I give your opinion more weight than either of those organizations? I also don't think this is a "who has more money" contest because I doubt either of those organizations are hurting for money. What does how good Apple's lawyers are have to do with whether or not an anti-trust allegation is well founded? (Nothing)

BestJewSinceJC 700 Posting Maven
BestJewSinceJC 700 Posting Maven

As amusing and ironic as I find this, I don't think

"500 Internal Server Error

Servlet processing error


java.lang.NullPointerException
at com.thruport.jbird.core.JBirdFilterChain.doFilter(JBirdFilterChain.java:36)
at com.thruport.jbird.core.JBirdContext.processRequest(JBirdContext.java:1989)
at com.thruport.jbird.container.JBirdRequestHandler.execute(JBirdRequestHandler.java:159)
at com.thruport.jbird.server.TcpConnectionHandler.run(TcpConnectionHandler.java:56)
at java.lang.Thread.run(Thread.java:619)"

Should be at the top of the Java forum.

BestJewSinceJC 700 Posting Maven

What I wan to acheive is.

the that is typed in aswell as it should display on screen and should be written to a file and each string should be on a seprate line. So * the asterik terminates the program but thats the only thing which appears in the file

What? Use good grammar.

BestJewSinceJC 700 Posting Maven

Public should be "public"

BestJewSinceJC 700 Posting Maven

Have you seen this article? Keep in mind that if you run your "long running task" on the event thread then that is probably why the cursor is not changing...

If that isn't helpful, sorry, but you'll probably have a lot more luck asking this on an Eclipse RCP specific newsgroup or forum. I don't think a lot of people here use RCP very regularly.

BestJewSinceJC 700 Posting Maven

Isn't University of Phoenix an online school? Which would explain why the teacher doesn't get back to you and the adviser doesn't advise.

BestJewSinceJC 700 Posting Maven

The real solution to this problem would be to use a boolean variable hasBeenUsed and set it to false initially. Then once your array is used, set it to true. That way you can check the variable later to see if it was ever used.

BestJewSinceJC 700 Posting Maven

you don't need a loop, you need an if statement, and the correct code was already given above.

BestJewSinceJC 700 Posting Maven

Threads are never deleted for database reasons. It would also help if, in the future, you mark threads solved once you are done with them, and post what you did to fix the code, that way people don't come in with the intention of helping you solve your problem and find out that you don't need help after they already read posts.

BestJewSinceJC 700 Posting Maven

The paint() method is called by setVisible(), and since you called setVisible(), paint was called indirectly. As far as your other question, you'll need to clarify what you mean: are you trying to figure out how large your monitor is and make the Frame cover the entire monitor?

BestJewSinceJC 700 Posting Maven

Lucario, your situation intrigued me so I did a little bit of research and digging to try to figure out what it going on. What I've come up with might be helpful to you although it does not answer the question of why your teacher cannot run your project from within certain environments (keep reading).

When run in an Applet that is embedded in a web browser, I do not think your project would work as it is written. For information on why that is, you should read this link which describes how Java applications run by the user (i.e., you double click on the executable file, or you compile and run from the command line, or you hit the run button from within an IDE such as Eclipse) implicitly have a higher level of permissions than applets. Therefore you have to give Applets more permissions when run from a browser.

Secondly I was confused by your use of getCodeBase(), since getCodeBase() returns the URL of the directory which contains this Applet. I.e., getCodeBase() would be the correct thing to call if your Applet code was located on a web server, but it doesn't really make sense (even though it works) the way you called it. I think this bit of code makes more sense, maybe it will clarify what I'm saying:

URL url = null;
	try {
		url = new URL("http://lucarioboards.com/");
	} catch (MalformedURLException e1) {
		// TODO Auto-generated catch …
BestJewSinceJC 700 Posting Maven

P.S.

http://java.sun.com/docs/books/tutorial/deployment/applet/html.html
is one resource that would allow you to embed your applet in an html page, and for the more modern JApplets you could use http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html#plugin

BestJewSinceJC 700 Posting Maven

As far as I know, you should be extending JApplet, not Applet, and if you are expecting this to run in a web environment, your teacher should not have to do anything other than going to the correct website with a Java enabled web browser. You'd have to embed the JApplet in an html page and on your server, the JApplet would have access to whatever resources it needed access to.

edit:

But that being said, the Applet actually works for me as is... so... no idea why your teacher can't get it to run.

BestJewSinceJC 700 Posting Maven

Read about queues on google, ask more specific questions, begin to write the code.

BestJewSinceJC 700 Posting Maven

For the getNames() I am trying to create a constructor to get the names of the 5 students that the teacher may enter. What is the correct way to do this?

It depends how the teacher has said she wants to be able to input the names. If the teacher wants to type in the names in a GUI, then you can use the JOptionPane method showInputDialog. If the teacher wants to be able to enter the names at the command line then you can use System.out.println("Enter the name"); and use the Scanner class to read in the name.

BestJewSinceJC 700 Posting Maven

Then remove or poll() the queue until you've looked at every element. Compare the smallest element found thus far to the current element, and set the smallest to the current if you find a smaller one.

BestJewSinceJC 700 Posting Maven

What Object does paint() get called on? I see no GUI code...

BestJewSinceJC 700 Posting Maven

The code without duplicate variable and method declarations is as follows. You should note that your code still has several syntactical and logical errors. For example, in your getNames() method, there is a syntax error because you are calling the showMessageDialog() method with only one argument, but it can only be called with either 2 or 3 arguments. You should look online to learn how to use that method properly. You have a logical error in your getNames() method because you have declared a variable "names" but you never initialized it to anything. So your return statement is returning null. I don't know what you wanted your getNames() method to do because your comments are pretty useless. A good comment would be something like "The get names method check the studNames array to make sure it has at least 5 names in it, and if it does not, then the method prompts the user to enter more names until studNames has 5 names. getNames() then returns this array of studNames". You should also note that getWhatever() is usually reserved in Java as a name meaning return the variable "whatever" and setWhatever(somethingElse) is usually reserved to change the value of "whatever" to "somethingElse". So using getNames as the title of a method that prompts the user and does other word is slightly confusing. A more descriptive method title and a method comment to explain the overall goal of the method would go a long way. Your comment "If array contains less …

BestJewSinceJC 700 Posting Maven

Doesn't matter, you should still use proper formatting so that it doesn't waste your time (when you're looking for errors) and my time when I'm trying to help you.

Anyway, in the code you posted above, you declared the same variable "testScores" multiple times and you declared the Grades constructor and the getAverage() method multiple times also.

BestJewSinceJC 700 Posting Maven

What happens if there is a "*" at row 0? Then wouldn't your code attempt to check row "-1", which doesn't exist? Similarly, if a row is at the end of the array, it looks like your code attempts to check ARRAY_END + 1, which is an index that doesn't exist. Same thing goes for the column.

BestJewSinceJC 700 Posting Maven

You seem to have the wrong number of closing brackets. You should have one opening bracket for each closing bracket, and it looks like (at first glance) that you never close the getNames() method. Your indentation makes it hard to count, though. Opening and closing brackets should line up, and where you have control structures (for/while loops, if statements, etc) they should look something like this:

if (something)
{
    thisMethodIsIndented();
    thisVariableAssignmentIsIndented = 1 + 1;
}

whereas yours in certain places looks like this, which makes it harder to see errors and read the code:

if (something)
{
thisMethodIsIndented();
thisVariableAssignmentIsIndented = 1 + 1;
}
BestJewSinceJC 700 Posting Maven

validation rules are invalid, solution rejected.

Yeah, but the validation rules for email addresses are quite complicated and I doubt the OP has made up the rules posted above, they are created by his teacher.

BestJewSinceJC 700 Posting Maven

What are you trying to accomplish? You can create a JPanel and show it dynamically by adding it to a JFrame or to another JPanel.

BestJewSinceJC 700 Posting Maven

You have the words "end if statement" in three different places so that isn't very helpful. You've stated that the error is at line 160 but you only posted 130 lines of code. Post your errors and be specific about which lines of code they are at.

BestJewSinceJC 700 Posting Maven

You have to create a new Object of that classtype i.e.

dataClass dc = new dataClass();

BestJewSinceJC 700 Posting Maven

Btw, I am very curious as to why label == "1" actually returned true. Perhaps the JVM somehow knew that the String Object "1" had already been created so it pooled them together, therefore resulting in the addresses being the same. But if that is actually the case, I doubt you realized it, hence what I pointed out above.

BestJewSinceJC 700 Posting Maven

You never initialized the instance variable "lbl" which is declared on line 14 above. At line 21, you declared and initialized a different variable that is also called "lbl". But inside your actionPerformed method, the "lbl" that it is trying to call setText() on is the "lbl" that you declared at line 14, but never initialized (using the new keyword).

if(label == "1")

What you just did in the code above is compared the reference (memory addresses) of label and "1". If you want to check if any two Objects (and String is an Object) are logically equal, then you need to call the equals() method:

if(label.equals("1"))
BestJewSinceJC 700 Posting Maven
while ( a != 0)
{
total += a;
}

This bit of code doesn't make sense. "a" is an array of doubles. So when you say "a", "a" is a reference/memory address. If you want to access the value stored in "a" you have to change the code to something like this:

while ( a[index] != 0)
{
total += a[index];
}

Where 'index' above is some valid index into the array, so if your array is of size 10, 0-9 would all be valid indexes. But using a while loop in this context doesn't make sense either, so I suggest that you use a for loop and do something like for(int i = 0; i < ARRAY_SIZE; i++) and put your calculations inside of that for loop.

jephthah commented: good +7
BestJewSinceJC 700 Posting Maven

In addition to what moutanna said, you should be wary of bad user input. For example, before you call nextDouble() you should verify that there is actually a double present in the input by calling hasNextDouble(), which returns true if there is a double that can be read in. Oh, and the user could also enter something like "a whatever" and your program would read in the letter, then the nextDouble() call would choke on the next token of input, which is 'whatever' and you would get an InputMismatchException.

BestJewSinceJC 700 Posting Maven

Moutanna's suggestion was a good one; break in this case would be a good idea. If you don't want to use break, though, you can use a for loop and make one of the conditions a boolean. Set that boolean to true once you find the value so it will end the loop.

for (int i = 0; i < size && !finished; i++){
   if (youFindTheMinimumRating) finished = true;
}

There are a ton of other ways to do this..

BestJewSinceJC 700 Posting Maven

Interesting conversation, may I join in please?
BJSJC: your statement about "only one thread" in posts #4 and #6 is wrong, there's also the EDT, as you note later.
moutanna's post #7 is very misleading. The listener method is NOT called "inside the button"; the method is running on the EDT for an instance of a Listener class whose execution is not going to be affected by changes to a component that happens to have a reference to it.
Constructing a window from a main thread may not be what the API doc recommends, but it is very common practice and never seems to create a problem provided that the window is only made visible as the last step. If (as in the posted code) the setVisible comes early you could theoretically get a semi-constructed window displayed followed by unpredicable stuff if the EDT happens to interrupt the main thread while it's still configuring the window.

Agreed, I actually didn't realize about the EDT until I put the SwingUtilities.isEventDispatchThread() test in the actionPerformed method, as I mentioned in my previous post. Good info though, thank you for the input.

edit:

P.S. I agree about the setVisible, I hadn't noticed that the OP put it before other relevant code or I would have moved that call to after the frame was fully constructed.

BestJewSinceJC 700 Posting Maven

Users asking for help about once every two days.

The joys of having your name in bold...

BestJewSinceJC 700 Posting Maven

The paycheck is a function not a class; and the functions could not be instanciated. that mean we should not write some think like:

paycheck p1 = new paycheck(nameInput, hourInput, wageInpu

this is wrong. the word "new" is used to create an instance of class and MUST not be used for functions

Hope it helps.

Except that according to the code the OP posted, "paycheck" is a constructor, so in fact, the word 'new' would be used.

BestJewSinceJC 700 Posting Maven

Check out this daniweb thread on scanf because if it is used improperly you can definitely have problems (such as overrunning the bounds of your char array) among other things. You also might want to see Dave Sinkula's snippet on reading an integer from the user for a more thorough and less error prone way to get the input. Oh, and I found one more useful resource on Daniweb on reading in Strings and Numbers in C, also written by Dave Sinkula. I'm also giving myself a refresher this morning since its been at least 2 years since I've done any serious C programming and these damn functions are a pain...

:)

BestJewSinceJC 700 Posting Maven

I see no errors... you're ignoring the 'open' variable inherited from the Cupboard class, though.

BestJewSinceJC 700 Posting Maven

OK, enough of the new member baiting please.

The 'noob' tags have been now been removed, and I would ask everyone to bear in mind that they were all new members here once upon a time.

What you calling 'baiting' I call a harmless joke. If this is considered 'baiting' then I think you should remove a lot more posts all over the site. It isn't a big deal, just saying. Also consider how the OP fired right back and I took it in stride. But I can see that you haven't bothered to edit his comment, just mine.