Download source code of a website in C#

With the help of the follwing short C# snippet, you’re able to receive the html code / source of any website as string. Such a function is useful, for example, if you want to parse some information from a website for later use.
Thus the snippet works, you have to add the following two using directives to the header of your source.

using System.Net;
using System.IO;

The function itself looks like this:

public string getHTML(string url)
{
//Create request for given url
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

//Create response-object
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

//Take response stream
StreamReader sr = new StreamReader(response.GetResponseStream());

//Read response stream (html code)
string html = sr.ReadToEnd();

//Close streamreader and response
sr.Close();
response.Close();

//return source
return html;
}

A function call could look like this:

getHTML("http://www.code-bude.net");

If you’ve got suggestions or even problems with the snippet, just write a comment.

Pex for fun – a programming game for Microsoft lovers

I’m just stumbled once again on a beautiful website that I want to share with you.
I found it at the german C# community mycsharp.de where herbivore, the admin, posted it in this thread. But not panic, the game is in English.
The website, I like to show you, is www.pexforfun.com on which you can solve a large number of more or less difficult programming “puzzles”. Relating to the available programming languages, you have the choice between C #, F # and Visual Basic.NET.
The puzzles are all built on the same base-function. This function, named “puzzle” is given and takes, depending on the puzzle, different numbers of paramaters. Your task is to find out, what the function should do with the input variables. So you can add any input and the game shows you the output of the function […]

How to run a full-value Linux on your Android device

I know, why I love my Android smartphone. It is open, flexible and the opportunities to use it seem to be endless. In times companies don’t let me choose, what software I can use to I transfer my music onto the device (Apple – iTunes), I, as an Android user, can ask myself the question: “Should I install the new Cyanogen Mod or straigt way a full-value Linux distribution on my device today? “.
Yes, you heard correctly, a full Linux distribution on your Android device. Ruan from Androidclone managed it and shares his knowledge gladly with all Android fans. At Androidclone board you can find a detailed tutorial, how to run Ubuntu 10.10 on your Android device.
It can be used parallel to Android as it is launched from […]

How to run Android on PC

Android unter WindowsIn the following article I’ll show you how to run Android in a virtual machine on your Windows. The post may appear relatively long at first glance, but actually setting up is really easy. So don’t be daunted by the article’s lenght.
If you reach the end of the article and did all steps correctly, you can work with Windows and Android on the same machine at the same time.  And now blathered enough, let’s go!
 
What do we need?

Microsoft Virtual PC (Download) or VirtualBox (Download)
Android x86 iso-file (Download)

At first you have to install Microsoft’s Virtual PC. Therefore you have to download it (use the link from the above “What do we need?”-list ). But wait – maybe you can spare yourself the download and installation. Take a look at your Start Menu […]

wholesale jerseys nfl Eagles jersey