Archive for June, 2012

This workbook cannot be opened because it is not stored in an Excel Services Application trusted location – SharePoint 2010

One of my colleagues sent me an email saying that he is getting this error (see below) whenever he tried to open an excel workbook. I just clicked the same file in the same location and I am able to open it. 🙂

But when I click on the excel file drop down –> View in Browser then I also got the same error.

The text format of the error is:

This workbook cannot be opened because it is not stored in an Excel Services Application trusted location.

To create an Excel Services Application trusted location, contact your system administrator.

According to the error message, obviously we need to add the document library path to Trusted File Locations in the Central Administration. So we will see the steps here.

Step 1: Go to Central Administration –> Manage service applications under Application Management

Step 2: Then click on the Excel Services Application

Step 3: Click on the Trusted File Locations

Step 4: Just click Add Trusted File Location under Excel Services Application

Step 5: Add the document library url (OR file location) on the Address box and check the  Children trusted check box –> Click ok

Please note: Don’t use like http://server:1010/documentlibrary1/forms/default.aspx instead of http://server:1010/documentlibrary1

If you use SSL (Secure Sockets Layer)/HTTPS connections, just add  https:// on the address.

If you want to read more about this just click here. The similar problem in SharePoint 2007 also, you can find the solution in my previous post.

After completing this configuration, you might get the “The workbook cannot be opened” error, if you want to get the solution just read here. 🙂

References:

1. http://sharepointknowledgebase.blogspot.ca/2011/12/excel-services-sharepoint-2010-trusted.html

2. http://technet.microsoft.com/en-us/library/ff191194.aspx

, , , , , ,

3 Comments

System.NullReferenceException in Silverlight application designer in Visual Studio 2010

This is my Environment:

  1. Windows 7 64 bit
  2. VisualStudio 2010 with SilverLight 4 developer runtime

ProblemAfter upgrading the SilverLight 5 client, I tried to create a SilverLight Application and then I have got the following wired error message on the design tab 😦

The text format of the error is:

System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.d__8.MoveNext()
at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
at MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier)
at MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context)
at MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider)
at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors)
at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
at Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
at MS.Internal.Host.PersistenceSubsystem.Load()
at MS.Internal.Host.Designer.Load()
at MS.Internal.Designer.VSDesigner.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
at MS.Internal.Designer.DesignerPane.LoadDesignerView()

Solution: The problem is the conflict of SilverLight versions and I have found the solution in this thread.

Step 1: Uninstall the latest SilverLight client which is SilverLight  5, the 1st one in the below control panel screen shot

Step 2: Uninstall SilverLight 4 developer, the next 1 in the above image

Step 3: Download and Install Microsoft Silverlight 4 Tools for Visual Studio 2010 (Add-on and pre-requisite files for Visual Studio 2010 to develop Silverlight 4 and RIA Services applications)

Installing..!

Installation finished successfully.

Restart the VisualStudio 2010, wow.. it’s working! 🙂

Happy Silverlighting..! Thanks R./

References:

1. http://connect.microsoft.com/VisualStudio/feedback/details/718259/new-ms-update-causes-vs2010-silverlight-project-to-have-error-in-design-wpf-editor

2. http://social.msdn.microsoft.com/Forums/en/vswpfdesigner/thread/01ce533e-ed94-48d2-8184-e2e34e6bdc6f

, , , , ,

12 Comments

DDL, DML, DCL and TCL Commands/Statements

Everybody knows about these statements but I just wanted to post this for quick references and also there is a new DML statement (MERGE) available in SQL Server 2008.

SQL commands are instructions which are normally used to communicate with the database to perform specific task and various other functions. Depending on the functionalities we can divide into 4 groups. They are DDL, DML, DCL and TCL.

DDL (Data Definition Language): is a vocabulary used to define data structures in SQL Server. Use these statements to create, alter, drop and truncate data structures in an instance of SQL Server. (MSDN Definition, you can read more here)

  • CREATE : creates an object (a table, for example) in the database.
  • ALTER : database modifies the structure of an existing object in various ways (Eg: adding a column to an existing table)
  • DROP : deletes an object in the database, usually irretrievably.
  • TRUNCATE : remove all records from a table, including all spaces allocated for the records are removed

DML (Data Manipulation Language): is a vocabulary used to retrieve and work with data in SQL Server. Use these statements to add, modify, query or remove data from a SQL Server database. (MSDN Definition, you can read more here)

  • SELECT : retrieves data from one or more tables, or expressions
  • INSERT  : adds rows (formally tuples) to an existing table
  • UPDATE : modifies a set of existing table rows
  • DELETE  : removes existing rows from a table, the space for the records remain
  • MERGE   : insert, update or delete operations on a target table. Normally called UPSERT operation

DCL (Data Control Language): is a vocabulary used to provide security such as roles and permissions in SQL Server. Use these statements to grant and revoke permissions to SQL Server database.

  • GRANT : gives user’s access privileges to database
  • REVOKE : withdraw access privileges given with the GRANT command

TCL (Transaction Control Language): is a vocabulary used to manage the changes made by DML statements in SQL Server. Use these statements to commit or rollback the transaction in a SQL Server database. (Read more here)

  • COMMIT : causes all data changes in a transaction to be made permanent
  • ROLLBACK : causes all data changes since the last COMMIT or ROLLBACK to be discarded, leaving the state of the data as it was prior to those changes.
  • SAVE TRANSACTION : save the state of the database at the current point in transaction

Please Note: I didn’t get a chance to work with ‘Save Transaction’, if you want to read more about this please click here

References:

1. http://culturalview.com/books/sql.pdf

2. http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_commands

3. http://blog.sqlauthority.com/2008/01/15/sql-server-what-is-dml-ddl-dcl-and-tcl-introduction-and-examples/

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

, , , , , , , , , ,

2 Comments

Constructors and Destructors (C#)

This is for my quick references and I have taken most of the information from MSDN and other web sites. BTW I have written and tested the source!

Constructors
– Constructors are methods that are executed when an object of a class is created.
– They have the same name as the class.
– A class  may have multiple constructors that take different arguments.
– Constructors enable the programmer to set default values.
– Like class, structs also can have constructors.

There are 3 kind of constructors in .Net (as far as I know), they are

  • Instance Constructors -Used to create and initialize instances of the class
  • Private Constructors – A special type of instance constructor that is not accessible outside the class (cannot be instantiated)
  • Static Constructors – Automatically initialize the class before the first instance is created or any static members are referenced
Example:
public class A //Class Name A
{
public int i;
public A() // Constructor of A
{
i=1;
}
}
class Program
{
static void Main(string[] args)
{
A a = new A(); //Initiated with new Operator
Console.WriteLine("The initialized value is: {0}", a.i);

System.Console.ReadLine(); //This line is to stop the result window
}
}

Destructors
– are used to destruct instances of classes.
– cannot be defined in structs. They are only used with classes.
– A class can only have one destructor.
– cannot be inherited or overloaded.
– cannot be called. They are invoked automatically
– does not take modifiers or have parameters.

Example:
class A
{
public A()
{
Console.WriteLine("Constructor");
}
~A()
{
Console.WriteLine("Destructor");
}
}

 

class Program
{
static void Main(string[] args)
{
A a = new A(); //Initiated with new Operator

System.Console.ReadLine(); //This line is to stop the result window
}
}

Leave a comment

Content Editor Web Part (CEWP) & JavaScript duplicating entries in SharePoint 2010

Recently we have migrated our SharePoint 2007 application to SharePoint 2010 and we also had manually configured few web parts in the new environment. Most of the web parts were working perfectly like sharepoint 2007 but one content editor web part which shows the weather forecast had some wired repeating behavior! 😦

Here is the weather forecast web part in the 2007 which has JavaScript to update the weather from their web site.

The JavaScript code in the Source editor:

I have created the CEWP in 2010 and paste the source code in to the editor.

and Publish the page, It is working fine no? but not really..!

Whenever I edit the page, the web part is duplicating the weather widget like this!

After spending few minutes I have found the solution in this post, actually SharePoint 2010 does not support the JavaScript directly into the source editor. So we cannot copy and paste the JavaScript to the CEWP editor instead, we have to create the scripts as a txt file (paste into a Notepad and save), upload into the SharePoint and then pointing that file as the source of CEWP.

Step 1: Open a Notepad and paste the source code

Step 2: Upload the txt file into SharePoint

Step 3: Get the url path of the txt file and paste it on the content link property of the content editor pane on the right side and click ok.

That’s all. No duplication probs any more. Happy Migrating..!

Thanks. R./

References:

1. http://sharepointadam.com/2010/08/31/insert-javascript-into-a-content-editor-web-part-cewp/

, , , , , , ,

3 Comments