masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use Boolean not boolean.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

keep writing scriplets in your jsp files, and it'll become a lot harder than it needs to be to debug/maintain.

I have told this guy not to do this multiple times in multiple threads.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then LOOK at your DB. Is the column REALLY named like that, EXACTLY like that.

And, it doesn't matter in what order the columns were created and/or exist in the db, these index numbers are PARAMETER indexes and are ONLY concerned with the number and position of the parameters (i.e. question marks) in the QUERY.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
ps=con.prepareStatement("update employees set EmployeeName=?,Nationality=?");
ps.setString(1, EmployeeName);
ps.setString(3, Nationality);

Uhm, where did the "where clause" portion of the statement go? And how many question marks do you count in this statement? And is the index you used larger than this?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It MIGHT help to know WHAT error you are getting (you will probably have to look at the logs). But what will REALLY help is to STOP WITH THE SCRIPTLETS. Program PROPERLY.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, all true. But it was just being a bit facetious, anyway. ;-)

I do that sort of thing, but, of course, with a contains call first, and prefix.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
wordMap.put(word, wordMap.get(word)++)
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then call trim on the one that is getting broken up.

Edit: Better would be to call it on both (but you should probably do null checks before doing that).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Did you try what was already posted (other than the beans and jstl advice, I have no wish to "speak to the wall", although I cannot imagine a case where it would be "need in this way", unless it is course work and required by the instructor, in which case I would look for a new course).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Change your println calls to

out.println("<pre>==="+ans+"===</pre>");
out.println("<pre>==="+cans+"===</pre>");

to ensure no whitespace is messing up your comparison.

But you REALLY need to learn how to use beans and the varying jstl tag libraries as all this scriptlet stuff is BAD. Scriptlets are JSP 1.0. The ONLY reason they still exist is backwards compatability (you do not want to be backwards, do you?). They are extremely bad for readability, maintainability, and scalability. There is NOTHING you can do with a scriptlet that you cannot do with Beans and jstl tags, and those two things eliminate the problems with scriptlets (not to mention how hard scriptlets are to properly debug).

stultuske commented: trim was what I had in mind too. +14
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Probably true. Not sure, was never ALL that interested. But, as I say, I believe the reason he sees about 180 per instance is simply because it never makes it out of young generation and so any "work" items from the for loop, etc, make up a bunch of "dead" space in the final "used" figure.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Also note that Integer is a class, so you are creating 1000 new instances of that class. That's not the same as 1000 ints (primitives) that would be just 4 bytes each

However, if you look at the class, the only non static member is an int, so, logically, it SHOULD only be 8 bytes, the object reference and the one member (and the object reference was already created by the creation of the array).

However, it probably never gets out of the young generation space and so there is probably a lot of "dead" space.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

srv_date'$srv_date',

Edit: REALLY. LOOK at your query String AND the error. The first recongnizable part of thequery in the error String is "stage_two", SO, look at the query String dirctly BEFORE that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, don't use Runtime OR ProcessBuilder for this, for one, see the API docs for Desktop.open. Then, also, make sure the file is really where you THINK it is AND that your program is running with the "currentWorkingDirectory" that you THINK it is.

Neon Tetras commented: Thanks. I read the API doc. Fixed my problem +0
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Ach, yeah, idiot. Inside square brackets it does NOT need to be escaped, however (unless it is to be the only character in the brackets, otherwise, simply do not make it the FIRST character within those brackets).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't use a "sync" AT ALL. See the API docs for AtomicInteger.

And about using Integer for counter? No way. Each "increment" will create a NEW Integer, thereby changing the object on which to look.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As a note though, '^' is a special character ONLY when used as the first character within square brackets, and an '_' is NOT a special character, at all, so there was no reason for the \\ occurances in your initial regex.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

How about not using split, and, instead, using pattern and matcher with (([^_^]+)?([_^])?)

i.e.

package bogustest;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class BogusTest {
  public static void main(String[] args) {
    String test = "test_String_123_^";
    Pattern p = Pattern.compile("(([^_^]+)?([_^])?)");
    Matcher m = p.matcher(test);
    while (m.find()) {
      if (m.group(1) != null) System.out.println("Match:  " + m.group(1));
      if (m.group(2) != null) System.out.println("substr 1:  " + m.group(2));
      if (m.group(3) != null) System.out.println("substr 2:  " + m.group(3));
    }
  }
}

Edit:
Of course, if you want to keep split you have this
System.out.println(Arrays.asList("test_String_123_^".split("(?=[_^])|(?<=[_^])")));

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Did you do

stack1.reverse(); // or whatever you named the method again

or did you do

stack1 = stack1.reverse();  // or whatever you named the method.

Hopefully you can see the difference, and, hopefully you now realize what difference that difference makes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the JDBC tutorials for PreparedStatement. Cobbling together a statement like this is just BEGGING for problems. Not only for syntax problems like you have, which can even come if the code is right, because what happens if the text for a field value contains a single quote (')? But it also opens you up for SQL injection attacks. E.G. What happens if the text for the last field value is bogus'); delete from table1;?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the tutorials. Start with the "sticky" thread in this forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

We will probably need something better than "or something like that", but my first guess would be to check the configuration of your local mail server. Can you send mail through it using an other mail tool?

masijade 1,351 Industrious Poster Team Colleague Featured Poster
 for (x = 0; x < 5; x++)
    System.out.println("This is x:" + x);

When you do not use braces { } to demarcate your blocks (whether for if, for, when, whatever) then ONLY the next statement is part of that block.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? Sorry to hear that, but what is your question again?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Change line 10 from the OP

private CashDispenser cashDispenser;

and actually assign that variable a value other than null (which is the default for Objects declared in this manner).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

uhm, use cashDispenser instead of CashDispenser? And actually assign that variable a value, of course.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, that can't be the configuration that is being used, as it is trying to use a user "javauser" not "nn". Also, if you are going to connect using "localhost" then don't forget to add a grant for "localhost" as that will not be the same as the grant for "mz.com" even if that machine is "mz.com".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

All I can say at the moment is check your spelling. On windows when not packaged in a jar it will not be case sensitive, but once is packed into the jar it is case sensitive.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Did you check that the file is actually in the created jar?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You don't close the else block of case 5.

Always use braces when using if and you won't forget this sort of thing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

But I want an alphabet to be at its position and a number should be auto incremented.

And for that I said to find some MS Access doumentation which will tell you how to get an auto increment type field and that same access documentation should be able to tell you how to, in a query, make sure that number (as a string) contains a specific amount of characters, and pad it when it is not, as well as how, in an access query, to concatenate strings. Have you done that yet? In any case, this is not a Java question in the first place.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Oh, so, in other words, you are simply going to wait and hope someone does it for you? Find an access forum/documentation/whatever and find out about sequences, then simply slap a letter onto the front of it while padding its length (and the access documentation will also show you how to do that). At least try, then post your attempt and maybe someone will help you fix it, if it doesn't work.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

for oracle investigate "trigger" and "sequence", for mysql invesitage "auto-increment", for other dbs something similar.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

How did printStackTrace "not work". You need to explain that one more. In any case, add a printStackTrace anyway and post the results of that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I done it already but not working properly ! ( Same Error)

Then you haven't done it correctly. Post that,hopefully without scriptlets.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Or by learning some SQL and doing a join.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By using another statement object, obviously.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you are using the same statement to open multiple result sets, see the API docs for Statement where it clearly states that opening a second resultset will automatically close the first.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because variables are not overridden, they are hidden. Meaning it will take the instance variable of the Type that the instance is declared as.

Edit: IOW, as you can see, the first part of that String has nothing to do with method overriding, as no method either sets, nor retrieves the value of the variable. The variable is being set in the class instantiation and being referenced through the instance using the declared type of that instance.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

um, tic[index] = someChar?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You would first need to convert your parallel array structure to a map or a single array of objects that contain both values.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

From the overall height of the desired image, of course.

Edit: And, of course, it is 5 - 2, not 2 - 5, in your example.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because the graphics coordinates 00 is the upper right corner. simply subtract the coordinate you want to paint to from the over all height and use that as the y coordinate.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, have that client close its socket?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, use a JDialog, in modal mode?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You cannot set a null value to a primitive array. You could initialize an array size 0 instead...

Uhm, Yes, you can. You cannot assign null to an element of the array but you sure can assign null to the array reference (which is what the OP did).

@OP your problem is that the second argument in your "read" call is the offset into the byte array (that is the first argument) which tells read where to start adding the bytes it reads, and "total" is probably already as large as size making that write beyond the end of the array.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why wouldn't it be possible to send one? Of course, you have to "create it" beforehand and then simply send it to the ouput stream after setting the content type.

As far as creating it, Google "Apache POI HSSF" (or "Apache POI XSSF" for Office 2007 or later).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why not just use getDate (for only a date) or getTimestamp for an actual timestamp?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You will find them in the tutorials.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the Swing Tutorials (you can find them at the main java tutorial site which you can find in the sticky thread in the forum).

Without much more information that is all we can say.