Tuesday, April 28, 2009

An introduction to Windows Azure

Windows Azure is a platform for running Windows applications and storing their data in the cloud. The Azure platform reduces the need for up-front technology purchases, and it enables developers to quickly and easily create applications running in the cloud by using their existing skills with the Microsoft Visual Studio development environment and the Microsoft .NET Framework.

Azure simplifies maintaining and operating applications by providing on-demand compute and storage to host, scale, and manage web and connected applications. Infrastructure management is automated with a platform that is designed for high availability and dynamic scaling to match usage needs with the option of a pay-as-you-go pricing model. Azure provides an open, standards-based and interoperable environment with support for multiple internet protocols, including HTTP/HTTPS, REST, SOAP, and XML.



As the figure suggests windows Azure compute and storage services are built on top of the fabric which is the foundational resource manager of Windows Azure. The Windows Azure compute service is a .NET-based software such as ASP.NET applications and Windows Communication Foundation (WCF) services. The platform also supports background processes that run independently—it’s not solely a Web platform.

Both Windows Azure applications and on-premises applications can access the Windows Azure storage service, and both do it in the same way: using a RESTful approach.

Running applications and storing their data in the cloud can have clear benefits. Rather than buying, installing, and operating its own systems, for example, an organization can rely on a cloud provider to do this for them. Also, customers pay just for the computing and storage they use, rather than maintaining a large set of servers only for peak loads. And if they’re written correctly, applications can scale easily, taking advantage of the enormous data centers that cloud providers offer. Yet achieving these benefits requires effective management. In Windows Azure, each application has a configuration file. By changing the information in this file manually or programmatically, an application’s owner can control various aspects of its behavior, such as setting the number of instances that Windows Azure should run. The Windows Azure fabric monitors the application to maintain this desired state.

Monday, April 20, 2009

Microsoft Project Code Named “Velocity” Community Technology Preview 3

Microsoft project code named "Velocity" provides a highly scalable in-memory application cache for all kinds of data. By using cache, your application performance can improve significantly by avoiding unnecessary calls to the data source. By using distributed cache, your application can scale to match an increasing demand with increasing throughput. "Velocity" distributed cache is provided in the form of a cache cluster, which simplifies your application code by managing the complexities of load balancing behind the scenes. When you use "Velocity," you can retrieve data by using keys or other identifiers, named "tags." "Velocity" supports optimistic and pessimistic concurrency models, high availabilty, and a variety of cache configurations.

You can install a small self-contained environment on your development workstation or use SQL Server to manage a large multi-server cache cluster for your enterprise.

The latest CTP can be downloaded from this location

Wednesday, April 8, 2009

Working with WPF DataGrid - Part 7

The Master – Detail scenario can be displayed in WPF DataGrid using the RowDetails feature of the WPF DataGrid. For showing data in the RowDetails you need to set the RowDetailsVisibilityMode property. In our example I have set the RowDetailsVisibilityMode to be visible when the user click on a row in the Grid.

<WPF:DataGrid Name="_employeeDataGrid"

DockPanel.Dock="Top"

Grid.Row="2" Margin="12 0 12 0"

VerticalAlignment="Top"

ItemsSource="{Binding}"

AutoGenerateColumns="False" Sorting="OnGridSorting"

RowDetailsVisibilityMode="VisibleWhenSelected" SelectionMode="Extended" SelectionChanged="OnRowSelected" >

<WPF:DataGrid.RowDetailsTemplate>

<DataTemplate>

<WPF:DataGrid AutoGenerateColumns="False" GridLinesVisibility="Horizontal" Margin="20 0 0 0"

SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected" CanUserAddRows="False"

HeadersVisibility="None" ItemsSource="{Binding Path=AddressInfo}">

<WPF:DataGrid.Columns>

<WPF:DataGridTextColumn Binding="{Binding Path=Line1}" />

<WPF:DataGridTextColumn Binding="{Binding Path=Line2}" />

<WPF:DataGridTextColumn Binding="{Binding Path=State}" />

</WPF:DataGrid.Columns>

</WPF:DataGrid>

</DataTemplate>

</WPF:DataGrid.RowDetailsTemplate>

I have added Addresses to each Employee and want to show the address inside another datagrid when the employee is selected in the Grid.

The Address class contains properties to store the Address info as

public class Address

{

public int Id { get; set; }

public string Line1 { get; set; }

public string Line2 { get; set; }

public string State { get; set; }

public override bool Equals(object item)

{

Address address = item as Address;

if (address != null)

return address.Id == this.Id;

return false;

}

public override int GetHashCode()

{

return this.Id;

}

public override string ToString()

{

return String.Format("{0}, {1} \n{2}", Line1, Line2, State);

}

}

Employee class is changed to have a collection of Addresses.

public class Employee

{

public int Id { get; set; }

---

public List<Address> AddressInfo { get; set; }

}

My factory class for creating Addresses for employees

public class AddressFactory

{

private static List<Address> AddressCollection = default(List<Address>);

private static int m_Id = 0;

public static bool Remove(Address address)

{

return AddressCollection.Remove(address);

}

public static List<Address> GetAddressCollection()

{

if (AddressCollection == null)

AddressCollection = CreateCollection();

return AddressCollection;

}

private static List<Address> CreateCollection()

{

return new List<Address>

{

new Address { Id = 1, Line1 = "224 E Garden St", Line2 = "Pensacola", State = "Florida" },

new Address { Id = 2, Line1 = "770 BTM Layout", Line2 = "Bangalore", State = "Karnataka" },

new Address { Id = 3, Line1 = "40 E Chicago Ave", Line2 = "Chicago", State = "Illinos" },

new Address { Id = 4, Line1 = "800 6th Ave", Line2 = "New York", State = "NY" }

};

}

public static List<Address> GetAddress(params int[] addressIds)

{

if (AddressCollection == null)

AddressCollection = CreateCollection();

var addressCollection = from address in AddressCollection

join id in addressIds

on address.Id equals id

select address;

return addressCollection.ToList<Address>();

}

}

The CreateCollection method of the EmployeeFactory is updated to get the Addresses for each Employee

private static List<Employee> CreateCollection()

{

return new List<Employee>

{

new Employee { Id = 1, FirstName = "Prajeesh", LastName = "Prathap", Occupation = "Engineer", DateOfJoining=new DateTime(2005, 8, 1), IsContracter = false, AddressInfo = AddressFactory.GetAddress(1, 3) },

new Employee { Id = 2, FirstName = "Rahul", LastName = "Bose", Occupation = "Student", DateOfJoining=new DateTime(2009, 5, 4), IsContracter = true, AddressInfo = AddressFactory.GetAddress(1) },

new Employee { Id = 3, FirstName = "Steve", LastName = "Roberts", Occupation = "Manager", DateOfJoining=new DateTime(1994, 8, 23), IsContracter = false, AddressInfo = AddressFactory.GetAddress(4) },

new Employee { Id = 4, FirstName = "Micheal", LastName = "Clarke", Occupation = "Engineer", DateOfJoining=new DateTime(2003, 1, 14), IsContracter = true, AddressInfo = AddressFactory.GetAddress(3, 4) },

new Employee { Id = 5, FirstName = "Rachel", LastName = "Green", Occupation = "Professional", DateOfJoining=new DateTime(2006, 3, 8), IsContracter = true, AddressInfo = AddressFactory.GetAddress(2, 3) }

};

}

Output