Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Asking Google for Pagerank Programatically

Asking Google for Pagerank Programatically

Scheduled Pinned Locked Moved C#
helpquestioncssmobiletutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jimbo8098
    wrote on last edited by
    #1

    This is my version of another guys code (hartertobak) in which he shows us how to use google to get the pagerank. I really liked this code and have really been looking for it BUT there needed to be some modifications to the code before it could be used for batch processing. So i made some simple but effwctive mods to his already beatiful code. The initial idea was wonderful and worked perfectly if you only wanted to do 1 or 2 URLS but was useless for batches of urls (urls in their thousands) because google will block pagerank requests for sites from the same ip if they have a frequency of less than 1 second (ish) so i had to come up with a way to stop that happening. When i heard of this problem the first thing i did was to put a 10 second sleep between every submission. This meant that google wouldnt pick up this as a bot making the submissions since a human could quite easily make a request to google every 10 seconds. The next thing after that was to bring in file handling and an interface so that the user could interact with the program. My first idea for this would be to import a .txt file. That way a file could be made and saved for later use and would mean not having to enter the urls one by one. Of course the user could do this but still have the flexibility to add more after it has been loaded. The HCI is VERY simple and basic. It is a listbox with a few buttons. The listbox is the main display. and the buttons are the controls. There is a textbox for inputting urls and some error handling with the textbox but it is assumed that the user has knowledge of what he/she is doing. every url must begin with http:// and contain at least 1 dot (.) So now i had a working program but there remains one problem. Time. The 10 second delay cannot be helped but the way i made that happen was to use Thread.Sleep which meant that the program is unresponsive. How do i make my program responsive while waiting those 10 seconds and display the results in real time? Any help appreciated :)

    jimbo8098

    L 1 Reply Last reply
    0
    • J jimbo8098

      This is my version of another guys code (hartertobak) in which he shows us how to use google to get the pagerank. I really liked this code and have really been looking for it BUT there needed to be some modifications to the code before it could be used for batch processing. So i made some simple but effwctive mods to his already beatiful code. The initial idea was wonderful and worked perfectly if you only wanted to do 1 or 2 URLS but was useless for batches of urls (urls in their thousands) because google will block pagerank requests for sites from the same ip if they have a frequency of less than 1 second (ish) so i had to come up with a way to stop that happening. When i heard of this problem the first thing i did was to put a 10 second sleep between every submission. This meant that google wouldnt pick up this as a bot making the submissions since a human could quite easily make a request to google every 10 seconds. The next thing after that was to bring in file handling and an interface so that the user could interact with the program. My first idea for this would be to import a .txt file. That way a file could be made and saved for later use and would mean not having to enter the urls one by one. Of course the user could do this but still have the flexibility to add more after it has been loaded. The HCI is VERY simple and basic. It is a listbox with a few buttons. The listbox is the main display. and the buttons are the controls. There is a textbox for inputting urls and some error handling with the textbox but it is assumed that the user has knowledge of what he/she is doing. every url must begin with http:// and contain at least 1 dot (.) So now i had a working program but there remains one problem. Time. The 10 second delay cannot be helped but the way i made that happen was to use Thread.Sleep which meant that the program is unresponsive. How do i make my program responsive while waiting those 10 seconds and display the results in real time? Any help appreciated :)

      jimbo8098

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      any real work (or sleep) that takes more than a few tens of milliseconds should be delegated to one or more separate threads; if the work load is light and the latency small (again, milliseconds; yours isn't) you could organize it with a timer. Study the BackgroundWorker (that is actually a thread) and don't you touch any GUI (HCI?) thingies from within its DoWork handler! Use the ReportProgress/ProgressChanged stuff if you must. PS: you're lucky I read your entire message up to the end, I didn't see a question coming any time soon! :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      J 2 Replies Last reply
      0
      • L Luc Pattyn

        any real work (or sleep) that takes more than a few tens of milliseconds should be delegated to one or more separate threads; if the work load is light and the latency small (again, milliseconds; yours isn't) you could organize it with a timer. Study the BackgroundWorker (that is actually a thread) and don't you touch any GUI (HCI?) thingies from within its DoWork handler! Use the ReportProgress/ProgressChanged stuff if you must. PS: you're lucky I read your entire message up to the end, I didn't see a question coming any time soon! :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        J Offline
        J Offline
        jimbo8098
        wrote on last edited by
        #3

        Thanks for replying. I wanted to give some info rathjer than just ask my question and get on with it XD Ok I'll have a look at that...

        1 Reply Last reply
        0
        • L Luc Pattyn

          any real work (or sleep) that takes more than a few tens of milliseconds should be delegated to one or more separate threads; if the work load is light and the latency small (again, milliseconds; yours isn't) you could organize it with a timer. Study the BackgroundWorker (that is actually a thread) and don't you touch any GUI (HCI?) thingies from within its DoWork handler! Use the ReportProgress/ProgressChanged stuff if you must. PS: you're lucky I read your entire message up to the end, I didn't see a question coming any time soon! :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

          J Offline
          J Offline
          jimbo8098
          wrote on last edited by
          #4

          That worked fine. Didnt use it in this yet but i used it in another similar program which would just stop running and it worked fine :) Thanks

          L 1 Reply Last reply
          0
          • J jimbo8098

            That worked fine. Didnt use it in this yet but i used it in another similar program which would just stop running and it worked fine :) Thanks

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            You're welcome. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups