Thursday, December 24, 2009

Tuesday, December 22, 2009

GDC09 Materials

Most of the GDC09 materials (presentations, demos and videos) are now available on our community web site www.devlifestyle.net

Saturday, December 19, 2009

GDC09 Videos

I started uploading the videos i shot at the GDC, it will take a while to finish all the uploads, you can check our DevLifeStyle community web site for the latest videos.

Please if anyone has some pictures or photos that he wants to upload, contact me directly

Thursday, December 17, 2009

Azure Reader: Cloud Based RSS Reader

During the preparation for my session in GDC09, I developed Azure Reader, a cloud based RSS based on Windows Azure, I developed it as a sample application or demo for Windows Azure, Unfortunately i didn’t have time to demo this application, what i will do is that I’m going to post the code soon (after doing some cleanup) with some posts that explains the application so that it may help you in your future azure development endeavor :).

you can access the application here

http://azurereader.cloudapp.net/

It uses LiveID for authentication so you can immediately start using it if you have a LiveID account, please note that your feeds subscriptions may be deleted at any time cause i frequently update the application

Wednesday, December 16, 2009

GDC’09 is Over :(

Yesterday was the last day in Microsoft Gulf Developers Conference 2009 (GDC’09). it was an awesome experience, it’s amazing to meet this number of developers and communicate and discuss with them the different technologies. the developers community in Saudi Arabia is becoming more mature.

I would like to thank all the people who attended the event, you are the reason that this event succeed.

Please keep an eye on the DevLifeStyle Community web site for the event materials (videos, presentations, demos) 

Saturday, December 12, 2009

GDC ‘09 Starts Tomorrow

Tomorrow at 9:00 AM Microsoft Gulf Developers Conference (GDC’09) will start , i will deliver a Chalk Talk session tomorrow at 04:15 PM, in this  session me and Mohamed Halabi will discuss Cloud Computing and the Azure Platform, If you need any advice, help or support regarding any Microsoft technology or if you feel you like to chat or even have fun (yeeh real fun), please drop us a visit at the Community Lounge located inside Microsoft Innovation Center (MIC), at the Community Lounge you will find many experts from the local communities and other speakers hanging out.

hope to see you all there.

Thursday, December 03, 2009

Windows Azure for MSDN Subscribers

As you may know Windows Azure will go live starting from January 2010 and the billing will start from February, MSDN Subscribers can find information about the available azure benefits granted for them in this post

http://msdn.microsoft.com/en-us/subscriptions/ee461076.aspx

Now all i need is just a MSDN Subscription :)

Windows Azure Tables

I spent around 1 hour trying to resolve an error that i received while trying to query a table in Windows Azure Tables, the query was something like this

this.Users.Where( s=> s.UserID==userID).ToArray();

the error i received


System.Data.Services.Client.DataServiceQueryException was unhandled by user code
Message="An error occurred while processing this request."

InnerException: System.Data.Services.Client.DataServiceClientException
Message="<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n
<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n
<code>InvalidInput</code>\r\n
<message xml:lang=\"en-US\">One of the request inputs is not valid.</message>\r\n
</error>"


after some research i found the following in the Azure SDK

Characters Disallowed in Key Fields
The following characters are not allowed in values for the PartitionKey and RowKey properties:

  • The forward slash (/) character
  • The backslash (\) character
  • The number sign (#) character
  • The question mark (?) character

My key field had some slashes :(

My bad !!, but in my defense the error message was not very clear :)

Tuesday, December 01, 2009

Saturday, November 21, 2009

PDC09 Videos

PDC09 Videos/Slides available for download from http://microsoftpdc.com/Videos

Wednesday, November 18, 2009

GDC ‘09 is now FREE

Register Online before December 10, to get a FREE pass to the Gulf Developers Conference.

Register Here

Monday, November 16, 2009

Microsoft Tech·Ed Middle East 2010

Yeah Tech-Ed is coming to the Middle East, check the website http://www.teched.ae
See you there ISA

Wednesday, November 11, 2009

Gulf Developers Conference (GDC ‘09)

Gulf Developers Conference 2009 (GDC '09) is the largest Microsoft developer event in the Gulf region. This is a 3-days conference that is expected to attract more than 2,500 attendees from Saudi Arabia and near-by Gulf countries starting from December 13 to December 15, 2009. The conference will be held at Al-Yamamah University, on the same premise of the new Microsoft Innovation Center in Riyadh, Saudi Arabia.
With the current release of latest new Microsoft technologies (e.g. Win7, Expression3, SL3), and the intense anticipation for upcoming Microsoft technologies (e.g. Office 2010, sharepoint 2010 & VS2010), GDC’09 is expected to attract the attention of many developers in the region. Attending GDC'09 will provide you with early access to key developer platform technologies. Moreover, GDC’09 will offer IT & Development Managers with a unique experience to learn about new technology directions from Microsoft and how such technologies can be used to maximize value for their businesses.

Don’t miss this event

http://www.microsoft.com/saudi/gdc

If you are a member of the DevLifeStyle Community you can have a special discount, for more details click here

Friday, September 04, 2009

Integrating ASP.NET Applications with SharePoint

Jamil Haddadin has an excellent post on how to perform ASP.NET related development with Visual Studio extensions for Windows SharePoint Services.

However during the development phase and due to the frequent changes we make it’s more efficient to work with the ASP.NET application directly, that will be much easier than the “coding/deploying to SP/testing” cycle you will use if you worked with the VSeWSS.

When you use the method described by Jamil you will find that you will not be able to build the ASP.NET application because of using strongly named class names in “Inhertis” attribute of the Page/Control directives.

To resolve this i don’t add the assembly name part in the “Inherits” attribute i just put the class name like the following

<%@ Page Language="C#" AutoEventWireup="true"

Inherits="MyApp.Portal.Forms.Customers"
MasterPageFile="~masterurl/default.Master" %>



This will allow you to successfully build and run the ASP.NET application, but when it comes to building and deploying to SharePoint, you will have to add the assembly info to the class name as follows


<%@ Page Language="C#" AutoEventWireup="true"

Inherits="MyApp.Portal.Forms.Customers, MyApp.Portal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5"
MasterPageFile="~masterurl/default.Master" %>

so i created this simple add-in that will iterate over all the *.aspx and *.ascx files in your project and inserts or removes the assembly info in the “Inherits” attribute of the Page/Control directives1

so before you deploy to SharePoint just run this add-in and it will take care of everything :)

you can download the add-in from below

Tuesday, September 01, 2009

Problem when Combining a Reporting Services Project and a SharePoint (VSeWSS) Project within a Single VS Solution

I ran into this strange problem today,if you have a visual studio solution that contains both a Reporting Services project and a SharePoint (VSeWSS) project you will have problems when you try work with the WSP view you will receive the following error

“Error parsing Solution. Value does not fall within the expected range.”

To resolve this you have to remove the reporting services project from the solution!!!

in my environment i have VS2008 with SP1 and VSeWSS 1.2 (or 1.3).

Anyone has any explanation for this behavior??

Tuesday, July 14, 2009

Wednesday, June 24, 2009

DevLifeStyle July Community Event

The DevLifeStyle Community invites you and your fellow developers to attend the next community event on 2nd of July.

Join us there and get a chance to win XBOX 360

Event Agenda

Session

Speaker

Start Time

End Time

Open Note by

Microsoft’s Developer Solutions Manager

Ammar Abuthuraya

12:45 PM

01:00 PM

Introducing WF 4.0:

Building Distributed

Applications with WF and WF Services

Mohamad Halabi

01:00 PM

01:45 PM

Fun Zone and Lunch

01:45 PM

02:30 PM

Introducing ASP.NET 4.0

Mohamed Mosallem

02:30 PM

03:15 PM

Closing and Xbox draw

03:15 PM

03:30 PM



Register Here

Monday, May 25, 2009

DevLifeStyle Community Event 28th May

The DevLifeStyle Community invites you and your fellow developers to attend the next community event on 28th May, Join us there and get a chance to win XBOX 360

Event Agenda

Session

Speaker

Start Time

End Time

BizTalk Orchestrations

Mohamed Mosallem

12:30 PM

01:15 PM

Introducing .Net 4.0

Mohamed Halabi

01:20 PM

02:10 PM

Break

02:10 PM

02:30 PM

SQL Server Business Intelligence

Salim Fayad

02:30 PM

03:15 PM

Closing and XBox draw

03:15 PM

03:30 PM

Location: Microsoft Innovation Center - Al-Yamamah University (Location Map)

Females are welcome

Register Here

Wednesday, April 29, 2009

TFS Articles

If you would like to learn Team Foundation Server, follow my series of articles available on the DevLifeStyle Community web site. currently there are three articles in this series available here (part1, part2, part3)

Monday, April 27, 2009

DevLifeStyle Community Event

Join us on Thursday to get a chance to Win an XBOX 360 and other valuable gifts.

2ndevent

Saturday, April 11, 2009

Team Foundation Server 2008 Installation

Recently i installed TFS 2008, there are some tips that i wanted to share with you :

- If you are going to use SQL Server 2008 on your data tier you must install SP1 for Team Foundation Server, if this is the first time to install TFS, you should integrate the SP1 files with the TFS installation, you can find more on how to do this in the installation guide

- The reporting services must be installed on the application tier

- There's a known bug regarding the TFS reports with SQL Server Reporting Services, you can get a hotfix for this from Microsoft support, refer to this knowledge base article for more info http://support.microsoft.com/kb/968905

Saturday, March 14, 2009

DevLifeStyle Community Event Invitation

The DevLifeStyle Community cordially invites you to attend the following community event

When: Thursday 19th March (12:30 PM to 3:30 PM)
Where: Prince Sultan University Auditorium
Agenda:

12:45 PM - 01:30 PM Enterprise Applications Integration with BizTalk Server - 1
01:30 PM - 01:40 PM Break
01:40 PM - 02:25 PM ASP.NET MVC
02:25 PM - 02:45 PM Break-Catering
02:45 PM - 03:30 PM Business Intelligence with Analysis Services and Performance Server - 1

If you are a .net developer looking for learning, discussing, sharing the new technologies, join our community. We will be waiting for you... join now.

Monday, February 23, 2009

Tuesday, February 03, 2009

Consuming Services from Client Side JavaScript (Part II)

In the previous post we discussed how we can call server side web/WCF services from JavaScript. in this post we will discuss how we can use Java Script Object Notation (JSON) to send/receive objects between client side JavaScript and server side services

JSON

JSON is a text based, human readable, platform independent data exchange format. it’s build on JavaScript object notations which allows you to define an object as a list of members and values that are enclosed in curly braces ({}), each member is delimited by a comma. Within each member, the name and value are delimited by a colon (:). the following example shows how you can define the object Car

<script type="text/javascript">
function DisplayCarInfo()
{
var car= {
"Name": "Mondeo",
"Model": 2009,
"Maker": "Ford",
"Drivetrains": "RWD"
};
alert(car.Name);
alert(car.Maker);
alert(car.Model);
alert(car.Drivetrains);
}
</script>


we can also express complex object hierarchies

<script type="text/javascript">
function DisplayCarInfo()
{
var car= {
"Name": "Mondeo",
"Model": 2009,
"Maker": "Ford",
"Drivetrains": "RWD",
"Options" :
[
{
"OptionName" : "ABS",
"OptionValue" : true
}
,
{
"OptionName" : "FogLights",
"OptionValue" : false
}
]
};

alert(car.Name);
alert(car.Maker);
alert(car.Model);
alert(car.Drivetrains);
for (i=0;i<car.Options.length;i++)
{
alert(car.Options[i].OptionName+":"+car.Options[i].OptionValue);
}
}
</script>

JSON and .NET

The .Net framework 3.5 includes classes (such as DataContractJsonSerializer and JavaScriptSerializer) that support the serialization/deserialization of objects to/from JSON representation.

The following console application shows how to get the JSON representation of an object

using System;
using System.Web.Script.Serialization ;

namespace JSONTest
{
class Car
{
public string Name { get; set; }
public string Model { get; set; }
public int Year { get; set; }
}
class Program
{
static void Main(string[] args)
{
JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
Car obj = new Car() { Name = "Ford", Model = "Mondeo", Year = 2009 };
Console.WriteLine(jsSerializer.Serialize(obj));
}
}
}

Scott Guthrie has a nice post that shows how to create an extension method to convert every object to its JSON representation

JSON and WCF

Windows Communication Foundation has a built in support for creating services that can be consumed from JavaScript and send/receive data in JSON format. a service must expose an end point configured with the webHttpBinding, this binding uses HTTP requests that use plain old XML messages or JSON instead of SOAP based messaging, you will use the enableWebScript behavior to set the default data format for the service to JSON instead of XML.

let’s consider the following basic service that contains a method that returns a complex data type


using System;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Web.Script.Services;

namespace WCFJSONService
{
[ServiceContract(Namespace = "WCFJSONService")]
public interface ICarsInfoService
{
[OperationContract()]
Car GetCarInfo(string carName);
}

[DataContract]
public class Car
{
[DataMember]
public string Name{get;set;}
[DataMember]
public string Maker{get;set;}
[DataMember]
public int Model { get; set; }
[DataMember]
public CarOption[] Options { get; set; }
}
[DataContract]
public class CarOption
{
[DataMember]
public string OptionName { get; set; }
[DataMember]
public string OptionValue { get; set; }
}

[ScriptService]
public class CarsInfoService : ICarsInfoService
{
public Car GetCarInfo(string carName)
{
switch (carName)
{
case "Corolla":
return new Car()
{
Maker="Toyota", Model=2009, Name="Corolla",
Options=new CarOption[]
{
new CarOption(){ OptionName="ABS",OptionValue="Yes"},
new CarOption(){ OptionName="FogLights",OptionValue="Yes"},
}
};
case "Sunny":
return new Car()
{
Maker = "Nissan",
Model = 2009,
Name = "Sunny",
Options = new CarOption[]
{
new CarOption(){ OptionName="ABS",OptionValue="Yes"},
new CarOption(){ OptionName="FogLights",OptionValue="No"},
}
};
default:
return null;
}
}
}
}


To use the service from client side JavaScript we need to configure the service using the following configuration
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WCFJSONService.CarsInfoServiceBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WCFJSONService.CarsInfoService">
<endpoint address=""
behaviorConfiguration="WCFJSONService.CarsInfoServiceBehavior"
binding="webHttpBinding"
contract="WCFJSONService.ICarsInfoService"/>
</service>
</services>
</system.serviceModel>

we will use the service from JavaScript as follows

<!--default.aspx-->
<asp:ScriptManager runat="server" ID="scriptManageR">
<Services>
<asp:ServiceReference Path="~/CarsInfoService.svc" />
</Services>
</asp:ScriptManager>
<select id="lstCar">
<option value="Corolla">Corolla</option>
<option value="Sunny">Sunny</option>
</select>
<input type="button" value="click" onclick="javascript:CallWCFService();" />
<script type="text/javascript">
function CallWCFService() {
var service = new WCFJSONService.ICarsInfoService();
var lst = $get('lstCar');
var car = service.GetCarInfo(lst.value,OnSucceeded);

}
function OnSucceeded(car) {
if (car != null) {
alert("Car Name:" + car.Name);
alert("Car Model:" + car.Model);
alert("Car Maker:" + car.Maker);
for (i = 0; i < car.Options.length; i++)
{
alert(car.Options[i].OptionName + ":" + car.Options[i].OptionValue);
}
}
}
</script>

as you can see the result returned from the service is automatically converted to JSON representation, if you want to see the actual JSON data returned follow these steps:

- Add the WebGet attribute to the GetCarInfo method, this will allow us to access the service method using the HTTP get verb

[OperationContract()]
[WebGet()]
Car GetCarInfo(string carName);

- Browse to the following URL http://youhostname:portNumber/CarsInfoService.svc/getCarInfo?carName=Corolla , you will be prompted to download a file, save the file and open it using the Notepad you will find the JSON representation of the Car object

For more info i suggest the following MSDN links:

WCF Web Programming Model Overview

Creating WCF Services for ASP.NET AJAX

Download the sample code from here:

Saturday, January 31, 2009

Consuming Services from Client Side JavaScript (Part I)

Many frameworks allow you to easily call a server side service from JavaScript directly, services are called asynchronously from JavaScript so when you call any service method from JavaScript you can supply two extra parameters to the method in addition to the original method parameters, the first one is the name of a javascript function that will be called once the result of the service method is received, and the second one will be called incase an error happened on the server.

In this post i will explore the options available to consume a service from client side JavaScript.

- Calling a page method: ASP.NET AJAX allows you to call public static methods available on your aspx page directly from JavaScript, you have to mark these methods with the [WebMethod] attribute and set the EnablePageMethods property of the script manager control to true. the following example demonstrates this

//Default.aspx.cs
[System.Web.Services.WebMethod]
public static string GetTemprature(string city)
{
switch (city)
{
case "Riyadh":
return "30";
case "Jeddah":
return "28";
case "Makkah":
return "34";
default:
return "";
}
}


<!--default.aspx-->
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<asp:DropDownList runat="server" ID="cmbCities">
<asp:ListItem Selected="True" Value="Riyadh">Riyadh</asp:ListItem>
<asp:ListItem Value="Jeddah">Jeddah</asp:ListItem>
<asp:ListItem Value="Makkah">Makkah</asp:ListItem>
</asp:DropDownList>
<input type="button" value="Get Temprature From Page Method" onclick="GetTempraturePageMethod();" /><br />
<script type="text/javascript">
function GetTempraturePageMethod() {
PageMethods.GetTemprature($get('<%=cmbCities.ClientID %>').value,
GetTempraturePageMethodOnSuccess);
}
function GetTempraturePageMethodOnSuccess(result) {
alert(result);
}
</script>

- Calling a web service method: to call a method from a web service you must reference the service from the script manger control and your web service must have the attribute [ScriptService] so that a JavaScript proxy for your service can be automatically generated for you

<!--WeatherWebService.asmx-->
<%@ WebService Language="C#" Class="WeatherWebService" %>

[System.Web.Services.WebService(Namespace = "ClientScriptServices")]
[System.Web.Services.WebServiceBinding(ConformsTo = System.Web.Services.WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class WeatherWebService : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
public string GetTemprature(string city)
{
switch (city)
{
case "Riyadh":
return "30";
case "Jeddah":
return "28";
case "Makkah":
return "34";
default:
return "";
}
}
}

<!--default.aspx-->
<asp:ScriptManager ID="ScriptManager" runat="server" >
<Services>
<asp:ServiceReference Path="~/WeatherWebService.asmx" />
</Services>
</asp:ScriptManager>
<asp:DropDownList runat="server" ID="cmbCities">
<asp:ListItem Selected="True" Value="Riyadh">Riyadh</asp:ListItem>
<asp:ListItem Value="Jeddah">Jeddah</asp:ListItem>
<asp:ListItem Value="Makkah">Makkah</asp:ListItem>
</asp:DropDownList>
<br />
<input type="button" value="Get Temprature from Web Service"
onclick="GetTempratureWS();" /><br />
<script type="text/javascript">
function GetTempratureWS() {
WeatherWebService.GetTemprature($get('<%=cmbCities.ClientID %>').value,
GetTempratureWSOnSuccess);
}
function GetTempratureWSOnSuccess(result) {
alert(result);
}
</script>


- Calling a WCF service: you can call a WCF service from using AJAX in the same way you call a web service


namespace ClientScriptServices
{
[ServiceContract(Namespace = "WeatherWCFService")]
public interface IWeatherWCFService
{
[OperationContract]
string GetTemprature(string city);
}
public class WeatherWCFService : IWeatherWCFService
{
public string GetTemprature(string city)
{
switch (city)
{
case "Riyadh":
return "30";
case "Jeddah":
return "28";
case "Makkah":
return "34";
default:
return "";
}
}
}
}

<!--default.aspx-->
<asp:ScriptManager ID="ScriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/WeatherWCFService.svc" />
</Services>
</asp:ScriptManager>
<asp:DropDownList runat="server" ID="cmbCities">
<asp:ListItem Selected="True" Value="Riyadh">Riyadh</asp:ListItem>
<asp:ListItem Value="Jeddah">Jeddah</asp:ListItem>
<asp:ListItem Value="Makkah">Makkah</asp:ListItem>
</asp:DropDownList>
<br />
<input type="button" value="Get Temprature from WCF Service"
onclick="GetTempratureWCF();" /><br />
<script type="text/javascript">
function GetTempratureWCF() {
var wcfService = new WeatherWCFService.IWeatherWCFService();
wcfService.GetTemprature($get('<%=cmbCities.ClientID %>').value,
GetTempratureWCFOnSuccess);
}
function GetTempratureWCFOnSuccess(result) {
alert(result);
}
</script>


You can download a sample web application from here



In the next post i will discuss how to use JavaScript Object Notation and WCF to send and receive complex object types