Daniel Baker

Greenhorn
+ Follow
since Apr 09, 2018
Daniel likes ...
Eclipse IDE Chrome Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daniel Baker

Did you try using an array of strings? So an array of multiple strings, representing the 2 columns? Each horizontal row is a row of 2 letters. You kind of had it in your code but you just had a single string array inside another array. Try splitting it up so you have multiple string arrays, each representing a row.

Maybe something like this:

5 years ago
Updated previous post to show only guidance instead of spoon fed code sample.

And thanks for that boxing comment, Campbell. I totally should've used that instead of Double.valueOf().
5 years ago
I realize that my previous post provided you with an answer instead of helping you "discover the answer for yourself" - I'm new here myself so didn't realize the intent of the forum when I posted my previous answer. If my previous post gets pulled, then I'll update this to provide more "guidance" instead of an answer.
5 years ago
Originally, I included the working code but I've been advised to edit my post to give you more guidance instead of just spoon feeding you the answer.

Here's what I suggest for the method implementation:

Create a new ArrayList to place the calculated differences between adjacent list elements and then iterate over the passed in list to calculate all the differences of adjacent elements.

To calculate the difference for adjacent elements, have the method look at the current list element and the element ahead. You'll have to be careful to set your list iterator to not go to the end of the list - otherwise, you'll get an IndexOutOfBoundsException since you're always looking one step ahead of the current element.
5 years ago
Thank you - much appreciated about the possible whitelisting in the future. Yes, I plan to contribute to the community to build up some trust.
6 years ago
Thank you very much for your helpful reply and I can see how it would look that way. The truth is, I was trying to promote that site but I thought I was doing it in a positive way by providing real answers and code samples that I wrote and tested myself and thought other people would find valuable.

But I can see now that doing this on old topics and on all my posts makes it look more questionable.

Thanks again for the clarification.
6 years ago
Hi, I'm new here so maybe I'm not following the right protocol, but I was wondering why some links in my posts got deleted.

For example, in this post:

https://coderanch.com/t/631335/java/BufferedReader-reading-clearing-text-file

the source link at the bottom was removed (the hyperlink was removed but the text is still there).

Then in this post:

https://coderanch.com/t/628600/java/Searching-file

the link at the bottom was again removed.

Then in this post:

https://coderanch.com/t/643608/java/Setting-values-PDF-Field

one of the links at the bottom of my post got removed (the hyperlink was removed)

Did I do something wrong? I thought I was providing a helpful answer in all my responses and I was giving credit to the source where I got it from.

I'm looking forward to providing more helpful answers but just wanted to know if I was breaking the rules in some way.
6 years ago
This code will print out all the PDF values and table names separately, just like you asked.

We can do this by using the String.split() method twice - once to split up all the PDF values-table column pairs and a second time to split up each pair into the PDF value and the table column name.



And here's the output:



This was done using a text file in c:\temp with the following value:

pdfFieldEmployee=Employee; pdfFieldStartDate=StartDate; pdfFieldSalary=Salary; pdfFieldExempt=Exempt

Sources:
https://funnelgarden.com/java_read_file/
https://stackoverflow.com/questions/3481828/how-to-split-a-string-in-java

6 years ago
Since Java 7, you can use the try-with-resources statement around the BufferedReader so you don't have to close it explicitly.



Source: https://funnelgarden.com/java_read_file/
6 years ago