chris carter's web log

Home |  Contact |  Admin
 

More WPF Fun Finding Out What's Running On Your Machine

Posted on November 18, 2008

Tobin had a good idea in his comment on my last post on my little scratch app What is That?

click to enlarge

DataMining: Losing the WebBrowser Control

Tobin mentioned mining the data rather than having the WPF WebBrowser control.  I set out with the goal of picking pages off of that site but quickly realized that the one i was using only gave some results so I switched to this one:http://www.processlibrary.com/, which gave me results every time; knowing how many hits that site may take I added a little file caching dealio, more on that later.

XPath Queries Against HTML with HtmlAgilityPack

I wanted to be able to execute XPath queries against an html document.  I don't like to waste time mucking around with the .NET built in stuff that will break as soon as I find out a page is not well formed, so I grabbed my always trusty friend, HTMLAgilityPack that allows me to do XPath queries against a non well-formed xml document.

Wow, I Have Alot Of Shit Running on My Machine

I quickly realized that hitting that web page for each or the 128 processes, that apparently were running on my machine, on startup was a bad idea, at least doing synchronous calls in the Window Loaded event.  The screen doesn't draw, and depending on what time you run this thing, it could talke a few seconds or a minute or two.

It seems that while investigating WPF things I usually end up at Pavon Podia's ealier blog here and his current blog here.  This time was no different, based on this post I worked up my bomb ass progress bar implementation.

Feelin Guilty

While testing my app the performance of making all of the web requests got to me, but not as much as the guilty feeling I was getting at hammering that website with the same requests over and over.  So I implemented a caching strategy.  This app saves every page that is requested to a directory on your C drive named WhatIsThis.  If a local file exists, it is read from disk, otherwise it's requested from the site and saved locally to disk.

Conclusion

There's really not much to this practice app so if you're looking for uber brilliant code, you've come to the wrong place, that kind of code exists here, here, and here.  This code is just me playing around with WPF.  Download the code here.