Wednesday, December 7, 2011

MVC 3 Razor And Partial View

MVC 3 Razor And Partial View

How do I use partial view in MVC 3?
Great!! Sometime, I don’t know why, I stuck for small things. I was trying to load two partial views(MVC 3). But, after spending 6 hours I got to know how to load.
This retards my brain. I have searching for good articles on MVC 3 & Partial views. But, I failed to get it.
So, Let us go in dept on MVC3 & Partial Views.
Partial view and User Controls are somewhat same in purpose of usage. But the way in which they is totally different. I will explain about these in detail.

Step 1
Create ASP.Net MVC 3 project using VS 2010. I have named it as ARVPartialView.
Add one partiaview and name it as PartialIndex












Step2
I have created one module like PartialModel as given bellow.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ARVPartialView.Models
{
public partial class PartialModel
{
public string Name { get; set; }
public int Actual { get; set; }
public int Target { get; set; }
public int Score { get; set; }
}

public partial class PartialModel
{
public List lstPartialModel { get; set; }

}
}




Step 3

Now the time to add some values to this list. The solution structure looks like as given bellow.




Since I like render partial view over Home/Index, So, I have written one function in HomeController.

public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
///
/// TODO:To get data and returning result to the index view..
///

///
return View(new PartialModel() { lstPartialModel = GetSampleData() });

}

public ActionResult About()
{
return View();
}


///
/// TODO:Function to add some data to list.
///

///
private List GetSampleData()
{
List model = new List();

model.Add(new PartialModel()
{

Name = "Aravind",
Actual = 10000,
Target = 12000,
Score = 83
});

model.Add(new PartialModel()
{

Name = "Ram",
Actual = 8000,
Target = 14000,
Score = 57
});
model.Add(new PartialModel()
{
Name = "Ajay",
Actual = 50000,
Target = 35000,
Score = 143
});

return model;
}
}


Step 4

In Index view, I have included partial view as given bellow. As like web usercontrol, partial view doest initiate any events while loading Just like initializecomponet etc. So, we have to pass the list to partial view in the parent page.







Step 5
Render partial view on Index view.




Step 6


Run the application.



Have a nice time & enjoy..
aravindbenator@gmail.com
http://silverlightarvind.blogspot.com







Monday, December 5, 2011

What is Silverlight Application Library Caching?

What is Silverlight Application Library Caching?


I was just working with one Silverlight application that has too many 3rd party assemblies (Excel, theme, charts etc).

Also it was taking long time while downloading first time. Obviously, this is because of large XAP size. So, I thought to divide entire application in multiple projects which will create multiple XAP’s and then use it by on demand load.

But, I have used more third party dll’s. In this case it is too hectic to store them on separate XAP and then load it on demand. Then, I came to know about new concept (for me) about “ Application Library Caching”



So, What is Assembly caching? We all know about the on demand download of XAP file. To do this, we need to write code for downloading the external xap files using WebClient. Application Library caching does the similar thing for you very easily. Suppose, if you have a bigger application and used a huge 3rd party libraries, this easy step will help you make a separate zip file with them which can be downloaded on demand without writing any additional code.



Step 1.

Create one Silverlight 3 or 4 application(its available in SL 3 also). I have named it as ARVApplicationLibraryCaching.

If you see in the solution-references, you will find the assemblies ,those have been added to the project.





Once you build the app, you can find XAP file in the client bin directory.

To see the contents inside the XAP, go to the ClientBin folder. There you will find the XAP output of your Silverlight application. Rename it with zip and extract then, you can find as given bellow.




To see all the assembly references, open appmanifest file using notepad.




You will notice that, it has all the referenced dll information as Assembly part, entry point and required runtime version. Assembly parts tells to load the referred assembly directly from the XAP.





Step 2.

Adding more third party Assemblies.

Go to add reference and add some third party dll’s. I have added here some dll’s related to theme.





Once you build the app and unzip the XAP. Then you will find as given bellow.




You will see that all the new referenced dlls are now part of your XAP. If you open AppManifest.xmal,






it contains all those additional dll entries as AssemblyPart and tells to load them from the XAP itself.

This actually increases the XAP size and makes your application little bulky. Thus increases initial loading time of your application.



Step 3.

Use application library caching.

To overcome this, there is a setting project property window as shown bellow.






Now, build the project. You will find zip files as per you have been added third party dll’s.




Then, go to AppManifest file, then see






Here a single AssemblyPart pointing to your original project output and rest of the dll references are now moved to ExternalParts. They are now pointing to the Zip files instead of the actual dlls.

Now, when you run your application, it will only download the XAP file which contains only the main resources. Rest of the dll ZIP will be downloaded on demand whenever require by your application.

Enjoy the concept!!!!!!!



Aravind

Thursday, November 10, 2011

Making Offline MVC 3 Application.

Offline App




Hi Guys!! I never thought, building offline MVC 3 app could be this much simple.

I had a question in mind for a long time that Why this offline application? How it works? Etc...

As per my knowledge, In Silverlight there is smart client concept. So that, Even we can see and work when there is no network available (flight mode or in remote area). Whenever device/app detects network, then either user can invoke saving operation into server or application can automatically triggers event to save data.

Silverlight did a great job in this aspect. But, in case of asp.net/html application, how it can be done?.

For the same purpose, HTML 5 introduces a MIME type manifest and local storage.

It mainly adds one manifest file to load all required recourses.

This walkthrough is to demonstrate the how we can create/develop offline/online application using MVC 3.

I will first create ASP.Net MVC 3 empty app using VS 2010 and I will add offline htm page to the project.



The htm page will look like:















The first line uses the Html5 doctype and the header links to jQuery. We uses two buttons, one to create the profiles in the browser local storage and another the send the profiles to the server.

To create red boxes arround our input boxes when jQuery detects some validation we need to add these few lines of css to stylesheet:

input.error {

border: 2px solid red;

}

Now it’s time to implement our UI logic with javascript. By creating a separate file for our javascript we keep the html page clean.

Add a “offline.js” to the script folder:

var root = '/Offline;//Controller name.


var subscriptionsUploaded = 0;






//jQuery on document ready handler


$(function () {


//Show the busy indicator during ajax calls


$("#busy").hide();


$("#busy").ajaxStart(function () { $("#busy").show(); })


$("#busy").ajaxStop(function () { $("#busy").hide(); })


var x = $("#createSubscription");


//When the createSubscription button is clicked create a subscription


$("#create_subscription").click(createSubscriptionClick);






//When the sendData button is clicked retrieve the subscriptions stored in the local storage and send the data to the server


$("#send_data").click(sendDataClick);






//Define jQuery validation rules and execute the validation when the form is validated


$("#sub_form").validate({


rules: {


firstname: {


required: true,


minlength: 2


},


lastname: {


required: true,


minlength: 2


},


email: {


required: true,


email: true


},


phone: {


required: true,


number: true,


minlength: 9,


maxlength: 9


}


},


messages: {


firstname: "",


lastname: "",


email: "",


phone: ""


}


});


});






function sendDataClick() {


//Iterate over the subscriptions stored in the local storage


for (var i = 0; i < window.localStorage.length; i++) {


//Retrieve the serialized subscription


var json = window.localStorage.getItem(window.localStorage.key(i));


try {


//Send the subscription to the server


sendData(


json,


//On success remove the subscription from the local storage


function (data) {


window.localStorage.removeItem(window.localStorage.key(data.Message));


subscriptionsUploaded++;


$("#resultmessage").html(subscriptionsUploaded + " subscriptions uploaded!");


},


//On error


function (xhr) {


alert(xhr.responseText);


});


}


catch (e) { alert(e); }


};


}






//Stores a subscription into the local storage


function createSubscriptionClick() {


//check the jQuery validation rules


if ($("#sub_form").valid()) {


var person = getSubscription();


//seialize the subscription


var jsData = JSON.stringify(person);


//store the subscription


window.localStorage.setItem($("#email").val(), jsData);


//update the resultMessage


$("#resultmessage").html($("#email").val() + " stored in local storage");


clearAll();


}


}






//Create a subscription object and bind to the input boxes values


function getSubscription() {


var firstname = $("#firstname").val();


var lastname = $("#lastname").val();


var email = $("#email").val();


var phone = $("#phone").val();


return { Firstname: firstname, Lastname: lastname, Email: email, Phone: phone };


}






//Clear the input boxes values


function clearAll() {


$("#firstname").attr("value", "");


$("#lastname").attr("value", "");


$("#email").attr("value", "");


$("#phone").attr("value", "");


}






//Ajax: post the json serilized subscriptions


function sendData(json, success, error) {


$.ajax({


url: root + '/save',


type: 'POST',


dataType: 'json',


data: json,


contentType: 'application/json; charset=utf-8',


success: success,


error: error


});


}



To get data from controller side we can use JSON format as given bellow.

In js file we can use

$.getJSON(

//controller name.

root + '/GetDataFromServer',

"",

function (data) {

});



When the user click on the create button the createSubscription function is called, this function is responsible for serializing the data into a Json object and to store it in the isolated storage. Isolated storage is a feature defined in the Html5 spec. For each domain the browser provide access to private key/value pair collection where data can be stored and retrieved. The sendData button is attached with an anonymous function that iterate over the key/value pair collection that contains the JSON serialized subscriptions and post the JSON serialized subscription object.

The MVC 3 includes built-in JSON binding support that enables action methods to receive JSON-encoded data and model-bind it to action-method parameters. We will now create our Model to bind to, add a OfflineModel class to the models of the MVC app:

public class OfflineModel

{

[Required]

[Display(Name = "Firstname")]

public string Firstname { get; set; }



[Required]

[Display(Name = "Lastname")]

public string Lastname { get; set; }



[Display(Name = "Phone")]

public string Phone { get; set; }



[Required]

[DataType(DataType.EmailAddress)]

[Display(Name = "Email address")]

public string Email { get; set; }



public void Save()

{

//store the object in db

//...

}

}





In controller, I have written sample code for returning some data.



public ActionResult GetDataFromServer()

{

List lstscores = new List();

try

{

//Return format to the client side.

return Json(

new { message = lstscores },

JsonRequestBehavior.AllowGet);



}

catch

{

throw;

}

}





In case, we need to bind these data to any controller like table/list etc, then we can create item list dynamically.

Here “data” is the JSON array of data. Here I am creating rows and adding it into existing table.

for (var i = 0; i < data.message.length; i++) {






$("table#lst_info").find('tbody')


//Column Agency


.append($(' ')


.append($('')


.append($('


.text(data.message[i].Agency)






)


)


//Column Actual


.append($('')


.append($('


.text(data.message[i].Actual)






)


)


//Column Target


.append($('')


.append($('


.text(data.message[i].Target)






)


)


//Column Score


.append($('')


.append($('


.text(data.message[i].Score)






)


)










);






}



Now, we can test the application.

To be able to load the application when we are offline we need to use a new feature available in the latest browser like IE9, the Html5:”offline application.

Add Offline.manifest file to the root of the application.

CACHE MANIFEST


/Offline.htm


/Content/Site.css


/Scripts/Offline.js


/Scripts/jquery-1.5.1.min.js


/Scripts/jquery.validate.min.js


/Content/wait.gif



Change the Doctype of the Offline.htm

////







So, now even when network is not available also, can display the page.

Let’s have a fun!!!!!!

Storing data over local storage:

As of you all knows, there are two types of web storage's.

1.localstorage .


2.Session storage.



But, In this article, we will discuss about localstorage.

In simple, we can add data to local storage as like this..

window.localStorage.setItem("data",”Hi this is Aravind”);



Retrieving data from localstorage…



var datadt = window.localStorage.getItem("data");



Suppose, if I want to save list or array, then what can be done?.



Then, we have to convert list/array into JSON format.



window.localStorage.setItem("data", JSON.stringify(data));



Retrieving it as..

var frequentdatadt = window.localStorage.getItem("data");


var data = JSON.parse(frequentdatadt);

Regards
Aravind













Thursday, October 6, 2011

CRM 2011 Online Vs On-Premise.

In my previous article http://silverlightarvind.blogspot.com/2011/09/crm-online-2011-with-odata-and-wcf.html. I have explained about CRM online and establishing connection with CRM 2011 online.

Now, I am going to explain about, Establishing connection with CRM 2011 On-Premise.

There is only one difference is that, here no need to pass device id credentials while creating proxy. Also instead of passing windows live credentials, we have to pass domain login id and password.

So, I have listed some of the basic differences between CRM 2011 online  Vs CRM 2011 On-Premise.




                                            Microsoft Dynamics CRM 2011 Online    Microsoft Dynamics CRM 2011 On-Premise

Robust marketing, sales,
 and
customer service features         Yes                                                   Yes

Integration with MS Office         Yes                                                   Yes

Customizations                        Yes                                                    Yes

Storage limit                            5 GB                                                  Unlimited

Database restore to
 certain date                           Not available                                       Allowed

Full Database export                No                                                     Yes

Offline synchronization with
 Outlook                                Yes                                                     Yes


Mobile device GUI support       Yes                                                     Yes

Maximum amount of custom
entities                                  200                                                  Unlimited

Maximum amount of custom
 workflows                            200                                                   Unlimited


Login Must use                     Windows LiveID                                  Domain Login


Minimal commitment            12 months                                         No

Payment method Monthly by
                                         credit card                                        Based on agreement



aravindbenator@gmail.com

Wednesday, October 5, 2011

Claims based authentication(Basic details)

In this article, I am trying to explain some basics about new claims based authentication with live scenario.

Fisrt of all,  What are authentication methods are available?

ASP.NET when launched supported 3 types authentications namely: Windows Authentication(better for Intranet scenarios and credentials are stored inside Active Directory), Passport Authentication (Now Live ID Authentication, can be used via Claims Based Authentication) & FBA(where user data is maintained inside SQL Database). ASP.NET 2.0 provided some tools and classes and made FBA much more simpler. It automatically created required tables, stored procs, UI to manage Users (Membership Providers), their access rules by their roles (Role Provider) and store some more data about users (Profile Provider).


In the Microsoft world, authentication is usually performed by Active Directory. I claim to be Arvind, and i prove this to Active Directory by providing my password. Other systems don’t trust me, they trust Active Directory. Active Directory gives systems a bit of data that says “yeah, I personally know this person. It really is Aravind.”

In single environment Claims based authentication is not needed.

But, Privacy regulations are impacting what kind of information capture and store about user. Because, in some case user don’t want to give his personal info.

And one more case is that, In case of merging two sites, then if both are having different authentication type, then it becomes a mess.

In this case, if claims based authentication has implemented, then it can handle both with a common method.

Scenario:


Suppose, I am having liquor online shop purpose to sell liquor direct to the customer. So my company service is to provide imported liquor to customer’s hand without any intermediate. I am having one website called myliquor.com. So customer can place his order over the net. But According to Law of Indian government, liquor should not sell to the people whose age is lesser than 18.


But, I don’t know whether the person who is placing order is eligible or not. So what I will do is, I will ask to government to provide some identity (token) that will ensure about customers age. Consider I will use the voter id login service from the government. So that it can tell the age of a customer.

By doing this, No need to maintain customer’s personal information for me. Also No need to check the age eligibility for me.


Best Example: while using the CRM 2011 online, we have use windows live id. Here CRM online get tokens from windows live.



There are several components to claims authentication. The STS(identity provider) that issues the tokens to entities. An application makes decision by consuming these tokens.


In between, identity provider and application there is a federation provider manages trusts for application and translates token containing claims in such a way that application can understand.

In next article, i will explain how do we set claims based authentication.

Tuesday, October 4, 2011

Style for HTML file control( making fake)



It is very easy to change the HTML  file control.  It is bit difficult make changes  input control style. So i achieved by making fake control inside the div as shown bellow.

div.fileinputs {


position: relative;

}



div.fakefile {

position: absolute;

top: 0px;

left: 0px;

z-index: 1;

}



input.file {

position: relative;

text-align: right;

-moz-opacity:0 ;

filter:alpha(opacity: 0);

opacity: 0;

z-index: 2;

}

Implementation is here...................................




 
You can set either image  or even button control to invoke click operation.

Thursday, September 29, 2011

CRM online 2011 with Odata and WCF

Hi guys, I have strugled a lot with working on CRM 2011 online. It has killed my two day's. Oh!!  It might be beacause of my low brain or subject :) :)
Any how I am able to manage to get data from CRM 2011 online.  In my previous blog, I have explained about basics about CRM 2011.

Now, I am going to explain how do we access CRM 2011 online data using services.

CRM 2011 Online


1. Register for CRM 2011 Online using Windows Live ID.
You can get it here: http://crm.dynamics.com/en-us/home

Available services in CRM 2011.

CRM can allow multiple Organizations to be created on 1 CRM installation.

Each Organization can be for a different company/purpose. So, users may want to access one of the Organizations on CRM installation. If the user/code already knows the Organization URL OR Organization Service URL then fine he can directly use organization service.

If not known, then he needs to write code to connect Discovery Service URL, then browse through all Organizations available and get Organization service URL for respective/required Organization.
In short, whatever Data/Metadata operations we want to do, we will need to use Organization Service URL.
If we want to find Organization Service URL for an Organization, then we need to do that using Discovery Service URL.

https://dev.crm.dynamics.com/XRMServices/2011/Discovery.svc (North America)


https://dev.crm4.dynamics.com/XRMServices/2011/Discovery.svc (EMEA)


https://dev.crm5.dynamics.com/XRMServices/2011/Discovery.svc (APAC)


The following URLs should be used to access the Organization service(SOAP endpoint):


https://{Organization Name}.api.crm.dynamics.com/XrmServices/2011/Organization.svc (North America)

https://{Organization Name}.api.crm4.dynamics.com/XrmServices/2011/Organization.svc (EMEA)

https://{Organization Name}.api.crm5.dynamics.com/XrmServices/2011/Organization.svc (APAC)

Where {Organization Name} refers to the Organization that you specify in the URL when accessing the Web application. For example, for Contoso.crm.dynamics.com, the {Organization Name} is Contoso.

The following URLs should be used to access the Organization Data service(OData REST endpoint)

https://{Organization Name}.api.crm.dynamics.com/XrmServices/2011/OrganizationData.svc (North America)


https://{Organization Name}.api.crm4.dynamics.com/XrmServices/2011/OrganizationData.svc (EMEA)


https://{Organization Name}.api.crm5.dynamics.com/XrmServices/2011/OrganizationData.svc (APAC)



For CRM On-premises customers:



http://{server}/XRMServices/2011/Discovery.svc for the Discovery service endpoint


http://{server}/{OrgName}/XRMServices/2011/Organization.svc for the Organization Service endpoint (SOAP)


http://{server}/{OrgName}/XRMServices/2011/OrganizationData.svc for the Organization Data Service endpoint (REST)


http://{server}/XRMDeployment/2011/Deployment.svc for the Deployment Service endpoint



2.Install Microsoft Dynamics CRM 2011 SDK.

You can get it here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&displaylang=en

3. Run the DeviceRegistration.exe utility to generate a device id and password.

There are two methods to get device id and password.

1.Using DiviceMAnager class available in SDK folder. So that we can generate device id and password.

2.By Commandline.

Once you download SDK from above given link, Inside tools, there will deviceregistration directory. Run it with command line /operation:Register.

Then you will get device id and password. Copy these credentials for further use.

4.Making context class for the organization.svc or discovery service.

C:\Users\aravinda.sheshadri\Desktop\ToolkitGestureDemo\sdk\bin\crmsvcutil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /url:https://<>.crm5.dynamics.com/XRMServices/2011/Organization.svc /o:crm.cs /n:XXXCRM2011 /domain:<>.crm5.dynamics.com /u:<> /p:<>/serviceContextName:XXXcontext /di:116bohmbs2iupfaxp07bp5mhrp /dp:GYfG8LSo%_+3H2H+mpT~w=IG

On run this command, class will be generated containing all entities(context). Here, I have given context name as XXXcontext. So I can access all entities using XXXcontext name.

While running this command, make sure that time in both server and local machine will be same(Time and Timezone).

5. Add this class file to your visual studio 2010 project.



6.Add a reference to the dll’s in there as necessary from SDK folder bin directory:



Microsoft.XRM.sdk

System.ServiceModel

Microsoft.Crm.Sdk.Data.Services;

System.Data.Services.Client;

System.ServiceModel.Description;

Microsoft.Xrm.Sdk;

Microsoft.Xrm.Sdk.Client;

Microsoft.Crm.Services.Utility;

7. How do I access CRM 2011 online wcf service over .net client?



If we are using organization.svc, then we have to use



OrganizationServiceProxy _serviceProxy;

IOrganizationService _service;

ClientCredentials Credentials = new ClientCredentials();

ClientCredentials devivceCredentials = new ClientCredentials();

CRMContext context;



Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;



//This URL needs to be updated to match the servername and Organization for the environment.





Uri OrganizationUri = new Uri("https://{organization name}.crm5.dynamics.com/XRMServices/2011/Organization.svc");



Uri HomeRealmUri = null;



//To get device id and password.



devivceCredentials= DeviceIdManager.LoadDeviceCredentials();





using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, devivceCredentials))

{

serviceProxy.ClientCredentials.UserName.UserName = "username";

serviceProxy.ClientCredentials.UserName.Password = "password";

serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());

IOrganizationService service = (IOrganizationService)serviceProxy;

_service = (IOrganizationService)serviceProxy;

context = new CRMContext(_service);

var querry = context.CreateQuery("LeadSet");

var querry1 = from itm in context.LeadSet

select itm;





}


8. Odata(OrganizatationData.svc) is not supported outside the CRM application.

Currently CRM 2011 does not support for Odata(organizationdata.svc) to do any operation from outside the CRM application. So If we make it as web resources, then we can use Odata services.







Proof:

http://mscrmblogger.com/2011/05/12/crm-2011-supported-vs-unsupported/
http://mscrmblogger.com/2011/05/12/crm-2011-supported-vs-unsupported/

http://msdn.microsoft.com/en-us/library/gg334279.aspx

“The REST Endpoint for Web resources provides an alternative interface to work with Microsoft Dynamics CRM data. You can use the REST endpoint to execute HTTP requests by using a service that is based on a Uniform Resource Identifier (URI). The REST endpoint is only available for use by JScript and Silverlight Web resources.”

Thanks


Aravind
aravindbenator@gmail.com



Thursday, September 22, 2011

jQuery Mobile.- Play with jQuery (if you you do not know javascript also!!.)





JQuery Mobile (Alpha 2.0).

Introduction
o jQuery Mobile, a user interface (UI) framework to write a functional mobile web application without writing a single line of JavaScript code.

jQuery Mobile

o jQuery Mobile is a touch-friendly web UI development framework that allows to develop mobile web applications that work across smartphones and tablets. The jQuery Mobile framework builds on top of jQuery core and provides a number of facilities, including HTML and XML document object model (DOM) traversing and manipulation, handling events, performing server communication using Ajax, as well as animation and image effects for web pages. The mobile framework itself is a separate, additional download of around 12KB (minified and gzipped) from jQuery core, which is around 25KB when minified/gzipped. As with the rest of the jQuery framework, jQuery Mobile is a free, dual-licensed (MIT and GPL) library.
Downloads available @
o http://www.ibm.com/developerworks/web/library/wa-jqmobile/#download
o http://www.ibm.com/developerworks/web/library/wa-jqmobile/


Basic features of jQuery Mobile include:
General simplicity
o The framework is simple to use. We can develop pages mainly using markup driven with minimal or no JavaScript.

Progressive enhancement and graceful degradation
o While jQuery Mobile leverages the latest HTML5, CSS3, and JavaScript, not all mobile devices provide such support.


Accessibility
o jQuery Mobile is designed with accessibility in mind. It has support for Accessible Rich Internet Applications (WAI-ARIA) to help make web pages accessible for visitors with disabilities using assistive technologies.
Small size
o The overall size of the jQuery Mobile framework is relatively small at 12KB for the JavaScript library, 6KB for the CSS, plus some icons.
Theming
o The framework also provides a theme system that allows us to provide our own application styling.


Browser support
o Not all mobile devices provide support for HTML5, CSS 3, and JavaScript.
o jQuery Mobile currently provides support for the following mobile platforms:
o Apple® iOS: iPhone, iPod Touch, iPad (all versions)
o Android™: all devices (all versions)
o Blackberry® Torch (version 6)
o Palm™ WebOS Pre, Pixi
o Nokia® N900 (in progress)

Structure of a jQuery Mobile page
o jQuery Mobile has guidelines on the structure of pages themselves. In general, a page structure should have the following sections:
Header bar
o Typically contains the page title and Back button
Content
o The content of your application
Footer bar
o Typically contains navigational elements, copyright information, or whatever you need to add to the footer



Example:


HTML head section
o

o attributes that are telling jQuery Mobile what this element is, how to look like and how to behave.





Defining a page block:
o

Page header bar section:
o

Page content section:
o

Footer bar section:

o

Adding a nav bar to the footer section:

o

Defining multiple local pages

o jQuery Mobile also provides support for multiple pages within a single HTML document. The multiple pages are local, internal linked "pages" that we can group together for preloading purposes. The structure of the multipage page is similar to the previous example of a single page, except that it will contain multiple page data-roles. Listing 8 shows an example.

o

Page transitions:
o jQuery Mobile provides support for CSS-based page transitions (inspired by jQtouch), which are applied when navigating to a new page and back. The transitions include:
Slide
o Provides a horizontal transition
Slide up and Slide down
o Provide transitions up and down the screen
Pop
o Provides an explode type of transition
Fade
o Provides a fading transition
Flip
o Provides a flip transition

o We can add page transitions in two different ways:
o Add a data-transition attribute to the link, using
o Use the data-transition attribute on static pages.
o Programmatically, using $.mobile.changePage("pendingtasks.html", "slideup");
o Use the programmatic approach when working with dynamic pages.

List views
o List views, a fundamental type of UI element, are heavily used in mobile applications. jQuery Mobile supports numerous list views: basic, nested, numbered, and read-only lists; split buttons; list dividers; count bubbles; thumbnails; icons; search filter bars; inset styled lists; and theming lists.
o A list view is created by using the

    data attribute. o o Inside the
      we define common
    • list items.

      Forms
      o Forms are used to post information to a server. jQuery Mobile supports many form UI components: text inputs, search inputs, slider, flip toggle switch, radio buttons, checkboxes, select menus, and theming forms.
      o Select menus are driven by native

Friday, September 2, 2011

Shedding light over CLR..

Common Language Runtime (CLR) is the engine available in .Net Framework to compile and run the program. CLR engine does not compile the code in machine code but converts the code in a set of instructions called Microsoft Intermediate Language (MSIL). This MSIL is one of the section of Portable Executable (PE) file, the other being Metadata. PE file automatically get generated when you compile the program code.




The conversion of the program code to MSIL by CLR engine, makes .Net platform and language independent. Although at present, Microsoft does not have CLR engines for other platforms, in future you can find .Net application being compiled in UNIX or Linux operating system. After the conversion of the program code to MSIL, the code is then translated to native or machine code. Instead of compiling the program code at development time, the MSIL code gets translated ‘just in time’ (JIT) by JIT compilers.




There are currently over 15 compilers being built by Microsoft and other companies that produce code that will execute in the CLR. CLR engine is divided into modules that contain code, metadata, and resources. The code is stored in common intermediate language (CIL) format. The module's metadata includes the types such as names, inheritance relationships, method signatures, and dependency information. The module's resources consist of static read-only data such as strings, bitmaps, and other aspects of the program that are not stored as executable code.



The CLR supports component-based programming. Component development has numerous attractive benefits such as code reuse, proper maintenance of all components by allowing independent bug fixes to each. In addition, the CLR helps developers in managing both allocation and deallocation of memory. This removes two of the largest sources of programmer error: leaks and memory corruption.



CLR is also helpful for security purposes. CLR provide permissions to a component based on what process it runs in, validates the code based on evidence such as information about code at load time and the website from which component was obtained to assign permissions on a component-by-component basis. Moreover, CLR checks the code to see if it has been manipulated. The metadata in a CLR component can contain a digital signature that can be used to verify that the component was written by genuine person and that it has not been modified. You can verily identify if anyone has tried to modify with the code. For example, if someone tries to change the code of transferring money from the intended recipient to himself the CLR will prevent the altered code from running.



Friday, August 26, 2011

Microsoft CRM 2011 and Silverlight 4(Using CRM web resources from silverlight)

Hi, 

I have made small document on using CRM 2011 webresources in silverlight application.

CRM & Silverlight

How do I use MS CRM resources from Silverlight?

The rest endpoint for web resources provides an alternative interface to work with MS CRM 2011.

We can use rest services(URI based) to access resources from CRM and can be only accessible from Silverlight and JavaScript web resources.



MS CRM Rest service Implementation.

MS CRM 2011 uses WCF framework to implement odata protocol (that is rest based data service)

This end point is called as Organization Data Service.

In MS CRM, the root service URL will be “[Your Organization Root URL]/xrmservices/2011/organizationdata.svc“.



Odata service sends or receives ATOM or JSON formats. ATOM is a xml based format and JSON is text format.

OData Entity Model (EDM)



The Microsoft CRM EDM is described in a OData service metadata document available at

“[Your Organization Root URL]/xrmservices/2011/organizationdata.svc/$metadata“.

This will use conceptual schema definition language (CSDL) to describe data available in it.



Limitations:



1. Only CRUD operation can be done. But messages that require Execute method cannot be performed.


2. Authentication can be done within the application. Use of rest end point are only limited to JavaScript and Silverlight web resources.


3. You cannot use late binding with managed code with Silverlight. You will typically use WCF Data Services Client Data Service classes while programming by using managed code for the REST endpoint with Silverlight. These classes allow for early binding so that you get strongly typed classes at design time. The only entities available to you are those defined in the system when the classes were generated. This means that you cannot use late binding to work with custom entities that were not included in the WCF Data Services Client Data Service classes when they were generated.




Thursday, June 2, 2011

What are the major distinctions between B2B and B2C marketing?

There are several clear distinctions that can be between the B2B (business to business) and B2C (business to consumer) marketing platforms. Although these two categories make use of the somewhat similar marketing programs that include internet marketing, direct customer marketing, advertising, among other media, however, B2B and B2C differs in the execution of these programs and the result of the marketing activities. Both these marketing techniques employ the same initial steps in developing a marketing strategy.




On the basis of the relationship building marketing efforts, B2B marketing openly caters one business to another business, thus, maximizing the value of the business relationship. Most Indian importers, exporters, and suppliers follow the B2B marketing approach, although some also employ B2C approach as well.



The other point of difference in both these approaches is that while B2C features a large target market, single step buying process and shorter sales cycle. Many manufacturers and wholesalers with B2C focus on merchandising and point of buying activities including coupons, displays and store fronts. So, you can say that basically any business that offers a retail product to the public comes under this type. The Online B2B Portals is helpful for the Indian manufacturers, wholesalers, exporters and suppliers connect with global buyers and importers. These B2B portals enable traders to create an account with them and find new trade partners, business leads, trade shows, hot deals, latest buying requirements and much, much more.



For both B2B and B2C marketing, having a strong brand presence is crucial. However in B2C marketing, the brand encourages the shopper to purchase, remain loyal and potentially pay a higher price. With B2B, it will only help you be considered, not essentially selected. Also, the buyer's emotional view on the purchase is the bottom line of these two markets. Since consumers make purchasing decisions on the basis of security, status, quality and comfort, and a business buyer will make a buying decision on the basis of increasing profitability, reducing costs and enhancing productivity.



In the B2B marketing or the business marketing, both the buyers and sellers are the business owners. The product is not sold to the final user in this type of marketing. The term B2C or Business to Consumer refers to transactions between a business and end-user. You local retail stores are an example of this type of marketing. Another example can be an e-commerce website selling products or services to individuals from around the world.



With B2B, there is a multi-step buying process and longer sales cycle. While B2C marketing focuses on a group or target consumer in order to disclose, sell or market services or goods to the community. Its ultimate aim is to change shoppers into buyers as forcefully and constantly as possible. B2C is product driven and maximizes the value of the transaction. It usually provides in-house service or maintenance software networks for other organizations to exploit so as to lift marketing, sales, profits and efficiency. For example the marketing sites those targets business holders, decision makers and managers.