Friday, April 09, 2010
Saturday, March 06, 2010
Formula 1 – 2010 Season
Sunday, November 15, 2009
Antique world map jig saw puzzle
This new puzzle by no means a easy walk in the park as you can see in the image above.
Normally you start the puzzle by separating the border pieces.So I too stuck to that but to no avail.The reason being there are no contrasting images to identify the correct pieces(Its just a single color boarder ss you can see in the image ).Then I was thinking how I am going to tackle this new challenge.So I changed my strategy.
Since there are clear lines , circles and letters , I started to separate them out.That was indeed the way to go.Then I first assemble the circle area.
After that it became relatively easy till I getting closer towards the border area.It was very hard to find the correct pieces and it took a considerable amount of time too.
After spending around 30 hours within the span of 2 months, finally , I managed to completed this.
My ultimate goal is to complete the world’s largest jig saw puzzle which has 24000 pieces.I have already ordered the miniature version of that which has 3000 pieces.Nishad ayya will bring that for me from UK end of this month.
Waiting for that .
Saturday, November 14, 2009
Hierarchical Nant builds
Found this very good article while I am trouble shooting a Nant build file failure.
http://www.pluralsight.com/community/blogs/keith/archive/2008/03/07/50388.aspx
Tuesday, November 10, 2009
The 12 factors to turn ASP.NET developers to SharePoint 2010
http://www.sharepointdevwiki.com/display/sp2010/2009/11/04/The+12+factors+to+turn+ASP.NET+developers+to+SharePoint+2010
Monday, November 09, 2009
Bandaranayaka College past pupil’s association’s new look web site launched
Tuesday, November 03, 2009
Share point 2010 Hands-on Labs in C# and VB
Developer hands on labs can be found at http://www.microsoft.com/downloads/details.aspx?FamilyID=C010FC68-B47F-4DB6-B8A8-AD4BA33A35C5&displaylang=en#filelist
Good luck !
Thursday, October 29, 2009
Embedding YouTube videos in your blog
Here is the embedded video into this blog entry :
References : http://www.youtube.com/youtubeonyoursite
Monday, September 21, 2009
Event full weekend

To be continued…
Tuesday, September 15, 2009
Internal names should be used in SPQuery
I wanted to change the display names of my fields and after doing that I renamed all the usages of that field name in my web part code.
After deploying the solution I got the error message "One or more field types are not installed properly. Go to the list settings page to delete these fields"
I had no clue what so ever when you read that error message.This is not the only error message that share point generates which we cannot figure out by looking at this.
I spent considerable amount of time debugging the solution until I decided to Google the error message.
Then found that in one of the msdn forums that the internal names of the fields should be used in the CAML queries.
And that was indeed the trick.
Monday, September 14, 2009
US Open 2009 Men’s single final
Who would have thought, the world number 6 seed Juan Martin Del Porto , Argentinean, will storm into final , by beating Rafael Nadal in straight sets to face non other than world number one Roger Federer who never loss at US Open since 2004.Without a doubt Federer will do everything to make it 6 in a row at Flushing Meadows.
Even though Federer has a 6:0 winning ratio against Del Porto , he will be a tough opponent in this final.I cannot wait to see this match which is schedule at not before 16:00Hrs which is early tomorrow morning in my time.That’s a worrying sign for me.
more info at www.usopen.org
Wednesday, September 09, 2009
SharePoint 2007 and WSS 3.0 Dispose Patterns by Example
It is a good practice to make sure your solution is free of memory leaks.
Check this out :
Use the SPDisposeCheck utility to examine your code.
Further references on this subject
http://msdn.microsoft.com/en-us/library/aa973248.aspx
http://furuknap.blogspot.com/2009/08/spdisposecheck-in-visual-studio.html
Wednesday, September 02, 2009
How to create active directory users programmatically
Recently one of my colleagues wanted a piece of code which can be created 500 users in Active Directory for some testing purposes.Knowing that this won’t be a big challenge I said I will give it a try.
Frankly speaking, initially I thought this will be a easy walk in the park.Creating the user in AD part was a piece of cake but the created user was not enabled by default.
I had to figure out how to enable a user account programmatically.That was the only tricky part.
Check the user enabling code segment in the code.(Setting the "userAccountControl" property of the user)
Here is the code
References :string ldapPath = "LDAP://" + server + "/cn=Users,dc=ec,dc=test";
DirectoryEntry entry = new DirectoryEntry(ldapPath, user, pwd);
for (int i = 0; i < userCount; i++)
{
string tempName = userPrifix + i;
DirectoryEntry newUser = entry.Children.Add("CN=" + tempName, "user");
newUser.Properties["givenName"].Add(tempName);
newUser.Properties["userPrincipalName"].Add(tempName + "@ec.test");
newUser.Properties["sAMAccountName"].Add(tempName);
newUser.Password = userPwd;
newUser.CommitChanges();
// Enabling the above created account
int flags = (int)newUser.Properties["userAccountControl"].Value;
newUser.Properties["userAccountControl"].Value = flags & ~0x2;
newUser.CommitChanges();
newUser.Close();
entry.Close();
}
http://www.codeproject.com/KB/system/everythingInAD.aspx
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm
Thursday, August 20, 2009
Tuesday, August 18, 2009
How to avoid recursive calls in list item event receivers in SharePoint
I wanted to insert a value into a column in a list when adding and updating items in the same list.
First I registered the item event receiver into the list.
SPList list = web.Lists[listName];
list.EventReceivers.Add(eventType, assemblyName, className);
Then in the actual event receiver class I override the “ItemAdded” and “ItemUpdated” methods.
public override void ItemAdded(SPItemEventProperties properties)
{
SPListItem item = properties.ListItem;
string itemStatusValue = string.Format("Item added @ {0} by {1}", DateTime.Now.ToLocalTime(),
properties.UserLoginName);
item["columnName"] = itemStatusValue;
item.Update();
}
public override void ItemUpdated(SPItemEventProperties properties)
{
SPListItem item = properties.ListItem;
string itemStatusValue = string.Format("Item updated @ {0} by {1}", DateTime.Now.ToLocalTime(),
properties.UserLoginName);
item["columnName"] = itemStatusValue;
item.Update();
}
But when I debug this in VS2008 I noticed that, as the item get updated or added it always calling to the “ItemUpdated” method.Of course that is understandable since I am updating a column in the same list. But I didn’t want that to happen.Then I found out that you can enable/disable event firing.
So the solution for that is ,
DisableEventFiring();
item.Update();
EnableEventFiring();
It is pretty straight forward once you get to know it.
More references on this : Visit BinaryJam
Friday, August 14, 2009
How to avoid inline codes in user controls in SharePoint web parts
Check here how to use web application projects to develop web parts.
So I was very fond of that method till I figured out, this is not going to inline with the SharePoint deployment techniques.Especially if you are using wsp solution packages and 12 hive structure in Visual Studio with WSPBuilder.
Recently in a project that I was working with, I used a slightly different approach to which I was used to.That is not using web application projects but I used the user control(*.ascx file) with inline codes for the web part in the templatecontrol folder.
There are pros and cons having inline codes.
The code is visible to a person who has access to the server directly.
If it is a complex web part your lines of code will be very high and which will lead to readability and maintainability issues.
Today I managed to figure out how to move inline code into your main assembly of your SharePoint solution and I thought of sharing that with you.
SampleWebPartControl.ascx (user control)
What is important here is that the entry in the RED box in above image.That is the way you specify where the code behind can be found for this user control.
SampleWebPartCOntrol.cs(code behind)
The initialization of user controls you are using is paramount(check the RED box in this image).I had all sorts of problems till I sorted that out.
Solution Structure
Check where the items in the RED box in this image.
Thursday, August 13, 2009
Subscribe to RSS feed of my blog

Now you can subscribe to my blog using RSS.
Steps
- Go to this RSS Feed.
- Select the “Subscribe to this feed using” as you need.My recommendation is “Microsoft Office Outlook”.
- Click on the “Subscribe Now” button.
- Click on the Advanced… button.
- Change the details as you want.
- Click Ok and then click on Yes.
Now you have my blog feeds at your finger tips.
OR you can add the "Feed" gadget into your blog with the given feed url.
Friday, August 07, 2009
List content type troubleshoot
Recently I had a problem with the default content types that are bind with a custom list.
I created an Announcement list and I have bind my own content type into it.Then I wanted to hide the default content type which is the “Announcement”.Initially I used the name to get the content type from the list but later I had to re factor it simply because, if we are to support multilingual we should not use names but id’s.
Then I thought this should be a piece of cake and I re factored it like bellow.
SPList list = web.Lists[listName];
SPContentType item = list.ContentTypes[SPBuiltInContentTypeId.Announcement];
item.Hidden = true;
item.Update();
list.Update();
To my amazement , as I activated the updated feature I got the error “Object reference not set to an instance of an object”.
And then I open this list from the SharePoint Manager and checked the ID of the content type “Announcement” and it is totally different one to the default content type id which is the “0x0104”.
Then I got some expert help on this and got to know that this is because what ever the bind content types in lists are a copy of the site content type.Thank you Bjorn for letting me know about it.
So here is the new code of doing it.
SPContentType item = list.ContentTypes[list.ContentTypes.BestMatch(contentTypeId)];
It was that simple once you got to know it.
So what you need to understand here is that adding a content type to a list means that you actually adding a copy of the content type.
Tuesday, July 28, 2009
SharePoint 2010 Sneak Peak
Are you wondering about how will SharePoint 2010 look like.Here we go click on SharePoint Sneak Peek.
Tuesday, July 07, 2009
My new digital camera – Sony DSC-W270
Time had come to change my very good old HP digital camera which is still working well apart from the noise in the image when took pictures with flash on.It really has a very good video recording without any issues. The new one , Sony DSC-W270 looks really a good one and looking forward to the new experience with this.In a nutshell this camera has a 5x optical zoom and 12.1M pixels.More details on this camera can be found here.





