Wednesday, June 22, 2011

Message: Expected identifier, string or number

If you get this error in your Ext JS page , then there is big possibility that you have added a extra comma which is not required .

E.g.
Incorrect entry
{
title: 'Main Content',
collapsible: false,
region: 'center',
layout: 'fit',
margins: '5 0 0 0',
xtype: 'panelbais' , }

Correct entry

{
title: 'Main Content',
collapsible: false,
region: 'center',
layout: 'fit',
margins: '5 0 0 0',
xtype: 'panelbais' }


Check out the last comma before the closing curly braces .

Monday, June 20, 2011

'undefined' is null or not an object in ext-all.js

One more ext-all.js error . This time it was due to extra comma in object literal definition.

Resolution :
Find and remove extra comma.

'flex' is null or not an object in ext-all.js

I got this error for quite some time and i had no clue what was wrong in my page . Page consisted of only 2 panel controls . That's all

After playing around with some of properties of panel , the issue was resolved.

Issue in my case :
First panel had property layout: 'anchor'
Second Panel had property layout: 'border '


Resolution :
Changed the second panel property layout: 'anchor'

This might not be your case . This error is very generic and can pop up due to multiple reasons .


Ext JS : Data Model proxy for Json and XML return type

JSON RETURN DATA

If you data is returned in JSON format then your proxy for Data Model will look like :
Ext.define("Post", {
extend: 'Ext.data.Model',
proxy:
{
type: 'rest',
url : 'http://xyz.com/ID/18/',
reader: {
type: 'json',
root: 'CUSTOMER'
}
}



XML Return Data

Ext.define("Post", {
extend: 'Ext.data.Model',
proxy: {
type: 'ajax',
url : 'http://xyz.com/ID/18',
reader: {
type: 'xml',
record: 'CUSTOMER'
}
},

Ext JS Programming Basic Requirement

So , if you have started working with Ext JS make sure you are using the following tools . Believe me they are quite handy and saves you from head banging ;-)

1) Fiddler
2) Scripting client
3) REST Service Tested ( Firefox)
4) Firebug


Thursday, June 16, 2011

Could not find default endpoint element that references contract 'x' in the ServiceModel client

Scenario :

I was creating a WCf client to test the services . After creating client proxy and testing the services i bumped into below error. It seems the configuration in my app.config was not correct.

ERROR:
{System.InvalidOperationException: Could not find default endpoint element that references contract 'x' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.


Resolution :
When you generate client using the svcutil.exe , an output.xml is generated. This file contains the end point configuration information . Take the configuration from this file and add it to app.config. Service should work without configuration issue assuming your code is not erroneous ;-)


Wednesday, June 15, 2011

Visual Studio IntelliSense to show comments for the Custom Function

If you added Summary to your custom defined function and it's still now showing description as part of Visual Studio IntelliSense then for sure you are missing a setting .

e.g.

///<summary>
This is test function
///</summary>

public void TestFunction()
{
//Do something...
}



when you access this function , you expect the description to show up but in case its shows nothing . Then do this :

1) Open Projects property page
2) Click the Build Tab
30 Check the "Xml documentation file " checkbox


Compile project and try once more ...



Wednesday, June 08, 2011

Accessing Enterprise Application Blocks

There are mutiple ways to access application blocks :

Using the Enterprise Library Service Locator

var writer = EnterpriseLibraryContainer.Current.GetInstance();
writer.Write("I'm a log entry created by the Logging block!");


var customerDb
= EnterpriseLibraryContainer.Current.GetInstance("Customers");


The Sophisticated Approach — Accessing the Container Directly

var theContainer = new
UnityContainer().AddNewExtension();


var writer = theContainer.Resolve();
writer.Write("I'm a log entry created by the Logging block!");

var customerDb = theContainer.Resolve("Customers");



Check out this diagram :
http://msdn.microsoft.com/en-us/library/Ff953191.441da4ba-fa2e-4da3-bac1-89897580d80b(l=en-us,v=PandP.50).png