Sunday 29 May 2011

Free eBook on Windows Azure

I just found a free 96 pages eBook available from Eric Nelson about the windows azure platform. Looked through it very quickly and I thought it would be a very good book to learn the overall of Windows Azure, SQL Azure and the software architecture which will be deployed on Azure. You can download it here.

image

You can also read the book Cloud Computing with Windows Azure Platform by Roger Jennings online from here. Remember this is just the online version, so you cannot download or print this.

Cloud Computing with the Windows Azure Platform

To Get the feel of this book, you can buy from the Amazon link below.

Update : Tuesday, 31st May 2011, While going through the online articles to fetch more and more knowledge on Cloud and What other Cloud Services offers as Compared to Windows Azure, also some very fundamental concepts which I have not discussed till now. i.e. SaaS, Paas, IaaS, etc. I cam across an excellent free eBook (Demystifying the Cloud An introduction to Cloud Computing) provided by Janakiram MSV on one of his post.

I must say the way he has the way he presented everything is something very unique in itself. Once you start reading this book, you will get totally engaged into it. You can download it from his blog link:

Demystifying the Cloud An introduction to Cloud Computing

Share:

Monday 23 May 2011

Head First Design Patterns - Code Examples in C#

The only thing which bothered me while reading this book (Head First Design Pattern) was the code which was provided in Java.

I was very happy to learn that this is no longer an issue because now you can download all the codes in you native C# Language that too in Framework 4.0 :-)

You can download the codes from codeplex using the link below.

http://hfpatternsincsharp.codeplex.com/

Share:

.NET Windows Development: Everyday Tips, Tricks & Optimization - Alberto Población

This is one of the best book I have came across so far, This book is so indulging that once you start reading this book you will want to finish all the chapters in one go, actually same thing happened to me too.

This book covers Tips, Tricks and Optimization techniques for Visual Studio 2005, 2008 and 2010 and also new features of Windows 7 too and most important is this is not only theory, In fact these are the collection of techniques which we use day to day in our work and  professional career.

Alberto has been in computer industry for more then 27 years and also Microsoft MVP in C# because of his great impact teaching others about .NET development both as a trainer as well as a top answerer in newsgroup and forums. Alberto Población poured the cream of his knowledge into this book. I would recommend all my readers to read this book at least once.You can get a fair idea of this book by reading the Table of Contents and Index @ Amazon.

I can assure that this book will help you to write more optimized and better code, you can also complete your task more quickly and effectively.

To buy this book you can go to this Amazon link “.NET Windows Development- Everyday Tips, Tricks & Optimization.”.

You can download the Example Source Codes used in this book from here : http://www.krasis.com/krasispress/Downloads.htm

Some of the Topics this book covers are:

  • Special techniques for accessing data.
  • New features in Windows 7 and Programming with these features.
  • Using Graphics, Serialization and Reflection
  • Various techniques that should be well-known, but aren't.
  • Tips and Tricks of Windows Forms application.

I don't know Alberto personally, but after reading this book I can say this was his very nice effort and I just request Alberto Población to keep sharing more of his knowledge like this in his future publications too.

Share:

Thursday 19 May 2011

“Article of the Day” – ASP.NET Forum

I am happy to announce that my article has been published on http://www.asp.net site Tuesday, May 17, 2011

You can visit the http://www.asp.net/community and Select “Article of the day” section in asp.net site & check out the following entry for my article.

Create and Deploy Windows Azure Application (http://tutorials.indianjobs.co.in/2011/05/create-and-deploy-windows-azure.html)

Thanks to all my readers/well wishers who has inspired me to post/write useful content on the blog. I will try my best to provide useful articles in upcoming days as well.

Share:

SQL Server Date-Time Formats

Here's a summary of the different date formats that come standard in SQL Server as part of the CONVERT function. Following the standard date formats are some extended date formats

Standard Date Formats
Date Format Standard SQL Statement Sample Output
Mon DD YYYY
HH:MIAM (or PM)
Default SELECT CONVERT(VARCHAR(20), GETDATE(), 100) Jan 1 2011 11:29PM
MM/DD/YY USA SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY] 11/23/98
MM/DD/YYYY USA SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY] 11/23/2011
YY.MM.DD ANSI SELECT CONVERT(VARCHAR(8), GETDATE(), 2) AS [YY.MM.DD] 93.01.01
YYYY.MM.DD ANSI SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD] 2011.01.01
DD/MM/YY British/French SELECT CONVERT(VARCHAR(8), GETDATE(), 3) AS [DD/MM/YY] 19/02/93
DD/MM/YYYY British/French SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY] 19/02/2011
DD.MM.YY German SELECT CONVERT(VARCHAR(8), GETDATE(), 4) AS [DD.MM.YY] 25.12.05
DD.MM.YYYY German SELECT CONVERT(VARCHAR(10), GETDATE(), 104) AS [DD.MM.YYYY] 25.12.2011
DD-MM-YY Italian SELECT CONVERT(VARCHAR(8), GETDATE(), 5) AS [DD-MM-YY] 24-01-92
DD-MM-YYYY Italian SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY] 24-01-2011
DD Mon YY - SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY] 04 Jul 11
DD Mon YYYY - SELECT CONVERT(VARCHAR(11), GETDATE(), 106) AS [DD MON YYYY] 04 Jul 2011
Mon DD, YY - SELECT CONVERT(VARCHAR(10), GETDATE(), 7) AS [Mon DD, YY] Jan 24, 11
Mon DD, YYYY - SELECT CONVERT(VARCHAR(12), GETDATE(), 107) AS [Mon DD, YYYY] Jan 24, 2011
HH:MM:SS - SELECT CONVERT(VARCHAR(8), GETDATE(), 108) 03:24:53
Mon DD YYYY HH:MI:SS:MMMAM (or PM) Default +
milliseconds
SELECT CONVERT(VARCHAR(26), GETDATE(), 109) Apr 28 2011 12:32:29:253PM
MM-DD-YY USA SELECT CONVERT(VARCHAR(8), GETDATE(), 10) AS [MM-DD-YY] 01-02-11
MM-DD-YYYY USA SELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS [MM-DD-YYYY] 01-01-2011
YY/MM/DD - SELECT CONVERT(VARCHAR(8), GETDATE(), 11) AS [YY/MM/DD] 98/11/23
YYYY/MM/DD - SELECT CONVERT(VARCHAR(10), GETDATE(), 111) AS [YYYY/MM/DD] 2011/11/23
YYMMDD ISO SELECT CONVERT(VARCHAR(6), GETDATE(), 12) AS [YYMMDD] 920124
YYYYMMDD ISO SELECT CONVERT(VARCHAR(8), GETDATE(), 112) AS [YYYYMMDD] 20110124
DD Mon YYYY HH:MM:SS:MMM(24h) Europe default + milliseconds SELECT CONVERT(VARCHAR(24), GETDATE(), 113) 28 Apr 2011 00:34:55:190
HH:MI:SS:MMM(24H) - SELECT CONVERT(VARCHAR(12), GETDATE(), 114) AS [HH:MI:SS:MMM(24H)] 11:34:23:013
YYYY-MM-DD HH:MI:SS(24h) ODBC Canonical SELECT CONVERT(VARCHAR(19), GETDATE(), 120) 2011-01-01 13:42:24
YYYY-MM-DD HH:MI:SS.MMM(24h) ODBC Canonical
(with milliseconds)
SELECT CONVERT(VARCHAR(23), GETDATE(), 121) 2011-02-19 06:35:24.489
YYYY-MM-DDTHH:MM:SS:MMM ISO8601 SELECT CONVERT(VARCHAR(23), GETDATE(), 126) 2011-11-23T11:25:43:250
DD Mon YYYY HH:MI:SS:MMMAM Kuwaiti SELECT CONVERT(VARCHAR(26), GETDATE(), 130) 28 Apr 2011 12:39:32:429AM
DD/MM/YYYY HH:MI:SS:MMMAM Kuwaiti SELECT CONVERT(VARCHAR(25), GETDATE(), 131) 28/04/2011 12:39:32:429AM

Some more date formats that does not come standard in SQL Server as part of the CONVERT function.

Extended Date Formats
Date Format SQL Statement Sample Output
YY-MM-DD
SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 8) AS [YY-MM-DD]
SELECT REPLACE(CONVERT(VARCHAR(8), GETDATE(), 11), '/', '-') AS [YY-MM-DD]
92-01-24
YYYY-MM-DD
SELECT CONVERT(VARCHAR(10), GETDATE(), 120) AS [YYYY-MM-DD]
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 111), '/', '-') AS [YYYY-MM-DD]
2011-01-24
MM/YY SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 3), 5) AS [MM/YY]
SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 5) AS [MM/YY]
08/92
MM/YYYY SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 103), 7) AS [MM/YYYY] 12/2011
YY/MM SELECT CONVERT(VARCHAR(5), GETDATE(), 11) AS [YY/MM] 92/08
YYYY/MM SELECT CONVERT(VARCHAR(7), GETDATE(), 111) AS [YYYY/MM] 2011/12
Month DD, YYYY SELECT DATENAME(MM, GETDATE()) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Month DD, YYYY] July 04, 2011
Mon YYYY SELECT SUBSTRING(CONVERT(VARCHAR(11), GETDATE(), 113), 4, 8) AS [Mon YYYY] Apr 2011
Month YYYY SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [Month YYYY] February 2011
DD Month SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) AS [DD Month] 11 September
Month DD SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD] September 11
DD Month YY SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [DD Month YY] 19 February 92
DD Month YYYY SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [DD Month YYYY] 11 September 2011
MM-YY SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 5), 5) AS [MM-YY]
SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 5), 4, 5) AS [MM-YY]
12/92
MM-YYYY SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7) AS [MM-YYYY] 05-2011
YY-MM SELECT RIGHT(CONVERT(VARCHAR(7), GETDATE(), 120), 5) AS [YY-MM]
SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 5) AS [YY-MM]
92/12
YYYY-MM SELECT CONVERT(VARCHAR(7), GETDATE(), 120) AS [YYYY-MM] 2011-05
MMDDYY SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '') AS [MMDDYY] 122506
MMDDYYYY SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') AS [MMDDYYYY] 12252011
DDMMYY SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), '/', '') AS [DDMMYY] 240702
DDMMYYYY SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 103), '/', '') AS [DDMMYYYY] 24072011
Mon-YY SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), GETDATE(), 6), 6), ' ', '-') AS [Mon-YY] Sep-02
Mon-YYYY SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY] Sep-2011
DD-Mon-YY SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY] 25-Dec-05
DD-Mon-YYYY SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(), 106), ' ', '-') AS [DD-Mon-YYYY] 25-Dec-2011
Share:

Wednesday 18 May 2011

Deploying Windows Azure Application – VS2010 IDE

This is with reference to my previous post where I showed how to deploy ASP.NET Windows Azure application manually on the Windows Azure Server.

In this post I am going to show you how to deploy Windows Azure application using Visual Studio 2010 IDE, this I guess is quite simpler as compared to the previous approach i.e. doing it manually.

Once you ready with your Windows Azure Application, Select Deploy option from the Windows Azure Application. To see how to create a basic application you can refer to my previous post.

image

Now from the Deploy Select

1. Create your Windows Azure project to Windows Azure Option

image

2. From the Credential Select Add option if you don’t have Server certificate already present. This will open a Popup for you to enter the details of the Certificate.

image

3. Here again I am selecting Create Option from the Dropdown. This will open another popup for entering the name of your certificate. Once you done Click Ok.

image

4. From the Second option Select the Copy full path and now its time for you to open you Windows Azure Site to upload your Certificate. By Selecting the Copy Full Path option basically this is copying the certificate path for you to clipboard, which you can paste later in Windows Azure Site.

image

5. Once you logged into your Windows Azure Website (https://windows.azure.com), Select ‘Hosted Service, Storage Accounts & CDN then Management Certificates and at the End Select Add Certificated as given in the Screen shot below as 1,2,3.

image

6. This will open a Popup screen for you to upload your certificate, I hope during these time you have not copied anything else in your Clipboard and you still have the path copied which I have mentioned in Step 4.

image

7. Select your Subscription and then Select Browse and paste the Path which you have copied earlier in the File Name of Select file dialogue. Select Open. and then Select Ok from the Popup menu given below.

image

8. So this will create a certificate on Windows Azure Server, and Create a Subscription Id for you Copy the Subscription Id using Ctrl+C, remember right click will not work since this is Silverlight Interface.

image

9. Now come back to your Visual Studio IDE with once you copied the Subscription Id from Windows Azure Site. and paste in the Step 3 of the popup screen as given below. Enter any desired name for your credentials and Click on Ok button.

image

If you get the Error: No Subscription found. As given in the screen below, this means either you have not created the Storage Account or Hosted Service or may be both.

image

To get this things working you have to go to Windows Azure Site and Create a Hosted Service with Do not deploy option selected, as we want to deploy using our Visual Studio IDE.

image

Similarly you have to create a Storage Account too. Hope after doing this you may not face any other issues. So once you have done with these things then

Again you have to Start from Step 1 above, but instead of Adding a new Certificate you can select the one which you have already created. Skip the Steps for uploading the certificate on Windows Azure Server and try again Deploying your application.

10. Now you are almost done, this will take you back to the screen which you got in Step 1, now click on Ok button.

If you get a prompt like the one below, there is nothing to worry, this simply tells you that your Hosted Service is already occupied with another deployment which you may have already done before, this this wizard will just replace you existing application with this one. You have to select Delete and Continue.

image

11. Once you select delete and continue your deployment process starts here, and you can see the progress in Windows Azure activity log.

image

You can also see the progress of your deployment using your Server Explorer or Directly in your Windows Azure Site.

 image image

Once finished your application is ready to browse from Windows Azure Staging Environment. The deployment wizard will provide you with a URL which you can use to browse you latest deployed application. Your URL may look like something like this http://f0f8a62a71fe43158bf43af14b11f5b5.cloudapp.net/, you can find in the Windows Azure Activity Log or you can also find this information in the Windows Azure Site.

image

Hope this helps.

Share:

Saturday 7 May 2011

Create and Deploy Windows Azure Application.

Well we have lots of Blog post which gives us how to deploy our .NET apps on Azure, but I just tried to describe it in my way using more Images which will give much clear understanding(a picture speaks thousand words!!!).

Ok, so to start with first you need to have Windows Azure Access, you can request for Trial licence here. Then for .NET developers will have to download the Azure SDK 1.4 (April 2011) using this link. And of course you need Visual Studio 2010 SP1, you can download it from here. Please note Windows Azure SDK is not compatible with Express editions of VS2010 IDE.

Now run the Visual Studio 2010 in elevated mode, i.e. you have to right click the Visual Studio 2010 icon in Program Files and Select “Run as Administrator”. Once you got the IDE you have to Select New Project and Select Cloud from the left menu, and Select Windows Azure Project from the right Selection menu. I am selecting this as C# project but you can select VB.NET too.

image

Name you application as you like, I named it as FirstWindowsAzure, and selected Ok button.

.image

Once you say Ok, this will show another window providing you with different options to select from. I am not going into very depth of each and every Roles, just to give you brief idea,

A Windows Azure role is an individually scalable component running in the cloud where each instance of a role corresponds to a virtual machine (VM) instance.

There are two types of role:

  • A Web role is a Web application running on IIS. It is accessible via an HTTP or HTTPS endpoint.
  • A Worker role is a background processing application that runs arbitrary .NET code. It also has the ability to expose Internet-facing and internal endpoints.

We also have a special type of Role called as VM Role. You can get more details on MSDN Link about Architecture of Windows Azure Roles.

To keep it simple and focussed I have created a WebRole and named it as MyFirstApp. Once I say Ok my Solution looks something like as below.

image

It is easy to add or remove roles in the cloud service after project creation has completed. To add other roles to this cloud service, right-click on the Roles node in the cloud service and select Add -> New Web Role Project or Add -> New Worker Role Project. Selecting either of these options brings up the Add New Role dialog where you can choose which project template to use when adding the role.

You can add any ASP.NET Web Role project to the solution by right-clicking on the Roles node, selecting Add -> Web Role Project in the solution, and selecting the project to associate as a Web role.

To delete, simply select the role to delete and hit the Delete key. The project can then be removed.

Now coming back to my application. I am keeping all the default codes which was created by the designer and hit F5. Visual Studio will build your project, start the Development Fabric, initialize the Development Storage (if run for the first time), package the deployment, attach to all role instances, and then launch the browser pointing to the Web role.

image

You can see the notifications area of the taskbar shows the Development Fabric has started. The Development Fabric is a simulation environment that runs role instances on your machine in much the way they run in the real cloud.

image

Right-click on the Windows Azure notification icon in the taskbar and click on Show Compute Emulator UI. This will launch the Windows Azure Compute Emulator itself, which allows you to perform various operations on your deployments, such as viewing logs and restarting and deleting deployments. Notice that the Development Fabric contains a new deployment that hosts one Web role instance and one Worker role instance.

image

I hope up to this point you have not encountered any exceptions/errors. Now your sample  application is ready for deployment. If you have already got access to https://windows.azure.com then you can open the site using your credentials. Once you logged in successfully you will get nice UI build on Silverlight 4.0 interface. This is the new UI, you can switch back the old one too if you like.

image

To start the deployment process first you have to Publish the FirstWindowsAzure using the following options (Create Service Package Only). This will create the Package and Service Configuration named named FirstWindowsAzure.cspkg and ServiceConfiguration.cscfg respectively in \bin\Debug\Publish directory.

image

image

Now in the Web Interface of Windows Azure Platform, Select New Hosted Service from the Top Menu Ribbon

image

This will Popup the menu as below.

You have to choose the Desired Subscription, Provide Name, URL Prefix, Region, Deployment options, Deployment Name, Package location and configuration file location.

Since the domain cloudapp.net and is common for all the users prefix with the URL Prefix provided by you, so your prefix has to be unique and not taken by any other users. Select the Staging environment for testing purpose, Keep the Start after successful deployment checked. This will start your Service as soon as its get created. For Package location and Configuration files you have to Browse locally for the files FirstWindowsAzure.cspkg and ServiceConfiguration.cscfg respectively in \bin\Debug\Publish directory. If you enter the URL Prefix which is already taken then it will give you the following error.

image

Once you enter all the required information you can Click Ok in the popup. This will validate your information's which you have entered and may give you a warning, you can simply ignore this warning.

image

This will start creating your application. Once it finishes, your application is ready to browse and hosted in Cloud. Remember this process may take a while during this time don't refresh your browser.

image

image

Once your hosted service is hosted and started, the Azure service will generate a random id for staging environment, which can be used to browse your application remotely, as given below.

image

image

This is just the basics which I wanted to share in this Post, you can also refer to MSDN article Code Quick Start: Create and deploy an ASP.NET application in Windows Azure. Both post are very much similar. I just tried to give more pictorial representation of the same for much better understanding for those who are starting from scratch.

Note: For evaluation licence of Windows Azure you one limitation is you can create only one hosted services. So before winding up just to let you know how to delete the already created hosted services.

First you have to stop the Service you have created if any, once it stopped, you can see the Delete button gets enabled. Then you can comfortably delete the created service and create the new service.

image

Other very useful link : http://blogs.msdn.com/b/jnak/

Hope this helps.

Share: