Nick Rowe

Ranch Hand
+ Follow
since May 26, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Rowe

Ok So I Have two programs, One program to write to a new document a list of variable values I have captured. And another to do something similar with another set of values.

I realise that I can simply call two seperate programs within the command prompt window but is there a way by writing a method and stipulating a path (like a css regeference to html) where I can call the second program.

I'd rather do this than add the class from one program to the other and then fiddle around with it.
This may sound silly to some but is it possible?

regards S
10 years ago
I see what you mean now, i have removed it from the if statement.

regards S
10 years ago
I realise that there are two possibilities for this i.e. the method from the previous post and also the solution below.

I was just testing the first method at the time, and posted.
By the looks of it the only issue i have now is that the odd occurance of a single character has come through as a variable on the odd occasion.

So i need to find if the value is equal to one character and add that to the If or scenario.

10 years ago
basically i need to search to check if an everchanging string contains more than one character, not a specific one but any SINGLE character in general.

This is as im attempting to return a word value and am getting the odd single character returned occasionally.
Its just a bit more error trapping.

regards S
10 years ago
I believe i just had a eureka moment.

I changed my code to the example shown below and it seems to have worked, i realise i missed the else if aswel




10 years ago
Basically if there is a value within the resourceline I want it to first trim the value and then iterate through the statements. I am expecting the If statments to search the string to see if it contains any of the symbol characters. If a character is found within the string then set the string to null (i.e dump the entire string value) and do the same thing If the value already exists within the arrayList.

Otherwise if the resourceline value does not contain any conflicting irrelevant data only then add to the array.

So how is the array being populated with all the crap IF im only adding the value after iterating through the IF statements. It just doesn't make sense to me. Surely it would only add the value If the data was correct?

regards S
10 years ago
Hi all,

I have a program that captures a substring between two strings and returns the value instance to an arrayList, however if the value already exists or contains certain symbols I want my program to dump the string and look at the next line.

I have done this with a series of IF statements however, when my program is executed its still returning many string values that contain these character symbols.

I have tried leaving the loop blank thinking that maybe it will just abandon the string within the IF statement if the conditions aren't met. But the string values are still comming through. Another method I have tried is setting the variable value for resourceline to null. But that just causes compiler errors.

Please can someone help

p.s. Apologies if there are any formatting errors

10 years ago
I see what you mean. however in my original post lines 48 and 117 are referenced correctly. I just took out some of the comment lines in the laterposts to save time, that was the only reason.

I took out the references to the main method because i actually realised that they werent necessary, i mean if theyre in the loop and the instance is not what i want it does not need to go back to the main. It simply needs to iterate through the IF statement until the end of the loop and then read the next line.

Staring at code for too long lol.

I'll make sure that in future posts I post exactly with reference to compiler messages etc.
regards S
10 years ago
The main(null); are removed as the post has developed so has the code. If you look up in the post there are clear references as to where the errors (were) occuring. i.e. the main method reference to the find method. .. and the main(null)reference under the If check statement. I just didnt think it was necessary to keep pasting up references when I had done so many times before.

The code itself is now compiling and running. Thank you for the comments.

The only issue now, which i believe i've posted in a new thread. Is that altho it compiles and runs its still writing irrelevant data to the specified text file. Which is a bit weird.

regards S
10 years ago
Basically i have a program to read in the contents of a folder and capture instances of a substring stored between two strings. I want the instances of the substring called "resourceline" to be stored within an array and then sorted and printed into a new document.

However i only want the instances to be stored IF they dont already exist and if the string does not contain certain symbols. I am doing this because i get too much irrelevant data come accross.
The problem is the progam is working but still writing data that i dont want.

please help
regards S

my code is below

10 years ago
Also the error arises when the program is executed not when it compiles. I realise the error relates to both lines 48 and 117.

Line 48 is the main(null); line within the if check statement.
Line 117 relates to the calling of the Find method within the main method.

Which has nothing to do with the buffered reader. If you are getting path errors when running my program then thats probably either because you aren't referencing the same path.

It looks like its something to do with the way im calling the main and Find methods themselves in these two instances. I cant see how it referenced br.close.
The throw catch scenario is used to readin all items within the folder, if there are no items left the loop closes.

10 years ago
The buffered reader reads in all items within the resources folder from the readin path, so yep there are a bunch of files in there. also my original program before the adaption looks like the code in this example.
And this code has been tested and works below. so the location of the buffered reader is fine.


Initially i changed the search being and end variables to match the criteria that i wanted to extract from the resource folder. However the results brought back were both repetitive and in some cases irrelevant. Because of this i used the If statments to only store the data within the array if it does not contain any of the specified symbols OR if it already exists within the array.

Im a little confused now.

regards S


10 years ago
In the end I called the method using main(null);

However the compiler is still not liking the calling the compiler is throwing out several of the same 2 erros below.
Apologies is there are any formatiing errors. The forum doesn't seem to like code pasted from notepad++

This is all the info i get from the compiler
ERRORS
at Find.<init>(Find.java:48)
at Find.main(Find.java:117)

The line 48 error relates to the call main(null); and the other error relates to calling the Find method.
I'll paste the code for my program below, its confusing me a little now.

regards S



10 years ago
Hi Guys im trying to call my main method from another method. But im having trouble so far i've tried

main();
public static void main(String[] args);
public static void main();

And i keep getting compiler issues expecting semi-colons im not sure what im doing wrong.
I am calling the method from the same class.

regards S

My main method looks like this

10 years ago
This is probably a stupid question but im wondering if there is a specific way of calling back a method from another method. My program only has one class to Im not calling it from anywhere else.

I've tried
public static void main(String[] args);
main();
main(String[] args);

and the compiler isn't having any of it.

regards S



I'll post my code below

10 years ago