06 April 2016

Webinar: Succeeding with Hybrid Search Using SharePoint

For many organizations, the path to the cloud is through Hybrid SharePoint (combining SharePoint Online with SharePoint Server). In fact, those that use SharePoint as a portal to provide unified access to enterprise information are finding that Hybrid SharePoint is the new reality.

With Microsoft's road-map focused on cloud-first/cloud-only, defining a strategy and an implementation plan becomes more difficult and critical. Hybrid SharePoint can be very effective - and unified search is central to making it work well.

Join this 45 minute webinar and learn how you can succeed with hybrid search using SharePoint from search guru, Jeff Fried, CTO of BA Insight.

Date & Time - Thursday, April 25, 2016 at 1:00pm EDT

Registration Link

02 March 2016

mySQL - Master-Slave configuration in Windows

Recently I was configuring Master-Slave configuration for mySQL database. It was required for one of our PHP applications deployed in Windows environment. I faced quite a lot of issues and had to research a lot on internet before finally making it work. Thought to document the steps for my reference here and perhaps it will help others as well -

General Steps -

  • Collect IP address details for both master and slave VMs. In our case, these details were – 
    • Master - <MasterIP>
    • Slave - <SlaveIP>
  • Open MySQL on both master and slave servers using any MySQL client and create empty database for your application with same name. 
  • Generally MySQL gets installed in following directory - C:\Program Files\MySQL\MySQL Server 5.6
  • Data and configuration information for MySQL instance is stored in following directory - C:\ProgramData\MySQL\MySQL Server 5.6 (Notice that it’s in ProgramData directory)


Master server Steps

  • Go to directory - C:\ProgramData\MySQL\MySQL Server 5.6. Note that this directory may be hidden and may not be visible in windows explorer. In that case, just type the full path in explorer bar and the directory will open.
  • Create “log_bin’ folder if it does not exist. This folder will be used by master database to store log files. These log files will then be read by slave database for replication.
  • Make following changes in MySQL configuration file – my.ini
    • Specify location and name of log file – 
      • log_bin = "C:\ProgramData\MySQL\MySQL Server 5.6\log_bin\mysql-bin.log"
    • Specify base directory of MySQL installation – 
      • basedir = "C:\Program Files\MySQL\MySQL Server 5.6"
    • Specify directory where MySQL data is stored – 
      • datadir = "C:\ProgramData\MySQL\MySQL Server 5.6\data"
    • Specify port no. for MySQL installation. Generally it is 3360 – 
      • port = 3360
    • Specify server id as 1 for master database.
      • server_id = 1
    • Specify IP address of master server
      • bind-address = <MasterIP>
    • Specify name of database instance to be replicated.
      • binlog_do_db = <YourDBInstanceName>
  • Save the configuration file.
  • Open MySQL command line. 
  • Enter root password (this password is set during MySQL installation).
  • Type following commands to restart MySQL instance (Note that MySQL56 is name of service for MySQL v 5.6. This can be found under Windows services list)– 
    • net stop MySQL56;
    • net start MySQL56;
  • Now run following set of commands to create a user ‘user_name’ on slave server and grant replication privileges to it
    • CREATE USER '<user_name>'@'<SlaveIP>' IDENTIFIED BY '<password>';
    • GRANT REPLICATION SLAVE ON *.* TO '<user_name>'@’<SlaveIP>’ identified by '<password>';
    • FLUSH PRIVILEGES;
  • Now running following commands to set read-lock on master database and get details about log files. These details will be required when making configuration changes on slave server – 
    • USE <YourDBInstanceName>;
    • FLUSH TABLES WITH READ LOCK;
    • SHOW MASTER STATUS;
  • This will show log file name and log file position. Make a note of log file name and its position. These will be required on slave server.
  • Take backup of master database and restore it on slave database.
  • Once done, you can unlock the read mode using following commands – 
    • UNLOCK TABLES;
Slave Server Steps
  • Go to directory - C:\ProgramData\MySQL\MySQL Server 5.6. Note that this directory may be hidden and may not be visible in windows explorer. In that case, just type the full path in explorer bar and the directory will open.
  • Create “log_bin’ folder if it does not exist. This folder will be used by slave database to store master database log files. 
  • Make following changes in MySQL configuration file – my.ini
    • Specify location and name of log file – 
      • log_bin = "C:\ProgramData\MySQL\MySQL Server 5.6\log_bin\mysql-bin.log"
      • relay-log = C:\ProgramData\MySQL\MySQL Server 5.6\log_bin \mysql-relay-bin.log
    • Specify base directory of MySQL installation – 
      • basedir = "C:\Program Files\MySQL\MySQL Server 5.6"
    • Specify directory where MySQL data is stored – 
      • datadir = "C:\ProgramData\MySQL\MySQL Server 5.6\data"
    • Specify port no. for MySQL installation. Generally it is 3360 – 
      • port = 3360
    • Specify server id as 2 for slave database.
      • server_id = 2
    • Specify IP address of slave server
      • bind-address = <SlaveIP>
    • Specify name of database instance to be replicated.
      • binlog_do_db = <YourDBInstanceName>
  • Save the configuration file.
  • Open MySQL command line. 
  • Enter root password (this password is set during MySQL installation).
  • Type following commands to restart MySQL instance (Note that MySQL56 is name of service for MySQL v 5.6. This can be found under Windows services list)– 
    • net stop MySQL56;
    • net start MySQL56;
  • Now run following set of commands to link master and slave servers for replication – 
    • CHANGE MASTER TO MASTER_HOST='<MasterIP>',MASTER_USER='<user_name>', MASTER_PASSWORD='<password>', MASTER_LOG_FILE='<MasterLogFileName>', MASTER_LOG_POS=<MasterLogFilePosition>;
  • Note the highlighted values of log file name and log position. These are available from master server.
  • Start the slave server – 
    • START SLAVE;
  • Run following command to see the status – 
    • SHOW SLAVE STATUSG
  • Check for following parameters – 
    • slave_io_running
    • slave_sql_running 
  • If the value is yes then this confirms that MySQL master-slave replication has been configured properly and is working fine.






25 February 2016

MediaWiki upgrade - 1.23.5 to 1.26.2 - WYSIWYG editor not working

Recently we upgraded our MediaWiki installation from 1.23.5 to 1.26.2.

We were using WYSIWYG MediaWiki extension in our existing version (1.23.5). During upgrade, we copied the same extension to 1.26.2 extensions folder and enabled it in LocalSettings.php.

However it did not worked and we got "500:Internal Server Error" when we tried to "Edit" any MediaWiki Page.

After a bit of research we found that we need to download a new version for this extension from this URL- https://github.com/Mediawiki-wysiwyg/WYSIWYG-CKeditor

Once downloaded, we copied the WYSIWYG folder to our extensions folder and it started working fine.

Hope this helps someone who is facing similar issue.


23 February 2016

Mediawiki 1.26.2 - Stylesheet not working/loading


We were running Mediawiki installation for one of our clients for quite some time. The Mediawiki version that we were using was 1.23.5. Since this version was quite old and has come to legacy status, we decided to upgrade to latest version of Mediawiki (1.26.2).

We downloaded and installed Mediawiki latest version 1.26.2. When we ran this version, we observed that the stylesheets are not working/loading. In older version (1.23.5) of Mediawiki installed on same server, it was working fine. We checked LocalSettings.php file multiple times and everything seems to be fine.

The Mediawiki 1.26.2 site was deployed as a directory in a website under IIS (Windows 2012 server). In same website, Mediawiki 1.23.5 was deployed under different directory. Mediawiki 1.23.5 stylesheets were loading fine. However for 1.26.2 it was not working.

We also tried deploying Mediawiki 1.26.2 under a new website  just to be sure that directory inside a website is not creating any problem. But still it didn't worked. We tried both with http and https protocol but it did not made any difference.

Finally after lots of research on mediawiki forums, we found the solution for this issue.

The problem was that PHP.exe did not had write access to temp folder where it creates temp files during application execution. This was fine with older versions of MediaWiki (E.g. - MediaWiki-1.23.5). However latest version (E.g. - Mediawiki-1.26.2) do not loads styles due to this problem.

By default PHP uses C:\Windows\Temp directory for storing temp files. However it was not possible to give permission to this directory due to security restrictions on our server.

So we modified php.ini file and defined a custom temp directory where PHP can store its temporary files. We gave read/write permissions to this folder. After doing this modification, we did iis-reset and when we opened Mediawiki 1.26.2 version, that stylesheets started appearing fine.

Hope this will help.

12 February 2016

Session sharing between Classic ASP and ASP.NET

Recently for a project which was a mix of classic ASP and ASP.NET, I was exploring ways of sharing session between classic ASP and ASP.NET.

After a bit of research, I found following three ways -

Option 1
  • Use nSession DLL - http://nsession.codeplex.com/
  • This provides a library which can be used in both ASP.NET and classic ASP applications to access session values. 
Option 2
Option 3
  • From ASP.NET page, encrypt session and pass in query string or store in a cookie.
  • Redirect to classic ASP page.
  • Get the encrypted value from query string or cookie, decrypt it and store in classic ASP session.
  • This new session can be used in application.
We have followed 'Option-2' which is standard recommended approach by Microsoft and is also a safer option with respect to security.

03 February 2016

SharePoint 2013 - Find ULS logs with Correlation Id

Generally whenever we get any SharePoint error, it is accompanied by a Correlation Id which is essentially a GUID. This can be searched in SharePoint ULS logs to find the actual error details.

Searching ULS logs for a particular correlation id is not easy due to following reasons -

  • ULS logs are text file. Searching and copying errors for a particular correlation id is effort and time consuming.
  • ULS log file tends to get large, sometimes more than 250MB. Opening and searching such huge files is not easy for any text editor or even ULS Viewer.
Recently, one of my team-mates told me an easy way out. Just run following command in SharePoint PowerShell and pass correlation id as input. It will copy all the logs related to that correlation id in a separate text file which you can easily view using any text editor or ULS Viewer.


get-splogevent | ?{$_.Correlation -eq "<correlation-id>"} | select Area, Category, Level, EventID, Message | Format-List > C:\TraceLog.log

C:\TraceLog.log is the location where your ULS logs related to that correlation id will be copied. You can specify any location and file name of your choice.




02 February 2016

SharePoint 2013 Pages - How to edit in browser

Recently I was trying to edit a SharePoint page in SharePoint 2013. When I clicked on 'Edit Page' button in SharePoint ribbon after selecting the page, I got following error -

We’re sorry, we couldn’t find a program to open this document

On my machine, SharePoint Designer is not installed. On a different server where it is installed, the above mentioned operation used to first launch the SharePoint Designer and then open the page in browser in 'Edit' mode.

I found that on different server, when page opens in edit mode, the URL has following query-string appended to it -

?ToolPaneView=2&pagemode=edit

I manually added this to my SharePoint page to be edited -

https://<my_sharepoint_site>/<my_page>.aspx?ToolPaneView=2&pagemode=edit

And Voila, it worked. I was able to edit the page and then save it as per normal process.


29 January 2016

Get-SPAppPrincipal/Register-SPAppPrincipal giving error

Today, I was running few PowerShell commands to configure server to server authentication for Federated Search.

I was following this URL - https://technet.microsoft.com/en-us/library/dn197169.aspx

While running following commands, I was getting error

Register-SPAppPrincipal -site $site.rootweb -nameIdentifier $sponameidentifier -displayName "SharePoint Online"

OR

Get-SPAppPrincipal -site $site.rootweb -nameIdentifier $sponameidentifier

Error was -

Get-SPAppPrincipal : We're sorry, we weren't able to complete the operation, please try again in a few minutes. If you
see this message repeatedly, contact your administrator.
At line:1 char:1

+ Get-SPAppPrincipal -site $site.rootweb -nameIdentifier $sponameidentifier
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...GetAppPrincipal:SPCmdletGetAppPrincipal) [Get-SPAppPrinc
   ipal], SPException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetAppPrincipal


I was not facing this problem when running same commands in a different SharePoint server.

Finally after lot of research and digging through ULS logs, I found the solution for that. I had created App Management Service Proxy earlier in the day on this new SharePoint server. When we create App Manager Service Proxy, it creates its own database which generally starts with name 'App_Managament_<GUID>'.

This database name can be found by going to Central Admin --> Backup & Restore --> Shared Services --> App Management Service Application.

My login id did not had permissions on this database. Once permission was granted, I was able to query this database via PowerShell commands and both my commands started working fine.

28 January 2016

SharePoint 2013 - SpSite.rootweb returns blank URL

Recently I was running few SharePoint PowerShell scripts for a SharePoint development project. I was using an existing web-application and site-collection created in my SharePoint development environment.

I ran following command to get root-web of my web application -

$site=Get-Spsite 'https://<my web application>/'
$site.rootweb

I got following output -

Url
----


This meant that there is no root site collection associated with my web application. However this was not the case.

Then I ran following command -

$site.allwebs

I got following exception -

The following exception occurred while trying to enumerate the collection: "Cannot open database
"<My content DB name" requested by the login. The login failed.Login failed for user '<My Login ID>'.".

I gave access to my login id on content database and again ran the command -

$site.allwebs

This time I got following exception - 

The following exception occurred while trying to enumerate the collection: "There is a compatibility range mismatch between the Web server and database "<My content DB name>", and connections to the data have been blocked to due to this incompatibility. This can happen when a content database has not been upgraded to be within the compatibility range of the Web server, or if the database has been upgraded to a higher level than the web server. The Web server and the database must be upgraded to the same version and build level to return to compatibility range.".

Finally after lot of research on internet, I found the solution - I need to give my App Pool identity access on my content DB as well.

Once this is done, it started working fine.

To cut long story short, always given access on content DB to following Ids -

  • Your Login ID which is used for running code or PowerShell scripts
  • App Pool Identity

Hope this helps.

18 January 2016

PluralSight - hack.summit()

PluralSight is organizing 2016 version of its virtual developer conference - hack.summit().

The event will be held between Feb 22-25, 2016.

Venue - Right at your desktop/laptop/tablet/mobile (Virtual event)

At this event, you can learn from best programmers in the world.

Participate in the hack over a weekend for a cash prize of $150,000.

To register for the event, use following link - https://hacksummit.org/