Sunday, December 9, 2012

Application Pools


IIS application pools provide a way for multiple sites to run on the same server computer but still have their own worker processes and identity. This can help to prevent an exploit on one site which enables the attacker to inject malicious code that can attack sites in different application pools.


Application pools are used for security separation. Memory leak will not bring other applications down. There are instances when an error (null pointer, buffer overflow) can bring the whole application pool down.
When each Web application starts, it loads an App. Domain into a memory. (.NET Framework instance) Depending on the complexity of all active Web applications, memory required to run all desired Web applications may grow significantly, and general guidance for the maximum number of applications sharing the same application pool may not apply.

Using separate application pools in your EPM Focused Office SharePoint Server Intranet Farm has no adverse effect on Office SharePoint Server and PS  components coexistence such as web parts

Wednesday, November 21, 2012

search through keyevent

 /*
     $("#clickMe").click(function(){
                sF.presentForm("<div>I am presented</div>");
        })
*/
    // _spBodyOnLoadFunctionNames.push("JsonCallwithOneParameter");
     function JsonCallwithOneParameter()
     {
   var htext = ""; 
   htext += "<link rel='stylesheet' type='text/css' href='../JQUERYFiles/jTPS.css' />";  
   htext += "<table id='demoTable' style='border: 1px solid #ccc;' cellspacing='0' width='700'>";
   htext += "   <thead>";
   htext += "  <tr>";
   htext += "   <th sort='description'>Room Type</th>";
   htext += "   <th sort='beds'>Beds</th>";
   htext += "   <th sort='maxGuests'>Occupancy</th>";
   htext += "   <th sort='average'>Nightly Avg</th>";
   htext += "  </tr>";
   htext += " </thead>";
   htext += " <tbody>";
   htext += "  <tr>";
   htext += "   <td>1 Bdrm Condo K (96 left)</td>";
   htext += "   <td>1</td>";
   htext += "   <td>4 max</td>";
   htext += "   <td>$169.00</td>";
   htext += "  </tr>";
   htext += "  </tbody>";
   htext += "  <tfoot class='nav'>";
   htext += "    <tr>";
   htext += "     <td colspan=7>";
   htext += "      <div class='pagination'></div>";
   htext += "      <div class='paginationTitle'>Page</div>";
   htext += "      <div class='selectPerPage'></div>";
   htext += "      <div class='status'></div>";
   htext += "     </td>";
   htext += "    </tr>";
   htext += "   </tfoot>";
   htext += "</table>";
  
   document.getElementById('feedContent').innerHTML = htext;
      }
  function searchpressed(){
 
   var sSearch = document.getElementById('txtSimpleSearch')
   document.getElementById('msg-keypress').innerHTML = sSearch.value;
    //GetFastResources
   var productURL = "http://win-n9fdqlp6lvb:8001/sites/CRManagement/_vti_bin/CSSharePointServices/ContractResourceClassSVC.svc/GetFastResources";
   var entry = {"name":""+ sSearch.value+""};

         $.ajax({
             type: "GET",
             url: productURL,
             data: entry,           
             contentType: "application/json; charset=utf-8",
             dataType: "json",
             //cache: false,
             complete: processobjresult,

             
             error: function () {
           //debugger;
                 alert('error second');
             }
         });

  }
  

Wednesday, November 14, 2012

Create a simple WCF in SharePoint

Create a Simple WCF in SharePoint
http://scottcurrier.wordpress.com/2010/07/28/simple-wcf-service-within-sp2010-note-to-self/

JSON, parseJSON
http://api.jquery.com/jQuery.parseJSON/
var obj = jQuery.parseJSON('{"name":"John"}');
alert( obj.name === "John" );
 

Got REST? Querying SharePoint List data using REST services client-side: Part 1 
https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/Got-REST-Querying-SharePoint-List-data-using-REST-services-client-side-Part-1.aspx


Got REST? Querying SharePoint List data using REST services client-side: Part 2
https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/Got-REST-Querying-SharePoint-List-data-using-REST-services-client-side-Part-2.aspx
 
  
Overview of using REST in SharePoint 2010
http://www.synergyonline.com/blog/lists/posts/post.aspx?id=35

REST-Based Ajax Services with WCF in .NET 3.5
http://www.code-magazine.com/Article.aspx?quickid=080014

JQUERY DataTable
http://www.overset.com/2008/08/30/animated-sortable-data-table-jquery-plugin--jtps/

Wednesday, October 17, 2012

Remove Duplicates From Fast

2 Useful links:
http://searchunleashed.wordpress.com/2011/12/08/how-remove-duplicate-results-works-in-fast-search-for-sharepoint/

http://msdn.microsoft.com/en-us/library/ff521593.aspx


Search a specific managed property:
and(string("hello world"), filter(property-spec:or(1, 20, 453, ... , 3473)))
and(string("hello world"), filter(property-spec:int("1 20 453 ... 3473", mode="or")))

Search all strings within specific managed property
and(string("."), filter(managedproperty-spec:or(variableofinput)))

 

Saturday, October 13, 2012

Error on External List

Access Denied by Business Data Connectivity

After create Business Connectivity Service (BCS), I connect one of the web application to the service, then created an "External Content Type".  Finally created a list based on this external content type. The list, or the external list has an error when rendering on the web. The error message is "Access Denied by Business Data Connectivity".

To fix it, Go to Central Administration -> Application Management -> Manage Service Applications -> Business Data Connectivity Service* -> [Your Entity] -> Set Permissions, add the users who needs to access the newly created external type/list.

Can't Login

I was working on a server and we were trying to access the local SharePoint site http://127.0.0.1 or http://nameoflocalserver/pages/default.aspx and I was constantly prompted for the username and password. In SharePoint 2010, it can really annoy you by not accepting your username password credentials in the popup window.

There are two methods to do this:
1.  Specify the host names in the registry - BackConnectionHostNames (more secure and recommended for PRODUCTION servers). Refer http://support.microsoft.com/kb/896861
2. Disable the loopback check - DisableLoopbackCheck (less secure and recommended for DEVELOPMENT environments). Read on to use this method 2 and add via an easy powershell cmd.

use powershell:

New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword

Click Start, click Run, type regedit, and then click OK
In Registry Editor, locate the following registry key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Right-click Lsa, point to New, and then click DWORD Value. (In Win 2008, its DWORD 32bit)
Type DisableLoopbackCheck, and then press ENTER.
Right-click DisableLoopbackCheck, and then click Modify.
In the Value data box, type 1 and then click OK.
Quit Registry Editor.
You may need to restart your server.

Friday, October 12, 2012

Invalid Property

Exception information:
Exception type: InvalidPropertyException
Exception message: Property doesn't exist or is used in a manner inconsistent with schema settings.

This maybe caused by the properties you add do not exist in your managed properties list.

Wednesday, October 10, 2012

Dynamic Rank


How Google Scores Fresh Content

Google Fellow Amit Singhal explains that “Different searches have different freshness needs.”

The implication is that Google measures all of your documents for freshness, then scores each page according to the type of search query. While some queries need fresh content, Google still uses old content for other queries (more on this later.)

Singhal describes the types of keyword searches most likely to require fresh content:

Recent events or hot topics: “occupy oakland protest” “nba lockout”
Regularly recurring events: “NFL scores” “dancing with the stars” “exxon earnings”
Frequent updates: “best slr cameras” “subaru impreza reviews”
Google’s patents offer incredible insight as to how web content can be evaluated using freshness signals, and rankings of that content adjusted accordingly.

Understand that these are not hard and fast rules, but rather theories consistent with patent filings, experiences of other SEOs, and experiments performed over the years. Nothing substitutes for direct experience, so use your best judgement and feel free to perform your own experiments based on the information below.

FAST Search for SharePoint 2010: Relevancy Tuning



Static rank points, also known as quality rank points, are added to search items before it is indexed. The number of points given is based on boost values that are stored in predefined static/quality rank components. You can decide which of these components to use at search time so that you only get the rank points from the components that you specify. You can control the effect of the static rank points by modifying the weight of the different components. Static rank points assigned to an indexed item are independent of the search words that are used, so static rank only indicates something about the general importance of an item. Adding static rank points is efficient from a search performance point of view because it does not add any complexity to the search evaluation.


Static rank points are derived from multiple managed properties. The following sets of managed properties are predefined for static ranking:
  • Urldepthrank: Rank points given to boost shorter URLs.
  • Docrank: Rank points given based on the number of and relative importance of links pointing to an item.
  • Siterank: Rank points given based on the number of and relative importance of links pointing to the items on a site.
  • Hwboost: FAST Search Server 2010 for SharePoint placeholder for generic usage of quality rank points.
In addition to these managed properties, you can add any custom integer managed property to the list of static/quality rank properties.


Microsoft FAST Search Server 2010 offers a more powerful enterprise search for SharePoint 2010. Combining the power of FAST and simplicity of SharePoint, FAST Search Server 2010 offers an exceptional intranet and people search experience. It also serves as a platform for building search-driven applications.
The most powerful feature FAST offers for SharePoint is relevancy tuning. FAST Search Server 2010 comes with a predefined relevance out of the box and is tuned against a large set of various sample data. However, the data is not scoped for users, locations, organizations, keywords or content types. The search administrator has the option to create custom relevancy models tuned to differences in content sources, application needs and user contexts.
FAST Search assigns a relevancy score to each search index. Tuning relevancy manipulates the scoring system for the FAST Search system in the following ways.
  • Static (quality) rank: Rank points added to a search item before it is indexed.
    The number of points given is based on boost values that are stored in four predefined static/quality rank components. In addition, any custom integer managed property can also be used to tune static rank. You can decide which of these components to use at search time so that you only get the rank points from the components that you specify. You can control the effect of the static rank points by modifying the weight of the different components. Static rank points assigned to an indexed item are independent of the search words used, so static rank only indicates something about the general importance of an item.
  • Dynamic rank: Rank points added to search items at search time.
    The number of points given is based on a combination of the search words used and boost values that are stored in dynamic rank components. You can control the effect of the dynamic rank points by modifying the weight of the different components.
  • Keyword rank: Rank points added to an item when a search word matches a specified keyword.
    Recall is improved by searching for the associated synonyms. Also, the search experience is improved by displaying additional relevant information with using Best Bets and Visual Best Bets. Also, incorporating document and site promotions to move relevant search results higher up in the search results list.
  • Linguistic features: Like stemming, spell checking, stop words and tokenization effect both relevance and recall.
  • Fast Query Language (FQL): A query language intended for creating queries programmatically.
    FQL can be used only for solutions developed for FAST Search Server 2010 for SharePoint.
The dynamic rank is more powerful than static rank because the ranking points are assigned at the search time based on search query. This makes it the most commonly used option for relevancy tuning. Dynamic rank option allows for boosting rank points in any of the following components of the indexed item.
  • Freshness: Rank points are given based on age of item.
  • Context: Rank points are given based on the search word hits in the item.
  • Proximity: Rank points are given based on distance between the search words hit in the item.
  • Managed Property Field Boost: Rank points are given based on value of managed property.
  • Authority (anchor text): Rank points are given based on when a search word retrieves hits in the link text.
  • Query Authority (click-through): Rank points are given based on when a search retrieves hits in items associated with previously clicked on search results.
As described herein, relevancy tuning allows an organization to implement a search solution that takes into account many variables that cause the most relevant results to rank highest in a search.
This tip contributed by Khanh Hoang, Abel Solutions’ Senior SharePoint Consultant.

Monday, October 8, 2012

Update Level


$mp = Get-FASTSearchMetadataManagedProperty -Name <ManagedProperty>
$mp.GetFullTextIndexMappings()
$fuu = Get-FASTSearchMetadataFullTextIndexMapping|Where-Object {$_.ManagedProperty.Name -eq “<ManagedProperty>”}
Remove-FASTSearchMetadataFullTextIndexMapping -Mapping $fuu
New-FASTSearchMetadataFullTextIndexMapping –ManagedProperty (Get-FASTSearchMetadataManagedProperty Body) –FullTextIndex (Get-FASTSearchMetadataFullTextIndex content) –Level <ImportanceLevel>
     

Update Context Weight, Remove Boost


$RankProfile = Get-FASTSearchMetadataRankProfile -Name <RankProfile>
$content = $RankProfile.GetFullTextIndexRanks()|where-Object -filterscript {$_.FullTextIndexReference.Name -eq "content"}
$content.ContextWeight = <ContextWeight>
$content.Update()

$np = Get-FASTSearchMetadataRankProfile -Name $rankprofilename

#remove a ManagedPropertyBoosts
$np.GetManagedPropertyBoosts() | where-object -FilterScript {if($_.ManagedPropertyReference.Name -eq "productname") {$_.Delete()}}

#modify a ManagedPropertyBoosts value
$np.GetManagedPropertyBoosts() | where-object -FilterScript {if($_.ManagedPropertyReference.Name -eq "format") {$_.BoostValue="unknown format,-4000";$_.Update()}}
  
#add a boost
$RankProfile = Get-FASTSearchMetadataRankProfile -Name <RankProfile>
$Property = Get-FASTSearchMetadataManagedProperty -Name <ManagedProperty>
$RankProfile.CreateManagedPropertyBoostComponent($Property, "<ManagedPropertyValue>,<ManagedPropertyBoostWeight>")
$RankProfile.Update()
#look up the value just added
$RankProfile.GetManagedPropertyBoosts()|where-object { $_.ManagedPropertyReference.Name -eq "<ManagedProperty>"}
 

Sunday, October 7, 2012

Schema and Feature


The index schema and its features (FAST Search Server 2010 for SharePoint)
There are several reasons to for excluding the content of crawled properties to improve both relevance and recall. Some crawled properties might be searchable through a managed property mapping, and do not have to be searchable through the default full-text index also.
http://msdn.microsoft.com/en-us/subscriptions/gg982954.aspx


FAST Search Query Integration Overview
Using the Query Web Service
Using the Query Object Model
Restricting Search Results Using Search Scopes
http://msdn.microsoft.com/en-us/library/ff394628.aspx

FQL Language Syntax
http://msdn.microsoft.com/en-us/library/ff394462.aspx#fqloperator_filter

Tuning Dynamic Rank
http://technet.microsoft.com/en-us/library/ff453912.aspx

Managed Property and Rank


Managed Property
A managed property is content or metadata associated with an item that may be searched or used in other ways, such as being displayed in search results or used for query refinement. To make metadata searchable, first define the managed properties. Then, map the crawled properties that should be searchable to a managed property. At this point, the crawled metadata is searchable as a field. To search this metadata automatically as a general part of the item, map the content of a managed property into the default full-text index (known as content) for querying.
http://msdn.microsoft.com/en-us/subscriptions/gg982954.aspx

Ranking and Sorting (FAST Search Server 2010 for SharePoint)
Sort Search Results by Rank
If you want to use a rank profile that is different from the default rank profile, you can specify the name of the rank profile in the sort specification.
The RANK operator or XRANK operator in the FAST Query Language (FQL). These operators enable you to apply a conditional rank boosting if a specific query condition is met.

Sort Search Results by Managed Property Value
You can specify query result sorting based on the value of one or more managed properties in the query result. This means that FAST Search Server 2010 for SharePoint performs the sorting based on all results that match the query.
http://msdn.microsoft.com/en-us/library/ff394654.aspx#ranking_sorting_rank

Example:
criteria.OrderBy = new List<OrderData>()
{
new OrderData(new RankPropertyExpression("departments"),
OrderDirection.Ascending)
};
http://documentation.ektron.com/cms400/v8.60/Reference/Web/Navigating/Search/Setting_up_FAST.htm

Change Importance Level


$RankProfile = Get-FASTSearchMetadataRankProfile -Name default1
$content = $RankProfile.GetFullTextIndexRanks()|where-Object -filterscript {$_.FullTextIndexReference.Name -eq "content"}
$content.SetImportanceLevelWeight(1, 5)
$content.Update()
$content.GetImportanceLevelWeight(1)

http://fs4sp.blogspot.com/2012_01_01_archive.html

Thursday, October 4, 2012

Fast Search Refinement and Scope

Manage refiners and refiner settings (FAST Search Server 2010 for SharePoint)
http://technet.microsoft.com/en-us/library/gg193929.aspx
Set-FASTSearchMetadataManagedProperty -Name <Name> -RefinementEnabled <Flag>
To enable a managed property as shallow refiner by using Windows PowerShell
$mp = Get-FASTSearchMetadataManagedProperty –Name <ManagedProperty>
$refiner = $mp.GetRefinerConfiguration()
$refiner.RefinementType = “DeepRefinementDisabled”
$mp.SetRefinerConfiguration($refiner)
$refiner
Use Powershell to create site scope
Search scopes in FAST Search for SharePoint (Part 1)
http://blogs.msdn.com/b/jorgeni/archive/2010/02/26/search-scopes-in-fast-search-for-sharepoint-part-1.aspx
New-SPEnterpriseSearchQueryScope -SearchApplication "Search Service Application" -Name MySimpleScope -Description "My Simple Scope" -DisplayInAdminUI 1 -ExtendedSearchFilter ‘title:vista’
Specifying which fulltext index to search
FAST Search scope filters have one additional capability; you can in the filter specify which non-default fulltext index (=composite field if you’re familiar with FAST ESP terminology) you want to query. To specify the fulltext index as part of, or the whole scope filter use “FullTextIndex=” as part of the filter. Note that the you separate the FullTextIndex parameter and the value with equals (=).
New-SPEnterpriseSearchQueryScope -SearchApplication "Search Service Application" -Name MySimpleScope -Description "My Simple Scope" -DisplayInAdminUI 1 -ExtendedSearchFilter ‘title:vista,FullTextIndex= mycustomfulltextindex’

Fast Search Query Tool
http://fastforsharepoint.codeplex.com/

Fast Search

Using FQL to query FAST Search Index
http://blogs.perficient.com/microsoft/2011/06/using-fql-to-query-fast-search-index/
Write a sample project, use FQL syntax to query FAST Search server through search services.
Can also use FQL on KeywordQuery Class build a console application to test FQL syntax.

FastSearch and PowerShell, use powershell to create content source, start crawl, execute search.
https://www.nothingbutsharepoint.com/sites/itpro/Pages/Fast-Search-Server-2010-for-SharePoint-Proof-of-Concept-Part-2b-PowerShell-Configuring-the-connector-Indexing-Content.aspx

Change Managed Property boost using PowerShell
$RankProfile = Get-FASTSearchMetadataRankProfile -Name <RankProfile>
$Property = Get-FASTSearchMetadataManagedProperty -Name <ManagedProperty>
$RankProfile.CreateManagedPropertyBoostComponent($Property, "<ManagedPropertyValue>,<ManagedPropertyBoostWeight>")
$RankProfile.Update()
http://technet.microsoft.com/en-us/library/ff191224.aspx


Change the overall- and managed property context weight by using Windows PowerShell (FAST Search Server 2010 for SharePoint)
http://technet.microsoft.com/en-us/library/ff191252.aspx

Fast Search Articles
http://gallery.technet.microsoft.com/office/site/search?f%5B0%5D.Type=User&f%5B0%5D.Value=Jan%20Inge%20Bergseth
Create a custom full text index using powershell
http://gallery.technet.microsoft.com/office/Create-a-custom-full-text-14811b11
Create and tune a custom rank profile for fastsearch
http://gallery.technet.microsoft.com/office/Create-and-tune-a-custom-c2f79c49
Manage Crawled Properties
http://technet.microsoft.com/en-us/library/ff191246.aspx
exclude a crawled property from indexing
$CrawledProperty = Get-FASTSearchMetadataCrawledProperty -Name "<CrawledPropertyName>"
Set-FASTSearchMetadataCrawledProperty -CrawledProperty $CrawledProperty -IsMappedToContents $false
indentify unmapped crawled properites
$category = Get-FASTSearchMetadataCategory -Name "<CategoryName>"
$unmappedCPs = $category.GetUnmappedCrawledProperties()

Good aritcle on index schema and its features
The index schema and its features (FAST Search Server 2010 for SharePoint)
http://technet.microsoft.com/en-us/library/gg982954.aspx

Saturday, September 22, 2012

Fast Search Useful Links


Adding a Refiner to the Refinement Panel Web Part
 
Walkthrough: Querying FAST Search Server From a Client Application
 
 
 Creating FAST Search Managed Properties and Mappings to Crawled Properties with Powershell
 
 
Working with crawled and managed properties via code


FAST Search Query Integration Overview
http://msdn.microsoft.com/en-us/library/ff394628.aspx

 

Fail to add Managed Property

When adding additional crawled property to Fast search, the search properties file may not pick up the additional addon.

As an example, add an selected DB column on the crawling file. Do an incremental crawl. From the test search page: http://localhost:13280, do a simple search, fields displayed should contain managed property with or without retrieved data. If there is no such an addon property, then there is a issue to your query server.

First check if the managed property has been added to and mapped to the crawled property, then start a crawl.

Additional checks on Index schema. The Index Schema defined in SharePoint Central Administration at the Query SSA's FAST Search Administration section is stored in SQL Server, and deployed to FAST Search through a timer job. It's possible that not all steps of the deployment occur, leading to a newer schema in SharePoint / SQL than the FAST qrserver is using.

To resolve it restart the QR server:
nctrl stop qrserver qrproxy search-1
nctrl start qrserver qrproxy search-1

nctrl restart qrserver

If you ever an error like this: Property doesn't exist or is used in a manner inconsistent with schema settings.

If the files are in place on the FAST Admin node, they can also be pushed to the query servers by running the following in a command prompt at the %FASTSEARCH%\index-profiles directory:

bliss -C deployment-ready-index-profile.xml

Ultimately, the deployment from the configuration stored in SQL can be restarted by opening the FAST Search Server PowerShell and running:

$allmp = Get-FASTSearchMetadataManagedProperty
$firstmp = $allmp[0]
$firstmp.Update()
This will republish the Index Schema without any changes.

If in the search results, you see there are "BADHITS",

The messages generally indicate that files created during an index-profile update have not updated properly, thus causing inconsistency on the system.

To determine if the files were incorrectly generated by the configserver, do the following:

Stop FAST ESP (nctrl stop).
Clear the contents of %FASTSEARCH%\var\searchctrl\etc\* and %FASTSEARCH%\var\etc\*. (The files will be regenerated.)
Start FAST ESP (nctrl start).

After the crawled items are processed, they are stored in an XML-based format (FiXML files). The indexer uses the FiXML files as input to the indexing process.

The indexeradmin resetindex command re-builds the content index from the FiXML files. This is normally needed only if the content index files are corrupted or damaged.


Thursday, September 20, 2012

Create and Delete Mappings

#create managed property
$packsizemanagedproperty = New-FASTSearchMetadataManagedProperty -Name productpacksize -type 1 -description "Product Package Size"
#Set-FASTSearchMetadataManagedProperty -Name productpacksize -Queryable $true -StemmingEnabled $true -RefinementEnabled $true
$packsizecrawledproperty1 = Get-FASTSearchMetadataCrawledProperty -name "mpbio_packsize"
#create mappings
New-FASTSearchMetadataCrawledPropertyMapping -Managedproperty $packsizemanagedproperty -crawledproperty $packsizecrawledproperty1


#Delete Mappings
$packsizemanagedproperty = Get-FASTSearchMetadataManagedProperty -Name productpacksize 
$packsizecrawledproperty = Get-FASTSearchMetadataCrawledProperty | where-object {($_.Name -eq "mpbio_packsize") -and ($_.CategoryName -eq "JDBC")} 
Remove-FASTSearchMetadataCrawledPropertyMapping -Managedproperty $packsizemanagedproperty -crawledproperty $packsizecrawledproperty -Force
Remove-FASTSearchMetadataManagedProperty -Name productpacksize -Force

Monday, September 17, 2012

Context

string currentPage = "http://admin.xxxx.com/mx";

HttpContext.Current.Request.RawUrl.Substring(1, 2)); //mx


SPContext.Current.Site.RootWeb.Url //http://admin.xxxx.com

 SPContext.Current.Web.Url //http://admin.xxxx.com/mx

Thursday, September 13, 2012

Add Custom Property

1.      Add it in metadata (in MetadataDefintion.xml, locate basket entity and add the following)
<PropertyMapping property="MyCustomProp" csProperty="MyCustomProp "/>
...
<Property name="MyCustomProp" dataType="String" isStronglyTyped="false" />

2.      Set model property, for example, in the shoppingcontroller.cs

In AddBasketLineItemCreateRequest function, add the following after the last line of this function.
builder.Model.Properties["MyCustomProp"] = "value";

Then when you add item to your basket, this MyCustomProp is available in basket pipeline.

You probably want to add the same to other type of requests, such as AddBasketLineItemUpdateRequest, AddBasketLineItemDeleteRequest, etc. based on your business need.

3.      access it in Pipeline through order dictionary indexer
orderDictionary["MyCustomProp"]

Remote Debugger

Very good article on how to set up remote debugging: http://msdn.microsoft.com/en-us/library/bt727f1t.aspx

At the remote machine, the msvsmon.exe has to be started by using administrator's credential:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x64
 

Friday, September 7, 2012

Create List and Add Column to the List

Create List
Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
try
{
$TestSiteUrl = "http://mysitecollection/mysite" #provide site url in this variable
$ListName = "EmpInfo"   #listName
$ListDescription = "Employee information list" #list description
$myTestWeb = Get-SPWeb -identity $TestSiteUrl   #Get web object
$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::GenericList  #GenericList template
write-host "Adding list" $ListName
#column1 schema xml
$firstNameColXml = "<Field Type='Text' DisplayName='FirstName' Required='TRUE' EnforceUniqueValues='FALSE'
MaxLength='255' StaticName='FirstName' Name='FirstName' />"
#column2 schema xml
$lastNameColXml = "<Field Type='Text' DisplayName='LastName' Required='FALSE' EnforceUniqueValues='FALSE'
MaxLength='255' StaticName='LastName' Name='LastName' />"
#build the list url
$listUrl = $myTestWeb.ServerRelativeUrl + "/lists/" + $ListName;
#we can't use getlist here as the method raises filenotfoundexception if the list url is not there
$myCustomList = $myTestWeb.Lists[$ListName]
if($myCustomList -eq $null)
{
  $lstId = $myTestWeb.Lists.Add($ListName,$ListDescription,$listTemplate)
  $myCustomList = $myTestWeb.GetList($listUrl) # use getlist here as  the list already exists
#Add columns
$myCustomList.Fields.AddFieldAsXml($firstNameColXml,$true,
[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
$myCustomList.Fields.AddFieldAsXml($lastNameColXml,$true,
[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
 $myCustomList.Update()
 write-host "list created successfully" $ListName
}
else
{
  write-host "List already exists" $ListName
}
}
catch
{
  write-host "Error" $_.exception
  $errorlabel = $true
}
finally
{
  if($myTestWeb -ne $null)
 {$myTestWeb.Dispose()}
  if($errorlabel -eq $true){exit 1}
  else {exit 0}
}exit 0

Add Column to a list
$site = SPSite($workspaceUrl)
$web = $site.RootWeb
$spList = $web.Lists["YourList"]
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList.Fields.Add("YourColumn",$spFieldType,$false)
$spList.Update()

Tuesday, September 4, 2012

Find right W3WP to debug


Identify Worker Process in IIS 7.0

From IIS 7.0 you need you to run IIS Command Tool ( appcmd ) .
• Start > Run > Cmd
• Go To Windows > System32 > Inetsrv• Run appcmd list wp


Copy DDL from GAC

Open “%windir%\assembly\GAC_MSIL”.
Browse to your DLL folder into the deep to find your DLL.
Copy the DLL somewhere on your hard disk

Thursday, August 30, 2012

SharePoint Correlation ID

1. Run on the powershell
get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List > C:\some.log
Where GUID is correlation id, and C:\some.log is written to this log file.

2. Run on SQL WSS_Logging
select [RowCreatedTime], [ProcessName], [Area],
   [Category],  EventID,  [Message] 
 from  [WSS_UsageApplication].[dbo].[ULSTraceLog] 
 where  CorrelationId='B4BBAC41-27C7-4B3A-AE33-4192B6C1E2C5'

Sunday, August 26, 2012

SharePoint 2010 Start Timer Job

Stop admin services, start immediately timer jobs, start admin services.
  • net stop SPAdminV4
  • Start-SPAdminJob
  • net start SPAdminV4

Good articles on SharePoint Variation

Run Sharepoint Configuration Wizard from powershell.
psconfig.exe -cmd upgrade -inplace b2b -force -wait -cmd installcheck –noinstallcheck

psconfig.exe -cmd upgrade -inplace b2b -force -wait -cmd installcheck –noinstallcheck

import-spweb -Identity http://xxx/xx -path C:\SPBU\Banners2\ExportList-8014c026-e4bd-4b6b-9a58-974c6a6fac83.DAT
import-spweb -Identity http://xxx/xx -path C:\SPBU\Promotions\ExportList-074335ed-2b00-4a1f-9db5-d3df31e2bcc9.DAT

Export content from SharePoint

function Export-All-SPWeb-Lists([string]$WebURL, [string]$ExportRootPath)
{
 [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
 [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Deployment") > $null

 $versions = [Microsoft.SharePoint.Deployment.SPIncludeVersions]::All

 $exportObject = New-Object Microsoft.SharePoint.Deployment.SPExportObject
 $exportObject.Type = [Microsoft.SharePoint.Deployment.SPDeploymentObjectType]::List
 $exportObject.IncludeDescendants = [Microsoft.SharePoint.Deployment.SPIncludeDescendants]::All

 $settings = New-Object Microsoft.SharePoint.Deployment.SPExportSettings

 $settings.ExportMethod = [Microsoft.SharePoint.Deployment.SPExportMethodType]::ExportAll
 $settings.IncludeVersions = $versions
 $settings.IncludeSecurity = [Microsoft.SharePoint.Deployment.SPIncludeSecurity]::All
 $settings.OverwriteExistingDataFile = 1
 $settings.ExcludeDependencies = $true

 $site = new-object Microsoft.SharePoint.SPSite($WebURL)
 #Write-Host "WebURL", $WebURL

 $web = $site.OpenWeb()
 #$list = $web.GetList($ListURL)
 foreach($list in $web.lists)
 {
  $settings.SiteUrl = $web.Url
  $exportObject.Id = $list.ID
  $newFolderPath = $ExportRootPath + $list.Title
  
  New-Item $newFolderPath -type directory -force
  
  $settings.FileLocation = $newFolderPath
  $settings.BaseFileName = "ExportList-"+ $list.ID.ToString() +".DAT"
  $settings.FileCompression = 1

  Write-Host "List", $list.Title
  Write-Host "FileLocation", $settings.FileLocation

  $settings.ExportObjects.Add($exportObject)

  $export = New-Object Microsoft.SharePoint.Deployment.SPExport($settings)
  $export.Run()
 }
 $web.Dispose()
 $site.Dispose()
}
 

Export-All-SPWeb-Lists "http://mySharePointWebApp/sites/mySiteCollection/" "C:\Temp\BackupRestoreTemp\"



Sunday, August 19, 2012

Carrot2 + eClipse


!SESSION Sun Aug 19 09:02:32 PDT 2012 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2012-08-19 09:02:32.341
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)



Check jar files in your project which are mentioned in config.ini if not proper then install manually and then follow the following steps:
  1. Select your product configuration file, right-click on it and select Run As Run Configurations
  2. Select "Validate plug-ins prior to launching". This will check if you have all required plug-ins in your run configuration. If this check reports that some plug-ins are missing, try clicking the "Add Required-Plug-Ins" button. Also make sure to define all dependencies in your product. And your application start running
It turns out eClipse default only around 10 plugin selected, once click on "Select All". The Carrot2 WorkBench should be able to be built. 
 
A couple of links: 
1. Eclipse download: http://www.eclipse.org/downloads/
2. Target Platform download: http://www.eclipse.org/downloads/
place target platform into  C:\Projects\Carrot2\Source\workbench\org.carrot2.workbench.target
where subfolder has eclipse version (3.5 or 3.6.2)


Saturday, June 2, 2012

SSIS Parent Children Packages

Some documents on how to set up parent and children packages.
http://sdrv.ms/JJmHTg

Saturday, May 12, 2012

Nutch readseg

A sample readseg command:
bin/nutch readseg -dump crawl-test/segments/20110201114/ dump -nogenerate -noparse -noparsedata -noparsetex

Nutch and Solr:
The Nutch crawler is ideal for crawling unstructured data like PDF, Word Documents and HTML. Solr is better for crawling Structured data such as XML, Databases etc. It scales better for Enterprise level search.
To sum up: use Nutch for indexing unstructured data; Use Solr for databases and structured data; Integrate both the indexes and use Solr to serve search results.