• Log in or sign up for an account here: https://www.sythe.org/login

I need some help...

Esuom

Guru
Banned
Joined
May 3, 2007
Sythe Gold
0
Messages
1,731
Location
EST Time Zone.
I need some help...
I am looking for some help on a program. I don't want to release too much information on it, but I will try to explain what I need the best I can.


I have a program, written in java of course, that uses lines from a text file 1 at a time. If a line doesn't work, it displays an error message. What I would like for it to do once it finds a line doesn't work, is to stop using the line (and possibly remove it from the text file?).



I hope that explanation worked...if it didn't, I will try to explain it a bit better.



Thanks.
 
I need some help...
What help do you need exactly? You have told us neither what you are doing with the line nor what problems you are having with the code.
 
I need some help...
I'm not having a problem with the code, I just am looking to make an edition.


I am taking proxies, 1 per line, from a text file and using them. I need a way so that when the proxy has an error, it stops using this proxy (it goes through the list over and over again)
 
I need some help...
How are you testing whether the proxy has an error or not?
 
I need some help...
If it loads the page and finds some specific text, the proxy works, if it doesn't, it displays "Error with Proxy: (proxy)"
 
I need some help...
So you already know how to tell if the proxy is not working? There would be a few ways to do this, if you already know if the proxy is broken... One solution is transfer all the working ones to a new text file when it knows they are working, then deletes the old one and renames the second one to the name of the first one. That is not the most efficient way of doing it, but it works.
 
I need some help...
So you already know how to tell if the proxy is not working? There would be a few ways to do this, if you already know if the proxy is broken... One solution is transfer all the working ones to a new text file when it knows they are working, then deletes the old one and renames the second one to the name of the first one. That is not the most efficient way of doing it, but it works.

Is there anything more efficient? That seems extremely slow.

Honestly, it wouldn't have to make a new text file, that was just a function I thought would be neat. If there would be a way I could just have it skip over them for the time that the program is running?


(And for the previous, current, and futures posts I have/will/am posting/posted (lol), and not making my self clear, just tell me. I'm not the best at talkign when it comes to coding.)
 
I need some help...
Well since you're looping through the text file anyway maybe the easiest way to only keep working proxies is to copy them one at a time into a new file as they are tested. So you test one then if it works append it to a new file and every other working one tested also gets appended to that new file.
 
I need some help...
Well since you're looping through the text file anyway maybe the easiest way to only keep working proxies is to copy them one at a time into a new file as they are tested. So you test one then if it works append it to a new file and every other working one tested also gets appended to that new file.

Hmm...this sounds like it would slow the program down quite a bit?
 
I need some help...
Hmm...this sounds like it would slow the program down quite a bit?

well, not really unless you need the program to run Über fast. It would not effect the performance enough for you to notice unless your like running nasa with it. :/
 
I need some help...
well, not really unless you need the program to run Über fast. It would not effect the performance enough for you to notice unless your like running nasa with it. :/

What a coincidence...I actually am running NASA.


But on topic, SuF, would you add me on MSN? I may need some help with this if you don't mind :D
 
I need some help...
Your program already runs in linear time in that it depends on the number of proxies listed in the file... Adding a few more operations to each iteration will slow it down some but it will give you the functionality you desire while still being quite usable.
 
I need some help...
Your program already runs in linear time in that it depends on the number of proxies listed in the file... Adding a few more operations to each iteration will slow it down some but it will give you the functionality you desire while still being quite usable.

Yea, when i wrote my crappy username downloading thing, i opened the file every time, wrote something to it, and it still did like 100 a minute, and thats even online so i think thats ok...


i added you btw.
 
I need some help...
Yea, when i wrote my crappy username downloading thing, i opened the file every time, wrote something to it, and it still did like 100 a minute, and thats even online so i think thats ok...
If you're continually writing to it you shouldn't even close it... Leave its file handle open as long as you're appending stuff to it.
 
I need some help...
If you're continually writing to it you shouldn't even close it... Leave its file handle open as long as you're appending stuff to it.

yea i know... but it still would have taken years to download all the usernames highscores anyways so i gave up. :P
 
I need some help...
Or if the list of proxies is not too big, keep a parallel list in an array or something. You can periodically write the list to file if you feel that is more efficient.
 
Runescape Gamblingrunescape gambling
Back
Top