A new beginning
October 2nd, 2008 // 1:51 pm @ Amar
It’s been a while since I posted. I have been involved in bringing my dream to reality. For a quick update, I have left my job to start my own company Toolagen Limited. Currently keeping very busy in giving shape to this organisation while working on several consulting projects on SharePoint / MOSS. Working for myself will enable me to work on even more engaging and complex SharePoint / MOSS projects while creating a service delivery team to develop and deploy complex MOSS solutions.
We are also working on some SharePoint tools which will soon be released to everyone. Hopefully we will be making it to Beta before Christmas.
Category : General & SharePoint
Blogging again
June 2nd, 2008 // 1:09 pm @ Amar
Some of my old readers would have noticed that I’ve stopped blogging for quite a while now. Thing in my personal life, kept me busy and off blogging.
However, I am very much here, and dying to start blogging again. While I was in hibernation, the world has moved ahead leaps and bounds. MOSS is getting more and more popularity, and I am seeing people get excited about SharePoint more than I have ever seen before. I have been working with MOSS for a little while now, and it is HUGE. So while I begin another journey to learn, hack and understand the nitty gritty’s of MOSS, I will try my best to keep discussing my findings with you. Had been busy with an architecture project in MOSS and currently working with a MOSS OpenXML based project. Have learnt a lot of things, but MOSS does amaze me daily.
For this so called first post, I will just list out some interesting pieces from fellow bloggers which I have been reading lately.
Andrew Connell posted a nice article on getting Silverlight working in SharePoint.
Spencer Harbar has posted a nice article on Internet Sites Licensing with SharePoint.
The Microsoft SharePoint Team has a nice article discussing the architecture for Building a News Workbench.
Paul Andrew has a short and effective task list on getting started with SharePoint development. Very practical advice here.
Doug Mahugh has some fantastic resources for those interested in getting started with Open XML. One of the best compilations I have seen.
And last but not least, Todd Baginski has a nice article on programmatically customising Site Navigation in WSS and MOSS.
Category : SharePoint
Office Servers Available on MSDN
November 29th, 2006 // 3:11 pm @ Amar
I just heard that the Office Servers including SharePoint 2007 are available for download at MSDN now. Not sure if this is old news or not, but a heads up to anyone who has not been keeping track. Go to MSDN and download SharePoint 2007 now
Category : SharePoint
Prefix ‘z’ is not defined error in SharePoint
November 24th, 2006 // 9:11 pm @ Amar
If you are trying to programmatically add items to a sharepoint list, using the web services, you might encounter this error while analysing the return value. I was adding entries to the site directory and on adding an entry, you get a XML result set back. Something similar to what is presented below: ( I have omitted bits which are not relevant )
<Results xmlns=”http://schemas.microsoft.com/sharepoint/soap/”>
<Result ID=”2,New”>
<ErrorCode>0×00000000 <ID />
<z:row ows_ID=”20″ … xmlns:z=”#RowsetSchema” />
</Result>
</Results>
Now, the problem is when you try to parse this, you will encounter the error “Prefix ‘z’ is not defined”. This happens because at this stage, the XML parser does not have any idea what the z in the z:row stands for. The solution I used, was to create a NamespaceManager and add the namespace of z to it manually. The following code will parse the resultset we have.
SiteDirectoryWS.Lists sd = new SiteDirectoryWS.Lists;
…
// form the xml to add an entry in the Sites list.
XmlNode returnNode = sd.UpdateListItems(“Sites”, insertListElement);
XmlDocument xmlDoc = new XmlDocument;
xmlDoc.LoadXml(returnNode.OuterXml);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsmgr.AddNamespace(“z”, “#RowsetSchema”);
nsmgr.AddNamespace(“rs”, “urn:schemas-microsoft-com:rowset”);
XmlNode elem = returnNode.SelectSingleNode(“.//z:row”, nsmgr);
If (elem != null)
retID = elem.Attributes(“ows_ID”).Value;
Category : SharePoint
.NET Code Performance
November 22nd, 2006 // 8:11 pm @ Amar
I recently had been busy performance tuning .NET code, and I was very surprised at some of the findings as I timed and profiled various code modules. I had done a lot of performance tuning with C++ before I migrated to .NET. Had not done any serious performance tuning till now with .NET. While I was profiling a SharePoint WebPart, these findings would be equally applicable to any .NET code.
I was surprised to see that accessing a property off an object had a surprising big hit. e.g.
MyObject is an object which has a property say, ID.
I have a loop of code which uses the MyObject and tried to compare the ID with something…
for (int i =0; i < 100; i ++)
{
if ( MyObject.ID == something)
do something…
}
I observed that there were a few milliseconds being spend whenever I tried to access MyObject.ID.
Alternatively the following code ran much faster.
int id = MyObject.ID
for (int i =0; i < 100; i ++)
{
if ( id == something)
do something…
}
I guess the overhead of accessing the object and getting the property value does have a hit and can take up time if say you have a recursive function or an iterative function. Will be careful of such cases in the future.
I guess I will spend a bit more time exploring the internals of .NET to profile and find out such cases which can make a difference in our code.
P.S. I know I have not been posting to this blog for a bit. I am trying to move my blog to a better host and with better control over it. Yahoo Hosting is not adequate for it, as I cannot do a lot of things I plan to do with my Wordpress installation. Hence will mostly be moving this site to a new server which does not have restrictions. So busy evaluating offers and packaged from hundreds of hosting companies to find one which is just right for a geek developer like me, who would like to have enough control when needed from time to time.
Category : SharePoint & dotNet
Code cannot find reference to assembly in GAC
September 29th, 2006 // 7:09 pm @ Amar
I came across this error today which made me quite curious on why it is happening. This occured to me in a SharePoint WebPart, but it is a very general .NET Framework error and as such can occur in any type of .NET application.
CS0011: Referenced class someClass’ has base class or interface
someNamespace.someBase’ defined in an assembly that is not referenced. You must add
a reference to assembly ’someNameSpace’.
To explain the scenario. You have an assembly in the GAC with some classes. You have some code which you are running which reference the GAC dll. For my case, I was inheriting my webpart from one of the baseclasses defined in the GAC assembly. If I put the assembly in the /bin directory as well as the GAC it worked beautifully, but if I deleted the assembly from my /bin directory, I got the above error. This sort of nullified the entire purpose of having a GAC.
What was happening was that the code was trying to reference the someNamespace.someBase Class but as there was no link in the code to provide it with a hint that the required assembly is in the GAC, it was complaining. As soon as the dll was in the /bin directory it was able to reference it and all was ok. To solve the problem, there are two ways to do it.
1. If you have a ASP.NET application, you can add a @Register Assembly derivative in your page.
2. You can add the reference in your web.config to hint the application to look for the assembly in the GAC by adding the following lines in your web.config file..
<system.web>
<compilation batch=”false” debug=”true”>
<assemblies>
<add assembly=”someAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=s0m3publ1ck3y” />
</assemblies>
</compilation>
</system.web></code>
The solution was found, the day was won. But it made me wonder if this is a design defect with .NET. If placed in the \bin directory, the application was very happy to reference the dll. If an assembly is in the GAC, why do we have to explicitely tell out application to look for the reference in the GAC. Shouldn’t it be doing that automatically in the first place.
Category : SharePoint & dotNet
Microsoft Knowledge Network for SharePoint 2007
July 17th, 2006 // 12:07 pm @ Amar
I just had a look at the Knowledge Network team blog. It seems like they have released a build last week. Completely missed out on it. Have not tried it out, but it does seem to be cool. Head over to the Knowledge Network Team Blog if you want to know more about it.
Category : SharePoint
Area template bugs…
July 12th, 2006 // 12:56 pm @ Amar
I am working with some custom area templates, and was interested to know if anyone has found any workaround for some bugs. I did not find anything on the ms knowledge base and was unable to locate any information on google.
1. Area Templates do not consider the hidden attribute while showing in the list of templates. When you set an area to let you choose which template to use when creating subareas, all the templates available are presented in that list. Even if you have set the Hidden=”True” (which is the default) in the webtempsps file, it displays all the templates. Is there any fix so that it only displays the templates which we want to appear in that list?
2. Multiple configurations in an area template gets ignored. If you have multiple configurations in the onet.xml for your area templates, on creation, it always seem to use the default configuration. Even if you choose the second configuration ( after adding them to your webtemp file ), it creates the area with the default configuration.
Has anyone found a solution to these problems? Or any workaround? The site ones work fine. Just the area ones are all affected by this. I am running SPS 2003 with SP2. I am still trying to find some workaround if there is any for these problems, and will post here if I found any. Please leave a comment if you have found any workaround.
Category : SharePoint
stsadm unable to connect to sharepoint database
July 12th, 2006 // 12:54 pm @ Amar
I ran across this problem today when I tried to run stsadm and kept on getting an error saying that it is unable to connect to the configuration database. I was able to go thru the site and the central admin pages successfully, but this problem was happening only when accessing via stsadm.
You need to give you current logged user access to the SharePoint databases. I found a very nice explaination about this problem on Mitch Milam’s site. Thanks Mitch.
Category : SharePoint
Improving SharePoint performance
June 27th, 2006 // 3:06 pm @ Amar
This is a neat trick to improve the performance of your Sharepoint Box if you have custom webparts installed. Normally, the SharePoint indexer kicks in to index the pages, and when it does kick in, it causes an additional hit on the server. There may be cases, when you don’t want your custom webparts to connect to backend data systems and process the data when the indexer is accessing it. So what we have done, is to check if the current account calling the page, is the service account or not. If it is the service account, then just dont do anything. This way, we bypass the entire processing of each of our custom webparts, when the indexer is accessing them and hence decrease the overall load on the server.
On many systems, the indexer is set to kick in every 10 – 20 mins, so it is quite a bit of saving on extremely busy systems.
Category : SharePoint