Thursday, August 19, 2010

Introduction to Azure

A recent brief introduction of Azure on Microsoft Student Lounge.

Azure is a set of services and technologies that enable you to easily benefit from the scalability and agility of cloud computing. Anyone, including independent developers, can store data and build and connect applications in the cloud.

In a typical on premises architecture, you have the server, the operating system running on the server and the applications. There is probably a database running on its own server as well as other infrastructure like security, networking, etc.

In the cloud, all of these items are still there – but you never have to see or worry about them. Azure provides the operating system as a service and the applications you write are distributed across those servers. The database is SQL Azure which is built on Microsoft SQL Server and is also distributed across the same datacenters. There is no need to invest upfront on expensive infrastructure. You pay only for what you use. You can scale up when you need capacity and pull it back when you don’t. Microsoft handles all the patches and maintenance so you get a secure environment with over 99.9% uptime.

This allows you to focus on application development rather than infrastructure configuration, maintenance and scalability. Let’s say you’ve created the next great web application. As it takes the world by storm you don’t have to worry about scaling up your servers, distributing your database across multiple data centers and such – Azure will deal with that – you just need to deal with the app itself. When the creator of the another next great web application contacts you - you can use AppFabric to collaborate and create composite applications.

For more information go here.

Monday, August 16, 2010

C# FAQs Series: How Use FTP Using C#


àIn C# FAQs Series: We discuss most frequent questions asked on C# forums.
As a C# developer you may often have to use FTP. Following is simple program which will demonstrate how to FTP using C#.
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main ()
{
// Geting the object used to communicate with the server.
FtpWebRequest FWRrequest = (FtpWebRequest)WebRequest.Create( "ftp://www.mrmubi.com/mytest.htm");
request.Method = WebRequestMethods.Ftp.UploadFile;
// Set network credentials.
FWRrequest.Credentials = new NetworkCredential ("user","password");
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader("myfile.txt");
byte [] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
FWRrequest.ContentLength = fileContents.Length;
Stream requestStream = FWRrequest.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("File upload complete , status {0}", response.StatusDescription);
response.Close();
}
}
}
}
How to download file using FTP in C#...
public static bool DisplayFileFromServer(Uri serverUri)
{
    // The serverUri parameter should start with the ftp:// scheme.
    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }
    // Geting the object used to communicate with the server.
    WebClient WCrequest = new WebClient();
 
    // Credentials
    WCrequest.Credentials = new NetworkCredential ("user","password");
    try 
    {
        byte [] newFileData = WCrequest.DownloadData (serverUri.ToString());
        string fileString = System.Text.Encoding.UTF8.GetString(newFileData);
        Console.WriteLine(fileString);
    }
    catch (WebException e)
    {
        Console.WriteLine(e.ToString());
    }
    return true;
}
How to delete file using FTP in C#...
public static bool DeleteFileOnServer(Uri serverUri)
{
    // The serverUri parameter should use the ftp:// scheme.
    // It contains the name of the server file that is to be deleted.
    // Example: ftp://contoso.com/someFile.txt.
    // 
 
    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }
    // Get the object used to communicate with the server.
    FtpWebRequest FWRrequest = (FtpWebRequest)WebRequest.Create(serverUri);
    FWRrequest.Method = WebRequestMethods.Ftp.DeleteFile;
 
    FtpWebResponse FWRresponse = (FtpWebResponse) FWRrequest.GetResponse();
    Console.WriteLine("File delete status: {0}",FWRresponse.StatusDescription);  
    FWRresponse.Close();
    return true;
}
You see how easy is it to play with your FTP account in C#.

Friday, August 13, 2010

Microsoft Adaptive Keyboard Prototype - UIST Student Innovation Contest

Microsoft adaptive keyboard, what an excellent idea. This means now we can configure our keyboard as well.
No, it's not the mystery device that Microsoft has been teasing as of late, but we have a feeling that plenty of folks will be wishing that the company's so-called "Adaptive Keyboard" was it. Unfortunately, it's just a prototype, and Microsoft apparently has no plans to turn it into an actual product. It will, however, be landing in the hands of a few lucky students participating in this year's UIST Student Innovation Contest, who will be given free reign to do whatever they like with the keyboard and possibly be rewarded with a $2,000 or $500 prize for their hard work. As for the keyboard itself, it's basically Microsoft's take on something like the Optimus Maximus, and consists of a large touchscreen display on top that "extends" to the keys below -- opening up a whole range of possibilities for different configurations and other shenanigans (no further technical details just yet, unfortunately). Head on past the break for a pair of demo videos and, if you're a student, hit up the source link below for the complete contest details -- act fast though, the deadline for applications is August 17th.



Thursday, August 12, 2010

Silverlight TV 40: You Are Already a Windows Phone Developer






Get Microsoft Silverlight


It has been said that if you know Silverlight then you are already a WindowsPhone 7 developer. Jesse Liberty joins John Papa this week to explore that statement and demonstrate the side-by-side creation of both a Silverlight application and a Windows Phone application.

Watch as Jesse cracks open Visual Studio 2010 and creates two similar applications: one for Silverlight and one for Windows Phone 7. He does this all from scratch so you get to see every step along the way.

Wednesday, August 11, 2010

Microsoft Research Reveals RearType QWERTY Input

For all Microsoft Research Lab fans, here is another idea from the team. See following article on Engadgets.
We've seen a few wacky split keyboards in our day, and even the occasional back-typing peripheral, but Microsoft Research has just congealed the core ideas into a why-didn't-I-think-of-that device for mobile use. Dubbed RearType, the QWERTY solution literally sticks a three-row keyboard on the back of a tablet PC, allowing users to have the same physical sensation as on laptop or desktop without taking up valuable touchscreen real estate. While there's still a few kinks to be worked out of the system (like how to set it down without triggering input) and no plans yet for commercial availability, a brief study showed users could attain 15WPM speeds on average with a single hour of training, and one participant managed to eke out a healthy 47WPM in the same timeframe. We imagine a certain Motorola device is feeling a mite jealous right about now. See the front of the (non-Microsoft) tablet right after the break, and read the full study at our more coverage link.

Sunday, August 8, 2010

C# FAQs Series: Using Proxy



In C# FAQs Series: We discuss most frequent questions asked on C# forums.
One of the most questions asked on C# froums is, how to use proxy settings in your own C# application.
You can programmatically change IE setting from registry using C#.
However the best way is to keep setting in your own application.
Updating IE settings:-

RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", "127.0.0.1:8080");
Control Settings in C# Application:-

YourWebService ws=new YourWebService();
System.Net.NeworkCredential cr= new System.Net.NeworkCredential("User","pwd","domain");
System.Net.WebProxy pr=new System.Net.WebProxy ("127.0.1.2", 80);
pr.Credntials=cr;
ws.proxy=pr;
ws.MyAnyMethod();
To reset default settings...
pr.Credentials=System.Net.CredntialsCache.DefualtCrdentials;

C# FAQs Series: Get Names of All Machine on LAN


In C# FAQs Series: We discuss most frequent questions asked on C# forums.
In this session we will see how to get all machines connected on LAN using C# code. 
You can use windows built-in tool net.exe to achieve this. All you need to do is start it using Process  class and send view command.
 
using System.Diagnostics; 
using System.IO; 
    //Gets the machine names that are connected on LAN 
 Process NetworkUtility = new Process(); 
 NetworkUtility.StartInfo.FileName = "net.exe"; 
NetworkUtility.StartInfo.CreateNoWindow = true; 
 NetworkUtility.StartInfo.Arguments = "view"; 
 NetworkUtility.StartInfo.RedirectStandardOutput = true; 
 NetworkUtility.StartInfo.UseShellExecute = false; 
 NetworkUtility.StartInfo.RedirectStandardError = true; 
 NetworkUtility.Start(); 
 StreamReader streamReader = new StreamReader(NetworkUtility.StandardOutput.BaseStream,  NetworkUtility.StandardOutput.CurrentEncoding); 
string line = ""; 
while ((line = streamReader.ReadLine()) != null) 
 { 
      if (line.StartsWith("\\")) 
      {             listBox1.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper()); 
      } 
} 
 streamReader.Close(); 
NetworkUtility.WaitForExit(1000); 
All machines on LAN will be added in listBox1.