Knute Snortum

Sheriff
+ Follow
since Apr 20, 2013
Knute likes ...
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
Forum Moderator
Knute Snortum currently moderates these forums:
After 25 years of programming, Knute has retired to be a professional musician. Knute first learned BASIC and Cobol on a CPM Timeshare system circa 1985. He spent way too long coding in one flavor of Business Basic or another. Going back to college, he learned C and a whole new world opened up to him. Knute likes Perl and Java, for completely opposite reasons. Knute is a complex person.
Portland, Oregon
Cows and Likes
Cows
Total received
167
In last 30 days
3
Total given
323
Likes
Total received
1145
Received in last 30 days
14
Total given
425
Given in last 30 days
17
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt Green check

Recent posts by Knute Snortum

Sara Dokaj wrote:... but when trying to run a application that wants jre it shows message that it need java run time environment 1.5.0 or higher to run.


Please post the entire error message here.  (Pro tip: whenever you say "it shows a message," post the message.)
2 days ago

I'm still trying to figure out if the code has been automatically compiled.  I'm not sure what to click on to check if it automatically being compiled.  


If you have Build Automatically checked, then the class is built every time you save it.  The classes are compiled to the output folder.  By default, this "bin" under your project folder.
To check for sure what your output folder is, right-click on the project in the Project Explorer, select Build Path > Configure Build Path...  Then click the Source tab.  At the bottom you will see what your output folder is.

If you really want to see if a class has been compiled, you can use a file explorer or list command for you system.  First, find your workspace folder.  It is usually called "workspace" or "eclipse-workspace" and is in you home directory.  Then navigate to your project folder "kaa1" and then your output folder (probably "bin").  You will find folders and/or files in this folder.  Navigate to the kaa1 folder.  In it you will see NewTest.class.  Note the file modification date and time.

Please note that the above is only necessary to satisfy your curiosity.
2 days ago
Let's try using a tiny program to test with:
Change PATH_TO_FILE to some legitimate file on your system.  The program should print "true" if it finds the file.
3 days ago

That Article wrote:Using strictfp guarantees that results of floating-point calculations are identical on all platforms.


So you wouldn't see any difference, even between platforms, and that's it's purpose.
4 days ago

I don't know how to compile from inside of Eclipse.  Is there someplace in Eclipse that will let me compile or do I need to do this from outside of eclipse?


Eclipse is probably compiling your Java code automatically.  You can check this by clicking the Project menu item and seeing if Build Automatically is checked.

Also is there a way to add the class to my command line that I have and run the program from within Eclipse without compiling it?


You can't run a Java program without compiling it.  I use JUnit to test with so I'm not up on how to use TestNG in Eclipse. However, I did find this website.
4 days ago
Where's the class name in that command?
4 days ago
Let's back up.

If the data is formatted the way you have just posted, you need to do the following:

1) Strip off the "[" and "]"
2) Split by commas *
3) Remove quotes

How would you go about doing this?

* You'll have to reconstruct fields like the date and the name.
4 days ago
I'm assuming that your program is printing Ground#toString() when it gets that output?  The first thing Ground#toString returns is player.toString(), and you have Player#toString looking like this:
Why would you expect that to return anything other than:

   name[](postion)
4 days ago
Let's start by correcting the code you posted.  It needs more braces and a little formatting.  I believe it should look like this:
Those closing braces are important and the braces around the if statement provide clarity.  

int is initialized to a=1 and while a <= to 4 update/increment a by 1 outer loop.
inner loop char x starts at 'a' and if x <= char 'c' update x char a,b,c,d... etc.
if a is equivalent to 2 and x is equivalent to b continue the first char loop;
print out a,x


This looks correct except that x will never get past char 'c'.

so first loop a is 1 and x is a
if condition is not met so print out 1a
2nd loop a is 2 and x is b  


Not quite.  The inner for loop stays in control, so you will get a == 1 and x == 'c'.  Now since x is 'c' you exit the inner loop and get the next iteration of the outer loop.  Now a == 2 and then the inner loop starts over again, so x == 'a'.  Make sense?

2nd loop a is 2 and x is b so both if conditions are met continue to first char loop WITHOUT printing anything because of the continue statement.
and then i get lost...


When the continue FIRST_CHAR_LOOP statement is reached, control is passed to the outer loop and it continues where it left off.  So a == 3.
4 days ago
What version of Eclipse is this and what type (that is, Jakarta EE?)
1 week ago

Bao Truong wrote:Thank you very much guys for the help.


Good job figuring it out!
1 week ago
Please ask your question on the original thread.
1 week ago
You should be able to access a file if you start the path with the file system root, which on windows is often the drive letter:
1 week ago
Piet, I believe your solution still splits the LASTNAME, FIRSTNAME and DATE when it shouldn't.  Didn't test though.

I spent entirely too much time on this, but I think my solution2() works well.  You could strip off the quotes if needed, but I didn't.  solution1() is the original solution.  solution3() is where I tried to use Apache Commons CSV, but I couldn't get it to work.
1 week ago
It is, but evidently the pattern matching engine knows that it's only meta when it first encounters a "[" character.  So the regex will work.
1 week ago