Often neglected areas of Web development

Being web developer you want your product to be successful. Following are the areas which is usually ignored or provide poor attention but these areas are major stakeholders in the success of optimized web application.

Target audience:

Identify your audience. Your design should be according to the need of your audience. If IT based company design should be corporate but if it is any musical store then it should be colorful, full with melodies. If website contains financial transaction, then security and session handle must be given extra attention.

Software development model:

Usually, web developers are so into coding that they start coding without thinking how they will proceed. Before start development, try to structure your project in modules. Estimate time and resources and analyze which software development model is suitable for your project. There are a lot of models and pattern for software and web development especially in open source. As web development is subset of software development, so you can software development mode full or partially per need, as often all steps are not applied. Some widely used models are Agile Programming, Prototype, RAD. Be careful with Timelines. It will be yours biggest success if you finish on time with desire product.

Requirements gathering and specification:

Obviously you should have all requirements in your hand. The functional or must-meet requirements should be gathered and compiled in the start but non-functional or good-to-have can be added later. Note that these requirements must be freeze or finalize before start development. Any new requirement must be accommodate in next major version like 2.0 or in a minor version like 1.0.1. Create a UML, ERD, DRD or some initial design that will help you in future for development and testing.

Testing:

Many people are so eager to move their project to production that they neglect the importance of testing. As soon as development complete, they start SQA team to finish testing and provide sign-off. It’s up to you. You can go as deeper as you want in testing. Test your code in the way that all scenarios should be covered. Create test cases with all possible values and scenarios of dynamic variables. Perform code analysis and code coverage, identify bottlenecks. Analyze execution plan and optimized queries.

Promotions:

One step that is necessary in web development is the promotion of your site. You can promote you site in different blog, forums, community sites, wikis. You can write your own blogs or blog can be a part of your web where people can come and write something. SEO (Search Engine Optimization) is a technique use for site promotion. Now-a-days the widest used approach is through social networks like Facebook and Twitter.

Evolution:

In last you must monitor your site carefully. You can do logging in your site to get possible errors. Watch your web logs daily in the start. Also, you should have a feed-back form on your web as you can get the problems of users and will fix or add in next release. No one is perfect and there is always a room for mistakes and weaknesses so evolution never ends but your product will be maturing gradually.

PHP password generator

Simple password generator class in PHP. Allow users to choose what kind of characters should be in the password

After long and hectic day with office work in the night I relax to do some coding (by the way I spend 80% of my office time doing coding :P). So, I decided to write a “Create Password” utility. This is just for the sake of code something because there are many fancy libraries for this purpose already available, as open source rocks!!!

First I thought what password could have, alphabets small and capital, number and special character but user must have flexibility to exclude any of this option so I came up with a class having all options.

 

abstract class Options
{	
	const SmallAlphabets = 0;
	const CapitalAlphabets = 1;
	const IsNumeric = 2;	
	const IsSpecialCharacters = 3;
}

I made it abstract, as I did not need to implement any function inside the class. It worked as enumeration.

Then I created a function to allow user to enable what options he wants and set options in constructor as the set on the generation of class object. User can omit code to disable any option

 

function UseInPassword($options){
/** set correponding bit value to 1 to keep track of allowed options */
$this->optionsTrack = $this->optionsTrack | pow(2,$options);
}

Here, I did a trick, I played with logical operators and I set the bit in an integer corresponding the value any option had in Options class.

GetPassword is the main function. User called that from outside. I wanted to generate all characters equally. For example, password length is 6 and user enable only SmallAlphabets, then 6 small alphabets will be created but if SmallAlphabets and IsNumeric is enabled then 3 small alphabets and there number. What if user enables all? There are four options and length is 6. 6 is not divisible by 4 so we cannot generate all options equally. We have to take reminder to generate more characters equal to reminder to fulfill password length. So each option generated once to make 4 characters and code will generate 2 more character in the sequence of their values in Options class. As follow

Count the options set by user by checking corresponding bit

 

for($i = 0 ; $i < 5 ; $i++){			
			$mask = $this->optionsTrack & pow(2,$i);
			if($mask > 0){
				$optionsCount++;
				$allowedOptions .= strval($i);
			}
		}


Get count of characters per option

 

$initialOptionCount = intval($this->passwordLength / $optionsCount);	
$reminder = $this->passwordLength % $optionsCount;	

Get final count as if password length is not completely divisible by the count of allowed option then we have to generate some character one more time

 

$finalOptionsCount = $initialOptionCount + ($i < $reminder ? 1 : 0);

Complete commented code is below and on git Hub and easy to understand.

Complete PHP code for Password generator

 

<?php
// namespacess
namespace junaid\code\pword\generator;

/** enumeration class to define what password would have and what would not have */
abstract class Options
{	
	const SmallAlphabets = 0;
	const CapitalAlphabets = 1;
	const IsNumeric = 2;	
	const IsSpecialCharacters = 3;
}


/** passsword generator class */
class Generator{
	
	public $passwordLength;
	public $optionsTrack;	
	
	/** below you can update a list of special character 	 
	 	and add or remove characters according to your will */ 
	private $specialCharacters = [
			'~','`','!','@','#','$','%',
			'^','&','*','(',')','-',
			'_','=','<','>',
			';',':','[',']','{','}'
	];
	
	function __construct(){
		$this->passwordLength = 7;
		$this->UseInPassword(Options::SmallAlphabets);
		$this->UseInPassword(Options::CapitalAlphabets);
		$this->UseInPassword(Options::IsNumeric);
		$this->UseInPassword(Options::IsSpecialCharacters);
	}
	
	/** enable different type of characters by passing corresponding Options value
	 	See in constructor how I enable all options by four calls of this function */
	function UseInPassword($options){
		/** set correponding bit value to 1 to keep track of allowed options */
		$this->optionsTrack = $this->optionsTrack | pow(2,$options);
	}
	
	function GetPassword(){
		if(0 == $this->optionsTrack)
			exit("No parameter set....");
		$optionsCount = null;
		$allowedOptions = "";
		
		/** count what are the options set by user by ANDing corresponding bit value with power of 2 */
		for($i = 0 ; $i < 5 ; $i++){			
			$mask = $this->optionsTrack & pow(2,$i);
			if($mask > 0){
				$optionsCount++;
				$allowedOptions .= strval($i);
			}
		}
		
		/** get count of characters per option need to be created */
		$initialOptionCount = intval($this->passwordLength / $optionsCount);		
		$reminder = $this->passwordLength % $optionsCount;
		
		$passwordArray = array();

		/** generate characters and put in array */
		for($i = 0 ; $i < strlen($allowedOptions) ; $i++){
			/** if provided lenght is not divisble by the count of allowed options
			  	some options need to be created more than other to get no of character 
			  	equal to password length */			
			$finalOptionsCount = $initialOptionCount + ($i < $reminder ? 1 : 0);
			
			for($j = 0 ; $j < $finalOptionsCount ; $j++){
				$passwordArray[] = $this->GetSingleCharacter($allowedOptions[$i]);
			}
		}
		
		/** shuffle */
		shuffle($passwordArray);
				
		return implode($passwordArray);
	}
	
	/** return character on the basis of provided option value */
	function GetSingleCharacter($switch)
	{
		$tmp;
		switch($switch){
			case Options::CapitalAlphabets:
				$tmp = chr(rand(65,90));
			break;
			case Options::SmallAlphabets:
				$tmp = chr(rand(97,122));
			break;
			case Options::IsNumeric:
				$tmp = rand(0,9);
			break;
			case Options::IsSpecialCharacters:
				$tmp = $this->specialCharacters[rand(0,sizeof($this->specialCharacters)-1)];
			break;
		}		
		return $tmp;
	}
	
	function __desctruct(){
	}
}


use junaid\code\pword\generator as ns;
$obj = new ns\Generator;
echo $obj->GetPassword();

?>


How to create BizTalk pipeline custom component?

Scenario:

I worked on a project named Levy. In this project we were getting transactions from another system in a flat file. BizTalk read that file from FTP location. Sometimes, we had huge number of transactions and flat file took 30 to 45 seconds to be written, and BizTalk started to read the file while the file was still writing by another system. This scenario caused partial file read situation.

We could not be sure about the exact timing of generation of file so we could not schedule any service window or sets polling on FTP receive location. This scenario occurred seldom so we decided to through error when it occurred and inform ITD Ops to run job again (which was creating file on FTP location).

Records in flat file were delimited by carriage return (\r\n as it is on windows) and fields inside every record were positional. We noticed that whenever partial file read by BizTalk, there was carriage return in the last, as file read line by line and every line had carriage return in the end. Therefore, we decided not to put carriage return after the last line, and check applied in receive pipeline, if carriage return was present at the end of the stream, it was partial read, otherwise flat file was good.

For this purpose, I created receive pipeline component for disassemble stage, and in case of partial file, I sent email to ITD Ops and wrote error in event log.

Extending Flat file disassembler component using FFDasmComp

In this tutorial, I will inherit may class library to FFDasmComp and implement few basic methods from IBaseComponent and IDisassemblerComponent interfaces. I cannot share actual project as it is condemned by policies of my current employer. I am going to simulate what I did with a sample project.

Open visual studio and create new project. Select C# and select Class library in template section. Give the name of the project as you want. I gave mine as CheckLevyFileFormat. I also rename class file to “CheckPartialFileRead“ as I never like “Class1” as a class name.

1

Now you have to add references of two assemblies. Right click on references in solution explorer, click add reference, click on browse tag, go to your BizTalk server 2010 installation directory(Normally in program files) and add Microsoft.BizTalk.Pipeline assembly

2

Do the same for Microsoft.BizTalk.Pipeline.Components. This assembly can be found inside BizTalk server 2010 installation directory or could be inside Pipeline Components folder, inside the installation directory. Check both locations.

Now, we need to add some code. First some namespaces required.

using System.IO;
using System.Xml;
using Microsoft.BizTalk.Message.Interop;
using Microsoft.BizTalk.Component.Interop;
using System.Runtime.InteropServices;
using Microsoft.BizTalk.ParsingEngine;
using Microsoft.BizTalk.Component;
using System.Text;

Later, we need to implement three basic functions of IBaseComponent

public new string Name
{
    get
    {
        return &amp;quot;CheckPartialFileRead Disassembler&amp;quot;;
    }
}

public new string Version
{
    get
    {
        return &amp;quot;1.0&amp;quot;;
    }
}

public new string Description
{
    get
    {
        return &amp;quot;Check Levy Partial File Read Disassembler&amp;quot;;
    }
}

The name you defined will appear when you add your new developed component in toolbox.

Now, the most important function is Disassemble. Following is the code which is quite self-explanatory. We are getting file content and break them into lines and check each line. Let say, length of each line must be 12(originally it was different in Levy project). As I do not remove empty entries when I split string into string array ( by passing StringSplitOptions.None in String.Split function), if there is “\r\n” in the end then last line will be an empty string and exception will be thrown.

public new void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
{
    try
    {
        //jha1-- read flat file contents
        StreamReader _streamReader = new StreamReader(pInMsg.BodyPart.GetOriginalDataStream());
        int _lineNumber = 0;

        string _levyContents = _streamReader.ReadToEnd();

        //jha1-- break it into lines
        string[] _lineArray = _levyContents.Split(new string[] { &amp;quot;\r\n&amp;quot; }, StringSplitOptions.None);

        //jha1-- check all lines. All lines lenght must be 12 according to Levy spces
        //jha1-- this will also cover
        foreach (string _line in _lineArray)
        {
            _lineNumber++;

            if (12 != _line.Length)
            {
                SendEmail(_lineNumber);
                throw new Exception(string.Format(&amp;quot;Error at line no. {0}. Length of all lines must be equal to 12&amp;quot;, _lineNumber));
            }
        }

        _streamReader.BaseStream.Position = 0;
        base.Disassemble(pContext, pInMsg);
    }
    catch (Exception ex)
    {
        System.Diagnostics.EventLog.WriteEntry(&amp;quot;Disassemble - Exception&amp;quot;, ex.ToString());
        throw ex;
    }
}

Full code can be found in attached zip.

Assign SNK to make this assembly strong name. Build the project, GAC the assembly and place into Pipeline Components folder in your BizTalk server installation directory.

3

Now create New BizTalk empty project and add new receive pipeline

4

Now right click on toolbox and click choose items

5

Click on BizTalk Pipeline Components tag and you will see your custom created pipeline component listed there.

6

It the component and it starts to appear into toolbox.

7

No you can use it like any other component. Drag and drop it into Dissemble stage.

Now to test it, I created a sample schema with three fields and sample orchestration that will just receive and print XML.

8

9

Build your solution, assign strong-name key, deploy on BizTalk, configure and apply your pipeline to receive location and test results.

Whole project is available on following location
http://1drv.ms/1mLdKPc

What is code review? Why code review is required? What is the check list for code review?

Review your fellow developer code – The best way to improve your code

In the start of my career, when I was naive, I considered code review a time waster. Because, something my code got more than a week to be reviewed by my team-lead. But, now I have realized how important it is.

When you are on a project with strict timelines and you are handling pressure from each side, even an experienced developer can do a rookie mistake, and in the influence of pressure, sometime you cannot identify the mistake even after go-through many times.

To maintain organization standards and to have functionally accurate and clean code, every piece of code should be reviewed by other developers. It will be helpful for new developer, as when new project assign to him, he got organization maintained code so it become easy for him understand and work faster.

Code Review Check List

Following is the check list that I follow during my code review. This list shortens or widen slightly according to nature of any project

When you are on a project with strict timelines and you are handling pressure from each side, even an experienced developer can do a rookie mistake, and in the influence of pressure, sometime you cannot identify the mistake even after go-through many times.

  • General

    • Code should be easily extendable and manageable.
    • Code is in working condition without any error.
    • Code is doing its intended purpose.
    • Methods in a class support its functionality.
    • The routines in each source file shall have a common purpose or have interrelated functionality.
    • Each line will not be more than 80 characters long.
    • Don’t overload any function, unless there is a genuine reason.
    • No uncalled, unneeded, unreachable code should be in source code file. Small piece of useless code can be kept but in commented form.
    • Code should be easily extendable and manageable.
  • Conventions

    • Use camalCasing for variables.
    • Use PascalCasing for class, functions and namespaces.
    • Avoid liters and constants values as much as possible.
    • Every class should be in any namespace or sub namespace. No global namespace.
    • No tab-based indenting. Use 3 spaces relatively to indent any line.
    • All variable must be meaning full. One letter variables never help. Boolean should not like flag or check. They must have some meaning like $isUserAdmin or $recordFound.
    • File name and class name must be meaningful and reflect the purpose of creation.
    • User calendar control instead of allowing user to write date in a textbox.
    • When continuing lines of code on new lines, they are broken after a comma or an operator.
    • Wrapped lines of code are aligned with the beginning of the expression at the same level on the previous line.
    • Program statements are limited to one per line.
    • Parentheses are used to remove operator precedence ambiguity and to improve code readability.
  • Comments

    • Top of any file, class and function
      • Author.
      • Purpose.
      • Creation date.
      • Document version in which class introduced.
        • Input parameters, their type and purpose.
        • Output values, its type and purpose.
      • For class, there is a section of revision history, which contains the date, purpose and function names change.
    • Comments must be provided for complex peace of code. If any design pattern, algorithm, framework or library (like MVC) implemented, then it must be specified with the reason of usage.
    • Put comment on any loop or conditional clause if it is doing something important and complex.
    • Avoid spelling and grammatical mistakes in comments.
  • Exception Handling

    • Catch all errors and do proper handling.
    • If there is an unexpected error that you can't recover from, then log details, alerts the administrator, clean the system.
    • Meaningful error messages are used.
  • Modularization

    • Divide code into classes, functions and namespaces.
    • Do not write very long function. If any function is more than 80 executable lines, then probably it should be divided.
    • No duplication of code.
    • If you find you are indenting very deeply, you most likely aren't using subroutines when you should.
    • Do not reinvent functions and classes. If any code can be replaced by any library, replace it.
  • Security

    • Apply validation on input fields. Do not allow NULL on mandatory value, or value with wrong datatype. Check inputs from SQL injection.
    • Implement security by doing precautions for Cross-site request forgery and cross site scripting where needed.
    • Create multiple users with different privileges (optional).
    • Apply captcha to all forms which can be used by attackers like creation account, comments, contact us, quote request form, etc.
    • Encrypt/Decrypt password and critical configuration values.

What is SRS (Software Requirement Specification)? What is SRS means? Why it is necessary to create SRS? What are its features, advantages and uses? What is Software requirements specification template according to IEEE?

SRS is not an ordinary word document. It is a starting point of project development. Provide understanding for functional and non-functional requirements.  

Good SRS is directly proportional to Good end product

What is SRS (Software Requirement Specification)? What is SRS means?

  • An SRS is a Software Requirement Specification document which serves as a written contract between client and an organization.
  • SRS is a written and documented understanding between organization and the client about the features and functionality of the product.
  • SRS an assurance between client and organization that both stakeholders understand the other’s requirements from that perspective at a given point in time.

Reasons for the creation of SRS (Software Requirement Specification)

  • SRS serves as an input our other all documents created in later stages of software development life cycle.
  • It is a feedback to the customer.
  • It’s modularized the problem statement.
  • It the bases of system design.
  • It defines product scope.

What SRS should contain?

According to IEEE, SRS should contain following

  • Interfaces – How does under-development product interact with other systems in the sense of hardware and software, and with actual user? It can contain GUI description, list of targeted devices, any other legacy systems.
  • Functional Capabilities – What software actually do? What are the features of the product? What is the input and output for any feature? What is the importance and priority?
  • Performance – It is a non-functional requirement but it is requested by almost every client that System should provide response in timely manner. Here, potential parameters that can affect system performance can be listed with their desire remedy.
  • System Attributes – Attributes that can be enough to define the system like hosted environment, Security, safeguards, etc.
  • Constraints and Limitations – Describe any items or issues that will limit the options available to the developers. These might include: corporate or regulatory policies; hardware limitations (timing requirements, memory requirements); interfaces to other applications; specific technologies, tools, and databases to be used; parallel operations; language requirements; communications protocols; security considerations; design conventions or programming standards (for example, if the customer’s organization will be responsible for maintaining the delivered software).

What are its features?

According to IEEE, SRS should have following properties

  • Correct – It should accurately reflect product functionality and specification at any point of time.
  • Unambiguous – There should not any confusion regarding interpretation of the requirements.
  • Complete – It should contain all features requested by a client.
  • Consistent – Same abbreviation and conventions must be followed throughout the document.
  • Ranked for importance and/or stability – Every requirement has its own importance. Some are urgent and could be on the critical path and must be fulfilled prior to other, some could be delayed.  It is better to rank every requirement according to its importance and stability.
  • Verifiable – How you are going to verify any requirement? Present requirements with numbers, facts and some measuring parameters.
  • Modifiable – Every SRS is subjected to be changed later. Clearly state every requirement so it can be easily identified later, avoid redundancy, use change control to manage modifications.
  • Traceable – Trace of any requirement up to its origin. Add reference to high level document from where any particular requirement started.

Advantages of SRS

  • It provides client a satisfaction as this is the first response to the client.
  • It defines functional and non-functional requirement.
  • It eliminates any confusion or misunderstanding on initial stage.
  • It reduces development effort.
  • It reduces the chances of requirement creep.
  • It makes testing easier.
  • It defines project scope.
  • It provides the basis for plan charter, work load, dependencies, etc.

Miscellaneous

  • SRS (Software Requirement Specification) developed at initial stage. First Requirements gathering and second Requirements analysis are prerequisites for its generation.
  • SRS should not contain any design requirement or design detail. Another document named Software Design Document should be created for this purpose.
  • Spend around 20% of your project time in requirement gathering.
  • Keep references to other related documents with their version numbers and generation dates.
  • Include pictures, tables, charts (bar, worm, etc…) it required.

LeetCode – Check valid Sudoku in PHP

What is Sudoku

Everyone plays sudoku once in a while. It is a good time-pass. Logic is, Sudoku consist of 9 rows and 9 columns and 9 blocks. Each block contains 3 rows and 3 columns, means if you divide 9 rows into 3 parts and 9 columns into 3 parts, you would get 9 squares or blocks.

Any Sudoku, is provided with predefined values (ranges 1-9, inclusive) for some cells and some cells are empty. To finish Sudoku game, user has to be filled all empty cells with a numeric value ranges one to nine (inclusive), in a way that no row, column or block has duplicate value.

PHP Implementation

Following php code is for a problem from Leetcode to check if any provided Sudoku is valid or is it already has any duplicate value in any row, column or block.

 

<?php
/*
* checkValidSudoku
* Create by Junaid Hassan
* email : junaidhassanalvi@gmail.com
* Blog : junaidhassanalvi.wordpress.com
* Linkedin : http://linkedin/in/junaidhassanalvi
* Date : 22-dec-2015
*/

namespace JunaidHassan\ProgrammingProblems\LeetCode;

class checkValidSudoku
{
	var $sudoku = array();
	
	// take inputs
	function populateSudoku($input)
	{
		$this->sudoku = $input;
	}
	
	function validate()
	{
		$bitMap;
		
		//check all rows for duplicate values
		// any duplicate value in any row will fail validation
		for($raw = 0 ; $raw <9 ; $raw++){
			$bitMap = 0;			
			for($col = 0 ; $col <9 ; $col++){
				if('0' != $this->sudoku[$raw][$col]){		
					
					// calculate mask to get or set any particular bit from bitMap
					$mask = pow(2,$this->sudoku[$raw][$col]);					
					
					// check if a bit againt the value is already set to one, 
					// if it is already set,it means program already encounter the value, return false, 
					// else set it to one
					if(($bitMap & $mask) == 0)
					{
						$bitMap = $bitMap | $mask;
					}
					else
					{
						return false;						
					} 
				}
			}
		}		
		
		// check all columns for duplicate values
		// any duplicate value in any column will fail validation
		for($col = 0 ; $col <9 ; $col++){
			$bitMap = 0;
			for($raw = 0 ; $raw <9 ; $raw++){
				if('0' != $this->sudoku[$raw][$col]){	
					
					// calculate mask to get or set any particular bit from bitMap
					$mask = pow(2,$this->sudoku[$raw][$col]);
					
					// check if a bit againt the value is already set to one
					// if it is already set,it means program already encounter the value, return false, 
					// else set it to one
					if(($bitMap & $mask) == 0)
						$bitMap = $bitMap | $mask;
					else
						return false;
				}
			}
		}
		
		
		$xStart = 0;
		$yStart = 0;
		
		// check for 9 blocks
		// IN Sudoku, we have 9 blocks, each blocks contain 3 rows and 3 columns
		// any duplicate value in any block will fail validation
		for($b = 0 ; $b < 9 ; $b++){
			
			// set start x index and y index for every block according to block number
			$xStart = floor($b /3) * 3;
			$yStart = ($b % 3) * 3;
			$bitMap = 0;			
			
			// traverse through all rows in the block
			for($x = $xStart ; $x < $xStart + 3 ; $x++){
				// traverse through all columns in the block
				for($y = $yStart ; $y < $yStart + 3 ; $y++){	
					
					if('0' != $this->sudoku[$x][$y]){
						// calculate mask to get or set any particular bit from bitMap
						$mask = pow(2,$this->sudoku[$x][$y]);
						
						// check if a bit againt the value is already set to one
						// if it is already set,it means program already encounter the value, return false, 
						// else set it to one
						if(($bitMap & $mask) == 0)
							$bitMap = $bitMap | $mask;
						else
							return false;
					}
				}
			}
		}
		
		// if validate for all rows, columns and blocks are passed then Sudoku is valid
		return true;
	}
}

use \JunaidHassan\ProgrammingProblems\LeetCode\checkValidSudoku as validateSudoku;

$obj = new validateSudoku();

//define input
$input =  array(
	array(3,0,0,0,7,0,0,1,0), //1
	array(6,2,0,1,9,5,0,0,0), //2
	array(0,0,9,0,0,0,0,6,0), //3
	array(8,0,0,0,6,0,0,0,3), //4
	array(4,0,0,8,0,3,0,0,1), //5 
	array(7,0,0,0,2,0,0,0,6), //6
	array(0,6,0,0,0,0,2,8,0), //7
	array(0,0,0,4,1,7,0,0,5), //8
	array(1,0,0,0,8,0,0,7,9) //9
);

// set input
$obj->populateSudoku($input);

// validate
echo "Given Sudoku ".($obj->validate() ? "is" : "is not")." a valid Sudoku";

?>


Search Engine Optimization (SEO) – What are SEO techniques for better page rank

Page’s title tag – Short Definition of your page

  • The most important tag is the title tag. It should be brief and description. It has to have important and popular keywords regarding your website or blog post.
  • Many people used “Untitled” as a page’s title. This title cannot do any good regarding SEO.
  • Many websites has a single title for all pages. This is also wrong because obviously you websites all pages will not do the same operations. You have to be more specific to rank your website better in the eyes of Search Engines.

Meta description tag – Long Definition of your page

  • There are many meta tag but the most important is description meta tag.
  • Meta description tag is another important aspect. You can say long title of your website. It is descriptive could be 3-4 lines or a small paragraph. It must contain keywords that can describe the content the best.
  • It should go in header tag of your page.
  • Have different meta description tag for each page according to its functionality.
  • Example : <meta name=”description=” content=”Jerry Store’s annual mega sale. 30% discount on electronic items. Up to 50% discount on household items.”>
  • Always search for related keyword first. Google trend is the best source for getting statistics about search keywords and checking what are the most searched keywords related to your topic.

URL rewriting – beautify your webpage URL

  • Search Engines do not like Ugly and long URL, so do Human.
  • Many websites use dynamic URL rewriting to made their URL pretty, easy to read and remember.
    • For Example: http://www.jerry.com/product.php?category_id=1&product_id=217, Here let say electronics has category_id 1 and Freezers has product_id 217. So how about if URL becomes http://www.jerry.com/ Jerry-stores-products-electronics-freezers. This one has keywords for the webpage so if this URL is referred from any other website, search engine crawler easily identify the content of the page and crawl it faster. products-electronics-freezers is better than products_electronics_freezers and productselectronicsfreezers.
  • How can we create this kind of SEO friendly URL is out of the scope but its implementation of URL rewriting on Apache server can be found.
  • Do not try to create massive amount of URLs for your website. It is the case when you put session id or any auto generated id in URL. Google directly quote this in their Google URL guidelines : “Overly complex URLs, especially those containing multiple parameters, can cause a problems for crawlers by creating unnecessarily high numbers of URLs that point to identical or similar content on your site. As a result, Googlebot may consume much more bandwidth than necessary, or may be unable to completely index all the content on your site”.
  • If you still have to create such links, there is a way to stop web crawler notice them. One way is to prepare your Robotics.txt for web robots and crawlers accordingly and second one is use nofollow attribute to stop web crawler follow anchor links.

Pages navigation – guide Robot through the path

  • Easier to navigate, higher the rank!!!
  • Web Crawlers like websites easy to navigate. Any broken liken should be removed or accommodated by custom error page(404)
  • Common approach is to use Breadcrumb for website navigation. This is a list of the pages in hierarchy from landing page to current page. It normally exist on all website page so no matter from where Web crawlers start, they will get all pages.
  • Another approach is a site map for web crawlers and users. There are two kinds of site maps. XML site map and HTML site map. XML is for Web Crawlers and HTML is for users. HTML site map resides on the website, if any user or web spider hit that page; the website’s all pages can be traverse easily. XML site map is submitted to Google of any search engine. It is one the ways to tell Google or any other search engine about your webpages URL.

Anchor text – Make it descriptive

  • It is easy for both user and web crawlers to understand what is text about
  • Try to avoid Click here, Show us, For example, Such as, Go to. 
  • Try to avoid put domain name or URL of anchor as the text.
  • Anchor tag text must define what that anchor is about. 

Write Quality content – I saved the best for the last

  • This is the superior to all. After all precautions list above, if your website content and services do not have quality, traffic slows down gradually.
  • Web crawlers love fresh content. The web page of the website updated periodically ranks better than the one does not have any new activity for a long time.
  • Create original content, always give something new to the customers, craft anything original that nobody or only few other have.

There could be many more. Google it to get it….