Sunday, July 24, 2011

Visual Studio 2010 styles

I have been working with visual studio 2010 yesterday and I was searching some thing and same time I have found one great site for Visual Studio styles. http://studiostyl.es/ This site is cool and you can find lots of visual studio 2010 styles of your choice. Here is the screenshot of site.


Style

You can create your own color schemes for visual studio also. I have downloaded the first one(Son of Obsidian). It will be visual studio settings file.Once you downloaded you can import like following. GoTo Tools->Import and export settings in Visual Studio 2010. Once you click this It will import and export dialog like following.


ImportExportDialog

I have selected Import selected environment setting and clicked next on next screen you will have option to save your visual studio settings like following.

SaveYourSettings

Clicking on next you will have options for different visual studio 2010 Style like following.

ChooseStyle

Click on browse and select your downloaded style like following.

OpenStyle

Click on open and then you will represented to recent file options click next You will come to final settings wizard like following.

FinishStyle

Click on finish now our style is applied.Close the dialog and open your project and you can see new color scheme for your visual studio 2010 like following.

VisualStudio2010Style

That’s it. Hope you like it. Stay tuned for more..Till then happy programming..


kick it on DotNetKicks.comShout it
Share:
Friday, July 22, 2011

Box Selection in Visual Studio 2010

Every day I am discovering something new with Visual Studio 2010 and In this post I am again going to explain you new interesting feature of Visual Studio 2010. We all required to modify the code in bulk some time and there is a new features for Visual Studio 2010 which enables to made changes in multiple line at same time. Let’s take a simple example like following.


using System;

namespace Parallel
{
  class Program
  {
         private int a=10;
         private int b=10;
         private int c=10;

         static void Main(string[] args)
         {

         }  
  }
}

In above code I have three private variable a,b and c and now I want to make them protected. There is two way either I do manually one by one or I can do it with box selection and modify them together. It very easy to use this feature Press ALT+ SHIFT and draw box with help of mouse on the code which you need to modify like following.



SelectedBox

Now I want to make it protected so I started writing protected and it will modify all the line at same time like following.

ChangedCode

And now my code is like following.

using System;

namespace Parallel
{
  class Program
  {
         protected int a=10;
         protected int b=10;
         protected int c=10;

         static void Main(string[] args)
         {

         }  
  }
}

That's it. Hope you like it… Stay tuned for more…Till then Happy programming.




Shout itkick it on DotNetKicks.com
Share:
Tuesday, July 19, 2011

Windows Azure Table Storage in detail

Windows Azure table storage provides two kind of storage 1) SQL Azure and other one is 2) Table,queue,blob and other storage like drives etc. In this blog post I am going to explain Table storage in details.

What is Windows Azure Table Storage:


Windows Azure table storage is a service provided by Azure platform to store data in form relational tables in windows azure storage instead of normal RDBMS System. It is a structured storage provided by Azure platform. The table storage which you create with windows azure is Unique. An account of windows azure can have any number of table storage.

Table Storage in details:


There are three important aspects when you deal with windows azure table services. Table,Entities and Properties. Here table is similar to storing data in spread sheet or storing in table with relational databases. Entity represents particular row in the table and property represents a particular column or cell in row. There are three system properties of each entity.
  1. Partition Key
  2. Row Key
  3. Time Stamp

Partition Key:


The partition key is a unique key value that is used to group, or partition, related data on same storage node. As we all know that internally data will stored in hard disks in table storage so whenever your data grows then at that time your data may be partitioned into multiple hard drives. At that time this partition key will keep all the data on the same storage nodes. So partition key is used to organize data in storage.

Row Key:


Row key uniquely identifies a specific entities on a partition. Different partition keys may share the same row key, but the same partition may not have two entities with the same row key.The Row Key property is optional and may also be an empty string if all that is needed for uniqueness is the Partition Key value
The PartitionKey and RowKey properties both have String values (up to 1KB in size) and together they form a unique primary key for an entity in a table.

TimeStamp:


Time stamp property has a DateTime value maintained by the Windows Azure Table System to facilitate optimistic concurrency.

Column Types in Table Storage:


Table storage in windows azure support following types of columns.
  1. byte[]
  2. bool
  3. DateTime
  4. double
  5. Guid
  6. Int32 or Int
  7. Int64 or long
  8. String.
In next post I will create application for table storage. That’s it. Hope you like it. Stay tuned for more.. Till then happy programming..

Shout it

kick it on DotNetKicks.com
Share:
Sunday, July 17, 2011

New Improved IntelliSense with Visual Studio 2010

I have posted lot many things about Visual Studio 2010 features because its a great IDE(Integrated Development Environment).Today I am going to write about IntelliSense improvement in Visual Studio 2010. Today when I was working with Visual Studio 2008 for a old project(Nowadays I am working with Visual Studio 2010), I have found new improve IntelliSense feature in Visual Studio 2010.


Filtering:


Visual Studio 2010 IntelliSense is filtered better than Visual Studio 2008. I have created a sample application and I am writing Console.ReadLine that you can see in following image its filtering with read only.

Intellisense

In earlier version it was not possible.Hope you like it. Stay tuned for more.. Happy Programming..

Shout it

kick it on DotNetKicks.com
Share:
Saturday, July 16, 2011

Introduction to Windows Azure

Recently I have got chance to work with SQL Azure and I loved it. So that’s why Here I am going to start series of post on Windows Azure and SQL Server Azure. In first post of this series I am going to introduce you windows azure platform. I know there are many peoples that may find this post as very beginner level but We all have started from beginner level at some point of time. So It’s better to start at beginner level and then go through step by step overview.

What is Windows Azure:


Well simplest answer in this simple language to above question is “ It’s a operating system which hosts number of services on cloud”. Microsoft has developed this platform to leverage services into the cloud. In azure world you can have application and databases running on cloud. You don’t have to worry about the infrastructure of servers and all other stuff. They will be automatically done by windows azure plate form itself. All you have need to do buy a windows azure services and then developed application with the SDK provided by Microsoft and deploy it. Your application will be ready to serve. You can add multiple instances of server as per your application requirement.

Developing windows azure application is slightly different from normal traditional applications. But developer can still use visual studio 2010 for that. It can also host PHP,Java and other applications also. It does not required to have proprietary software to write application. In fact you can use windows azure with Visual Studio 2010 express edition also.

Roles:

In windows azure everything is based on Roles. There are two kind of roles available for windows azure.
  1. Web Role
  2. Worker Role
Web Role:
You can think web role as web server where we can host our web application or web site. They provide public computers to connect your application like a simple website url i.e. myapplication.cloudapp.net etc. You can run the application with standard HTTP and HTTPS ports also. Even you can have multiple web roles for your single application as per your requirement.
Worker Role:
You can defined Worker Role as some kind of services that works behind the web application. i.e. A window service to create thumbnail of images to display it in web application or a caching service etc. Worker roles are also available outside the world they can talk to any application.

Storage Resources available in Windows Azure:


Azure provide two kind of storage facility In built storage in Azure where we can store data in blobs,queues,tables, drives which are used for following purposes.
  1. Blob- Used to store large amount of data.
  2. Queues-Background work processing
  3. Table- Storage for fast retrieval
  4. Drives-NTFS Formatted page blobs
Windows Azure also provides storage facility with SQL Azure.SQL Azure is a database in cloud where you can almost have all functionalities of SQL Server in cloud. I will cover about above topic in details in forthcoming posts.

All types of roles comes in four verities: Small,Medium, Large and Extra large. All roles are virtual machines. Each represents an increase in pricing and has a different set of specifications that govern how much RAM, local storage space and CPU cores are available to the role as described below:


Size CPU Cores Memory Disk Space for Local Storage Resources
Small 1 1.7 GB 250 GB
Medium 2 3.5 GB 500 GB
Large 4 7 GB 1000 GB
Extra-large 8 14 GB 2000 GB


That’s it. Hope you liked this post. In forthcoming post I am going to explain you can use windows azure in your application with example. Till that stay tuned for more.. Happy programming..


Shout it

kick it on DotNetKicks.com
Share:
Friday, July 15, 2011

Some important attributes in EFCodeFirst

In today’s post I am going to explain some of the important attributes in EFCodeFirst. Whey you do scaffolding with ASP.NET MVC this all attributes are where much important. So Let’s explore all the attributes.

Key Attribute:

When you put this attribute in the class it tell that this property is part of the primary key and If you use code first when its create table based on this entity then it will be a part of primary key of table. Here is the sample example of that.
[Key]

public int ArticleId { get; set; }
Here article ID will act as primary key.

Foreign Key Attribute:

This attribute is very useful when you deal with interrelated tables You can specify the column in entity which is foreign key for that Like following.
[ForeignKey("CategoryId")]

public ICollection<Category> Categories { get; set; }
In above example CategoryId is a foreign key of category table to article table.

ScaffoldColumn Attribute:

When you Scaffold your application with ASP.NET MVC scaffold feature or dynamic data with asp.net webforms this attribute will tell that this column need to have field for that. You can write that column like following.
[ScaffoldColumn(false)]

public int ArticleId { get; set; }
Here it will tell article id will not have UI in scaffoling.

StringLength Attribute:

This attribute is used to specify the maximum length of a string. This attribute is very usefull in validation and other stuff. This attribute only applied to the Stringlength property like following.
[StringLength(512)]

public string Title { get; set; }
Here in the above code it tell that title could not have more then 512 character string.

There lots of other attributes also. I will blog about it in future posts. Hope you liked this. Stay tuned for more..Happy Programming.

Shout it

kick it on DotNetKicks.com
Share:
Tuesday, July 12, 2011

Parallel for loop in C# 4.0

Now days we are getting our computer equipped with more and more power even now we are getting quad core processor is also at lower price. Since we have multicore processors are now so we can take advantages of multicore processor with parallel execution in C# 4.0. There are some time consuming task for the computer for example a long for loop or similar kind of things. This kind of task can be done parallel with parallel class in C# 4.0.

Now in C# 4.0 you have the Parallel static class with the help of this you can perform task parallel very easily. In this post I am going to explain Parallel for loop. Let’s take a very simple example. First lets create a example with simple for loop. Following is code for that.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace Parallel
{
class Program
{
    static void Main(string[] args)
    {
        for (int i = 0; i <=100000; i++)
        {
            Console.WriteLine(i);
        }
       
    }
}
}

In the above its a normal loop which increments I and then print the that number into the console screen and Here is the output.

Ouput1

Here in the output you can see its sequentially process one by one now lets change this code to parallel for loop like following.

using System;

namespace Parallel
{
class Program
{
    static void Main(string[] args)
    {
        System.Threading.Tasks.Parallel.For(0, 100000, i =>
        {
            Console.WriteLine(i);
        }
        );
        Console.ReadLine();
    }
}
}

Here in the above code you can see that I have used parallel for which also prints the Incremented integer in console application. Now let’s run that code and see the output as following.

Output2

If you see the output very carefully then you can see that its not processing sequentially one by one but its processing it parallel and its will be much faster if you have multicore processor in your computer. But beware if you are going to run in simple processor computer its going to take more time then normal computer. That’s it. Hope you liked it.. Stay tuned for more.. Till that happy programming..



Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews