I need some help...

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

I need some help...
  1. Unread #1 - Dec 18, 2008 at 4:03 PM
  2. Esuom
    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0

    Esuom Guru
    Banned

    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.
     
  3. Unread #2 - Dec 18, 2008 at 4:34 PM
  4. Zyloch
    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0

    Zyloch Member

    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.
     
  5. Unread #3 - Dec 18, 2008 at 4:36 PM
  6. Esuom
    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0

    Esuom Guru
    Banned

    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)
     
  7. Unread #4 - Dec 18, 2008 at 4:52 PM
  8. Zyloch
    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0

    Zyloch Member

    I need some help...

    How are you testing whether the proxy has an error or not?
     
  9. Unread #5 - Dec 18, 2008 at 4:57 PM
  10. Esuom
    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0

    Esuom Guru
    Banned

    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)"
     
  11. Unread #6 - Dec 18, 2008 at 7:46 PM
  12. SuF
    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

    SuF Legend
    Pirate Retired Global Moderator

    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.
     
  13. Unread #7 - Dec 18, 2008 at 8:35 PM
  14. Esuom
    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0

    Esuom Guru
    Banned

    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.)
     
  15. Unread #8 - Dec 18, 2008 at 9:02 PM
  16. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    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.
     
  17. Unread #9 - Dec 18, 2008 at 9:10 PM
  18. Esuom
    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0

    Esuom Guru
    Banned

    I need some help...

    Hmm...this sounds like it would slow the program down quite a bit?
     
  19. Unread #10 - Dec 18, 2008 at 10:03 PM
  20. SuF
    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

    SuF Legend
    Pirate Retired Global Moderator

    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. :/
     
  21. Unread #11 - Dec 18, 2008 at 11:38 PM
  22. Esuom
    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0

    Esuom Guru
    Banned

    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
     
  23. Unread #12 - Dec 19, 2008 at 9:18 AM
  24. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    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.
     
  25. Unread #13 - Dec 19, 2008 at 9:26 AM
  26. SuF
    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

    SuF Legend
    Pirate Retired Global Moderator

    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.
     
  27. Unread #14 - Dec 19, 2008 at 11:17 AM
  28. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    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.
     
  29. Unread #15 - Dec 19, 2008 at 3:47 PM
  30. SuF
    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

    SuF Legend
    Pirate Retired Global Moderator

    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
     
  31. Unread #16 - Dec 20, 2008 at 3:26 AM
  32. Zyloch
    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0

    Zyloch Member

    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 >

Users viewing this thread
1 guest


 
 
Adblock breaks this site