Wednesday, July 02, 2014

Understanding, Designing, and Implementing Big Data Solutions in Azure

Hi,

I am writing this blog post to point to an important published article from Microsoft Patterns and Practices Team on understanding, designing and implementing Big Data Solution on Windows Azure using HDInsight.

Want to know what is big data ? what is being used for ? Do you have a need for it ? what is the best scenarios to think about adopting to big data tools?
The answer for these questions are covered under the first section of Understanding Big Data on below link:

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


Second section of this article is covering how to design a scalable big data solutions in Azure platform using HDInsight. Would you use big data to explore your data and extract patterns, Apply BI techniques, Build ETL integration tools, Automation data processes all are covered on below link:

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

Third section of this article is covering how to using Azure as PaaS to implement your Big Data Solution using HDInsight including how to provision your first Hadoop cluster node and all required configurations for storing your big data files, build end-to-end solutions and visualizing your data:

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


Hope this helps!

--ME



Friday, June 13, 2014

How to: Create ASP.NET MVC Authentication tables in an existing database

Hi All,

I am writing this blog post to show how to migrate or move the standard MVC authentication tables into your existing database in your asp.net web application.

Background
When you create a MVC web application in VS 2013, VS embed a sql server database in your project, and this project is being used as a source of asp.net membership. Since you will not use this database as an embedded file and you want to have it as part of your existing database in SQL Server instance. The file is created under App_Data folder. To see the .mdf file click on Show all files in the solution explorer.
You can see the contents of this database and all tables in the server explorer window.

How to create those tables in SQL server ?

First, you can delete the .mdf file in App_Data folder. Since we don't need any of these tables.Then, we need to update the default connection string in the web.config to point to our database.

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=SERVER\INSTANCENAME;Initial Catalog=DBNAME;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>


Third, Open Nuget Package Manager and write the following commands:

Enable-Migrations
Add-Migration Init
Update-Database

Check out your database, all ASP.NET membership tables with Prefix Asp have been create and then you can test it out by running your application and execute membership actions such as Signing up or Signing in to your application.

Created tables after running above commands:
AspNetRoles
AspNetUserClaims
AspNetUserLogins
AspNetUserRoles
AspNetUsers
__MigrationHistory


Hope this helps.

Thanks

-- ME

Tuesday, June 10, 2014

Getting started with Solr for .NET architects & developers - part 1

Hi folks,

I am writing this blog post to provide some tips and insights on using open source search technologies such as Solr in your solutions and applications.

Here are my notes:
1) Solr is an open source search server product. It is free and one of the most trusted, mature search products in the market.

2) Solr uses lucene, lucene is the heart of Solr search server product. Lucene is the full text service or component that is used in Solr which provides all search, index and queries capabilities.

3) Lucene is a java based library to create, manage, and retrieve inverted index files.

4) Inverted index is a specialized data structure by Lucene to handle queries to text based documents.

5) Using full text feature that is available in some DBMS is not a replacement for Solr, Solr provides advanced search, query and ranking capabilities.

6) Solr provides on top of lucene full text capability the following features: pagination, sorting, faceting, auto-suggest, spell checker, hit highlighting, data modeling, grouping, and standard http API to integrate with your solutions.

7) Each Solt server has only one home, the path of the home is $SolrInstallation/example/solr, where $SolrInstallation is the path where you installed solr binaries.

8) Each Solr server can contain more than 1 core, each core contains its index data and configuration.

9) Solr web application is stored under solr.web folder which contains all servelts, html and js files.

10) Solr is running on Jetty as an application server. Google is using Jetty in its App Engine platform.


Hope this helps.

References: Solr in Action



Friday, April 25, 2014

Unable to retrieve metadata for unrecognized element 'providers' when adding a controller in VS 2013

Hi,

I was trying to add a new controller in my project using Visual Studio 2013. I was using Code First Entity Framework for my data access. I tried to build and clean the project few times before adding the new controller; but still was getting this error message when  adding a new controller to my web api project.

Here is the error message:


The solution is the following:
1) Open the web.config file in your project.
2) Scroll down until you see entity framework section.
3) This is how it will be looking:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

4) Remove the providers section.
5) Save and you will be able to add new controllers!

Hope this helps!


Thursday, April 17, 2014

Error when running web applications that reference SharePoint dlls in IIS Express

Hi All,

I was developing a web application that reference SharePoint 2013 dlls, and since SharePoint server dlls in general runs on a 64 bit environment, i want to use IIS express in Visual Studio 2013 without the need to use full local IIS that runs on 64 bit.

I was getting this error message when i am running my web application:

Could not load file or assembly or one of its dependencies. 

and i was seeing in the yellow error page that the VS 2013 is using IIS express under c:\ program files (86)\ IIS Express folder which is the 32 bit.


I want to switch IIS express to 64 bit so i will be able to run my web application that references 64 bit SharePoint dlls. here is the solution for this:

From Visual Studio 2013 IDE:

Click on :  Tools --> Options --> Projects and Solutions --> Web Projects  --> Use the 64 bit version of IIS Express --> check this checkbox and save.


Once you save, make sure you exit any instance of the IIS express and try to re-run your project! It will run with no issues!

Enjoy!


Tuesday, April 01, 2014

How to add a required field validator in SharePoint 2013 Application Pages using HTML5

Hi All,

I was developing a custom application page in SharePoint 2013, while adding all my controls in the custom application page i wanted to add a required field validator to a textbox control.

As a .NET developer, you will find the normal action is to add a required field validator to your page, which basically works, but in this post i want to show you that you can easily incorporate HTML5 validation attributes in SharePoint 2013 pages!!

In HTML5, you can add an attribute called required to any control, which tells the browser that this control is a required control.


<%@ Register TagPrefix="spuc" Namespace="Microsoft.SharePoint.WebControls"
             Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


<spuc:InputFormTextBox ID="txtName" runat="server" class="ms-input"
      Title="Full Name" TextMode="SingleLine" Columns="40" required />


Adding a required attribute to your markup control will flag this control as a required control in your SharePoint page.

You can apply any other HTML5 validation attribute and it will render correctly in any SharePoint Page with no additional setup.

Here is a cool blog about how to apply HTML5 validation types into input control:
http://www.the-art-of-web.com/html/html5-form-validation/
 

Enjoy!



--ME

Working Tips with SPWebConfigModification Class in SharePoint 2013

Hi Folks,

I was working on updating a SharePoint web.config programmatically in SharePoint 2013 Farm Solution. Applying web.config modifications in SharePoint is straight forward task by adding the modifications into a collection of the web application and then submit your changes.

Since this class is poorly documented, I was trying to update a specific web application web.config and not all web.config in this farm. all the code samples in MSDN and other blogs don't provide a necessary understanding how it works so before taking the MSDN code and apply it into your feature or wsp you should know the following essential tips:

1) You can apply your web config modifications either on the web application level or the content service level which affects all web config files in your farm.

2) When your code has the following line of code, this means that the changes will be taken effect into all web applications in the farm:

SPWebApplication webApp = new SPSite('siteUrl').WebApplication;
WebApp.Farm.Services.GetValue<SPWebService>.ApplyWebConfigModifications();

Even though you are using a web application object, but this code will update all web.config files, which you should avoid when you apply solutions unless you are applying Farm updates.


3) If you want to update a specific web application web.config:

SPWebApplication webApp = new SPSite('siteUrl').WebApplication;
WebApp.Update();  // update specific web.config for this web application
webApp.WebService.ApplyWebConfigModifications();


line #3 will only update the web.config for a specific web application and not all unlike
SPWebService.ContentService.ApplyWebConfigModifications();

Hope this helps!

**References:
1) Add or remove entries in web.config programmatically:
http://msdn.microsoft.com/en-us/library/bb861909(v=office.14).aspx



Wednesday, March 12, 2014

Developer Dashboard doesn't show for anonymous users in SharePoint 2013

Hi All,

I was working on a public SharePoint site and i wanted to enabled the developer dashboard utility. I Ran the following powershell command to enable the developer dashboard:

Turn On Developer Dashboard Powershell Command:

$content = ([Microsoft.SharePoint.Administration.SPWebService]::ContentService)
$appsetting =$content.DeveloperDashboardSettings
$appsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On
$appsetting.Update() 


**If you want to turn it off, just change the On flag to Off and you are good.

After that, I was able to see the developer dashboard icon in the Central Administration site but not on my public SharePoint site.

So basically, I found that you have to grant permissions for anonymous users to access this utility since it is not accessible for anonymous users even if the utility is enabled.

How to enable Developer Dashboard for anonymous users:

$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$dashboardSettings = $contentService.DeveloperDashboardSettings
$dashboardSettings.RequiredPermissions = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask
$dashboardSettings.Update()


By default, the required permissions property for the developer dashboard utility is "AddAndCustomizePages" which is available for authenticated users who have this permission, so you need to changed it to no permissions by setting the value to EmptyMask which means in SharePoint permissions world no permissions are needed.

Note: This is a good technique while you are developing, testing and in the user acceptance test phase of any SharePoint implementation project. when you don't need this utility it is strongly recommended to turn it off on production environment.

Hope this helps!


References:
1) SharePoint base permissions:
http://msdn.microsoft.com/EN-US/library/ms412690






The memory usage on the current server is about {0}. This can cause the eviction or throttling of the Distributed Cache Service

Hi,

After enabling the usage and data collection service in SharePoint 2013, i was getting the following warning in windows event log:

The SharePoint Health Analyzer detected a condition requiring your attention.  The Current server is running low on memory.
The memory usage on the current server is about {0}. This can cause the eviction or throttling of the Distributed Cache Service/
Check the memory usage on the machine.And try to free up some memory or add more ram on the machine. For more information about this rule, see "http://go.microsoft.com/fwlink/?LinkID=224261".

How to tackle this memory consumption and performance issue in SharePoint 2013:

First, if in you are not utilizing the document activities, feeds or micro-blogging services in SharePoint so it is recommended to stop the Distributed Cache Service. this will give you a great performance boost in your box.

To get an understanding of the benefits of Distributed Cache Service in SharePoint read this TechNet post- Section "Benefits of Distributed Cache":

http://technet.microsoft.com/library/jj219700(office.15).aspx

Second, you can minimize the number of days you want to store SharePoint logs on the disk to free up some space. here is the steps:
1) Open Central Administration,
2) Click on Monitoring.
3) Under Reporting, Click on Configure diagnostic logging.
4) Scroll down to Trace log, where you can change the number of days to store log files from 14 to 5 days or you can specify the size of the log files in GB which gives you control over the size of these growing files.

Hope this helps.