Robert Hill

Ranch Hand
+ Follow
since Feb 24, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Robert Hill

Can you print out the array contents and display them here?
16 years ago
They could have allowed it. The ambiguity can be easily solved. It isn't a massive issue in C++ with a little care.

They didn't allow it and came up with interfaces which is slightly more flexible.
17 years ago
Don't use StringTokenizer. It is a legacy class and really has little value, other than to support legacy code.

You can use String.split() and with a carefully created regular expression you can do this with a little code.
[ March 08, 2008: Message edited by: Robert Hill ]
17 years ago

Originally posted by fred rosenberger:
hmmm...

I think you need to slow down a little. What you wrote here will cause some problems.

in your 'getGrade' method, you print some stuff - that's fine. but... you also call a funtion - the getGrade() one. In other words, the method calls itself. So, the method gets called the first time, and then calls itself.

THAT call starts going, and calls itself again.
THAT call starts going, and calls itself again.
THAT call starts going, and calls itself again.
THAT call starts going, and calls itself again...

you see the problem?




public static float getGrade()
{
float grade;

if (score > 90)
grade = "A";
else if (score > 75)
grade = "B";

System.out.println("\nThis is a " + getGrade(highest) + " grade.");



getGrade() and getGrade(int) are two different methods. No recursion here.
17 years ago
Thank you very much.

The only problem was that it would not autoscroll to the last row, but to the last row -1. Oddly, just passing the actual row count didn't fix the issue but this did:


table.scrollRectToVisible(table.getCellRect(table.getRowCount()-1, table.getColumnCount(), true));

Thanks again!
17 years ago
I have searched around for a solution to this, but all I have found are solutions from 2002 and the methods they called to achieve this seem to have been removed.

I have the JTable and it fills up like it should, it scrolls correctly, but how do I get it to scroll automatically when a new row is added?
17 years ago
That is the autoboxing feature. java handles the conversion between primitives and there respective wrapper class.
17 years ago
It might be a pointless question, since Java is so different then Ruby.

For those not familiar with Active Record it is a wonderful tool for Ruby on Rails. It abstracts SQL statements into Ruby method calls. Ruby is flexible enough to handle creating new methods for a class dynamically.

As an example:

Message.new(params[:message]).save creates and saves a new row in the Message table using parameters from a HTML form. The Message class has dynamically created methods to manipulate the row, and makes validation a breeze.

Before this sounds like an ad for Ruby on Rails, and a condemnation, which is not the intent, here is my question. Most of the SQL I use is the same sort of thing over and over. So it is tedious to have to write SQL statements in Java code. Before I attempt to write some simple wrappers to help DRY out some Java code, Does something like this already exist for Java. I doubt Java has something exactly the same, but something reasonably close would be great.

Thanks!
When I start MySQl, there are 10 mysqld processes and 1 mysqld_safe process. It takes up a huge chunk of memory and doesn't seem like there should be that many.

Is this right?
17 years ago
I have to write a program that reads from a file of disk IO requests and test different algorithms like elevator or shortest seek time first. The problem is that I need a file a real disk IO requests to run it on.

Does anyone know of a program that will trace real programs IO requests or even a link to existing disk trace files?
17 years ago
Mount Ranier National Park.

There are neat little towns around Wenatchee.

Grand Coulee Dam

The beaches around Westport, Wa are really wild in the winter. Although further south towards Ilwaco is a bit nicer.

A short ferry ride to Bainbridge Island and back is quite nice, especially at night.

Vancouver Island in BC is a very nice place as is Vancouver, BC.

A word of caution. If you are driving in the mountains, even if the weather seems nice stay on the main roads, and have plenty of emergency supplies. Things can turn bad quickly, don't get lost like that poor editor from CNET last winter in Oregon and not be prepared for it.

Even in the summer, it is a good idea to be prepared when venturing in the mountains.
17 years ago

ImageIcon[] imageArray = ImageIcon["C:\pixs\*.gif"];



The array declaration is looking for an integer to use for its size, not a String.

Secondly, passing a String into an array element won't work.A String is definitely NOT an ImageIcon. So this will not work either

ImageIcon[] imageArray = ImageIcon[100];

...

imageArray[0] = "C:\pixs\*.gif"

Hint: Look up ImageIcon in the API docs.
17 years ago
It creates an array object of size 0. It is a valid object so there would not be any exceptions thrown when you call size.

Of course, an array of size 0 isn't very useful. In fact it is pointless.

Try placing a value in index 0 and see what you get.
[ October 11, 2007: Message edited by: Robert Hill ]
17 years ago
RoR does have the potential to seriously challenge J2EE. Remember, it is only 3 years old or so and needs lots more work and testing to be acceptable to companies now relying on EE.

I seriously doubt companies would trash all the work and money and jump into rails or anything else. If RoR does eventually take over the enterprise space(not even close to a certain thing), Java will still be around for a long, long, long time. At worst, there will be thousands and thousands of jobs to maintain all this Java code, and EE will still be used. After all, J2EE isn't the only enterprise framwork(s) being used. Fortran is still used today in specialized areas, and there is still a lot of legacy Fortran to maintain.

Is it worth it? Yes and no, depending on your goals. If you are interested in creating small-ish web sites, I think a person would be nuts to use anything but Rails. Servlets is overkill for small projects and PHP is a security mess and encourages poorly written and designed web pages. I don't know enough about Zope to comment.

If you want to get a enterprise level job, you would be nuts to not learn J2EE.

Then again, you would be nuts to only learn one language/framework. I haven't seen statistics, but it would not surprise me to learn that most programming projects use multiple languages.
17 years ago
By itself, the code you posted won't compile, of course.

But did you try to compile and run it?

why have 2 variables that store the same value(now and startValid)?
17 years ago