WCF 4.5 features: Simplified Generated Configuration Files

 

In this post we will discuss one of the most important feature of WCF 4.5. WCF 4.5 generates simplified configuration file at the client side. WCF 4.5 generates configuration file for basicHttpBinding as following,


 

 

To understand simplified configuration file in better way take an example, Before WCF4.5 when you were adding a service reference, at the client side WCF was creating service configuration file with all the default values for the attributes of the binding. In earlier version of WCF4.5 configuration file created at client side was as following. Below is the configuration file for service with wsHttpBinding.

 

Above I have taken an old configuration file and it contains many other attributes along with default attributes. However point I am trying to make that in prior version of WCF 4.5 ,automatically created configuration file at client side contained default  attribute with values of binding by default. Whereas in WCF4.5  automatically created configuration file at client side is much simplified and contains only the binding name as shown in the image below, 

In WCF 4.5 generated configuration file at client side is very much simplified and does not contain any default value of the binding attribute.

 

In this way you can notice simplified configuration file at the client side. In later post we will discuss another feature of WCF 4.5. I hope you find this post useful. Thanks for reading.

 

Configure Node.js for Windows

In this post we will walkthrough step by step to set up environment for node.js on windows. Very first navigate to Windows Azure Download page and select node.js for Windows to download

image

Once you click on node.js download option for Windows you will get following confirmation windows. Click on Save File.

image

After saving the file when you run the exe, it would launch a Web Platform Installer. You will get option to install Windows Azure SDK for Node.js. Click on Install button to proceed with installation

image

After successful installation you will get information about successful installed products as following in a dialog box.

image

After installation open command prompt as administrator and run the command

npm install azure-g

image

After successful installation of package create a working folder. For example I have created a folder called nodedemo in C drive. Now navigate to http://nodejs.org/ and copy the Hello Word sample from here

image

Create a file called server.js inside nodedemo folder and paste this code. After this run the command

node server.js

image

You will get message that node server is running. Now when you navigate to http:127.0.0.1:1337 , you should be getting following response from the server

image

Once you get this response you can be sure that node server is configured on windows. I hope you find this post useful. Thanks for reading.

 

Step by Step creating Virtual Machine in Windows Azure

In this post we will walkthrough step by step to create Virtual Machine in Windows Azure. To start with very first you need to login to Windows Azure Management Portal here and then click on Virtual Machines option in left panel.

image

If you do not have any virtual machine created then you will get following message. You need to click on CREATE A VIRTUAL MACHINE

image

If you do not have any virtual machine created then you will get following message. You need to click on CREATE A VIRTUAL MACHINE. After clicking that you will get following option

  1. QUICK CREATE
  2. FROM GALLERY

In this tutorial let us try option of Quick Create. On selecting this option

First you need to provide DNS NAME of the virtual machine. It should be unique. You will get a right mark on valid DNS name.

 

image

Next you need to choose the Image for the Virtual Machine. Choose any image as of your requirement. You will get virtual machine mount with image you will choose from the dropdown.

image

Next you need to provide password to access Virtual Machine. Choose the size of the machine and datacenter. After providing these entire information clicks on Create Virtual Machine to create the virtual machine.

image

In bottom of the page you can see information and status on creating virtual machine.

image

Once Virtual Machine got created successfully, you can see the details as following

 

image

 

In this way you can create Virtual Machine in Windows Azure. I hope you find this post useful. Thanks for reading.

 

Video : ListBox Data Binding in Windows Phone


using System.Collections.Generic;
using Microsoft.Phone.Controls;

namespace PhoneApp1
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
this.DataContext = GetProducts();
}

private List<Product> GetProducts()
{
List<Product> lstProduct = new List<Product>
{
new Product { ProductName ="Pen" , ProductCat ="Education" , ProductPrice = 100 },
new Product { ProductName ="Pencil" , ProductCat ="Education" , ProductPrice = 200 },
new Product { ProductName ="Bat" , ProductCat ="Sports" , ProductPrice = 400 },
new Product { ProductName ="Ball" , ProductCat ="Sprots" , ProductPrice = 90 },
new Product { ProductName ="Eraser" , ProductCat ="Education" , ProductPrice = 10 },
new Product { ProductName ="Shoes" , ProductCat ="Sports" , ProductPrice = 790 },
new Product { ProductName ="NoteBook" , ProductCat ="Education" , ProductPrice = 345 },
new Product { ProductName ="Cycle" , ProductCat ="Sports" , ProductPrice = 5000 },
new Product { ProductName ="Gel Pen" , ProductCat ="Education" , ProductPrice = 130 },
new Product { ProductName ="Football" , ProductCat ="Sports" , ProductPrice = 440 },
new Product { ProductName ="Hockey Stick" , ProductCat ="Sports" , ProductPrice = 320 },
new Product { ProductName ="Drwaing  Book" , ProductCat ="Education" , ProductPrice = 480 },
new Product { ProductName ="Novel" , ProductCat ="Education" , ProductPrice = 180 },
new Product { ProductName ="Tenis Bat" , ProductCat ="Sports" , ProductPrice = 340 },
new Product { ProductName ="Tenis Ball" , ProductCat ="Sports" , ProductPrice = 46 }

};
return lstProduct;

}
}

public class Product
{
public string ProductName { get; set; }
public string ProductCat { get; set; }
public int ProductPrice { get; set; }
}
}


<ListBox x:Name="lstProduct" ItemsSource="{Binding}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding ProductName}" Style="{StaticResource PhoneTextTitle2Style}" />
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding ProductCat}" Style="{StaticResource PhoneTextNormalStyle}" />
<TextBlock Text="{Binding ProductPrice}" Style="{StaticResource PhoneTextAccentStyle }" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

Video : Find which Panorma Item is selected in Windows Phone

 

Source Code


public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();

myPanorma.SelectionChanged += new EventHandler<SelectionChangedEventArgs>(myPanorma_SelectionChanged);
}

void myPanorma_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (myPanorma.SelectedIndex == 0)
{
MessageBox.Show("first item is selected");
}
if (myPanorma.SelectedIndex == 1)
{
MessageBox.Show("second item is selected");
}

}

What is strict mode in JavaScript?

Have you ever noticed use of strict keyboard as shown in following image anywhere?

 

When I start creating application for Windows Store (Metro App), I noticed this on the top of the default.js file. Well it is nothing but a way to tell JavaScript for better coding and error checking in JavaScript code. If you put strict mode then you are not allowed to do many things in JavaScript code like assigning value to a read only variable.

You can put strict mode restriction

  1. On the function level
  2. On the page level   

 You can put strict restriction on function level as following

Now let us try to put some code in above function. In below code we are assigning value to a variable which is not declared. We have also put function is the strict mode.

When try to call this JavaScript function, you will get error as following. You see in the error message that “Variable undefined in strict mode”. If you go ahead and remove strict mode from the function then you should able to call the function.

If you have put strict mode then you will get error if you try to perform following operations.

  1. Assigning value to non-declared variable
  2. Assigning value to read only variable
  3. Defining duplicate property
  4. Defining duplicate parameters in a function
  5. Using future reserved keywords like interface, let, package etc.
  6. Cannot defined a function inside if-else or for statement

There are many other operations will give you error in strict mode. I hope now purpose of strict mode is clear to you. Thanks for reading!

Create App Package for Windows Store

 

 

In this post we will follow step by step procedure to create app package for Windows Store. Let us suppose you have created a “Hello World “application for Windows Store and want to create an App Package for the same. To create that from menu select PROJECT

 

image

 

From the POROJECT menu, select Store->Create App Package

 

image

 

Next you will get Create App Package wizard. At the point, we do not want to upload package to Windows Store so select the option No and click on Next

 

image

 

In next screen you need to choose Platform for the package. You can create package for

 

  1. 64 bit platform
  2. 32 bit platform
  3. ARM
  4. Neutral platform

 

Subsequently you need to choose whether you want to create package for Release Mode or Debug Mode. Here, I am creating a package for Neutral platform. Select that option and click on Create to create package.

 

image

 

After clicking on create in bottom of Visual Studio you can notice Build Succeeded message. And in next window you will get Success Message with path of the created package.

 

image

 

When you browse to path you will find package has been created to upload.

clip_image001

In this way you can create application package for Windows Store. I hope you find this post useful. Thanks for reading.