How to Use BackgroundWorker for Your Threading Needs

When your application needs to perform time-consuming operations, you don’t want the interface to hang, so you need to use a separate thread for this operation. Still, if the operation takes some time to process, you may want to give the user some feedback about its progress. The .NET framework provides the Thread and ThreadPool classes to create and manage threads. They can be quite powerful and are a must for heavy threading operations. However, if you want a simpler solution, the BackgroundWorker class is your friend.

Read More…

Posted in C# at April 18th, 2010. View Comments.

How to Extract Only the Content from a Web Page

Have you ever visited a web page and actually had to take a moment to figure out where the content was because the page was so heavily loaded with non-content stuff? With the growing number of websites, with different designs, one may wish to simply read the page’s content without having to deal with all the extra stuff (navigation, ads, social features…).

Read More…

Posted in C#, PHP, Tools at April 10th, 2010. View Comments.

Easily Parse HTML Documents in C#

So, you are building a C# application and need to parse a web page’s HTML. You could use regular expressions, but it seems more efficient to use a DOM-based approach. What if you could even take advantage of the power of XPath?

Read More…

Posted in C# at March 30th, 2010. View Comments.