.. of ones and zeros ..
a discussion of technology and software development by bryan napier

SharePoint Licensing

June 25th, 2007 . by bryan

Lots of people out there are asking the same questions regarding SharePoint licensing. Are CAL’s for concurrent users? Do I need both Standard and Enterprise CAL’s? Can I mix Standard and Enterprise CAL’s in a given environment?

It has been difficult finding definitive responses to these questions, and it seems like if you ask 5 people you get 5 different opinions on the licensing. Finally I ran across this great FAQ from the Microsoft Office group specifically on SharePoint licensing, which answers the above questions and many more:

Microsoft Office SharePoint Server 2007 frequently asked questions - SharePoint Server - Microsoft Office Online


My First Linq Program

June 18th, 2007 . by bryan

I successfully coded my very first LINQ program today, and man is it a doozie!  Observe:

class Program
{
    static void Main(string[] args)
    {
        List<Student> studentList = new List<Student>();

        studentList.Add(new Student(“Charlie”, “Brown”));
        studentList.Add(new Student(“Drew”, “Carrie”));

        IEnumerable<Student> students =
            from
                Student
            in
                studentList
            where
                Student.LastName.Equals(“Brown”)
            select
                Student;

        foreach (Student student in students)
        {
            Console.WriteLine(student.FirstName);
        }

        Console.ReadLine();
    }
}

internal class Student
{
    private string _firstName;
    private string _lastName;

    public Student(string firstName, string lastName)
    {
        _firstName = firstName;
        _lastName = lastName;
    }

    public string LastName
    {
        get { return _lastName; }
        set { _lastName = value; }
    }

    public string FirstName
    {
        get { return _firstName; }
        set { _firstName = value; }
    }
}

 Which when run looks like:

CropperCapture[3]

I’m excited by the possibilities this offers, and am anxious to have an opportunity to explore all LINQ has to offer!


Safari for Windows!

June 12th, 2007 . by bryan

Thank you Apple!  I am now one step closer to retiring my 500MHz iBook!

CropperCapture[2]

Incase you missed it, you can download it here.  This is definitely not a production build, as I have been running it for less than a day and it has crashed 3 times, but it is very, VERY promising!


SPLimitedWebPartManager Memory Leak?

June 5th, 2007 . by bryan

Have a look at the following code segment:

while(true)
{
    using (SPSite siteCollection =
        new SPSite(“http://localhost”))
    using (SPWeb site =
        siteCollection.OpenWeb(“/Marketing”))
    {
        SPFolder pagesFolder = site.GetFolder(“Pages”);

        foreach (SPFile page in pagesFolder.Files)
        {
            WL(page.Url);

            using (SPLimitedWebPartManager webPartManager =
                page.GetLimitedWebPartManager
                    (PersonalizationScope.Shared))
            {
            }
        }
    }
}

With this code segment I’m just connecting to a site and iterating over the page collection, grabbing and instance of the page’s SPLimitedWebPartManager as I go. Since SPLimitedWebPartManager implements the IDisposable pattern I am being a good citizen and wrapping its instantiation in a using {} block. The problem with this code segment is that this is what it does to the process memory:

image

Now, if I change the source code to this:

while(true)
{
    using (SPSite siteCollection =
        new SPSite(“http://localhost”))
    using (SPWeb site =
        siteCollection.OpenWeb(“/Marketing”))
    {
        SPFolder pagesFolder = site.GetFolder(“Pages”);

        foreach (SPFile page in pagesFolder.Files)
        {
            WL(page.Url);

            using (SPLimitedWebPartManager webPartManager =
                page.GetLimitedWebPartManager
                    (PersonalizationScope.Shared))
            {
                webPartManager.Web.Dispose();
            }
        }
    }
}

The memory picture looks much different now:

image

The only difference being the addition of an explicit Dispose() within the webPartManager using.

A look inside the SPFile.GetLimitedWebPartManager call reveals that it calls an internal GetLimitedWebPartManagerInternal() method on the SPFile SPWeb member variable. A closer look at this method shows the following code:

SPWeb web = this.Site.OpenWeb();
if (this.AllowUnsafeUpdates)
{
    web.AllowUnsafeUpdates = this.AllowUnsafeUpdates;
}
SPWebPartManager manager = web.GetWebPartManagerInternal(pageUrl, requestedView, forRender, includeHidden, out bytes);

We see here that a new SPWeb object is getting spun up, and in the call to GetWebPartManagerInternal an assignment is going to be made to the SPLimitedWebPartManager m_web member variable. If we look at the Dispose() implementation for SPLimitedWebPartManager, we see the following:

public void Dispose()
{
    if (!this.m_disposed)
    {
        if (this.m_manager != null)
        {
            this.m_manager.Dispose();
        }
    }
    else
    {
        return;
    }
    this.m_webParts = null;
    this.m_manager = null;
    this.m_disposed = true;
}

Nothing is being done to dispose of the m_web! If I explicitly dispose of m_web, then memory stays low.

Is anyone encountering the same?