Saturday, September 6, 2008

C#: A Different Program

C#: A Different Program

I certainly won't claim that I have learned everything that I need to learn about graphics in C#, but I had reached a point with that plotting program when I had resolved all my concerns about event related stuff, and I had at least a rough idea how various display functions work.

I'm now writing a program that is a bit less graphical, but exercises many of the other facilities of C# and .NET. It reads in a web page, determines all the links to other pages (and names within the current page), and verifies that they can be opened. This is the broken link detector--often useful if you link to lots of other pages, and those links break.

In addition, it will be recursive within a particular domain. If I tell it open, it will try to open all links to pages at or below, then repeat the process for each of those pages. It will stay at or below the level of the original web page, otherwise it would take a very long time to complete the process, what with the several billion web pages that are out there! And yes, I have seen the gag page that claims to be the last page on the World Wide Web, and tells you that you may now turn off your computer!

I've reached the point where the program reads in a web page and parses the HTML to find all the HREFs contained therein. (Or at least, I think it finds them all. We'll see when I start trying other pages.)

There are HTML audit programs like this out there already, I know. But writing one of my own forces me to learn a lot of capabilities that I otherwise might not learn. Learn by doing works for me a lot better than reading a tutorial.

UPDATE: Well that's cool! I don't have the recursive part done yet, but I ran it against my home page, and it discovered that one of the links from my recent restructuring is broken!

No comments:

Post a Comment