Thursday, March 22, 2012

Web application Performance Optimization Tips & Tricks

These days web applications performance became more important to businesses and it leads to Performance => Better Visibility => More Customers => More Revenue. Especially for Internet-based distributed applications, the need is even more acute – users have a choice about where they browse, and if a site’s performance frustrates them they may never return. Every web application consumes around 80% end-users time on page download. Most of this time is tied up in downloading of different components like images, scripts, flash, stylesheets, etc…

In this series of blog posts, I’m going to share different techniques that I used in different ASP.NET & SharePoint projects for frontend optimization. These techniques are pretty simple and standard best practices for frontend optimization. But I’m going to share the facts and figures that I got in different projects.

Each part will be published soon…

Thursday, March 15, 2012

jQuery Validation plugin and Credit Card validation issue

This post is just a simple solution to a situation that we ran into in one of my previous projects. We were using jQuery Validation plugin to validate forms in our project and found issues with credit card number validation.

I did some research on the internet related to this issue and found a very interesting post "Validation using 'creditcard2' extension". It is another extension which extends credit card validation for jQuery Validation plugin. Here are some issues fixed in this new extension:

Validation using jQuery Validation extension:

542418083235Passes
5424180832351Passes
41111111111111113Passes
370000000000002Passes
4111111111111111Passes

Validation using jQuery 'CreditCard2' Validation extension:

542418083235Fails
5424180832351Fails
41111111111111113Fails
370000000000002Passes
4111111111111111Passes

After adding new 'CreditCard2' extension in our project along with jQuery Validation extension at least we got the fix for credit card number. Than we ran into another issue related to credit card type. Both extensions require "Card Type" as a field on the form. As per the project requirement we need to get payment details without asking for "Card Type". Based on the entered credit card number we need to figure out which card type is this. To fulfill this requirement with the existing extension, I made a change in ‘CreditCard2’ extension. This is as followings:

Added a new method in script to get the card type from number:

function CreditCardTypeFromNumber(num) {
// first, sanitize the number by removing all non-digit characters.
num = num.replace(/[^\d]/g, '');
// now test the number against some regexes to figure out the card type.
if (num.match(/^5[1-5]\d{14}$/)) {
return 'MasterCard';
} else if (num.match(/^4\d{15}/) || num.match(/^4\d{12}/)) {
return 'Visa';
} else if (num.match(/^3[47]\d{13}/)) {
return 'AmEx';
} else if (num.match(/^6011\d{12}/)) {
return 'Discover';
}
return 'UNKNOWN';
}

Change the signature of 'CreditCard2' method with the following:

Old: jQuery.validator.addMethod("creditcard2", function(value, element, param) {
New: jQuery.validator.addMethod("creditcard2", function(value, element) {

Replace the first line of the ‘CreditCard2’ extension with the following:

Old: var cardName = param; New: var cardName = CreditCardTypeFromNumber(cardNo);

Move the following lines at the start of the method:

value = value.replace(/[\s-]/g, ""); // remove spaces and dashes
if (value.length == 0) { return false; } // no length
var cardNo = value;
var cardexp = /^[0-9]{13,19}$/;
if (!cardexp.exec(cardNo)) { return false; } // has chars or wrong length
cardNo = cardNo.replace(/\D/g, ""); // strip down to digits

By making the above changes ‘CreditCard2’ extension is ready to work without Card Type field.

Improvements in SharePoint 2010 from the Business Perspective - Part 2

This is the second post in a series of blog posts on SharePoint 2010 improvements. If you've missed the first post, you could read it here

Audience Targeting

In SharePoint 2010 users can target Web Part content in two ways:
  1. Configuration Web Parts Pages to display different Web Parts based on audience membership.
  2. Configure Web Parts to display different content based on audience membership.

Document Management

SharePoint 2010 includes a broad collection of new capabilities that simplify and streamline how companies manage documents.
  • Content Organizer

    Content Organizer is a rules-based classification engine that provides consistent classification of content based on Content Type and specific metadata properties. Site owners can create rules to drive content to specific document libraries and folders, where they inherit access control policy, default metadata values, and specific retention schedules.
  • Document Sets

    Using Document Set users can bundle multiple documents that support a single case, project, contract, etc… under a unique entity. But the set can share metadata properties, and users can apply workflows and versioning to the Document Set as a whole. Each Document Set has a customizable welcome page that displays shared metadata properties.
  • Document IDs

    SharePoint 2010 offers a new capability that assigns documents a unique identification number. Each document has a “permalink” based on its unique ID, which lets people retrieve the document regardless of where it is within a SharePoint deployment.
  • Managed Metadata Service

    Managed Metadata Services in SharePoint 2010 which allows businesses to centrally manage metadata and share it anywhere in the farm.

Record Management - Store once, use many

SharePoint 2010 broadens the scope of records management by delivery core capabilities across the entire SharePoint platform. As a result, users can declare all content within SharePoint as records, and companies can manage a central records archive or support in-place records management.

Rich Media Management

SharePoint 2010 includes enhanced management and presentation of multimedia content including Asset Libraries and the Media Player Web Part.

Improved Web Analytics

SharePoint 2010 delivers improved Web Analytics, providing details reports on user activity, content inventory, and search use.

SharePoint Search

SharePoint Search capabilities are delivered through two server products:
  • SharePoint Server 2010 – delivers out-of-the-box intranet and people search. SharePoint makes it easy to find content by combining relevance, refinement, mining, discovering (Manual or automatically generate list of colleagues mined from Microsoft Outlook) and social behavior in the search experience.
  • FAST Search Server 2010 for SharePoint – offers a new choice in enterprise search. It delivers an exceptional intranet, people search, visual search experience and a platform for building custom, search-driven applications.

Wednesday, March 14, 2012

Improvements in SharePoint 2010 from the Business Perspective - Part 1

As a consultant, a lot of time one question is asked from us. What are the improvements in SharePoint 2010 from the Business Perspective? Also someone asked me the same question on a forum as well. So I decided to write a post on it. Here are some of the improvements in SharePoint 2010 from the Business perspective.

Ribbon User Interface

SharePoint 2010 features the Microsoft Office Fluent user interface, including the ribbon user interface. The SharePoint Ribbon user interface offers an extensible, seamless, and familiar user experience across client and server applications.

Easy Web Editing

Sites in SharePoint 2010 contain the same list and libraries as previous version of SharePoint, but the site is now a collection of pages. Because SharePoint sites focus more on pages than collections of lists, user can better control sites. User can also easily work together to change existing pages with wiki technology in SharePoint 2010 team site pages. To edit content on a page, user can simply click the Edit tab type on the page. To enhance content, people can embed Web Parts, media files, and SharePoint lists in the page with a single click.

Cross-Browser Support

SharePoint 2010 now supports not only Microsoft Internet Explorer, but also Firefox and Safari. With any of these browsers, user can view and edit sites, and work with content effectively with a high-quality experience.

Improved Mobile Experience

SharePoint 2010 now offers support for multiple micro-browsers, helping more users to work together while using mobile devices. Users can view and edit Office documents, browse SharePoint document libraries, and search for content and people.

Stay Connected (receive alerts on you cell phone)

SharePoint 2010 list and libraries now allow you to receive text messages to your phone when you subscribe to an alert.

Work Online or Offline

SharePoint Workspace 2010 is the rich desktop client for SharePoint 2010 that helps users to work together, even when they’re not connected to a network. When users work offline, SharePoint Workspace caches any changes and automatically synchronizes the changes when connected to SharePoint site. In SharePoint Workspace 2010, people can take offline the content of entire sites, including custom lists and line-of-business data, and can integrate Microsoft InfoPath 2010 forms for richer data entry and data validation.

Enhanced Search Experience

SharePoint 2010 provides thumbnail Previews, Search results Refinement such as "Did You Mean" and improved relevance.

Office Web Applications

SharePoint 2010 works with the web companions to the most popular Office applications, so users can access documents, spreadsheets, presentations and notes without worrying about whether the computer they use has the latest Office programs installed.

Multilingual User Interface

SharePoint 2010 makes it easier for those organizations that have employees across borders and speak different native languages. After site administrators install the required language packs and activate the Multilingual User Interface (MUI) service, users can switch between languages and have their sites in the language they’ve chosen. When users create new content, they can also submit translations of the content so other users can view the content in specified languages.