masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sorry, but you do realize that that only investigates the first element in the list, right?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use Boolean not boolean.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sorry, until you get rid of those scriptlets and program your JSPs PROPERLY, I am keeping quiet.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, place the mysql jdbc driver jar on the classpath?

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

Have fun. I don't think ANY one person would be capable of writing those photo (and even worse video) recognition algorithms.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, what have you got? If nothing, then Start Here.

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

Come guys, the way this looks with the one poster having 2 posts and the other only 1, I think this is some kind of amateurish promotion "scam" for this product and BOTH users are probably the same guy, and probably someone related to if not the owner of the product.

happygeek commented: yep both have the same IP - typical bait and respond spam +12
masijade 1,351 Industrious Poster Team Colleague Featured Poster

That applies to ALL instance methods, which is the reason that method overriding works.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Eww, that with the notification email could also turn out to be a windfall for the hackers. What's to stop them from sending a phishing attack (although that is not really necessary, but could also give them the "new" password) or trojan email using that as the bait?

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

I would say, first, to contact whoever you got this "Tribot" from, and second to file a bug report with oracle.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm

throw new SecurityException()

and

throw new StackOverflowError()

maybe?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You are entitled to your opinion, BUT, when the process is EXPLICITLY defined by the JLS to NOT do that, it doesn't really MATTER what your opinion is.

Edit: Also, you STILL do not seem to have grasped the fact that C++ "works" that way IN THE CURRENT IMPLEMENTATION of the C++ specs that YOU ARE USING. Other implementations may NOT work that way, as C++ DOES NOT DEFINE how the process is to work.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That means one or more of the preceding character (class). I.E. There must be at least one of the preceding character (class), but there can also be more than one, and, if there is more, than all of them will be matched.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

@s.o.s

You can also escape the literal -

System.out.println("This is _ a - test?.".replaceAll("[_\\-?]", "+"));

produces

This is + a + test+.

But, including it at the front or end looks cleaner. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It greps whether the command used contains the string "/transforms/" and returns 1 if it does and 0 if it doesn't.

$0 (or, iow, ${0}) refers to the actual command used on the command line.

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

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

Yes. That is what I said, isn't it? And check the constructors for JDialog (see the API docs, of course) so that you can properly define your constructors and properly set the "parent".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

post the code for the initial frame creation, the setting of the look and feel (should be the same place, hopefully), as well as the code for the creation and display of the "second form".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This looks like a tutorial to me.

It looks like someone posting their homework assignment, to me.

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

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

Take a look at the anchor property.

Edit: You'll also need to look at the weightx property. You can read about it in the general notes for the GridBagLayout class.

And weighty, of course (if he wants the upperleft, otherwise he'll just get the left. ;-)

Ezzaral commented: Yes, and weighty too ;) +15
mKorbel commented: both contstrains +1 +9
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.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Only administrators can bind ports smaller than port 1024.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, where is your catch block for this, as any number of exceptions can be thrown by this code, and I have the sneaking suspiscion that you are ignoring them.

peter_budo commented: Catch block still trying to catch with rest of the code :P +16
masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Your first mistake is making this a scriptlet in a jsp. At the very least use either a Servlet or the sql JSTL tags, better would be to use some application beans. The actual error, however, means that you have an empty field in that row that you are retreiving as a String (and so results in null) and you are parsing that String to a number. Since the reference value null is not a valid String object (and even if it were the value would not be a valid number value) you cannot parse it to a number. Why do you not use getInt, rather than getString. And query the table explicitly (i.e. select col1, col2, ... rather than select *) and use a null check (in oracle it would be something like nvl(col, defaultValue), in Access I don't know and don't feel like checking).

javaAddict commented: Short but to the point +13
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I've already told you that until it compiles there is nothing to execute.

And, as far as being new goes, then you need to start with something simpler, such as the official tutorials.

stultuske commented: hear yeh, hear yeh .. +10
masijade 1,351 Industrious Poster Team Colleague Featured Poster

loop backwards, currently once you do removeRow(0) the former row 1 becomes row 0, then when you doe removeRow(1) (really row 2 now) the original row 3 becomes row 1, etc, etc.

mKorbel commented: that right +1 +8
masijade 1,351 Industrious Poster Team Colleague Featured Poster

By simply catching IOException and using the getMessage method on the exception and the contains method on that String. You can not catch only that exception, though. If you want to make sure that the rest of the method will still continue if the exception is anything but that, then wrap just the statement that might throw that exception in its own try/catch block.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yep, that's the other thing, using the schema/owner references. I don't know that the brackets are necessary there, and even if they are, then only around the reserved words.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you have not "included it on your classpath" properly. How did you "include it on your classpath" and how, exactly are you executing this code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you are working with relatively small amounts of records (in the low thousands in one hit) with a single transaction, use hibernate or some other object representation framework, if you are working in bulk (hundreds of thousands of records or more in one hit), use straight JDBC (or maybe something like ibatis). In either case use the containers connection pool.

peter_budo commented: Good to know that some others know ibatis. My colleague will be very happy ;) +16
masijade 1,351 Industrious Poster Team Colleague Featured Poster

No it is not. You should read the mysql user manual (and pay close attention to the part about grants) and give the root login a password (or restrict it to only the unix socket connection), delete the "blank" user account, and create an application user for your application.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

it must be if (th<T1 && sw1==true)

Actually, it should be

if (th<T1 && sw1)

IMHO I find that "boolean==true" or "boolean==false" completely assinine. Some say it helps "readability". BS, complete BS. If any programmer cannot read "boolean" or "!boolean" there's a problem, and not with the code. If you don't agree with this, that's your prerogative, but this is just a little pet peeve of mine.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

try "man gcc" or google for gcc documentation.

vedro-compota commented: ++++++++ +3
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please ask a coherent question.

Ezzaral commented: No kidding! +15
masijade 1,351 Industrious Poster Team Colleague Featured Poster

@ not at all, some InHouseAppS have long, long story :-)

Yes, all. If a company contracts someone to write code for them, or someone writes (or even just tests) some code on that companys computers, that code belongs to the company. The only way it does not is if the company wrote a specfic contract in that manner, in which case they hopefully contracted for support, and if not, they need to throw it out as it is nothing but a dead weight for them and they were fools for doing it that way.

Edit: And, p.s., if it is a program that got into the company in any other way (i.e. someone wrote it at home and simply brought it to work and started using it) then the company still needs to throw it out as a security risk (and possibly/probably prosecute/discipline the employee) or the employee needs to start a process of getting it verified/certified with the company, which would then, probably, also require a support agreement, again.

Edit Again: At least this is the way in which most company employment contracts and/or computer use restriction documents are written.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See JDialog instead of JFrame.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The servlet url, of course, with either post or get.

Dean_Grobler commented: Didn't know it was just as simple as that, thank you. +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm I would comment out the "throw" statements in the mouse listener interface methods, again. Not that that, necessarily, is your problem, but ....

cwarn23 commented: Thankyou for the great advice :) +6