Adblock breaks this site

I need some help...

Discussion in 'Programming General' started by Esuom, Dec 18, 2008.

  1. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    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.
     
  2. Zyloch

    Zyloch Member

    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
  3. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    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)
     
  4. Zyloch

    Zyloch Member

    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0
    I need some help...

    How are you testing whether the proxy has an error or not?
     
  5. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    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)"
     
  6. SuF

    SuF Legend
    Pirate Retired Global Moderator

    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary
    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.
     
  7. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    I need some help...

    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.)
     
  8. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    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.
     
  9. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    I need some help...

    Hmm...this sounds like it would slow the program down quite a bit?
     
  10. SuF

    SuF Legend
    Pirate Retired Global Moderator

    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary
    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. :/
     
  11. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    I need some help...

    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
     
  12. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    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.
     
  13. SuF

    SuF Legend
    Pirate Retired Global Moderator

    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary
    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...


    i added you btw.
     
  14. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    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.
     
  15. SuF

    SuF Legend
    Pirate Retired Global Moderator

    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary
    I need some help...

    yea i know... but it still would have taken years to download all the usernames highscores anyways so i gave up. :p
     
  16. Zyloch

    Zyloch Member

    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0
    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.
     
< where to start? | Help with adding border colors >


 
 
Adblock breaks this site