masijade 1,351 Industrious Poster Team Colleague Featured Poster

A JPanel with JButtons (or JLabels and a MouseListener) and setVisible(true/false).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Google for a few mock exams.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Umm, peter, I thought you knew this one. ;-)

str = servletData.toString();

I believe should be

str = new String(servletData);

or

str = new String(servletData, charset);

if the "bytes" are neither ascii, nor UTF, nor the local charset.

The second one (with the toByteArray()) is correct, but if its not working then check out the charset variation.

And Merry Christmas and a Happy New Year! (and if you're not Catholic/Christian/Other Derivatives don't take offense). ;-)

peter_budo commented: Great mind +7
masijade 1,351 Industrious Poster Team Colleague Featured Poster

As I said, check out the man pages for printf.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Check out the man pages for printf.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

i could easily complete this task myself,

Yeah, right. Let me guess you have a few bridges to sell, too, right?

but thought i'd get someone else to check it out for me first.

Rather, you thought you'd try and get someone else to do your (home)work for you. The usual lazy, ungrateful, overbearing, obnoxious, kid. You come a dime a dozen (and over priced at that).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Parse the String to a Date using SimpleDateFormat, initiate a Calendar with that date, then use the get(int) method of the Calendar.

See the API docs for SimpleDateFormat and Calendar/GregorianCalendar.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What error?

And where is the import for Viewer?

Don't tell me that you are trying to use the same package that the iText classes use, and so you think you can reference their classes without an import.

It doesn't work that way. Put your classes in their own package and import the iText classes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

oh shut up u puff, stop whining and just get on with it. if you got nothing helpful to say then fuck off!

Look who's talking.

Not getting much help are you?

I wonder why that is?

Your attitude, maybe?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have the clients "register", and have the server keep a list. What's the problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, what do you have so far, and what problems are you having with it. No one is going to write it for you. We will help you fix your mistakes, but not do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What "java pdf library" did you check and provide the code for the way you checked it, because iText can do this easily. Although I don't really know why you need to know the number of pages in order to simply feed the document to a browser (which is what all your other posts about this have been about so far).

And don't simply tell me that you have already tried this, show me.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What are you talking about?

You want code to change code? Are you attempting to build some sort of parser or something?

Also, there is nothing "contrary" about the comparison between if/switch and for/while. Those statement groupings do the same things, not "contrary" things, which makes your post even less understandable.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
Integer.parseInt("10101", 2);

Does what you said.

Integer.parseInt("ABCDEF", 16);

Parses a hexidecimal number. The second number is the radix (as the argument says). If you use 2, then yes, its binary. If you use 16, then its hex. The radix is "base" you're talking about. Have you tried it in that manner? Seemingly not, or you would not have made that last post. Just because, in whatever example you saw, only 2 for binary was used, does not mean that that is the only "base" that the method understands.

Edit: It does not simply convert a binary String representation of an integer to a String representation of an integer in another base. That is not how it works. It takes whatever String you give it and parses that String into an Integer using the radix you give as the "base" for the String representation in the first argument.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
public class OutlookPanel extends JPanel {
    public OutLookPanel() {
    }
    public OutLookPanel(Layout layout) {
        super(layout);
    }
    public OutLookPanel(boolean isDoubleBuffered) {
        super(isDoubleBuffered);
    }
    public OutLookPanel(Layout layout, boolean isDoubleBuffered) {
        super(layout, isDoubleBuffered);
    }
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please use a few imports. Reading that code with all those explicit calls is painful, and annoying, and I, for one, am definately not going to "fight through it". Use some imports and then repost your code.

And, I will ask again, what is wrong with Integer and its parseInt(string, radix) method? And, to go along with that, Integer and its toString(int, radix) method.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Post your code, and what Class is not found?

And make sure to use code tags when you post your code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The WorkerTester.java file as well as all the other files associated with it is located in the directory, so I don't think I have to specify the classpath as a parameter.

"." is not necessarily on the classpath, and if it is not, then yes, you do have to add it. So did you actually try with the command I showed you? Or did you just assume that it wouldn't make a difference? Also, try to compile one of the classes that does not depend on any of the others, and then make sure that the classfile actually appears in the same directory as the java file (not that you have some alias set that automatically causes the compiler to place the class files elsewhere). If it is there, then compile them one at a time from the file with the least dependencies, to the file with the most. More than bit annoying, but hey.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

hi from my understanding there is no default constructor defined in any of the Classes that you wrote.when you are overloading constructor the default constructor is not provided. externally you have to write the default constructor

tell me i am wrong.

This has nothing to do with a default constructor. And, you never have to implement a default constructor. Only if you want to.

Edit: Well, I shouldn't really say never, but at least the cases where you might have to are not that common, and definately not a problem in this case.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Seemingly.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JApplet is a "top-level" widget, and getContentPane() returns the JPanel (which is a Container) to which items could be added.

Do you understand the "extends" keyword, and, if so, did you bother to read the API docs for that getContentPane() method, which is the one returning the container?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the API for Class, namely the newInstance() method.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I would say to read the documentation and/or ask on a webshere forum/mailing list.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

alrite lad, calm it.just ask nicely and i shall.

What? We have no need to "ask nicely". We are not the ones asking for help here. And, it looks as though you aren't going to get any.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

threads

masijade 1,351 Industrious Poster Team Colleague Featured Poster

But, okay, to play along, recursion and the tertiary operator.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is not what you said.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
Arrays.sort();
masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can't. The JSP runs on the server, JavaScript on the client. The only thing you can do is set a parameter and submit a form (or something to that effect).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course it does. Try with a calendar and simply count the days. You can use an if statement so that you don't increment on Sa and So. Try to implement that pseudo code with a small change

counter
current date = start date  // current date is a Calendar object however
while (current date less than end date)
  if current date not sa/so increment counter
  add one to current date

Read the API for Calendar/GregorianCalendar

I already listed the methods you will need, and if you look at the "constants"/fields defined by Calendar, you will easily see which ones you need to use in the methods and in the if statement.

Edit: Try this, and if it doesn't work, post that code and we will help you correct it. The code you posted, will never be able to adequately account for "skipped" days. It would be able to approximate them, but never really acount for them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And I have no idea what you mean with that statement.

Is this your code? If so, what problem are you having with it? If not, ask the entity from which you received the code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi dont mistaken me,i know the logic but some problem occur so you please send to the example code

Well, like I said

Well, lets see what you have.

I am not simply going to post the code here, without you having proven that you have already tried it. From What I see here, you are simply trying to get someone else to do this for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do you know what API means?

It means Application Programming Interface.

iText is a library (a jarfile) that provides you with methods for doing this. It is not a "software that does this work". But, if you want to reinvent the wheel, then please, go ahead, just don't expect anyone else to do it for you. You are going to have to inspect the actual format of PDFs (in all the varying versions) and learn how to read and manipulate them yourself. Or, you could simply download and use an API.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Google "Java PDF API" or "iText" (which is a Java PDF API, just not the only one).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

pseudo code

counter
current date = start date  // current date is a Calendar object however
while (current date less than end date)
  increment counter
  add one to current date

Forgot to mention that you will also need compareTo from the Date class (and the if is not needed when done this way).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, lets see what you have.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What's wrong with the Integer class and its varying parseInt() methods?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I think there's a library in the Jakarta Commons project that's supposed to pretty much automate commandline parameter parsing.
Whether it's easier to use that than parse them yourself I can't tell as I've not used it ;)

I should have known, but then again I don't deal with this too often either, so I haven't bothered looking for an API. But, if its a "common" task, jakarta commons usually has something for it. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You should be using forward, and not redirect. The user should only ever see the url he originally clicked on then. Also, use filters to perform the authentications, not the JSP itself.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

How about this one:

"What I did all year, rather than even attempt to come up with a final project."

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you tried "reloading" that page, or is it simply a static version cached by the browser?

If you are able to "reload" the page, then I am willing to bet that you are using getSession(true) to retrieve the session (in which case you are creating a new session if one does not already exist).

The static, cached page you can't really do anything about (from the server). You can set response headers and pragmas (Google no-cache and expires) to try and prevent it, but the browser does not have to follow these. Or you can use some JavaScript to play with the history, but the browser may have this deactivated.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, all the args come as String first and they will (or should) all start with "-". So, chop the first character of the String (if it is not "-" then return an error and exit). Then chop the next character (charAt()) and run that through a switch statement.

i.e.

int n;
File i;
for (String arg : args) {
  if (arg.charAt(0) != '-') {
    System.err.println("whatever");
    System.exit(1);
  }
  switch (arg.charAt(1)) {
    case 'n':
      n = Integer.parseInt(arg.substring(2));
      break;
    case 'i':
      i = new File(arg.substring(2));
      break;
    default:
      System.err.println("Invalid .....");
      System.exit(1);
      break;
  }
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

As I have told you already (maybe you still haven't gotten it after all), you are not "opening" anything with this code. You are simply telling the browser what it is to display (you do this by setting the content-type and content disposition) and then feeding the data through.

The browser is deciding what to do with it (i.e. how to display it). Java and your JSP has no control over this. From this point on it all determined, and controlled, by the browser, on the client. The server and the JSP has nothing more to do with it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A Loop, counter, an if statement, a Calendar and its add(int, int) and get(int) methods, and its day of the week named constants.

Read the API docs for Calendar, then try to whip something up based on the above, and if it doesn't work, post it, and we'll help you to correct it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

create a object ab using InputBufferedReader method.
....
read() reads a character by character from the input.

If you mean BufferedInputStream then no. It reads byte by byte, which is not necessarily the same thing.

If you mean BufferedReader, ok.

But there is no such thing as an InputBufferedReader (which would have to be a class and not method BTW).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In your ReplaceText class, in the saveOutput method found in the file FindNoun.java line 92 you are using a variable that is not defined (or is defined with null). Which is, of course, exactly what the error message says.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, first of all, use a Connection Pool. Don't make a connection everytime the JSP is called, that is just plain bad practice.

Secondly, move all this stuff out into a Bean where it should be. All this Scriptlet stuff is wholly unmanageable.

And seem to be reading the data a row at a time, but want to fill the table a column at a time. And you seem to be doing this by outputting, essentially, an entire table for each row with only one column being populated. So I need to ask why you thought that would work?

You need to read all of the data storing it into a multidimensional array to arrange it properly, then you can output the array a "row" at a time and get the display right. But that is the last I am going to say on the topic until you get rid of all this scriptlet junk.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

But, you are not opening the application with Java. That is exactly what I said in the last post. You are simply setting a content-type type (and filename with extension since windows is stupid enough to need this info) and then passing the file through byte for byte. How the file gets displayed on the client is determined by the browser.

I tell you what, change your file settings remove the ".xls" association. Then access an excel sheet using your JSP and tell us what happens. The browser displays a bunch of BS in the browser, rather than using excel to display the sheet, doesn't it?

Like I said, you are not opening excel on the client in your Java code, you are simply letting the browser know what it is you are sending, and the browser is deciding how to open it.

It's not that hard to understand.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

We would if we had any idea what you were talking about.

Provide the relevant table information, and the code you're using to access it, and a better description of exactly what you expect as compared to what you get.