Tuesday, August 23, 2016

xml load in chrome

Please follow the following articles.

https://bugs.chromium.org/p/chromium/issues/detail?id=988#c9

https://productforums.google.com/forum/#!topic/chrome/hFCbU6MPw9k;context-place=topicsearchin/chrome/load$20xml$20file$20in$20chrome

Issue:

<html> 
<head> 
<script type="text/javascript"> 
function parseXML() 
{ 
try //Internet Explorer 
  { 
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); 
  } 
catch(e) 
  { 
  try //Firefox, Mozilla, Opera, etc. 
    { 
    xmlDoc=document.implementation.createDocument("","",null); 
    } 
  catch(e) 
    { 
    alert(e.message); 
    return; 
    } 
  } 
xmlDoc.async=false; 
xmlDoc.load("note.xml"); 

document.getElementById("to").innerHTML= 
xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; 
document.getElementById("from").innerHTML= 
xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue; 
document.getElementById("message").innerHTML= 
xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue; 
} 
</script> 
</head> 

<body onload="parseXML()"> 
<h1>W3Schools Internal Note</h1> 
<p><b>To:</b> <span id="to"></span><br /> 
<b>From:</b> <span id="from"></span><br /> 
<b>Message:</b> <span id="message"></span> 
</p> 
</body> 
</html> 

and note.xml is: 
<?xml version="1.0" encoding="ISO-8859-1"?> 
<note> 
<to>Tove</to> 
<from>Jani</from> 
<heading>Reminder</heading> 
<body>Don't forget me this weekend!</body> 
</note> 



Try replacing:
var xmlDoc = document.implementation.createDocument("", " ", null);
xmlDoc.async = false;
xmlDoc.load(xmlsrc);

With:
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET", xmlsrc, false);
xmlhttp.send(null);
var xmlDoc = xmlhttp.responseXML.documentElement;

Courtesy of http://chromespot.com/showthread.php?t=1063.

Another blog https://bugs.chromium.org/p/chromium/issues/detail?id=988#c9  says

var error = "";
var file = root+"/inc/xml/linguas_"+lg+".xml";
try //Internet Explorer
{
 xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
 xmlDoc.async=false;
 xmlDoc.load(file);
}
catch(e)
{
 try //Firefox, Mozilla, Opera, etc.
 {
  xmlDoc=document.implementation.createDocument("","",null);
  xmlDoc.async=false;
  xmlDoc.load(file);
 }
 catch(e)
 {
  try //Google Chrome
  {
   var xmlhttp = new window.XMLHttpRequest();
   xmlhttp.open("GET",file,false);
   xmlhttp.send(null);
   xmlDoc = xmlhttp.responseXML.documentElement;
  }
  catch(e)
  {
   error=e.message;
  }
 }
}

Tuesday, October 27, 2015

Create Search Service Application in SharePoint 2010

Create Search Service Application in SharePoint 2010

copied from the below site
http://adicodes.com/powershell-script-create-sharepoint-search-service-application/


# Get App Pool
$saAppPoolName = "Default SharePoint Service App Pool"

# Search Specifics, we are single server farm
$searchServerName = (Get-ChildItem env:computername).value
$serviceAppName = "Search Service Application"
$searchDBName = "SearchService_DB"

# Grab the Appplication Pool for Service Application Endpoint
$saAppPool = Get-SPServiceApplicationPool $saAppPoolName

# Start Search Service Instances
Write-Host "Starting Search Service Instances..."
Start-SPEnterpriseSearchServiceInstance $searchServerName
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName

# Create the Search Service Application and Proxy
Write-Host "Creating Search Service Application and Proxy..."
$searchServiceApp = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName
-ApplicationPool $saAppPoolName -DatabaseName $searchDBName
$searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$serviceAppName
 Proxy" -SearchApplication $searchServiceApp

# Clone the default Topology (which is empty) and create a new one and then activate it
Write-Host "Configuring Search Component Topology..."
$clone = $searchServiceApp.ActiveTopology.Clone()
$searchServiceInstance = Get-SPEnterpriseSearchServiceInstance
New-SPEnterpriseSearchAdminComponent –SearchTopology $clone –SearchServiceInstance  $searchServiceInstance
New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone  -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $searchServiceInstance
$clone.Activate()

Write-Host "Search Done!"

Sunday, August 9, 2015

Add a user control to a master page or page layout


Here is an example to add a user control in a master page/page layout.

<%@Register TagPrefix="topnav" TagName="TopNavigation" Src="~/_controltemplates/15/TopNavigation.ascx" %>



   <topnav:TopNavigation id="TopNavigation1" runat="server" EnableViewState="true" />
                    

Thursday, November 13, 2014

Get All Farm Information with Web application,Site Collection, no of sub sites/webs ,content db name and size with powershell

Add-PSSnapin Microsoft.SharePoint.Powershell
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs)
{
    foreach ($webapp in $websvc.WebApplications)
    {
        echo $webapp.Name
        echo $webapp.Url
        #give the path where .csv file will be saved
          $path = "D:\mycsvfolder\Test\"+$webapp.Name+"_Webapplication"+".csv"
             $csv = "WebApplication,SiteCollection,Sub Sites,Content Database,Size of Site Collection`r`n"
         
                 $fso = new-object -comobject scripting.filesystemobject
$file = $fso.CreateTextFile($path,$true)
   $file.write($csv)
  try{    
         Write-Host $webapp.Sites
         Write-Host $webapp.Sites.Count
          foreach ($site in $webapp.Sites)
         {
            echo $site.HostName $site.Url $site.LastContentModifiedDate $site.ContentDatabase.Name $site.WebApplication.Name
         try{
       
         Write-Host $site.AllWebs
             Write-Host "Count:"$site.AllWebs.Count
         
                 #echo $web.Title $web.Url $web.Created $web.LastItemModifiedDate $web.WebTemplate $web.Site.
           
              #$urlweb=$web.Url
         
                       $csv =$webapp.Url+","+$site.Url+","+$site.AllWebs.Count+","+$site.ContentDatabase.Name+","+$site.Usage.Storage+ "`n";
           $file.write($csv)
     
           
           
                         }
                        catch
                        {
                              $csv =$webapp.Url+","+$site.Url+","+"No access"+","+$site.ContentDatabase.Name+","+$site.Usage.Storage+ "`n";
           $file.write($csv)
                        }
                       
                       
             }}
             catch{
             Write-Host "Webapplication does not have site collection"
             }
        }

#$file.close()
       
    }


Thursday, September 4, 2014

How to Enable Windows Powershell ISE in Windows Server 2008 R2

Hi 
Run the below command in Windows Powershell to enable Windows Powershell ISE
Import-Module ServerManager 
 Add-WindowsFeature PowerShell-ISE
 
For more please follow Guru Pratap's blog
http://blogs.msdn.com/b/guruketepalli/archive/2012/11/06/enable-powershell-ise-from-windows-server-2008-r2.aspx

Tuesday, June 3, 2014

Important links for custom membership provider in .net

http://www.codeproject.com/Articles/165159/Custom-Membership-Providers

http://logcorner.wordpress.com/2013/08/28/how-to-configure-custom-membership-provider-using-asp-net-mvc4-with-external-login-like-facebook-yahoo-google-or-other-relying-party-accounts-2/

http://www.devx.com/asp/Article/29256/0/page/3

http://www.codeproject.com/Articles/689801/Understanding-and-Using-Simple-Membership-Provider



Tuesday, August 20, 2013

Some SQL Query:Taken from net
nth salary in a table
SELECT * /*This is the outer query part */
FROM SPTestTable Emp1
WHERE (n-1) = ( /* Subquery starts here */
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM SPTestTable Emp2
WHERE Emp2.Salary > Emp1.Salary)

3rd highest salary
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP 3 salary
FROM SPTestTable 
ORDER BY salary DESC) a

ORDER BY salary

Delete duplicate rows from a table.
select distinct * into #temp from SPTestTable truncate table SPTestTable insert SPTestTable select * from #temp drop table #temp