masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but with some tests, it seems as though simply calling repaint after calling validate accomplishes your goal. (At least it did for me, although without it I also saw what you were experiencing.)

I would normally assume that a call to repaint() after a call to validate() would essentially be redundant, but seemingly not.

peter_budo commented: Yes in deed, reapint() does the magic. Thank you +12
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, but what contains "mainPanel"? And how is mainPanel added to that container. Or is "mainPanel" the contentPane?

I have a more involved possibility but it involves the component that contains "mainPanel" more than it does "mainPanel" itself.

But, since you're saying that your adding "premade" Panels to mainPanel, then try this, as well:

Dimension d = mainPanel.getSiez();
mainPanel.removeAll();
mainPanel.add(addEP);
addEP.setPreferredSize(d);
addEP.setSize(d);
mainPanel.setPreferredSize(d);
mainPanel.setSize(d);
validate();

(and, if that works, you should probably be able to remove the two mainPanel.set*Size calls, but try including them, first).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

How is the component containing "mainPanel" constructed? Can you show that (without any of the code behind the constructs, but simply what components are in it and how they get placed in it).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The problem is that the panel will only cover as much area as it needs. Anything beyond this area is "ignored" during a validate on the panel (since that area no longer "belongs" to the Panel. 2 "quick" possibilites (I would try the second first).

Have you tried

Dimension d = mainPanel.getSiez();
mainPanel.removeAll();
mainPanel.add(addEP);
mainPanel.setPreferredSize(d);
mainPanel.setSize(d);
validate();

or

mainPanel.removeAll();
mainPanel.add(addEP);
mainPanel.getParent().validate();
masijade 1,351 Industrious Poster Team Colleague Featured Poster

How do you normally use an array?

String[] files = file.listFiles();
int numFiles = files.length;
masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

listFiles() and use the length of the returned array?

See the API docs for File.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, Peter, what's this

authorsLastName = GetAuthorLastName();

;-)

However, with the way it's written (if it compiles at all) authorsLastName is an instance variable anyway (as it is not declared in the method simply defined), and that is probably not a good idea.

Otherwise, knowing exactly what SQLException you get would help. Post the rest of the message. I can almost guarantee, however, that it has to do with what GetAuthorLastName() is returning (or not).

peter_budo commented: Yes, you right, I did not spot that one +12
masijade 1,351 Industrious Poster Team Colleague Featured Poster

This is an SQL question, but what the heck

SELECT Description, SUM(Quantity) FROM
  ((Select Description, Quantity, PluCode FROM Sale_Mast_Data)
   Union
   (Select Description, Quantity, PluCode FROM Sale_Mast_Data_H))
Group By PluCode

Union usually "ignores" duplicate rows. So, if a row in "_H" is an exact duplicate of a row in the other you will only get one copy of it. If you "need" both, use "UNION ALL".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

> > And you're real problem, at least IMHO, is using the JDBC-ODBC in Tomcat.

I don't think he is using a bridge type driver given the package name com.microsoft.jdbc.* and [Microsoft][SQLServer 2000 Driver for JDBC] .

Oops, you're right. Whenever I see that "[Microsoft]" I blank out and think JDBC-ODBC (I have never used SQL Server, so I usually only see it when someone is posting an error message that has to do with the bridge and access). ;-)

> The bridge is not threaded and Servlets/JSPs are.

I really don't see how this is different from the way threading is handled in Java I/O classes which do make native calls; the threading is most probably handled in the Java implementation of JdbcOdbc. Some real problems with ODBC implementations are invoking third party native code, installation required on the client machine, debugging nightmares etc. :-)

Maybe, maybe not. The way the thing is used makes a difference (at the very least in performance as the things usually spend more time using a connection and the like than other things). And, normally, DB's being such a large part of an application, it is just that much more likely to be a problem (or at the very least a drag). You can't even have multiple open statements on a single connection.

http://java.sun.com/products/jdbc/faq.html#15

In any case, the JDBC-ODBC bridge should always be, IMHO, the "driver of last resort". There must be a reason that the Driver is …

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If they are writing everything (or even alot) in main, then they are not using Java properly. They are attempting to perform procedural programming using an Object-Oriented language. Ignore them.

Alex Edwards commented: Funny, direct and correct! =) +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

before setAutoCommit(true) you need to do a commit(), but your problem comes before this. And you're real problem, at least IMHO, is using the JDBC-ODBC in Tomcat. The bridge is not threaded and Servlets/JSPs are. They do not work well together. So, that is quite possibly also your real problem and not only my opinion. More than that I cannot (without much more information) and, truthfully, will not say.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So loop through the list and perform a file.canRead() on it before displaying it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try putting SimpleDateFormat infornt of sdf

SimpleDateFormat sdf = new SimpleDateFormat ("EEEE MMMM DD, YYYY");

Well,

1. That's already been said.
2. The OP has declared the problem solved.
3. You didn't notice that today was declared today=new date() rather than today=new Date() .

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi

I have stored File objects in a vector. Now I which to call the methods of the file objects stored in the Vector. Unlike C++ you cannot simply refer to the vector by index e.g.
vector.getAbsolutPath() nor can you simply call vector.elementAt(i).getAbsolutePath();

If you use Generics (see my last post), yes you can.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes it will work.

The following also works (and should actually be done this way, now):

Vector<File> vector = new Vector<File>();
// populate vector
String path = vector.elementAt(i).getAbsolutePath()
PoovenM commented: Well coded :) +3
peter_budo commented: The better one wins, ;) +11
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I believe the result of the paint method (i.e. the actual changing of the picture seen on the screen) doesn't occur until the paint method returns. Which means, playing the sound inside the paint method will ensure that the sound is played first.

I could be completely off-base, but I believe that is the way it is.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, you understood it right, and that's what I thought, you wanted, from the server, to use code on the client, when the client wouldn't even have it until the server is finished, since that is when the server would deliver that code to the client.

So, how did you want to do it now?

Then again, your JSP can set the onLoad attribute of the body tag to execute the JavaScript method as soon as the page is loaded.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not that I think it the right way to do it (and also not that I think it will work since you will probably be expecting to be able use document objects which are not going to be there) but

http://java.sun.com/javase/6/docs/technotes/guides/scripting/index.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

SimpleDateFormats will only format Date objects (or classes that extend Date). They won't work on your date class.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

null has no type. It would have a vague type determined by whatever type the argument it was passed in as was suppossed to have. And I say vague, because it would be determinable, because the method already knows it's suppossed to be of that type.

Also, how would propose to get the type (if it had one)? The Class is the type, and since there is no way to dereference null (since it is a non-object) you can neither inspect the "class" field nor call the getClass() method (at least one of which instanceof also uses).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. Write two methods. One that takes a String as an parameter, and one that takes an int as a parameter.

If you feel you must do it this way, then Google for "Java instanceof".

stephen84s commented: Yep +3
Koldsoul commented: Thank you for your help. Your idea worked using instanceof. +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

try it, post it, and we will help to correct it

masijade 1,351 Industrious Poster Team Colleague Featured Poster
SELECT name, SUM(liters), SUM(amount) FROM salemast GROUP BY name ORDER BY name
peter_budo commented: GROUP BY "I approve" +10
masijade 1,351 Industrious Poster Team Colleague Featured Poster

You make it

} while (employee.equals(""));

and then evaluate the additional "20 errors".

The thing about the compiler is, it makes multiple passes through a code file, and if one pass finds an error, it will finish that pass, but not even attempt to make the other passes. And "simple" syntax proofs are the first pass. So, now you only see this problem. Once this one is fixed and the syntax proof succeeds, the compiler then makes the next pass, thereby finding your additional "20 errors".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where in this part of the code have you defined Clock.

Stopwatch Clock;
			switch(c) {
				
				case 1: Clock.Start();break;
				case 2: Clock.Stop();break;
				case 3: Clock.Reset();break;
				case 4: Clock.Display();break;
			} //end of switch for calling stopwatch
masijade 1,351 Industrious Poster Team Colleague Featured Poster

See http://java.sun.com/docs/books/tutorial/uiswing/layout/

It is almost always a big mistake to attempt to use the "null" layout (i.e. no layout). And for something like this, it is definately a mistake. Learn how to use some of the varying layout managers.

I wouldn't suggest you try it right away, but I use GridBagLayout extensively. It is the most flexible and controllable of all the layout managers, but it is also the most complex and the easiest to get wrong.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You have not set the layout for your JFrame, and so it is using the FlowLayout.

Uhmmmm, I believe the contentPanes of the top-level windows use BorderLayout, but that's beside the fact.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

There is no direct way to "clear the screen" (except printing out a bunch of blank lines), and yes there is something to the effect of system("COMMAND");

Check out the Runtime and/or ProcessBuilder classes.

But the advice by jwenting is correct.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Look at your constructors. You have a constructor that takes as arguments

String, String, char, boolean, Course, Course

but you are calling the constructor with

String, String, char, boolean, int, int

See the problem?

jasimp commented: What Problem ;) +8
masijade 1,351 Industrious Poster Team Colleague Featured Poster

"dd/MM/yyyy" not "dd/mm/yyyy"

Case makes a difference (m is minutes in hour, not month in year).

See http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Always read the API docs for the class in question, first.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

if this site is going like the Sun forums we'll see kids requesting "send me ze koduz" for years to come.

Well, judging by the post before this one, yep.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This is a JavaScript question.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Also, that tutorial is bad in more ways than one (and not only because it's causing an exception).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No point to repeat that, this guy completely ignore that for last two weeks from me. Another hopeless case to bang on...

Yeah, I've pretty much scaled back on saying this (nobody listens, they all want the "easy way out", then cry when they need to fix or modify it), but, sometimes, I'll climb back onto that horse for a round or two. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Did you mean maybe rs1.getString("Total"), seeing as how that statement seems to be in the rs1.next() while loop.

Also, you definately should not be doing this stuff as scriptlets in a JSP. This is a maintenance nightmare.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
peter_budo commented: Did I seen these tutorials somewhere? :) +9
masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can also do

tar xvf bin.tar \*perl\*

but you're right, the quotes are probably easier.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Is there a server running?

To use a client you have to have something to connect to, and that message means (usually) that there is nothing listening on that port, at that ip.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Correct. Add an e.printStackTrace() to the catch block printing that message so you can see what type of IO Exception you're getting. Also, as long as the port is above 1024, anyone can use it (ports under that are only available to accounts with system admin privileges), but a very large number of ports under 5000 are used by widespread programs, and so there is a large chance of a conflict, but if the server is actually able to bind it's listening sockt, that is not the problem.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And your question is?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Post your code and we will help you correct it, but no one is just going to give it to you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course you can (and it is -9), but it's not worth it if you don't know whether or not it was already used. use split and mail it in pieces, then use join to recreate the file at the other end.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not that I think you'll win much, but did you use the -9 option when you created the gzip file?

Otherwise, split and join.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Other than the fact that you shouldn't be doing this in a JSP, I don't know, since you haven't bothered to tell us what is going wrong with it, and I am not even going to attempt to guess.

What exceptions do you get?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Question 1. What if the same pattern also fits inside the "largest" pattern? i.e

pattern: A.*B
String: ABCDEFBGHIJK

Is AB matched, or is ABCDEFB matched?

Question 2:

What is th difference between 'A-Z' and '[A-Z]'? (Although there are other things in tr that should be used for this.)

Question 3:

Are you sure you copied it right as:
File substitution always happens on variable assignment.
doesn't seem right to me.

Question 4:

Knowing that handle>&handle redirects the first handle to whatever "stream" the second handle currently points to, and handle>outputStream redirects the listed handle to a newly created output stream, what do you think the answer is? Hint, the keyword in that question is marked.

Question 5:

Simply try it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

MouseListener

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't do other's homwowrk for them. It is against the terms and agreements you agreed to when you signed up here.

And, if you absolutely must post code, please use code tags.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Who says there is any?

I find it extremely lazy of people to expect there to be software programs that will convert code from one language into code from another. Both languages will have there own idioms, syntax, and "way of doing things", and it is almost guaranteed (regardless of which 2 languages are involved) that a "converter" program would be able to create syntactically correct, and runtime efficient code.

I have seen converters for other languages, and although they created code that was syntactically correct, it was nothing I ever wanted to actually use.