Getting Started with windows Azure development

 

This is a follow up to my usergroup presentation I recently did for Gold Coast Usergroup recently. I have many emails, ok just 2 asking me to document my presentation so they can get started developing with windows Azure.

before you get started you need to make sure your development machine is running, Vista or Windows Server 2008 or my favorite windows 7, you also need to have IIS 7.0 with  WCF HTTP activation installed.

Next you will need to have Visual Studio 2008 or Visual Web Developer Express. please make sure you have the latest service packs  installed. This way you will have .NET .35 Sp1.

Next step is downloading all the necessary SDKs, the best way is to simply go to

clip_image001[7]

http://microsoft.com/azure and look for the link “Get tools & SDK” Download and install the SDK and Azure tools for Visual studio, while you are here you might want to bookmark this page, In addition  to tools and SDKs, there are tons of whitepapers and training videos and other resources available.

 

now we are ready to launch Visual Studio, since we installed windows azure tools for visual studio, we should be able to see windows Azure template projects under cloud Service. Lets select cloud Service, I’m going to name my solution MyFirstCloudApp. press OK and you should see the “New Cloud Service Project” window.

clip_image001[5]

Highlight “ASP.NET Web Role” and add it to your Cloud Service Solution by pressing > button, before pressing OK click on the pencil icon on the newly created ASP.NET web role to rename the project to MyCouldApp from the default WebRole1.

Two projects should have been created in your solution. MyCloadApp project is very similar to a standard ASP.NET web application project, but has been modified to work with Windows Azure.

View the contents of Servicedefinition.csdef and ServiceConfiguration.cscfg in the Project MyFirstCouldApp. 

 

clip_image001

 

The ServiceDefinition.csdef file contains the metadata needed by the Windows Azure fabric to understand the requirements of your application, such as which roles are used. It will also contain configuration settings that apply to all instances. .The ServiceConfiguration.cscfg file lets you set the values for the configuration settings and the number of instances to run for each role.


The Roles node in the Cloud Services project enables you to configure what roles the services include (Web, worker or both) as well as which projects are used for these roles.
Adding configuring roles through the Roles node will update the ServiceDefinition.csdef and ServiceConfiguration.cscfg files.

Open Default.aspx, and add some HTML I’m just going to add an THML tag <H1> and ASP Button and ASP Label control, idea here is that we are working with the ASP.net application .

Lets execute the service in Windows Azure by pressing F5 . The service will build and then launch the local development fabric

 

right click the Development Fabric icon in the system tray and seimagelect  Show Development Fabric UI.

click on the service Details view the service details, you should see a URL and IP address and port number, when you execute a windows Azure service it will try to allocate the port  specified in the ServiceDefinition.csdef if this port is not available, then next available port is used.

Click on the webrole and the instance 0, you should see the log for this instance.

switch back to visual studio and stop debugging, open ServiceConfiguration.cscfg and change the number of instances from 1 to 5, Press F5 and then switch to Development Fabric UI, now you should see 5 instances instead of one, you might have to refresh if you still see one instance.

Next week I will have another blog about deploying this app to the cloud.

Short cut keys in windows 7

 

So I finally installed windows 7 on my main laptop and I can’t tell you how happy I am, performance is so much better than Vista. Boot time and shut down processes are very quick. hibernate and resume are reliable and quick. But what I really like are all these cool shortcut Keys everyday seems like I find a new short cut key, here are a few of them.

windowkey.jpg

Win + L Quickly locks your computer, very useful.

Win + D Displays your desktop by minimizing all your open windows .

Win + R opens up the Run window so you can launch and application or paste a URL.

Win + T shows the first Item on your task list you can then navigate through them by using the arrow keys.

Win + U opens up the Ease of access window, here are some useful tools such as magnifier, but you can easily zoom in by pressing Win + ‘+’ and zoom out by pressing Win + ‘-‘ this is very useful specially when you are doing a presentation, which I do a lot of.

Win + P is also very useful for presentations. it gives you the projector shortcut keys

Win + S is really cool, if you are familiar with Snag it, well it does basically the same thing allows you to grab a portion of your screen then pastes it in One Note.

Win + E Opens the explorer window.

Win + F opens of the search window.

Win + X launches the Mobility window from there you can control the volume, check battery status, Wireless setting, projector settings and Sync settings

Win + N launches OneNote

Now some really cool shortcuts, some times I want to dock one of my apps to the right and another one to the left all you have to do is press Win + right or left arrow Key, this is really cool when you use multiple monitors.

Win + Up arrow will maximizes current window, Win + Down arrow will restore the current window if it is maximized, hit it again and will minimizes the active window.

you can maximize, restore or dock the active window simply by dragging it to the top or sides, or just grab any window by its title bar shake it a bit and it automatically will minimize all the other windows, call me a geek but I think this is really cool.

South Florida Code Camp News - Code Camp News for: Feb - 03 - 2009
We have all 72 sessions for this code camp booked and registrations should break 700 today. Please register yourselves and encourage others to register. You can find links on the website: http://codecamp09.fladotnet.com/

Using Words Spellcheck and grammer check with your windows Forms application

One of my customers wanted to add spell check functionality to their windows Form application.  knowing that everyone in their organization has Microsoft Office installed, I did not want to include word interop with the application. so I found a neat way of using words spellcheck. for more information you might want to check this article that was very helpful .

  Private Sub SpellAndGrammarCheck(ByVal YourTextbox As TextBox)

        Try

            Dim oWord As Object = Nothing

            Dim oDoc As Object = Nothing

            Dim oData As IDataObject = Nothing

            oWord = System.Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"))

 

           Dim  oDocuments as object = oWord.[GetType]().InvokeMember("Documents", _

                           BindingFlags.[Default] Or BindingFlags.GetProperty, _

                           Nothing, oWord, Nothing)

 

 

            oDoc = oDocuments.[GetType]().InvokeMember("Add", BindingFlags.[Default] _

                     Or BindingFlags.InvokeMethod, Nothing, oDocuments, Nothing)

            oWord.Visible = False

 

            oWord.WindowState = 0

            oWord.Top = -3000

            Clipboard.SetDataObject(YourTextbox.Text)

 

            With oDoc

                .Content.Paste()

                .Activate()

                .CheckGrammar()

                .Content.Copy()

                oData = Clipboard.GetDataObject

                If oData.GetDataPresent(DataFormats.Text) Then

                    YourTextbox.Text = CType(oData.GetData(DataFormats.Text), String)

                End If

                .Saved = True

                .Close()

            End With

            oWord.Quit()

            MsgBox("Spelling check complete!")

            'SPELLWORKING = True

        Catch COMEcep As COMException

            MsgBox("MS Word must be installed to perform spelling checks", , _

                   "Spell check is not available")

        Catch ex As Exception

            MsgBox("Error, Make sure you have MS word installed.", , ex.Message)

 

        End Try

End Sub

 

Using Words Spellcheck and grammer check with your windows Forms application

One of my customers wanted to add spell check functionality to their windows Form application.  knowing that everyone in their organization has Microsoft Office installed, I did not want to include word interop with the application. so I found a neat way of using words spellcheck. for more information you might want to check this article that was very helpful .

  Private Sub SpellAndGrammarCheck(ByVal YourTextbox As TextBox)

        Try

            Dim oWord As Object = Nothing

            Dim oDoc As Object = Nothing

            Dim oData As IDataObject = Nothing

            oWord = System.Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"))

 

           Dim  oDocuments as object = oWord.[GetType]().InvokeMember("Documents", _

                           BindingFlags.[Default] Or BindingFlags.GetProperty, _

                           Nothing, oWord, Nothing)

 

 

            oDoc = oDocuments.[GetType]().InvokeMember("Add", BindingFlags.[Default] _

                     Or BindingFlags.InvokeMethod, Nothing, oDocuments, Nothing)

            oWord.Visible = False

 

            oWord.WindowState = 0

            oWord.Top = -3000

            Clipboard.SetDataObject(YourTextbox.Text)

 

            With oDoc

                .Content.Paste()

                .Activate()

                .CheckGrammar()

                .Content.Copy()

                oData = Clipboard.GetDataObject

                If oData.GetDataPresent(DataFormats.Text) Then

                    YourTextbox.Text = CType(oData.GetData(DataFormats.Text), String)

                End If

                .Saved = True

                .Close()

            End With

            oWord.Quit()

            MsgBox("Spelling check complete!")

            'SPELLWORKING = True

        Catch COMEcep As COMException

            MsgBox("MS Word must be installed to perform spelling checks", , _

                   "Spell check is not available")

        Catch ex As Exception

            MsgBox("Error, Make sure you have MS word installed.", , ex.Message)

 

        End Try

End Sub

 

How to get the current user logged into Sharepoint

the following snippet get the current user lgged into Sharepoint and displays his/her Name, Login name, Email and all the groups he/she belongs to.

try {SPWeb web = SPControl.GetContextWeb(Context);SPUser sUser = web.CurrentUser; string str = "Name:" + sUser.Name + "<BR>"; "Login Name :" + sUser.LoginName + "<BR>"; "Email:" + sUser.Email + "<BR>"; "Groups:" + sUser.Groups.Count + "<BR>"; foreach (SPGroup grp in sUser.Groups) { " * " + grp.Name + " total Members:" + grp.Users.Count + "<BR>"; catch (Exception ex) { "No Current User" ;

 

 

 

 

 

str +=

str +=

str +=

 

 

str +=

}

lblInfo.Text = str;

}

 

lblInfo.Text=

}

Using custom Assemblies with SQL Server Reporting Services.

In almost every Reporting Services class I teach, I get basically same questions. One of the most popular questions is how do I call a method in a custom assembly from my report.  Here are step By step, instructions to do this.

 

1.       Using Visual Studio Create a new Class Library(VB or C#) I am going to name my Project SSRSAssembly

2.       Rename your Class1.VB or Class1.CS to ComplexCalculations, presumably you would have your re-usable methods in this class

3.       For next step, please use your imagination, pretend the following function has a few lines of code with loops possible calls to other assemblies and does some complex calculations (instead of just returning the square value of the parameter being sent to it.

(a)    Add the following Method to your Class

VB

Public Function SquareMe(ByVal i As Integer) As Integer

        Return i ^ 2

End Function

C#

public int SquareMe(int i)

{

    return Math.Pow(i, 2);

}

    

4.       Build Your project .

5.       Open your Report project.

(1)    Access your report properties from the Reports menu option

(2)    Click on the reference tab and add a reference to your assembly by browsing to it.

(3)    Define the class name ( in my example I called my class  ComplexCalculations)

(4)    Provide an Instance name.

6.       In a textbox within your dataregion where you want to display the result of your call, enter:

=Code.MyInstance.SquareMe(Fields!SickLeaveHours.Value)

7.       Copy your Custom dll to Report Server bin folder (default location is C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin)

8.       Open rssvPolicy.config located in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin.

9.       After the last <CodeGroup .. add

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="SSRSAssembly" Description="reportHelperLib. ">

                <IMembershipCondition

                class="UrlMembershipCondition"

                version="1"

                Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\SSRSAssembly.dll"

/>

              </CodeGroup>

10.   Note you might have to change the Name and the URL.

4th Annual South Florida Code Camp

The Code Camp will be held on Saturday 2/2/2008 and include breakfast, lunch, giveaways, valuable raffle items and of course lots of great content!

The sessions are now listed on the agenda page. A big thanks to all the speakers that have stepped forward and volunteered to come speak at their own expense. We have already scheduled 70 of 72 sessions. There will be something for everyone... from the person who is new to .net to advanced architecture and software process sessions. For the second year we will have an all Spanish track. Dedicated tracks include "Into to .NET", "Silverlight" and "Agile / CI". Sessions include Ajax, MVC, Visual Studio 2008, Powershell, Windows Workflow and .NET reflection.

Over 500 attendees have signed up, and we should easily bypass last years number, if yo uhave not signed up please do so http://www.clicktoattend.com/?id=122048


Find more information at http://codecamp08.fladotnet.com .

Visual Studio 2008 Install-Fest - Miramar - 12/11/2008 - Free Visual Studio! SOLD OUT!

There are only 50 copies available but we will have other activites so please stop by!

I've put up a list of the 1st 100 to register at: http://www.fladotnet.com/vs2k8.aspx.

There are only 50 copies but i'm sure that not all of the 1st 50 will show up on time with a computer to do the installation.


South Florida Code Camp Call for Speakers!


Speaker registration form at: http://codecamp08.fladotnet.com.

We have been receiving speaker proposals, should have enough rooms to accomodate anyone who wishes to speak and will get the sessions posted on the website soon.

The tracks (subject to change) are:

- Intro to .NET

- Web Development

- Windows / Smart Client

- SQL / Data / BI

- .NET New and Cool

- Agile / CI

- Architecture

- Frameworks

- Office Development

- Gaming

- SharePoint

- Spanish


To attend this outstanding free event, register at: http://www.clicktoattend.com/?id=122048