Monday, February 04, 2008

Tzunami Deployer, Metalogix and an apology

My current customer is looking to upgrade to sharepoint 2007 from 2003, and that is a problem - we want to move to a totaly new information architecture, so just running "upgrade" will not do.
I have reviewed two products - >Metalogix Migration Manager for SharePoint and Tzunami Deployer that may help us, since their tools are built for that purpose. I am still resesarching on the differences between the two, and it seems that no matter what, we will need to write some code to apply our own rules on how content should be moved. As soon as I am sure I am well versed in the differences, I will post a review about the two.
One thing I can highlight now is that metalogix seems like a great solution not for an upgrade, but for deploying content between seperate farms by using a very simple interface.

Apology
Sorry - it has been a long time since I blogged about anything useful, and I refuse to blog about windows 2008 RTMing (oops!) and other such links. But I promise that as soon as I get a chance I will start again. The last few months were hectic with holidays and goodbyes (personal story), but now I should have more spare time, and since I am preparing for a lecture that I am giving in Tech Ed Israel - I would probably have some things to write about pretty soon!.

Thursday, January 10, 2008

Getting user profile values that support multiple value

I noticed today that the MSDN article "User Profiles Object Model Overview" has a wrong code sample for the "correct way of retrieving a user profile property value". The code sample there will not work, because the object model in sharepoind doesnt have the methods and objects the sample code is using.
Therefore - here is my correct way:

if (Profile[this.UserProfilePropertyName].Count == 1)
    return Profile[this.UserProfilePropertyName].Value.ToString();
else
{
    StringBuilder ret = new StringBuilder("");
    UserProfileValueCollection values = Profile[this.UserProfilePropertyName];
    System.Collections.IEnumerator allValues = values.GetEnumerator();
    while(allValues.MoveNext())
    {
        ret.Append(allValues.Current.ToString());
        ret.Append(";");
    }
    return ret.ToString();
}

Tuesday, December 18, 2007

This is customer support!

Sorry - another non-sharepoint post. I promise to post something good later today.

I just got a response from the GPS company TomTom about a question I sent them. You see, my TomTom GPS is also a bluetooth hands free in my car, and has a microphone that you attach to the sun screen which allows you to talk with great sound quality. The problem is that tomtom never expected someone like me to use that - I broke the microphone clip after about 8 months use.
The annoying thing - they dont sell spare parts. In the UK you can buy another set of microphone+clip, but here in Australia it is not available for some reason. So I got to tomtom web site, and in the support section asked for help. within a day (!) I got a response that they are sending me a replacement!

This is the kind of customer service I like to see. I know that the next GPS I get will be a tomtom.

Side note - if anyone from tomtom is reading this - can you add an Israel map to your collections of maps? I really want to travel with my tomtom...

Sunday, December 16, 2007

DELL XPS and 64bit operating systems

This has me angry enough to blog about. I have a Dell XPS m1330 laptop. Its a great laptop - fast, small, efficient and best of all - it is configured with all the best options available from dell (except for a solid state hard drive), including 4GB RAM - which dictates a 64bit operating system to take advantage of the juice.
The only problem is that you cannot install a 64bit operating system on it without turning off AHCI - which sucks. I called Dell, and a supporter named "Michael MG" confirmed that they (dell) do not know what drivers are needed to download to make this work (he advised me to "google it") and when I asked, if my laptop doesnt have a "A:" drive how do I install drivers during windows installation. Michael told me that I can't and therefore should only install windows 32bit or turn off AHCI support.
WTF?!
Does anyone know if the Apple machines support AHCI on vista 64bit?

Tuesday, December 11, 2007

Service pack is released

Ok, so all other bloggers are talking about it, you probably dont need me to tell you - but just in case I have a reader who only reads my blog - here are the links to the service packs:
  1. Windows SharePoint Services v3 SP1
  2. Microsoft Office SharePoint Server 2007 SP1
  3. Office SharePoint Designer 2007 SP1
I didn't install those myself yet - if I run into trouble I will post.

Thursday, November 29, 2007

Why event handlers are triggered twice?

A lot of people call me Mr Event Handlers (ok, that is not 100% correct. Currently I am the only one calling me that, but never mind), but today's article comes from a Friend who we will refer to as Antin.
Antin did some research on why event handlers behaved strangely in publishing sites and emailed me the results. He logged every event that happens when you check-in a file in a publishing site, and logged the thread of each call, along with the time, so he figured out the sequence.

I think his results are important for all of us writing event handlers - we need to know what is happening when. If you do find this helpful, post a "thank you antin" comment on this post, and I will make sure he know about it (enough encouragment and he may start his own blog, the lazy bugger).

The test results:
(In brackets will be thread number, then list item is old/new, then before properties is old/new, then after values is old/new) Change AND Check-in:
1. Updating (10; old; old; old)
2. Updating (10; new; new; new)
3. CheckingIn (10; new; new; new)
4. CheckedIn (15; new; new; new)
5. Updated (11; new; new; new)
6. Updated (1; new; old; old;)

Change AND Save:
1. Updating (10; old; old; old)
2. Updated (12;new; old; old)

Check-in ONLY
1. CheckingIn (9; new; new; new)
2. CheckedIn (11; new; new; new)
3. Updated (13; new; new; new)
4. Updated (10; new; new; new)

Publish ONLY
1. Updating (1; new; new; new)
2. Updated (13; new; new; new)

If you look at what happens for the save only and the check in only and the combination of new/old values it looks like it working like this:
1. ItemUpdating - from the Save event
2. ItemUpdating - from the CheckIn event (which should fire after the Updated from the Save)
3. ItemCheckingIn
4. ItemCheckedIn
5. ItemUpdated - from the CheckIn event
6. ItemUpdated - from the Save event

Tuesday, November 27, 2007

Avoiding CSS caching issues

I had a problem in several projects where we changed the CSS and deployed it to the load balanced server environment, and still the old CSS file was cached somewhere, and we couldnt roll out the changes to the users.
Another problem on the same line are browsers that cache the css files, and users do not see the changes we make to the css until we tell them to clear their browser's cache.

To resolve this, we took a trick from Microsoft - notice how Microsoft always links to the css with a version number in sharepoint? this is done to avoid caching when you put a new version.

My trick was to develop a custom web control (that I call the "CssInjector") that gets as a property the link to the css file, and renders that link with a random querystring. this forces the browsers (as well as IIS or other caching applications) not to cache the file.
The problem with this solutions is that it will have performance implications - slower loading of pages, so what I'd really like to do is what MS did - rely on a version number. However, I have yet to come up with the architecture that will let me manage version numbers in my solution package without having to manually setting the version every time. I thought of reading the version number from the CSS file itself, but that will introduce performance issues again - as the code will have to load and read the css file each time a page is opened.

So until I get a better solution, here is the code I am using for my web control:

using System;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
namespace SharePointTips.SharePoint.WebControls{
public class CssInjector : WebControl
    {
        private const string CSS_LINK_FORMAT = @"<link rel=""stylesheet"" type=""text/css"" href=""{0}"">";
        private string _CSSFileLink = "";
        public string CSSFileLink
        {
            get { return _CSSFileLink; }
            set { _CSSFileLink = value; }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.CSSFileLink.Length > 0)
            {
                writer.Write(string.Format(CSS_LINK_FORMAT, this.CSSFileLink + "?k=" + GetUniqueKey(8)));
            }
        }
        public static string GetUniqueKey(int length)
        {
            //create an array of acceptable characters
            char[] chars = new char[62];
            chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
            StringBuilder result = new StringBuilder(length);
            Random rnd = new Random();
            //create the random string in the specified length
            for (int i = 0; i < length; i++)
            {
                result.Append(chars[rnd.Next(chars.Length)]);
            }
            return result.ToString();
        }
    }
}
And here is how I use it in the master page:
<%@ Register Tagprefix="SharePointTipsWebControls" Namespace="SharePointTips.SharePoint.WebControls" Assembly="SharePointTips.SharePoint.WebControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxx" %>
<SharePointTipsWebControls:CssInjector runat="server" ID="SharePointTipsCSS1" CSSFileLink="/_layouts/SharePointTips/SharePointTipsCustomCss.css" />

Wednesday, November 07, 2007

MVP Night in Vegas

Text to come...

Monday, November 05, 2007

SharePointPedia is live

Microsoft has just released a site built on sharepoint, that will hold information (links) for sharepoint. (The short link is http://sharepointpedia.com)
Check out Lawrence Liu post about this.

Sunday, November 04, 2007

First night in Vegas

Yes!
I am there at last, Vegas for the sharepoint dev connections conference. It only took me 30 hours to get from home to here, and I landed only 12 hours after I left (confused? so am I...)

So far, Vegas stinks. I don't mean it sucks - I mean it stinks with cigarette smoke. Man, its like going back to eastern europe (or Amsterdam). One reason I love Australia so much is the anti smoking laws.

So just a reminder - If you want to meet, in two days (Tuesday) we are having the SharePoint by Day, SharePint by Night event, with all MVPs having a few drinks and talking sharepoint with everyone who will stop to listen. Must be funny!
See you there!