masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the file and write a new file leaving out the pieces that should be "deleted". Then delete the original file and rename the newfile to the the name the oldfile had.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And what exactly is your question? All I see is a few unrelated actions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

but you shouldn't.
NEVER assume you have sole control over the terminal.

Correct. I was hoping he would take the hint, that when you have to go so far out of your way to do something so seemingly simple, that it is either not worth it, or not truely desired. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What is clrscr()?

ClearScreen (I assume).

@OP

System.out.println() about 100 times, or JNI.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you're going to have to reproduce the results yourself.

Take a look at the values to be written into each field, find the longest, and pad the rest in that column to match it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi Masijade,

Could you please help me in understanding the String.format() more closely. I am in urgent need. Could you help by giving some examples.

Thanks,
Ashok.

Read this carefully

http://java.sun.com/javase/6/docs/api/java/util/Formatter.html#syntax

And then, as already said, attempt to do it yourself, if you have problems post what you have and we will attempt to help you correct it. And that link contains examples and a complete explanation of the format string to be used in the format method, so it will contain more than enough information for you to be able to accomplish your task.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's cool. I was mainly explaining for the OP's benefit. The more he understands the less he has to ask. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Just to clarify (in case you don't realise it)

sed 's/^.*,\n$//'

doesn't work because sed is a line editor. It works one line at a time, and the "\n" at the end of the line is the end of the pattern, i.e. it is $. For that reason "\n$" will never match. Also, you cannot remove/replace the newline, for the same reason. That is the reason that the "N" command exists, so that you can pull an additional line into the pattern space, thereby making the \n a part of the pattern, rather than it being the end of the pattern (now the \n at the end of the second line is the end of the pattern, until you read in a third line, etc.)

At least that is the way I understand it. I could be wrong though.

Edit: And, by the way, just as a side note, if that command had actually done anything, it would have deleted the entire line. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have added the JLabel to my container..

Did nt include that part of my code as it dint seem important..

What was about the "REFRESHING" that you mentioned..

I am sorry was unable 2 get it

call validate() on the component you added the label to.

Also, replace that

} catch (Exception e) {}

with

} catch (Exception e) {
    e.printStackTrace();
}

Then tell us if any error occurs. Simply swallowing errors, like you are doing, is very, very, very, very bad practice.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Generally URLs are only used for the internet, use Files for local stuff...

True, to an extent, but it still works with a url, as it will be given a "file://" url, rather than an "http://" url. It is still valid. His problem lies either in that he is not adding the JLabel, at all, is not calling validate() on whatever he added it to, or, because he is calling "new JLabel" in the try block, he is not actually changing the JLabel that already appears in the GUI, but rather creating a new one and not doing anything with it. (I believe, anyway.)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, you are neither adding the JLabel to anything, nor "refreshing" whatever you might have wanted to add it to.

Edit: And, if you want to change a Lable that already exists somewhere in the GUI, then don't use new JLabel() in the try/catch block. If you do, you have created a new JLabel, but the original still exists and is still a part of the GUI.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

please do your own work. And, even if people are willing to do your (home)work for you (and not despise you for so shamelessly asking it), you would find them at an SQL forum (which is what this question is about) and not a Java forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If they are coming from the same statement, no. The API clearly says that any time a statement executes a query, all previous resultsets will be closed. Multiple statements on the same connection will allow you to have multiple resultsets. One per statement. However, as has been pointed out, if you are using the JDBC-ODBC bridge you may only have one statement at a time.

What DB are connecting to, and what Driver are you using?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

no, find an Excel forum. It's an Excel question, not a Java question.

didn't we have this exact same conversation on the Sun forums earlier?

Yep.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

that would be one resultset per statement, not per connection.

Yep. Hate those little (BIG) mistypes. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

// runtime error encountered , cannot resolve symbol i

And, besides, that's a compile time error, not a runtime error. It doesn't occur in either case, so this can't be your actual code, or you are actually attempting to compile something else and only think you are attempting to compile this one.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Place the values in an array, then use Arrays.sort and select the first value (the last value is the highest).

masijade 1,351 Industrious Poster Team Colleague Featured Poster
order by fieldname sort desc

This is an SQL question, not a Java question. In the future find an SQL forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can have multiple statements on one connection (though only one resultset per connection, normally), but seemingly, your connection can only have one statement active at the same time. Are you, per chancce, using the JDBC-ODBC Bridge, if so take a look at this:
http://java.sun.com/products/jdbc/faq.html#15

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, don't just use spaces on your own.

Try formatting as he suggested. Take a look at
String.format()
to format the String before output or
PrintStream.printf()
to format the String during output (System.out is a PrintStream if it is System.out that you are using).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As far as an IDE, that's all your personal choice. My preferences (and they are only just that, my preferences), are an Apache web server connected to a Tomcat over mod_jk. The Tomcat as your web container, and a PostGreSQL DB. If you have a company backing you, to pay for licenses and the like, then I would actually still go for the Apache, but I would use BEA weblogic and an Oracle. Once again though, those are only my preferences, you will have to decide for yoursefl what you want to use.

As far as examples and the like, use the tutorials, that's what they are there for.

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
http://java.sun.com/javaee/5/docs/tutorial/doc/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You need a login system, a rights/roles system (i.e. who can do what), and a DB store a document (or just it's info) and its current status and history.

You will need filters to control logins and sessions, servlets for post actions, jsp for displaying the data, and beans for carrying out the DB actions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Simply try to find another way, as I have no idea what it is you are actually asking.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course there are, and if your question had actually made any sense, someone would have answered it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
....
    b1.setActionCommand("enable");
    b2.setActionCommand("disable"); 
....
 String s1=e.getActionCommand();
....
    if("quit".equals(s1))
....
    if("saiyan".equals(s1))
....

Enough said.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Reflection (to see if the method exists). Search for it. But I haven't got a clue what kind of a screwed up design you have.

Also, with an interface, you do not need to know the name of the class of the object being passed in, but whoever wrote that class needs to have either implemented the interface, or extended the base class. Your method need know nothing more about it.

I makes absolutely no sense to just assume that an Object will have a specific method when there is no prior defintion of the method. And that is exactly what the compiler is telling you with that error message.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You've created the variables in TestSort1 and try to use them in Sort1. Doesn't work that way.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because, the only methods that all objects have are those methods defined in Object.

What you want to do, doesn't exist. If want something at least a little bit like this, then read reply #5 again (the part about abstract classes and interfaces).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And you don't need to. An array is a special type of Object, and length is a field of that object. But the "objectness" (yes, I can make up words) of an array is not something you need to worry about.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I know there isn't one, since what you want doesn't work the way you want it to, and you've been told that a million times.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I haven't tried it very often, but look up the sed command "N". It is meant to append an additional line into the pattern space. Try something like

/"[^"]*$/{
N
s/\n//
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

So?

What are they? Try to fix them as well.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

*sigh*

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I think, masijade, that he wants to call this method:whateverMethod(Object obj) with any kind of object and for the method to do what is necessary every time dynamically. Meaning that I don't think that he intends to check what type of class he is passing in order to do casting.
Perhaps if he wants to save the object he is passing, he should consider serializing/desirializing

My "solution" is the same thing, simply "widened" with varargs so that the number is not limited to only one. That is, of course, even worse, but the principle in both remain the same, as well as my last statement. The need to do this is usually (not always, but usually) a result of bad design. The very least he could do is to create a base abstract class to inherit from, or an interface to implement, and use that abstract class or interface as the parameter. That, at least, dictates some restriction.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What are you talking about? Send a parameter dynamically? No idea what you mean there.

However, why don't you just make the defintion as follows:

public whatever whateverMethod(Object... arguments) {
  // whatever
}

Now you can pass it as much of anything as you like.

The necessity for something like this, however, means you have a bad design and need to rethink your application design.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I think masijade is refereng something like Tomcat How to on their home page that should be your first place to check if you do not have any books on this topic

Actually, the tomcat distribution contains all of the doumentation for that version. All you need to do is start Tomcat and you can read the stuff locally over http://localhost:8080

peter_budo commented: fair point +7
masijade 1,351 Industrious Poster Team Colleague Featured Poster

It means your session will be invalidated if more than 60 seconds go by between the last response and the next request.

How your application handles expired sessions depends on how you programmed it. And, if you have a "logout" page you should be invalidating the session manually there. You can still have a timeout (the maxInterval), but remember that this is general to the eintire application, not a specific page or two.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By reading it's documentation.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Can you do it in HTML? If not, then you can't do it in JSP, either. If so, then have the JSP produce that HTML. Where's the problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because the designers thought the language was better off without it. If you want more information, go to James Gosling's blog site and ask.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do the API docs say?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If it is meant to be between multiple hosts simuteneously, then UDP to a multicast address over multicast enabled network interfaces.

Edit: If you need to be absolutely certain that every message is received, then TCP.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A directive to the browser and/or proxy server not to hold a cached copy of the page. Nothing to do with a session.

Edit: Or, more correctly, that whatever cached copy they do hold is invalid as soon as they made it, and they should retrieve a fresh copy rather than using the cached copy.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

there are ways to do it manually, using timers and threads in the application

Correct, of course, I should have said

but it is not practical for your classes to automatically expire the session

instead of

but your classes will not be able to automatically expire the session

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Show more of your code.

Edit:

And use code tags, and start your own thread rather than hijacking an old one.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

To have it expired automatically, you need to configure the Application Server/Web Container properly.

Reading the session properly, and redirecting to a login page, is something you will have to do though.

The above command is the one the server will use, you can use it yourself, as well, but your classes will not be able to automatically expire the session, so it only makes sense for you to use the command in your code on logout, or after invalid actions (according to your application).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the error messages you get when you compile and try to fix them.

Provide us with those error message, and we might help you, but we are not going to guess at what the errors might be.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Show your code, because from what you've said so far, I am certain you do not have a servlet, so of course it "won't work" in Tomcat (or any other web container/application server, either).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Like I said, let me see how you "ran" the servlet. Lets see the code. A Servlet is not a standrad Java class, and would definately interest me to know how you were able to call the service method properly and pass it a request and response object, along with everything else that is needed (such as ServletContext and the rest) for it to run properly.

IOW, what you have is not a servlet.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi all,
I`m doing a project on an online bulletin board.
I`m not able to configure tomcat in my windows machine.
And i`ve been able to compile and run servlets in command line.

Then its probably not a servlet, as it is notoriously hard to get a servlet to run (properly) from the command line. How are you running it?

Its the browser where i want to see the servlets run.
Any help will be appreciated.
I have tomcat5.5 and jdk1.5 also 1.14 in different machines.Same problem in both the machines.

What, exactly, is the problem? What error do you get?