Friday, June 17, 2011

Official Kinect developer kit

Finally Microsoft does the right thing (as I hope for Apple and Sony PS) and this is official developer kit for Kinect now is available for download :
http://blogs.technet.com/b/next/archive/2011/06/16/official-kinect-developer-kit-now-available-for-download.aspx

Sunday, June 12, 2011

Developers guide: Overriding vs Overloading

...many developers may confusing between these two type of changes on Methods :
So lets say that Overriding is whrere that the signature is not going to change and only
we change the super class implementation of a method, such as a subclass,
but in Overloading we have two methods with different signature.

Monday, October 18, 2010

Pass external values with GridView HyperLinkField which are not part of the Gridview

As long as you only could use data sources members in NavigateUrl of GridView, I use this way to pass external values with GridView HyperLinkField which are not part of the Gridview :
For example I've an
_ID1 (a member of GridView) , _ID2(External data with sample value 100 as string), which should pass to my NavigateUrl, simply :

1. Define "protected string _ID = "100";" at top of class.
2. NavigateUrl=''
3. You are done.

Monday, January 18, 2010

BDC Import error: Could not create profile page for Entity

In SharePoint While you import the BDC (XML) file you may get this error:
"Could not create profile page for Entity 'xxx'.The error is: Cannot create a new connection to closed Web Part 'x-y-z' "
After 2 days searching with no practical solution I decide to solve it by myself by monitoring SQL and Web Parts underground, finally I've found and solved the solution.It worked to me 100%.
What is the error exactly?
While you create a specific finder for the BDC to profile it, (so "could not create profile..." warning solve by the way) then you may get the above error because one of the following reasons which I've found (you should do step by step in my order to get faster response):
Problem 1: You might close "Profile Page Template Web Part", when a BDC want to associate a profile to a template page it returns and error that : "Cannot create a new connection to closed Web Part".
Solution 1:
1. Go to the "Shared Services" admin page.
2. Under "Business Data Catalog" click on "Edit profile page template".
3. If you don't see the "Business Data Item" Web Part in the page go to Step 4 , otherwise go to Problem 2 .
4. Navigate to Site Actions->Edit Page then click on "Add a Web Part", this will open a page.
5. On the opened "Add Web Part to Top Zone" page, click on "Advanced Web Part gallery and options".
6. On the "Add Web Parts", click on "Closed Web Part" and select "Business Data Item" and drag to the page to restore it.
7. click "Exit Edit Mode" (on top right).
8. You done.So back to the BDC import page and import the BDC.
Problem 2: Check Problem 1 first.Do not waste your time. If did so, your problem is you closed a web part in which may did not remove from SQL correctly.
Solution 2:
1. I've coded a TSQL to solve faster and safe, so copy the uniqueidentifier for the close web part from the error message, for example mark and copy the bold section:
"The error is: Cannot create a new connection to closed Web Part g_38004421_f6ad_4880_807a_8c90bcf42f4a "
note that I do not mark and copy "g_".
2. open SQL management studio and query this script. Replace the bold parameters with yours:
USE WSS_Content
DECLARE @Id nvarchar(50)
DECLARE @WId nvarchar(50)
SELECT @WId = 'UNIQUEIDENTIFIER '
SELECT @Id =(
SELECT id FROM AllDocs
WHERE id =(
SELECT tp_PageUrlID FROM WebParts
WHERE tp_id like '%' + @WId + '%' ))
DELETE FROM WebParts
WHERE tp_PageUrlID like '%' + @Id + '%'
DELETE FROM AllDocs
WHERE id like '%' + @Id + '%'
The code above find the UID that cause the error in the WebParts table and AllDocs related object, then delete them.
All works to me. Hope you too.

Sunday, January 17, 2010

SharePoint WebPart Tips and Tricks

To view and manage all Web Parts within a page or see the status of them, simply append "?contents=1" to a given URL page. for example:
http://vsmoss/sites/intranet/some_reports.aspx
would be:
http://vsmoss/sites/intranet/some_reports.aspx?contents=1
brings you to the Web Part Page Maintenance Some_Reports

Tuesday, November 10, 2009

SharePoint 2007 Infopath Web Service Data Connection obscured problem

The issue is very obscured, and as I knew so many admins and developers have the same problem.You could search google if I was not right....
The problem: When you want to create a Web Service Data Connection for Infopath form, after entering the WSDL (web service) URL get the obscured error that says: "Invalid XML document or access denied or so on".
Causes: In fact the problem is not access permission nor invalid XML, so invalid URL for WSDL causes the issue.
Solution: in the web browser open the URL of the web service, if it opened, Click on Service Description link at the line 1 of the page, if you got blank page the URL for web service is not correct, otherwise you will get the coded XML page(right place).
For example you may type the incorect URL for WSDL but the URL exist: http://SERVERNAME/_vti_bin/SERVICE.asmx -> Exist
http://SERVERNAME/_vti_bin/SERVICE.asmx?WSDL ->(After Click) NOT Exist = blank page
even if the URL was incorrect you could open it on your browser but if you click on the Service Desciption link you will get the blank page.In fact the correct path is (to me was):
http://SERVERNAME/Sites/Intranet/_vti_bin/SERVICE.asmx -> Exist
http://SERVERNAME/Sites/Intranet/_vti_bin/SERVICE.asmx -> (After Click) Exist = XML coded page

Wednesday, September 09, 2009

Mapping Sql Data Type to System Type

//C#
private Type DeriveCLSType(SqlDataType _SqlDataType)
{
Type typ = GetType();
switch (_SqlDataType)
{
case SqlDataType.BigInt:
typ = Type.GetType("System.Int64");
break;

case SqlDataType.Bit:
typ = Type.GetType("System.Boolean");
break;

case SqlDataType.Char:
case SqlDataType.VarChar:
case SqlDataType.VarCharMax:
typ = Type.GetType("System.String");
break;

case SqlDataType.DateTime:
case SqlDataType.SmallDateTime:
typ = Type.GetType("System.DateTime");
break;

case SqlDataType.Decimal:
case SqlDataType.Money:
case SqlDataType.SmallMoney:
typ = Type.GetType("System.Decimal");
break;

case SqlDataType.Int:
typ = Type.GetType("System.Int32");
break;

case SqlDataType.NChar:
case SqlDataType.NText:
case SqlDataType.NVarChar:
case SqlDataType.NVarCharMax:
case SqlDataType.Text:
typ = Type.GetType("System.String");
break;

case SqlDataType.Real:
case SqlDataType.Numeric:
case SqlDataType.Float:
typ = Type.GetType("System.Double");
break;

case SqlDataType.Timestamp:
case SqlDataType.Binary:
typ = Type.GetType("System.Byte");
break;

case SqlDataType.TinyInt:
case SqlDataType.SmallInt:
typ = Type.GetType("System.Int16");
break;

case SqlDataType.UniqueIdentifier:
typ = Type.GetType("System.Guid");
break;

case SqlDataType.UserDefinedDataType:
case SqlDataType.UserDefinedType:
case SqlDataType.Variant:
case SqlDataType.Image:
typ = Type.GetType("System.Object");
break;

default:
typ = Type.GetType("System.String");
break;
}
return typ;
}