masijade 1,351 Industrious Poster Team Colleague Featured Poster

sed with the -n option and the "p" "operator". Try reading the man page for sed again, then post your attempt here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Checkout the Map returned by conn.getTypeMap() (conn being your Connection object, of course).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, so what do you have, so far?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course, the stuff with the replacement is completely unnecessary as this

s/^[^=]*=\(.*\)$/\1/

is the same as

s/^[^=]*=//

And the second is probably, at least slightly, more effecient.

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you are on any Microsoft OS chances are that no such server exists on your system. You can also test the presence of an echo server by typing "telnet localhost 7" on your command line and see if it connects. If it displays "Connection Refused", then thats a confirmation that there is no echo server on your system.

And, if you're on a system owned by a company (rather than your own personal) then that server has probably been disabled, regardless of the OS. ;-)

(Most Security guidelines require the disabling of that service.)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And I told you that sort of thing would be a lot more work. Good luck with that, we are not going to write it for you.

For arrays:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html

For Collections (which would be better):
http://java.sun.com/docs/books/tutorial/collections/index.html

caps_lock commented: thanks for the links +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

In that manner, you can't. Create an image that you can create an ImageIcon from to set as the button lable (see the API docs for JButton) and create a Sound file and use a MouseListener to play it with the MouseEntered event (See the Swing tutorials).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, I can at least say that that's nicely formatted. Otherwise .....

Did you have some sort of question you wished to ask?

masijade 1,351 Industrious Poster Team Colleague Featured Poster
hidebutton++

isn't that statement missing a ";"?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm fairly sure you meant "files.length" and not "f.length()".

Edit: Not that that matters though. Once the loop is done, the method will return anyway.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The NPE (as the OP already knows from his post on www.java-forums.com (or is it org?)) is because listFiles will return null on an empty directory so he needs to add an if statement to check for that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

post above: thanks for that, but I dont want to list the roots I want to list the files and files in directories that are in all directories on a computer.

Then what was this?

I want it to be able to go through all roots (drives)...

With no user intervention, so without including "C:\\" or "." as a string in the source, or without a TextIO.java class.

As that is the part I was responding to. You will need to use that.

I think Ive got some stable code now. But I still want to know how to recursive scan the whole computer and not just a drive. At the moment I'm able to scan "C:\\" or "D:\\" and not both, does any one know how I can make that work?

See above. You can only "recursively" scan each drive/root one at a time. But you can loop over what the above mentioned method returns.

Why does no one ever listen to what I say?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The same way you would in any other layout, as an item listener is attached to specific components, and not to a layout. The layout has nothing to do with it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

File has a method that returns all the system "roots". See the API docs for File.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course, since the only thing "in the vector" is a reference to the linked list, not the linked list itself.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Simply use a Set (i.e. HashSet). That doesn't allow you to add duplicate entries, but doesn't through an exception if it is a duplicate (the method to add simply returns false if the entry already exists).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay guys. I'm sorry. I'll try to control myself. Something about this thread just brought out the worst in me, I guess. ;-)

In any case, OP, give it try, as s.o.s. says, and if you have an actual problem, come back with that. If it's that you're still searching for an idea, search the forum a bit, and you'll see that others have asked for project ideas before, and some of them have actually gotten some constructive answers. I'm sure you'll be able to find something there.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

*Ahem*

I have some cold medicine I could give you. ;-)

javaAddict commented: very funny +4
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nay. My own dog lays into the newspapers (if I leave them laying around) often enough, he doesn't need any help in that area. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Or the ASPCA and can confiscate his dog, so the thing doesn't eat it any more. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Who is stopping you from submitting it?

His dog!

verruckt24 commented: good one +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

To tell you the truth, I don't know what you mean "interpret a parameter determined by a JAR file".

If it is simply to be an argument on the command line, then, of course, args[0].

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First of all, why 25 different ping classes? Simply create one with a constructor that takes parameters.

And then you start 25 threads that each start an additional 10 processes and you're wondering why it might take a bit of time?

And, you're performing all of these actions in the event thread (which should be worried about nothing other than updating the GUI).

It would probably be helpful to know exactly what "some modifications" means.

Also, the stdout and stderr have only so much buffer size, and if you fill those buffers then the app will hang until you read them. Read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html completely and thoroughly.

Also, you're setting "scan_fin" true as soon as ping 25 is done (which doesn't necessarily mean they are all done, since 25 could run faster than some of the others and they are all running at the same time). And you should be synchronising access to that variable also.

And, currently, pushing scan does nothing as in this code you've commented out the only method call that would have done something.

You need to do some more general studying about the GUI event thread, threads in general, and Runtime Exec.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What exception? The full stack trace, please.

And add a stacktrace to that first catch block, as well. Besides, getting one exception may close the resultset which would lead to the catch block simply throwing another exception.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the API docs for Float, namely it's varying "parse" and "valueOf" methods.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi, how do I make it show the exact exception that occured?

Post the entire stacktrace that's provided in your logs.

Why should I not be doing this action in a JSP page? What else would I do it in?

Because JSP's are only the "view" portion of MVC. You should not be performing "actions" in the JSP that actually belong to either the control or model layers. Think "Beans" and "Servlets". JSP's should do nothing but display pages.

Its a PHP assignment that I did, but I must rewrite all the PHP code into JSP.

Thanks,

So write it properly. See the link above.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It might help to know exactly what exception occurred. But, first and foremost, you should not be doing this type of action in a JSP.

And this "an exception occurred" doesn't help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then why use a textfield? Simply post the text. If you want to make it look like one, then use a small table and configure it properly.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The top left pixel is 0,0

The divider itself, however, also has a width, and I believe the "location" for the divider is probably based on the "center" of the divider. Try using "getDividerSize", and some math for the adjustment.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You're missing the loop. Think "while"

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the comments on this code here:

http://www.daniweb.com/forums/thread162658.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, an upload is obviously the right way, but not in a JSP. God's write an actual Servlet, for Christ's sake. This scriptlet stuff is becoming a real scourge. Let me guess, you got this from roseindia, right?

Also, I assume that "/usr/programs/apache-tomcat-6.0.16/webapps/Pinnacle" is the directory in which your application is found? I.E. the Context Root. There are better ways of getting that information than hardcoding it.

Also, using "\n" in that "indexOf" stuff is also a bad idea. What happens if the client doing the upload is a MAC (which uses only \r for the line endings)?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Seemingly not soooooo Urgent, or you'd be working on it rather than simply whining/posting about it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

smack package? What's it do? Spank you?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

http://forums.oracle.com/forums/message.jspa?messageID=3167957#3167957

Here i idea but how to change in mysql syntax

Http://www.mysql.org/ ? Maybe? There are forums there, too, you know?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What about it? This is not an SQL forum, and your's is an SQL question.

As I have already said
Find an SQL Forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

An "order by" clause ?

Your question has nothing to do with any programming language, what-so-ever. Find an SQL forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Maybe masijade will know.

Nope. Only have very limited experience in Perl on Windows. And, truth to tell, almost no experience in Perl the last four years, so I'm a bit rusty, anyway. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I said chdir function. Don't use the system function to do this, use the chdir function.

http://perldoc.perl.org/functions/chdir.html

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Each system command gets it's own "shell" (if you want to call it such, it's not really a complete shell, but it is an executiuon environment). So, the cd is working, but it's happening within that subshell, which means the shell in which the perl script itself is running, remains unchanged. Use the chdir function.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use the

read(byte[], offset, length)

That method returns how many bytes were successfully read, or -1 at EOF.

Use that return value to modify the offset and the length and call read again.

Doing this in a while loop (i.e. != -1) will ensure your success (in the absence of an IO error, of course).

Try it and if you have a problem post that code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Vernon, no disrespect intended there. I didn't pay any attention to who it was that was posting. Just feeling a little pissy, I guess. It happens. Sorry.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Stick with your thread on Sun, you are getting good advice there.

http://forums.sun.com/thread.jspa?threadID=5353799&tstart=0

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And you were already told, no.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

> public static Color CopyAttributes (someclass bclass) C# bites? ;-)

Whoops, forgot to include the Color argument. Oh well, he should have been able to figure that one out himself (hopefully).

In any case, I agree with you. This duplication of data is stupid, and probably only done to avoid "having" to do getRed and the like, all the time. But, sometimes, I just don't feel like taking the effort to try talking them out of it. It is usually like "talking to a brick wall" and only half as effective.

;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I assume that these classes are all of the same type (or at least all extend the same type)? In that case simply pass the object itself along with the method call;

Instead of

public class aclass
{
    public static Color CopyAttributes (Color newcolor, int red, int green, int blue, int alpha)
    {
          red = newcolor.getRed ();
          green = newcolor.getGreen ();
          blue = newcolor.getBlue ();
          alpha = newcolor.getAlpha ();
          return new Color (red, green, blue, alpha);     
   }
}

do

public class aclass
{
    public static Color CopyAttributes (someclass bclass)
    {
          bclass.setRed(newcolor.getRed ());
          bclass.setGreen(newcolor.getGreen ());
          bclass.setBlue(newcolor.getBlue ());
          bclass.setAlpha(newcolor.getAlpha ());
          return new Color (red, green, blue, alpha);     
   }
}

Or define an interface with those setmethods and have the classes implement that interface, and then make the interface type the argument.

VernonDozier commented: Helpful approach. I hadn't though of passing a class or interface. +10
masijade 1,351 Industrious Poster Team Colleague Featured Poster

A while loop and a regex, but I assume that that may be beyond you at the moment.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

> byte[] b = new byte[f.length]; .

Array bites? ;-) byte[] bytes = new byte[f.length()];

:icon_redface: :)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Integer math will return an integer and integers do not have decimal places. You need to cast one of those numbers to a double while doing the division.

PercentTotal = Votes[i] / (double) Totalv * 100;

But, to tell you the truth I would probably simply make "Totalv" a double to begin with.

...
double Totalv = 0.0;
...
Totalv += Votes[i];
...
PercentTotal = Votes[i] / Totalv * 100;
...
Ezzaral commented: Gotta love the int math bugs :) +15