• Site Collection Design

    In may cases, the entire site structure can be contained in a single site collection, andn indeed this is convenient because the built-in navigation is based on the sites and page within the collection. In addition, content queries, content type, storage quotas, and numorous other sharepoint capacitites are scoped at a site collection, so there is a tendency to design large site collections to make them work over a large set of content. a site collection is alwyas stored in a single sharepoint content dtabase, although a content database con contain many site collections. Many sharepoint administrators limit site collections to 50-200g , and place large connections in their own, dedicated content database.

    sharepoint's build-in groups are scoped at site-collection level, so if seperate sets of groups are desired for administrative control, separate site collections will be necessary.

    Some sharepoint features are scoped at the site collection level, if these features are desired in some areas but not others, then the areas need to be in different site collections.

    Anonymous access is coped at the site collection level, so if part of a web site is to be open to anonymous users, where another forces a login, these sections should be in separate site collections.

    a common pitfall is to build a solution with one giant site collections and find out months or years after that the datbase has become too large to restore from backup within the service=level agreement. If a site contain large items such as video, then consider putting them in a separate site collections and linking to them to divide the storage.

  • Regex-Directed(NFA) Versus Text-Directed (DFA)

    You can easily find out whether the regex flavor you intend to use has a text-directed or regex-directed engine. If backreferences and/or lazy quantifiers are available, you can be certain the engine is regex-directed. You can do the test by applying the regex regex|regex not to the string regex not. If the resulting match is only regex, the engine is regex-directed. If the result is regex not, then it is text-directed. The reason behind this is that the regex-directed engine is eager.

  • regular expression notes

    Greediness

            <p>
            With the question mark, I have introduced the first metacharacter that is greedy. The question mark gives the regex engine two choices: try to match the part the question mark applies to, or do not try to match it. The engine will always try to match that part. Only if this causes the entire regular expression to fail, will the engine try ignoring the part the question mark applies to.
            </p><p>
            The effect is that if you apply the regex Feb 23(rd)? to the string Today is Feb 23rd, 2003, the match will always be Feb 23rd and not Feb 23. You can make the question mark lazy (i.e. turn off the greediness) by putting a second question mark after the first. * greedy, *? lazy, ? greedy, ?? lazy, + greedy, +? lazy.
            </p>
    
  • Creating a custom Master Page Template

    Creating a custom master page template involves several steps. First, you must create the master page template itself. Second, you must create a custom feature that provisions an instance of this master page template inside the Master Page gallery for a specific site. Finally, you need to add some code to redirect site pages to use your custom master page instead of using default.master. The Visual Studio project named CustomBranding provides a working sample that demonstrates how all of the pieces fit together.

            <p>
            Remember that the CustomBranding feature is scoped to the level of the site collection. While you can create a custom feature scoped at the site level to integrate a custom master page template, it’s better to design such a feature at the site collection level because users typically want branding to occur at this level. It is less convenient if you force users to activate the feature separately for every site within a site collection.
            </p>
            <p>
            You can create a custom template by using two different approaches. First, you can make a copy of default.master and then modify it according to taste. A second approach involves starting from scratch so that you can design the exact HTML layout you’re looking for. If you start from scratch, be sure to think through which named placeholders you need to include. There are over 30 named placeholders defined inside default.master, and many of the standard site pages, such as default.aspx and AllItems.aspx, assume that whatever master page they link to will have these same named placeholders.
            </p><p>
            If you forget to include the same set of named placeholders found in default.master, you will likely experience problems. ASP.NET generates errors whenever it finds that a site page references a named placeholder that is not defined in the master page to which it is linked.
            </p><p>
            The custom master page template used in the CustomBranding project is named Litware.master. The Litware.master template is a variation on the default.master template with changes to allow for fly-out menus on both the top link bar and Quick Launch menu. The CustomBranding feature includes a Module element that has been designed to provision an instance of the Litware.master page template into the Master Page gallery of the top-level site.
            </p>
    
  • Delegate Controls

    WSS introduces a powerful new extensibility mechanism known as delegate controls. In some ways, a delegate control is similar to a named placeholder because it defines a region inside a master page that can be substituted with unique content to meet the needs of a particular business solution. Like a placeholder, a delegate control can optionally supply default content that is used until a substitution is performed.

    One major difference when compared to placeholders is that the substitution mechanism for replacing the contents of a delegate control is driven through feature activation. Therefore, you can replace what’s defined inside a delegate control in default.master without requiring any changes to default.master or the site pages that link to it. All you need to do is define a Control element within a feature and then activate that feature.

            <p>
            A significant aspect of using delegate controls involves the scope of the feature that is being used to drive substitution. When you design a feature to substitute the contents of a delegate control, your feature can be scoped at any of the four supported levels. These levels include site scope, site collection scope, Web application scope, and farm scope. This dimension of delegate controls provides a powerful mechanism for enabling and disabling functionality on a wide-scale basis.
            </p>
            <p>
            Let’s begin by looking at an example of a delegate control that is defined in default.master to create the region that defines the standard search area in site pages just above the Site Settings menu. The delegate control definition in default.master looks like the following:
            </p>