Archive for August, 2009
C# .Net using Post with HTTPWebRequest
0Just a reminder for posterity : posting with .Net its so easy! Check out the Cocoa touch framework to realize the difference!
public string Post(string url, string data) {
string strReturn = null;
try
{
//Encoding the post vars
byte[] buffer = Encoding.ASCII.GetBytes(data);
//Initialisation with provided url
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
//Set method to post, otherwise postvars will not be used
WebReq.Method = "POST";
WebReq.ContentType = "application/x-www-form-urlencoded";
WebReq.ContentLength = buffer.Length;
Stream PostData = WebReq.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
//Closing is always important
PostData.Close();
//Get the response handle, we have no true response yet
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
//information about the response
HTTPStatusCode status = WebResp.StatusCode;
string server = WebResp.Server;
//read the response
Stream WebResponse = WebResp.GetResponseStream();
StreamReader _response = new StreamReader(WebResponse);
strReturn = _response.ReadToEnd();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return strReturn.Trim();
}
Enjoy!
Google Visualizations
0While working on my idea of presenting on this website also the Romanian National Bank exchange rates (very useful in this crisis time), I end up in choosing a form of visualization.
One might argue that text is good enough, but for me frankly graphs and charts are the best. So I started looking on the internet for free and customizable charting tools.
From the plethora of choices on the web I will present just a few:
1. An interesting tutorial on how to build a chart of your own – it’s the easy way to get exactly what you need done as it should be. It is quite old, but still actual, as Macromedia MX programming is still supported in Adobe CS3
2. OpenFlashChart GWT Library – very interesting, free library and highly customizable. But it comes with a big drawback : it has approx 375 Kb .. quite big for my requirements.
3. Origamy Flash graph component – amazingly nice and costly . 99$ ..
4. Google visualization – free, fast, light and with a ton of settings. They have pies, tables, charts … with really lots of settings. The added traffic isn’t much … around 30 kb per graph ( and I measured biggest one – Annotated time line ).
Microsoft Surface – What’s inside
4
After starting the task, I started to be very curios about the technology that drives this device.I started looking over the internet and I found this picture. Very interesting, isn’t it? Basically contains a normal computer, linked to a projector and few infrared cameras.
1) Screen, the visual part of the device – Contains a special diffuser which turns the Surface’s acrylic tabletop into a big horizontal “multitouch” screen, capable of acquiring and processing multiple inputs from multiple users in the same time. The Surface is far more advanced than simple multitouch devices, being capable to be aware of different objects by recognizing their shape or by reading coded “domino” tags when placed on the table.