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

Simply modify your query.

"SELECT contact, start FROM appointment WHERE createdBy = ? and start >= ? and start <= ?"

// and use

ps.setString(1, MainApp.currentUser);
ps.setString(2, new Date());
ps.setString(3, new Date(new Date().getTime() + (1000 * 60 * 15)));

// 1000 millisecond * 60 seconds * 15 minutes = number of milliseconds in 15 minutes.

And then keep a list/map of appointments you have already displayed and check these against the appointments the query returns so that you don't show one you've already shown.

You would, of course, also have to regularly check, but I assume you are already doing that. The interval is something you may need to experiment with.

As a note, it would behoove you to create a primary key on the table so that you do not need to keep the entire appointment in memory, but rather just the key value (such as an auto-increment number). You can then also retrieve all information for an appointment at the time it is needed by querying for the specific key.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hey James, Dani.

Glad to hear it. I no longer have much time to look in here, but glad to see it is still around, and still willing to take, and act on, user input.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Like I said, check that the font you want exists, and, if not, use another.

java.awt.GraphicsEnvironment.getAvailableFontFamilyNames();

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First, ensure a garbage collection is done, then see if it is reduced, at all.

Other than this, java will only return memory to the system if a certain percentage of the heap space is "free", there are command line parameters to use increase/decrease these ratios, but I suggest caution. Simply figure with your java process using the max heap amount of memory (plus some more, since permgen is not included in max heap and java does need some system memory).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Um, check if Arial exists and if not set something else?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Google for JUnit and design unit tests, and then do extensive "business" tests as well. And then you will know that your program is as good as you are currently able to test it for, but some user will STILL find bugs (and you can only hope it isn't a hacker that does it first).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

traverse the directory and remove all sub directories, and all sub directories of the sub directories, etc, a recursive method will suffice.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, don't use scriptlets. Either use a Bean, or google for the sql jstl tag package.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use Boolean not boolean.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the Desktop class and its open method (passing it a url).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Add a "default" case to handle the 31 day months (since they make up more than half of them), and remove those individual cases, and it will also ensure that your variable gets a value.

The reason you get that error is because what hapens if the user enters a number that doesn't match any of those options? What would be the value then. In fact, you should probably keep all of the indivudual case options, and add a default option setting the value to -1 and check for that value (after the switch) to determine that the input was valid.

In fact, what is happening is that the integer value of the character at string index 0 falls OUTSIDE of those options, as the char integer value of the String "1" is NOT 1. Use Integer.parseInt(String).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

BTW THIS

String sql="SELECT * FROM employees where employee_id='"+request.getParameter("emp_id")+"'";

Is just BEGGING for SQL syntax errors and/or SQL injection attacks.

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

Use the getData() method of the DatagramPacket class, wrap the resulting byte array in a ByteArrayInputStream, and use the MessageDigest class and its MessageDigest.getInstance("MD5"); and then DigestInputStream with the BAIS and the MD in the constructor and its digest method.

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

What exactly is your question?

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

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

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

Finished.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Also posted Here.
Anyone answering may wish to check that they are not repeating anything already stated.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then that means your jsp is getting "short-circuited" inside (or before, as I do not know if those price lines are being returned, either) the for loop.

As I said, check the web containers logfiles for any error that did not get propogated back to the browser. And the code beofre the for loop itself would also offer valuable insight.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes.

How, and with what language, or even IF to do so, rather than using one that already exists, depends on your requirements.

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

Just the value of "total" is not getting output, or is that entire line not getting output. I.E. do you see nothing or do you see "THE TOTAL IS" and nothing more.

Edit: And did you look at the web containers logfiles to make sure no errors are being thrown that have not been propogated back to the browser.

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

My guess is that if your Access file is not password protected the username and password make no difference.

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

You are using the same dates on every query. Where are you setting the month/year (by year overlap) and where are you setting the first day of the month on the start date?

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

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

And your question is?

Let see your code and WE will help YOU to correct it. We are NOT doing this for you. The instructions you posted are MORE than enough to get started, so get started.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You need NONE of those. You build a webservice client where you can get normal OBJECTS to work with, rather than a blurb of XML.

Edit: Not true, hibernate COULD help with your DB, but not NEEDED. And JAX-WS IS webservices. Simply google for some web service tutorial and pay attention to the client side of that tutorial (since your post seems to imply that the service already exists and you simply need to USE it).

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

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

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

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

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

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You don't HAVE a table, you have a list, and from your description it is a SINGLE value list. So you have to remember how many of those values constitute a row so that you can insert the tr tags at the proper time and you have to insert the td tags for each value. Better, if you must have a list, would be a List of Lists, with each contained List being the values from one row, then use a double loop. What about all of this do you NOT understand. You cannot produce an HTML table without placing those tags in the produced HTML.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because it is an EXAMPLE showing method overriding through polymorphism.