About Amit Verma

I am not a SharePoint expert developer, but I can share cool things with you.I consider the time working with SharePoint as doing my favorite part of the day.

Step By Step Procedure To Install And Configure SharePoint 2016 In A Dev Box As Single Farm Server

I was preparing a Dev Box for the SharePoint 2016 and thought of sharing the same with the community.

1. We can download and install the SharePoint 2016 from the below link.

https://my.visualstudio.com/Downloads?q=SharePoint%20Server%202016

clip_image002

2. The installer is an EXE/MSI which can be double clicked to start the installation.

3. The installation is straight forward and the required components will be downloaded by the EXE itself. The prerequisites for the SP2016 can be found in the earlier article.

4. Once, the installation completes, start the configuration wizard.

clip_image003

5. Click on Next

6. Give yes for the required services restart.

clip_image004

7. Since, I am creating a dev box, let us select the Single Server Farm and click Next.

clip_image005

8. Specify the Config Database details.

clip_image006

9. Give the Passphrase password.

clip_image007

10. In my case, as it is a single server farm, select it again and click next.

clip_image008

11. Specify the Central Admin Port and Click on Next.

clip_image009

12. Verify the Given information on the below screen.

clip_image010

13. Configuration Wizard starts and wait for all the tasks to be completed.

clip_image011

14. Once, the configuration completes, click Finish and launch the Central Admin URL.

clip_image012

Hope this helps. In the upcoming articles, let us see about various service application configurations.

Develop SharePoint 2013 Addin with Angular 2

Introduction

After spending far too long getting SharePoint 2013, Visual Studio 2017, Webpack and Angular2 to all play nicely together I thought I would take the opportunity to note the steps.  There are very few recent articles out there that accommodate this working with the latest versions of Angular 2.  Angular 2 is also sometimes referred to as Angular 4, but this just really refers to the version number of the Angular 2 framework which should really just be referred to as Angular now (the previous version known as Angular 1 is now just known as AngularJS).  For this article I will just refer to Angular 2 as Angular as we all are supposed to now.

Anyway, as mentioned it was fairly painful getting this to work.  Inspiration for this particular article comes from the Angular docs for webpack here, which is where the test source code comes from.  Also this blog post was also a very helpful resource.   There have been a few changes in both webpack and Angular since these articles have published.

The approach I am taking with this post is to be able to build an Angular app as a SharePoint add-in using Webpack to bundle the Typescript files into Javascript files that SharePoint understands, and use NPM (Node Package Manager) as the tool to install the required packages as well as use NPM scripts as a task runner.

Requirements

For this post I am using:

  • Visual Studio 2017 Community Edition
  • Node v7.9.0
  • NPM v4.2.0
  • SharePoint 2013 On Premise (version 15.0.4815.1000).  This will also work with SharePoint Online as well.

It’s assumed that you have an environment where you can deploy a basic SharePoint 2013 Add-in as I won’t be covering this aspect in detail here.  If you are using SharePoint online you will need access to a developer site, or a Site Collection that has been configured to side load add-ins.

Useful Extensions for Visual Studio 2017

I am also using the following Visual Studio 2017 extensions that are helpful with developing Angular apps in SharePoint:

  • Add New File – this allows creation of files just by pressing Shift+F2
  • Angular 2 Snippet Pack
  • Open Command Line – open a command prompt in the current context simply by pressing Alt+Space
  • Web Essentials 2017

Project setup

Open Visual Studio and select the SharePoint Add-in

NewImage

In this example we will be building a SharePoint Hosted solution so choose that option.

newProject2

I am using an On Premise SharePoint 2013 environment for this example but this should also work in SharePoint 2016 and SharePoint Online

newProject3

Once the project is loaded you should be presented with the SharePoint add-in project structure.  The first thing we will need to do is remove the files we do not need.  Take the following steps:

  • Remove jQuery by right-clicking the project and select Manage Nuget packages and uninstall jQuery
  • Remove the 4 Default Modules (Content, Images, Pages, Scripts).
  • Add a new Module item and call it ‘app’.  Delete the ‘Sample.txt’ file from the module that is created.
  • Add 2 new Folders in the root of the project called ‘src’ and ‘config’.
  • Create 2 new folders underneath the src folder called ‘app’ and ‘assets’.
  • Create 2 new folders underneath the ‘assets’ folder called ‘css’ and ‘images’
  • Once you have finished these steps you should end up with the following project structure
NewImage

This completes the basic setup.  Next we need to use NPM to obtain all the components we will be using in this solution.  We will be using a package.json file to retrieve everything we need here.  Add the following package.json file at the project root.

package.json

{
name: sharepoint-addin-angular,
version: 1.0.0,
description: A starter project to develop SharePoint addins with Angular,
main: index.js,
scripts: {
build: webpack –config config/webpack.dev.js –progress –profile –bail
},
author: Neil Cummings,
license: ISC,
dependencies: {
@angular/animations: ~4.0.3,
@angular/common: ~4.0.3,
@angular/compiler: ~4.0.3,
@angular/core: ~4.0.3,
@angular/forms: ~4.0.3,
@angular/http: ~4.0.3,
@angular/platform-browser: ~4.0.3,
@angular/platform-browser-dynamic: ~4.0.3,
@angular/router: ~4.0.3,
core-js: ^2.4.1,
rxjs: 5.0.2,
typescript: ^2.3.2,
zone.js: ~0.8.5
},
devDependencies: {
@types/core-js: ^0.9.41,
@types/jasmine: 2.5.36,
@types/node: ^6.0.45,
angular2-template-loader: ^0.6.0,
awesome-typescript-loader: ^3.0.4,
css-loader: ^0.26.1,
extract-text-webpack-plugin: 2.0.0-beta.5,
file-loader: ^0.9.0,
html-loader: ^0.4.3,
html-webpack-plugin: ^2.16.1,
jasmine-core: ^2.4.1,
karma: ^1.2.0,
karma-chrome-launcher: ^2.0.0,
karma-jasmine: ^1.0.2,
karma-sourcemap-loader: ^0.3.7,
karma-webpack: ^2.0.1,
null-loader: ^0.1.1,
raw-loader: ^0.5.1,
style-loader: ^0.13.1,
typescript: 2.3.2,
webpack: 2.2.1,
webpack-dev-server: 2.4.1,
webpack-merge: ^3.0.0
}
}
view rawpackage.json hosted with ❤ by GitHub

Open a command line (or Powershell) window and navigate to the location of the project root (where the package.json file is located).

Run the following command:

npm install

This will read from the package.json file and save all the items listed in the dependancies and devDependancies into a new folder it creates called ‘node_modules’

npminstall

You may see some warnings in the command window but these can be safely ignored.

If you refresh the Solution Explorer in Visual Studio 2017 you will see that a new folder called ‘node_modules’ has been added.  You will need to click on ‘Show all files’ to see this folder as this will not be included in the project.

solExplorer2

Important:  This folder will not be included in the project and you should not attempt to try to include it in the project as to attempt to do this will likely cause Visual Studio to crash.

Adding some Angular content into the project 

We will need some angular content to deploy to SharePoint.  Add the following files into your project:

src/index.html

<!DOCTYPE html>
<html>
<head>
<title>Angular With Webpack for SharePoint</title>
<meta charset=UTF-8>
<meta name=viewport content=width=device-width, initial-scale=1>
</head>
<body>
<my-app>Loading…</my-app>
</body>
</html>
view rawindex.html hosted with ❤ by GitHub

This index.html is the file that we will serve as the default file that is requested.  Note that it contains no script tags referencing any of the Angular or Javascript files we will be creating.  We will use webpack to inject these references to the index.html file that will eventually be copied into our App module when we build and deploy the solution to SharePoint.

Also note that there is no base_ref element.  We are unable to include this element here as it will cause an issue with the relative pathing of our deployed Javascript files.

src/app/app.module.ts

import { NgModule } from @angular/core;
import { BrowserModule } from @angular/platform-browser;
import { AppComponent } from ./app.component;
import { APP_BASE_HREF } from @angular/common;
@NgModule({
imports: [
BrowserModule
],
declarations: [
AppComponent
],
providers: [
{
provide: APP_BASE_HREF, useValue: /
}
],
bootstrap: [AppComponent]
})
export class AppModule {
}
view rawapp.module.ts hosted with ❤ by GitHub

Note the use of the APP_BASE_HREF in this file.  This has been added as when we specify the base_ref in the index.html file this causes the server to attempt to resolve the javascript files from the root directory instead of the relative path to the Site collection.  The base_ref attribute is necessary for adding Angular routing (which we are not using in this simple example but most Angular projects will use the routing functionality).

src/app/app.component.ts

import { Component } from @angular/core;
import ../../app/assets/css/styles.css;
@Component({
selector: my-app,
templateUrl: ./app.component.html,
styleUrls: [./app.component.css]
})
export class AppComponent {
}
view rawapp.component.ts hosted with ❤ by GitHub

src/app/app.component.html

<main>
<h1>Hello from Angular App with Webpack</h1>
<img src=../assets/images/angular.png>
</main>
view rawapp.component.html hosted with ❤ by GitHub

src/app/app.component.css

main {
padding: 1em;
font-family: Arial, Helvetica, sans-serif;
text-align: center;
margin-top: 50px;
display: block;
}
view rawapp.component.css hosted with ❤ by GitHub

src/main.ts

import { platformBrowserDynamic } from @angular/platform-browser-dynamic;
import { enableProdMode } from @angular/core;
import { AppModule } from ./app/app.module;
if (process.env.ENV === production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
view rawmain.ts hosted with ❤ by GitHub

src/assets/css/styles.css

body {
background: #0147A7;
color: #fff;
}
view rawstyles.css hosted with ❤ by GitHub

Also, copy the following image and add it into the src/app/assets/images folder as angulr.png

NewImage

These files make up a very basic Angular app.  This is taken directly from the Angular IO docs here if you need more details about the purpose of these files.

Preparation for bundling the files into the App Module.

Our strategy for bundling will be to take our TypeScript code, 3rd party libraries (Angular etc), Polyfills and split them into 3 separate files that we will then deploy to SharePoint.  In order to achieve this we need to create 3 Typescript files use import statements that tell Webpack which files to bundle.

Create the following files:

src/polyfills.ts

import core-js/es6;
import core-js/es7/reflect;
require(zone.js/dist/zone);
if (process.env.ENV === production) {
// Production
} else {
// Development and test
Error[stackTraceLimit] = Infinity;
require(zone.js/dist/long-stack-trace-zone);
}
view rawpolyfills.ts hosted with ❤ by GitHub

 src/vendor.ts

// Angular
import @angular/animations
import @angular/platform-browser;
import @angular/platform-browser-dynamic;
import @angular/core;
import @angular/common;
import @angular/http;
import @angular/router;
// RxJS
import rxjs;
// Other vendors for example jQuery, Lodash or Bootstrap
// You can import js, ts, css, sass, …
view rawvendor.ts hosted with ❤ by GitHub

As we are using TypeScript to build our Angular project we will also need a TypeScript configuration file to tell webpack how to compile our TypeScript files.

src/tsconig.json

{
compilerOptions: {
target: es5,
module: commonjs,
moduleResolution: node,
sourceMap: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
lib: [
es2016,
dom
],
noImplicitAny: false,
suppressImplicitAnyIndexErrors: true,
types: [
node,
core-js,
jasmine
],
typeRoots: [
../node_modules/@types
]
}
}
view rawtsconfig.json hosted with ❤ by GitHub

At this stage your src folder should look as follows:

solExplorer4

Configure Webpack to bundle our files for deployment

Create the following files to configure Webpack:

webpack.config.js (create this file in the project root).

module.exports = require(./config/webpack.dev.js);
view rawwebpack.config.js hosted with ❤ by GitHub

config/helpers.js

var path = require(path);
var _root = path.resolve(__dirname, ..);
function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [_root].concat(args));
}
exports.root = root;
view rawhelpers.js hosted with ❤ by GitHub

config/webpack.common.js

var webpack = require(webpack);
var HtmlWebpackPlugin = require(html-webpack-plugin);
var ExtractTextPlugin = require(extract-text-webpack-plugin);
var helpers = require(./helpers);
module.exports = {
entry: {
polyfills: ./src/polyfills.ts,
vendor: ./src/vendor.ts,
app: ./src/main.ts
},
resolve: {
extensions: [.ts, .js]
},
module: {
rules: [
{
test: /\.ts$/,
loaders: [
{
loader: awesome-typescript-loader,
options: { configFileName: helpers.root(src, tsconfig.json) }
}, angular2-template-loader
]
},
{
test: /\.html$/,
loader: html-loader
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: file-loader?name=assets/[name].[hash].[ext]
},
{
test: /\.css$/,
exclude: helpers.root(src, app),
loader: ExtractTextPlugin.extract({ fallbackLoader: style-loader, loader: css-loader?sourceMap })
},
{
test: /\.css$/,
include: helpers.root(src, app),
loader: raw-loader
}
]
},
plugins: [
// Workaround for angular/angular#11580
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)@angular/,
helpers.root(./src), // location of your src
{} // a map of your routes
),
new webpack.optimize.CommonsChunkPlugin({
name: [app, vendor, polyfills]
}),
new HtmlWebpackPlugin({
template: src/index.html
})
]
};
view rawwebpack.common.js hosted with ❤ by GitHub

config/webpack.dev.js

var webpackMerge = require(webpack-merge);
var ExtractTextPlugin = require(extract-text-webpack-plugin);
var commonConfig = require(./webpack.common.js);
var helpers = require(./helpers);
module.exports = webpackMerge(commonConfig, {
devtool: source-map,
output: {
path: helpers.root(app),
publicPath: ,
filename: [name].js,
chunkFilename: [id].chunk.js
},
plugins: [
new ExtractTextPlugin([name].css)
],
devServer: {
historyApiFallback: true,
stats: minimal
}
});
view rawwebpack.dev.js hosted with ❤ by GitHub

Your project structure should now contain the following files:

solExpolorer5

Using Visual Studio Task Runner to test the script.

Within the package.json file we have a single script as follows:

“build”: “webpack –config config/webpack.dev.js –progress –profile –bail”

This will run the webpack command to bundle our files, add them to the app module folder, then inject the script tags into the index.html file.

First we will test that this functionality is working by running webpack from the command line.  Open a command window in the project route and run the following command:

webpack –progress

If it’s successful you should see the following output in the command window:

webpackcmd

If you have any errors running this command add the –display-error-details switch to the webpack command – this can be really useful to help resolving errors in your solution.

In Visual Studio you should see the following  in the Solution Explorer window (note that you will need to have ‘Show all files’ selected to see these files:

solExplorer6

Note that Visual Studio does not autotically include these files in the project and these will have to be highlighted then choose the option to ‘include in project for these files’.

solExplorer7

If you now open up the index.html file that was generated by webpack you will see the following:

index

Note that the script tags have been generated automatically – thanks Webpack!

We can use Visual Studio Task runner to do this prior to deployment to SharePoint.  You will need the NPM Task Runner extension to make this functionality available within Visual Studio.  Within Visual Studio open Extension and Updates then search the Visual Studio Marketplace for this plugin:

npmtaskRunner.png

Now open the Task Runner Explorer in Visual Studio and bind it to the ‘before build’ event as follows:

taskrunnerExplorer.png

This will ensure that the webpack command is run every time we deploy the solution to SharePoint incorporating our latest changes to our code.

Deploying the SharePoint 2013 AddIn

Okay now we are almost there.  The only thing left to do is deploy the solution to SharePoint.  Double check the feature to ensure that the only module we are deploying is the app module.  The feature window should look like the following with only the app module included for deployment:

feature.png

We also need to make a small change to the AppManifest.xml file so that the solution points to our index.html file rather than the default.aspx file we deleted earlier:

appmanifest.png

Now we are ready to deploy the solution to SharePoint.

Right-click the project and choose the option to Deploy.  If all goes well then you will see the following in the output window in Visual Studio:

output.png

Now go to your developer site and test to see it’s working.   If all has gone well then you should see the following in your browser:

finished.png

Obviously this is a very simple little app and was quite a lot of work to get here but serves as a good starting point for a larger project.

The full source code for this project is available here:

https://github.com/neilcummings/SharePointAddInAngular/tree/master/SharePointAddInAngular

Implement Angular 2 in SharePoint 2010

One thing to note is the compatibilities between the different libraries, the SharePoint master page and the IE9 browser is something that I tend to forget. So here are few things to consider:

  • SharePoint 2010 Cross-browser support both include Internet Explorer 9 and above.
  • You can use 1.9.x or 2.0.x but my preferences have been to stick with 1.9.x despite the little performance increase with 2.0.x
  • SharePoint master page. For the default master page in SharePoint 2010 (v4.master), the X-UA-Compatible or default mode will be set to IE=8. In order to use Angular, you will need to change it least to IE=9 (you can also use IE=Edge to get the latest versions of the browser)

AngularJS-SharePoint2010
Finally, your HTML needs to be formatted properly (if you do not want to see weird behaviours happening). In fact, make sure that all required attributes for an HTML tag are defined. If it will still render fine in other browsers, IE9 will just not like it. My most common errors are to forget HREF for the anchor tag or ACTION attribute to form. Not sure if this is related to the Angularjs library or the DOCTYPE HTML set to Strict on the master page, but as long as you make sure the HTML pass W3C Markup validation service, you will be fine

How to fix common organizational Mistakes .NET Developers make with Microservices

Microservices have really only become possible for .NET Development with the advent of .NET Core, and because of that we have almost two decades of built up practices that don’t apply in the world of microservices.

In case you haven’t heard of Microservices, here’s a quick ten second primer on them: They’re a deployable focused on doing one thing (a very small thing, hence ‘micro’), and they communicate their intent and broadcast their data over a language agnostic network API (HTTP is a common example).

For instance, sitting in the WordPressDotCom editor right now, I could see maybe a dozen Microservices (if this weren’t WordPress), a drafts microservice, notifications, user profile, post settings, publisher, scheduler, reader, site menu, editor, etc.Basically, everything above is a microservice. All those clickables with data or behaviour above? Microservices. Crazy, right?

Back of the cereal box rules for Microservices:

  • The code is not shared
  • APIs are small
  • build/deployment of that service should be trivial.

So that’s code, but what about the organization? What about project setup?  Those are the pieces that are as crucial to successful microservices as anything else.

In .NET Monolithic projects, we’ve spent years hammering home ‘good code organization’, with lots of namespaces, namespaces matching directories, and multiple projects.

But thinking about those rules of organization for Monoliths, when’s the last time you were able to easily find and fix a bug even in the most well organized monolithic project?  On average, how long does it take you to find and fix the bug in a monolith? (Not even that, but how long does it take you to update your code to the latest before trying to find the bug?)

The benefits of Microservices are the polar opposite of the benefits of a Monolithic application.

An ‘under the hood’ feature of Microservices is that code is easy to change. It’s easy to change because it’s easy to find, it’s easy to change because there’s not much of it, and it’s easy to change because there isn’t a lot of pomp and circumstance around changing it. In a well-defined microservice, it would take longer to write this blog post than to find the issue (I’m exaggerating, but only slightly).

 

If you’re developing .NET Microservices, here are some points to keep in mind, to keep from falling into the old traps of monoliths:

Keep the number of directories low: The more folders you have, the more someone has to search around for what they’re looking for.  Since the service shouldn’t be doing that much, there isn’t as much need for lots of directories.

Move classes into the file using them: Resharper loves to ask you to move classes to filenames that match their class name.  If your class is just a DAO/POCO; rethink that.  Keep it close to where it’s used. If you do split it into a separate file, think about keeping all of its complex types in the same file it’s in.

1 Microservice, 1 .NET Project, 1 source control repository: This is a microservice. Splitting things out into multiple projects in one .sln file necessarily raises the complexity and reduces the advantages Microservices have.  Yes, it feels good to put that Repository in a different project; but does it really need to be there? (Incidentally, it’s currently impossible to publish multiple projects with the .NET Core CLI)

Code organization should be centred around easily finding code: If I can’t find what your service is doing, I may just rewrite it.  Then all that time you spent on that service organization will be gone anyway. The inner-workings of your microservice should be easy to find and work with. If they aren’t, maybe it’s doing too much?

Your build process should be trivial: If your project pulls down Nuget packages from two separate repositories, it’s time to rethink your build process.

Why are you sharing code, anyway?: Private Nuget packages are monolithic thinking;  to make “sharing code” easy.  But in the Microservice world, you shouldn’t be sharing code, right? Duplicate it, pull it out into its own service. Sharing it simply means you’re dependent on someone else’s code when it breaks (which is why we have microservices in the first place; so we don’t have that dependency).

Working beats elegant, every time: I love elegant code. I also love working code. Incidentally, I get paid to write working code, not elegant code.  If using a microservices based architecture allows me to move faster in development, why would I hamper that by spending time making code elegant that doesn’t need to be? There are even odds that this service won’t even exist in its current form in 6 months, let alone be around long enough for its elegance to be appreciated.

Microservices are a different paradigm for software development, in the same way, agile was meant to be different than classic SDLC (Waterfall). The same thinking that built Monoliths can’t be used to build Microservices successfully. Next time you’re writing a microservice, think about what practices and inertia you have; and double check: Does this practice make sense in a Microservice?  If it doesn’t, jettison it.

What is the best way to iterate over a Dictionary in C#

Dictionaries are special lists, whereas every value in the list has a key which is also a variable. A good example for a dictionary is a phone book.

Dictionary<string, long> phonebook = new Dictionary<string, long>();
phonebook.Add("Alex", 4154346543);
phonebook["Jessica"] = 4159484588;

 

Notice that when defining a dictionary, we need to provide a generic definition with two types – the type of the key and the type of the value. In this case, the key is a string whereas the value is an integer.

There are also two ways of adding a single value to the dictionary, either using the brackets operator or using the Add method.

To check whether a dictionary has a certain key in it, we can use the ContainsKey method:

Dictionary<string, long> phonebook = new Dictionary<string, long>();
phonebook.Add("Alex", 415434543);
phonebook["Jessica"] = 415984588;

if (phonebook.ContainsKey("Alex"))
{
    Console.WriteLine("Alex's number is " + phonebook["Alex"]);
}

 

To remove an item from a dictionary, we can use the Remove method. Removing an item from a dictionary by its key is fast and very efficient. When removing an item from a List using its value, the process is slow and inefficient, unlike the dictionary Remove function.

Dictionary<string, long> phonebook = new Dictionary<string, long>();
phonebook.Add("Alex", 415434543);
phonebook["Jessica"] = 415984588;

phonebook.Remove("Jessica");
Console.WriteLine(phonebook.Count);

Finding and delete duplicate values in a SQL table

declare @YourTable table (id int, name varchar(10), email varchar(50))

INSERT @YourTable VALUES (1,'John','John-email')
INSERT @YourTable VALUES (2,'John','John-email')
INSERT @YourTable VALUES (3,'fred','John-email')
INSERT @YourTable VALUES (4,'fred','fred-email')
INSERT @YourTable VALUES (5,'sam','sam-email')
INSERT @YourTable VALUES (6,'sam','sam-email')

SELECT
    name,email, COUNT(*) AS CountOf
    FROM @YourTable
    GROUP BY name,email
    HAVING COUNT(*)>1

OUTPUT:

name       email       CountOf
---------- ----------- -----------
John       John-email  2
sam        sam-email   2

(2 row(s) affected)

if you want the IDs of the dups use this:

SELECT
    y.id,y.name,y.email
    FROM @YourTable y
        INNER JOIN (SELECT
                        name,email, COUNT(*) AS CountOf
                        FROM @YourTable
                        GROUP BY name,email
                        HAVING COUNT(*)>1
                    ) dt ON y.name=dt.name and y.email=dt.email

OUTPUT:

id          name       email
----------- ---------- ------------
1           John       John-email
2           John       John-email
5           sam        sam-email
6           sam        sam-email

(4 row(s) affected)

to delete the duplicates try:

DELETE d
    FROM @YourTable d
        INNER JOIN (SELECT
                        y.id,y.name,y.email,ROW_NUMBER() OVER(PARTITION BY y.name,y.email ORDER BY y.name,y.email,y.id) AS RowRank
                        FROM @YourTable y
                            INNER JOIN (SELECT
                                            name,email, COUNT(*) AS CountOf
                                            FROM @YourTable
                                            GROUP BY name,email
                                            HAVING COUNT(*)>1
                                        ) dt ON y.name=dt.name and y.email=dt.email
                   ) dt2 ON d.id=dt2.id
        WHERE dt2.RowRank!=1
select * FROM @YourTable

OUTPUT:

id          name       email
----------- ---------- --------------
1           John       John-email
3           fred       John-email
4           fred       fred-email
5           sam        sam-email

(4 row(s) affected)

Finding duplicate values in a SQL table

SELECT
    name, email, COUNT(*)
FROM
    users
GROUP BY
    name, email
HAVING 
    COUNT(*) > 1

Simply group on both of the columns.

Note: the ANSI standard is to have all non aggregated columns in the GROUP BY. MySQL allows you to avoid this, but results are unpredictable:

In MySQL you need sql_mode=only_full_group_by

Sharepoint 2010 HTML5 Compatibility

Yes, it’s compatible. But in order to use the technique of HTML5 you also need a browser supporting HTML5 and SharePoint 2010. There is a project on codeplex making a custom HTML5 master page templates to SharePoint 2010 – so yes it’s possible. At the same time be aware of that you can’t expect fully supported the functionality of your SharePoint 2010 farm, but most of it will work.