Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

table[tr/td/b/font='Nohup Files'] seems to work for getting the table element, if that's what you are wanting. I tried it out with the following structure

<root>
    <table>
        <tr><td><b><font>Not this one</font></b></td></tr>
    </table>
    <table>
        <tr><td><b><font>Nohup Files</font></b></td></tr>
    </table>
    <table>
        <tr><td><b><font>Other</font></b></td></tr>
    </table>
</root>
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Like the poet says, love is a mutual thing. If it's one sided, then it quickly turns into agony.

I didn't say a word about anything being one-sided. Not sure where you got that.

A couple that truly loves each other doesn't need to exchange many words.

You are completely mistaken about that. Don't let some romantic notion lead you to believe couples that "truly love each other" don't need a lot of verbal communication to make it last.

I look at my mom and dad, and see love every day.

And chances are they talk things out constantly and argue occasionally. I guarantee it's a lot more than body language and unspoken understanding.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Lardmeister, when/if you get married, you need to come back and re-evaluate that statement :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

582

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can use getWidth() and getHeight() for those parameters.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>Also, does anyone know how to add to an existing file, not just write over it?
There is another constructor for FileOutputStream that allows you to specify append.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do not hijack and bump old threads to add your question. Create a new thread for this. Read the forum rules.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you commented out the line that would have read the name data, so you're going to need to put that back in or skip ahead in your input stream somehow. Since you're using some third-party TextReader class, we can't really offer much advice on using that specifically.

Edit: I guess you figured it out, but the code you have posted doesn't really match with that text file you attached.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just as a stapler will bind paper, love will bind people.

A stapler will bind people too, if it's big enough.

Nick Evan commented: yup +14
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

570

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

566

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

554

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

As already mentioned above, if you return an Integer object instead of a primitive, it can be null.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm think you can set the working directory through the project properties in Eclipse, but I don't have it here to look myself. I would think the root working directory would be "Desktop/CS Programs/CS 2410/CS 2420" but that may not be the case.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Or is there any method available in string class which reads only those data which are of datatype double from the file.

The String class doesn't, but there are methods for that on the Scanner class if you choose to use it to read your file instead.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are parsing methods for that in the wrapper classes for the primitives (Integer, Float, Double, etc). Take a look at Double.parseDouble()

One last reminder here: use [code] [/code] tags around any code that you post.
By 15 posts you should know how to use them and this will be the last unformatted code that I'll take the time to read.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's actually relative to whatever your projects "current working directory" is, which I am not sure what that is by default in Eclipse. You could try placing a copy of that file in your project's root directory (not the src directory). Or you could just specify the full path to the file.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is a small data structure

class DataPoint{
  public int someValue;
  public float anotherValue;
  public String aLabelPerhaps;
}

These can be kept in a List

List<DataPoint> dataPoints = new ArrayList<DataPoint>();

instead of defining 5 arrays. Each line in your data file is represented by one instance of that data class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Once you get that part working, you have a bit of work to do on the logic of your loops to populate the puzzle array.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your current code is passing your System.in scanner to your Sudoku constructor. You need to create a new scanner for your input file and that is the one you want to pass to your constructor.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, use the Scanner to read the values from each line in the file and into your variables. I would recommend creating a small data class to replace your individual arrays and use a single ArrayList to hold the instances for each point.

Edit: You could just as easily use your current file reading code with the split() to populate the data instances. You certainly don't have to use the Scanner if you don't want to. It just has some methods that make it more convenient.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There certainly are ways to return null if nothing is found, but the point of the discussion above is that there are often more useful idioms for that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... I was just being facetious ... :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Read the API doc on the Scanner class. It can read from a file just as easily as it can from System.in.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, I always thought that Tom Hanks guy was kind of shifty...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Any code posted should be placed between [code] [/code] tags so that formatting and indentation is preserved.

Please ask specific questions. "Can someone help me finish writing the code so that this program will work?" is not a specific question. No one wants to complete your homework just for the sheer fun of it. If you don't understand how to implement a particular section, explain your thoughts on that section, perhaps some pseudo code, and what you have tried.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

After 61 posts here, you should be well aware that "chat-speak" or "IM-speak" is discouraged in the forum rules. Are you really too lazy to type out all of the letters and use punctuation where appropriate? Should anyone else spend their time to help someone who doesn't care enough to take the time to communication properly? Think about it.

That said, try the Java Media Framework. You can find a lot of demo code and examples here: http://java.sun.com/javase/technologies/desktop/media/jmf/reference/codesamples/index.html

stephen84s commented: Excellent post. +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

520

/nods

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you mean you want to open it for general browsing in the OS (with Explorer for example), you'll have to use Runtime.exec() or ProcessBuilder for that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sounds like a problem with the database itself or the JDBC driver implementation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

516

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, apparently whoever wrote those methods are using that class as a key or with reflection.
I don't see how you expect anyone to know the "why" details of someone else's code based upon a method signature.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

506

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is elementary language syntax that you could easily search out yourself.
http://letmegooglethatforyou.com/?q=java+final+static

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the error message says why. Did you read it? It also indicates the line on which the error occurred.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

ohs?.. you're a warrior? & your wife is beautiful?.. I don't think so..
I guess both of you are aliens..

I don't expect you to understand.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

506

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's usually not too much trouble to convert from a JFrame to a JApplet as long as you don't run up against the tighter security concerns of applets. Just change the "extends JFrame" to "extends JApplet" and divide the code into the appropriate applet life cycle methods (init, start, stop, destroy). If you run into troubles, just post the code and your questions back here.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

forget it i found it out thanks for nothing

With posts like this, "nothing" is pretty much what you are likely to get in the future as well.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a look at the constructor you wrote for Rectangle and compare that to the code you are using to create it (which you are doing when you add the "new" keyword). You have collected the info to use that constructor, you just aren't doing so.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, you're going to have to convert the top-level window to JApplet. There really aren't too many things to change in many cases. If the other classes are lightweight components, it should be fairly trivial.
You can find a lot of information here: http://java.sun.com/docs/books/tutorial/deployment/applet/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>it won't go into 2nd iteration as i=2<n=2 is not satisfied....so i won't get any results for 2nd day.
See the point is that i=1 is the second day. i=2 would be a third day that doesn't exist in your n=2 array.

I'm not really following which days you are expecting to add to the "netsoilwaterbalance". On day 2, are you trying to add day 1's rainfall values or day 2's values?
if you want netsoilwaterbalance(day 2) = netsoilwaterbalance(day 1) + rainfall(day 2) - etc(day 2) then I would recommend writing your loop like this instead

double lastWaterBalance = mad;
for (i=0;i<n;i++}{
    netsoilwaterbalance[i] = lastWaterBalance + rainfall[i] - etc[i];
    lastWaterBalance = netsoilwaterbalance[i];
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It will access the last day. That is the entire point. Because arrays are zero based, the index is one less than the ordinal number of the element you are accessing.

If n=3, you have 3 elements in the array. Write out their index values: 0,1,2
So on your input loop, trace the value of i all the way through this

for (int i=[B]0[/B]; [B]i<n[/B]; i++)

and now for your output loop, trace this

for (int i=[B]1[/B]; [B]i<n[/B]; i++){
  netsoilwaterbalance[i] = netsoilwaterbalance[i-1] + rainfall[i] - etc[i];
}

Write down on paper the value of i in each of those.
I really can't explain it any more than that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

502

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Of course it does. You are still advancing to 'n' because you just moved the increment inside the loop. You are checking that it's less than n, but then you increment it.

Your input loop needs to fill those arrays, from i=0 to i=n-1.
For your output, you just want to process from i=1 to i=n-1.
So write those loops accordingly and put the increment back in the for() statement.

And make sure to place [code] [/code] tags around your code in future posts so that formatting is preserved.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>netsoilwaterbalance = netsoilwaterbalance[i-1] + rainfall - etc;
If you let i get to 'n', that expression is going to fail as well. You still need to limit that to i<n .

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you are using that same loop on your inputs and it's invalid.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Arrays are zero based, so for 'n' elements, you have index values 0 to n-1. Therefore, this loop

for (i=1;i<=n;i++)

will skip the first element and run to n, which is past the end of the array. You need to loop

for (i=0;i<n;i++)
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

502