How to build a low cost Bluetooth relay

Bluetooth iconMeanwhile there are lots of solutions for home automation in the market. However the most of them share one flaw – their price. But blessedly there is Youtube where you can find a video for each topic…
On Youtube I came across a clever tinkerer named Lou, who shows how you can build a low cost Bluetooth relay. I think this is really cool, because there are a many application areas. You could open your garage door, switch lights on and off or unlock an electric lock. To build up one of these Bluetooth relays you must not even be a technical genius, because the use of a soldering iron is sufficient. Knowledge in programming or microcontroller-technology isn’t necessary.
For the Bluetooth relay you need only one transistor and a Bluetooth headset from […]

How to get website header information in C#

With the following function you can easily retrieve a list of website headers in C#. The function needs only the url of a webpage to collect the data. If the function is successfully executed, you’ll get a Dictionary, typed as <string, string>, as return value. This Dictionary<string, string> contains all the headers of the webpage, whose url you passed by at function call time.

//Don’t forget to set the using-directive ;)
using System.Net;

//…

public Dictionary getHeaders(string url)
{
//Dictionary which shall contain the header information
Dictionary header = new Dictionary();

//Create webrequest
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

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

//Read all headers from the response
foreach (string headerItem in response.Headers)
{
//Add header to the dictionary
[…]

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 […]

authentic nfl jerseys cheap cheap jerseys china