Results 1 to 8 of 8

Thread: c# help

  1. #1
    Chillie in here j.o.s.h.1408's Avatar
    Join Date
    Dec 2005
    Location
    a place called home
    Posts
    8,543
    Thanks
    757
    Thanked
    256 times in 193 posts
    • j.o.s.h.1408's system
      • Motherboard:
      • ASUS P6T Delux
      • CPU:
      • Intel core i7 920 @ 3ghz
      • Memory:
      • 3GB DDR RAM
      • Storage:
      • 1TB Samsung F1, 500GB Seagate baracuda + 320gb Seagate PATA +150GB WD PATA
      • Graphics card(s):
      • EVGA 480GTX SC edition
      • PSU:
      • Seasonic M12 600W Module PSU FTW
      • Case:
      • Lian Li PC-A7010B (the rolls royce of pc cases)
      • Operating System:
      • vista ultimate edition and windows xp
      • Monitor(s):
      • 22inch 2005FPW dell monitor
      • Internet:
      • 24mb BE There Broadband

    c# help

    Hi i am in the process of learning c# and i am trying to develop a simple web search gui program that lists a list of products from a text entered by the user in a textbox. my ginnie pig is scan.co.uk

    whats the best way to get the specific content i need from a html webpage that generates the search results from within scan ie http://www.scan.co.uk/Search.aspx?q=9800

    here is the code i have done so far. i store the scan html source code for the above link on a String. not good?

    Code:
    public void connect()
            {
                Console.WriteLine("About to make a connection to the server");
                Console.WriteLine("URL = " + scanURL + search[0]);
                try
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(scanURL+search[0]);
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    Console.WriteLine("Response =" + response);
    
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        TextReader reader = new StreamReader(response.GetResponseStream());
                        webPage = reader.ReadToEnd();
                        Console.WriteLine("webpage =" + webPage);
    
                    }
                }
                catch(Exception e)
                {
                    Console.WriteLine("Error = " +e);
                }
                
            }

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: c# help

    First off picking a website thats changing like scan is atm, thats a bit stupid.

    try something clean n simple like google to start with.

    check:
    http://msdn.microsoft.com/en-us/libr...dh(VS.85).aspx
    for an example of templating.
    throw new ArgumentException (String, String, Exception)

  3. #3
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: c# help

    can i suggest amazon as a target?

    screen-scraping is a very messy prospect as it's SO fragile you wouldn't believe - something as simple as a change to the banner ads can break it utterly

    what you can do with amazon is learn about SOAP - which integrates really nicely into your code - and make searches directly into amazon's database

  4. #4
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: c# help

    hex does raise a very good point, if possible, use an API thats going to be fairly concrete and not change much.

    that said the templating matching in .Net is very powerful, and allows for a fair bit of tollerance. I was able to write something to scrape a certain usenet indexing service that requires session based login in about 15 minuites, its very easy once you get your first one done, maintance is also fairly easy.

    But the main problem as hex said is changes happening, the worst kind you don't really notice because they still seam to parse OK just the data been invalid.
    throw new ArgumentException (String, String, Exception)

  5. #5
    Chillie in here j.o.s.h.1408's Avatar
    Join Date
    Dec 2005
    Location
    a place called home
    Posts
    8,543
    Thanks
    757
    Thanked
    256 times in 193 posts
    • j.o.s.h.1408's system
      • Motherboard:
      • ASUS P6T Delux
      • CPU:
      • Intel core i7 920 @ 3ghz
      • Memory:
      • 3GB DDR RAM
      • Storage:
      • 1TB Samsung F1, 500GB Seagate baracuda + 320gb Seagate PATA +150GB WD PATA
      • Graphics card(s):
      • EVGA 480GTX SC edition
      • PSU:
      • Seasonic M12 600W Module PSU FTW
      • Case:
      • Lian Li PC-A7010B (the rolls royce of pc cases)
      • Operating System:
      • vista ultimate edition and windows xp
      • Monitor(s):
      • 22inch 2005FPW dell monitor
      • Internet:
      • 24mb BE There Broadband

    Re: c# help

    ahh i see what you mean guys thx. anyways is there any guide or tutorial stuff for someone wishing to learn c#? any exercises etc that i can use and learn from? im coming from a java background so some of the stuff i would be familiar with but like to know a good guide that i can follow and practise on using examples, exercises and totorial notes

  6. #6
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: c# help

    Just buy CLR Inside Out (Second Edition) to get an understanding of how internals work, from java (like me!) i think its really worth reading this book, its the bible.

    Then its just a case of explorering the Framework libraries.
    throw new ArgumentException (String, String, Exception)

  7. #7
    Chillie in here j.o.s.h.1408's Avatar
    Join Date
    Dec 2005
    Location
    a place called home
    Posts
    8,543
    Thanks
    757
    Thanked
    256 times in 193 posts
    • j.o.s.h.1408's system
      • Motherboard:
      • ASUS P6T Delux
      • CPU:
      • Intel core i7 920 @ 3ghz
      • Memory:
      • 3GB DDR RAM
      • Storage:
      • 1TB Samsung F1, 500GB Seagate baracuda + 320gb Seagate PATA +150GB WD PATA
      • Graphics card(s):
      • EVGA 480GTX SC edition
      • PSU:
      • Seasonic M12 600W Module PSU FTW
      • Case:
      • Lian Li PC-A7010B (the rolls royce of pc cases)
      • Operating System:
      • vista ultimate edition and windows xp
      • Monitor(s):
      • 22inch 2005FPW dell monitor
      • Internet:
      • 24mb BE There Broadband

  8. #8
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: c# help

    jarp, should be able to find it cheaper, i bought it for £30 inc P&P aaages ago.

    That book explains the whole underlying mechanics of .Net, once got your head round that the pace at which you'll be able to pickup the 'framework libraries' will be much faster.
    throw new ArgumentException (String, String, Exception)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •