SEO stands for search engine optimization for the website.Generally on any of the search engine like google,yahoosearch,msn etc. user type a keyword(s) and website related to the kewords get displayed. For a website to display in google search or any other search engine, website content needs to be optimised in terms of using website content,keyword,description in meta tag.extra.Convonix provide the SEO service to the website holder/conpanies.There are some tips to optimize a website for search engines which are as follows.
SEO Techniques
Step One - Choosing Keywords [most important]
You first must choose your keywords. This is perhaps the most important step of the process as incorrectly targeting phrases can result in traffic that is not interested in your product. There are three tools that I use virtually every day to help pick the most appropriate keywords:
1.Overture's Search Term Suggestion Tool
2.WordTracker
3.A Brain
The last in the list is the most important. Look through the potential keyword phrases and think, "Who would be searching using that phrase?" If the answer is, "a student looking for information" then chances are it won't result in a sale. If the answer is "Someone who is looking specifically for a product I offer," then obviously this is a prime candidate as a targeted keyword phrase.
Step Two - Site Content
Even before I optimize websites I like to get a good deal of new content down in order to insure that I know exactly where I'm going and exactly what I need to do to get there. Creating some of the new content before starting the optimization process can be doubly helpful in that it can reveal potential additions to your website that you may not have considered (a forum or blog for example). If you already have a site, perhaps simply sit on your back deck, sip on a coffee and image what you would do if your whole site was lost and you had to start again (other than launch into a very colorful discussion with your hosting company).
Step Three - Site Structure
A solid site structure is very important. Creating a site that is easily spidered by the search engines yet attractive to visitors can be a daunting and yet entirely rewarding endeavor. To adequately structure your website you must "think like a spider" which is not as difficult as it may sound. A search engine spider reads your web page like you would read a book. It starts at the top left, reads across, and then moves down.
Priority must be given then, to what you place near the top of your page.
Step Four – Optimization
Once you have your keyword targets, your content created and your site structure established you must now move on to the most obvious step, the optimization of your content.
As noted above, a spider places importance on what it reads highest on the page and so beginning with a sentence that includes your targeted phrase only makes sense. That said, stuffing in keywords in hopes that it will add weight to your page generally doesn't work. The term "keyword density" refers to the percentage of your content that is made up of your targeted keywords. There are optimum densities according to many reputable SEO's though exactly what they are is debatable. Estimates seem to range anywhere from 4 or 5% to 10% to 12% (quite a gap isn't it).
Personally, when it comes to keyword density I prescribe to one rule: put your keywords in the content as much as you can while keeping it comfortably readable to a human visitor.
Some do it first, I do it last. Regardless of when you do it you must choose your heading. At the beginning of your content you have the opportunity to use the <h1> tag to specify the heading of your content. This tag is given extra weight and is also an indicator to the search engine of where your actual content starts. Make sure to use your keywords in the heading but don't shy away from also adding additional words (though not too many).
Step Five - Internal Linking
To insure that your website gets fully indexed you have to make sure that the spiders have an easy path through your website. Text links make the best choice as the anchor text (the actual words used to link to a specific page) add relevancy to that page for the words used to link to it. For example, if I ran a website on acne and had a treatments page I could link to it with an image, with text reading "Click for more information on how to treat this skin condition" or simply "Acne Treatments". When a search engine spider hits an image it has no idea what the image is and, while it will follow the link, it will not give any weight to the page it hits. If you use text that does not contain the keywords you are targeting you are essentially supplying the engine with the same lack of relevancy as with an image, but if you use the phrase "Acne Treatments" to link to your acne treatments page you are attaching relevancy to that page for those keywords.
There are two main ways to insure that your site gets well spidered AND that the relevancy is added. The first is to place text links on the bottom of your homepage to your main internal pages (not EVERY page, that just looks odd). The second is to create a sitemap to all your internal pages and link to it from your homepage. Both methods have advantages and disadvantages but that's a whole article unto itself.
Step Six - Human Testing
So now you have your site, it's optimized and you have your navigation in place. The next step is to put it past someone who has never seen your site (and preferably who won't know how much work you've put in and tell you it's great even if it's not).
Ask them to find specific information and see how long it takes. Ask someone else to just surf your site and watch which links they click and ask them why they chose those ones.
Most importantly, find out how the content reads to them. You've spent hours working through the content at this point and are probably not the least biased on its readers. Find out how it reads to someone who has no invested interest in the site and correct any issues they may bring up.
Step Seven - Submissions
I take a different philosophy than most when it cones to search engine submissions. I submit to directories (both general and topic-specific) and to a few topical search engines but for the most part I've found submitting to Google, Yahoo, MSN and the other major engines has proven to be a bit of a waste of time. The major search engines are spidering search engines, which means they will follow links to wherever they go. Simply having sites that are spidered by the major search engines linking to you will get your site found.
When I have spent time submitting my sites I have found they get picked up in about a week. When I have simply skipped this step and sought out reputable directories and other sites to get links from I have found that at least the homepage of the site gets indexed in as little as two days.
Neither will hurt your rankings but simply to make the best use of your time, seek our directories and other websites to get links from and leave the spiders to find you on their own.
Step Eight - Link Building
All of the major search engines give credit to sites that have quality links pointing to them. How many is enough depends on your industry and targeted phrases. Running a search on Google the reads "link:www.yourcompetition.com" will reveal approximately how many links a competitor has.
The first place to seek links is with general and topic-specific directories. After that you may want to move into reciprocal link building. Reciprocal link building is the exchange of links between two websites. Some webmasters will simply link to any website that links back to them. I highly recommend being more particular than that.
Find websites that you believe your site visitors would genuinely be interested in and you've probably found a good link partner. You want to find links from sites that are related to yours.
There are obviously many more methods to building links than directories and reciprocal link building. Again though, this is a whole article (or more) in itself.
Step Nine - Monitoring
Whether you use WebPosition Gold or just run searches manually by hand you will have to monitor the major search engines for your targeted phrases. Also, you will need to review your stats to see where your traffic is coming from and what search terms are being used to find you.
If a month passes and you don't see any changes then more work needs to be done. I'm certainly not stating that you should take a month off, a solid search engine positioning strategy involves constantly adding content, building links, and insuring that your visitors are getting the information they want to have and finding it as easily as possible.
Step Ten – RSS Feed [will give you notes.]
We can Increase link popularity by submitting the RSS feed, blog or podcast to the appropriate directories. The following directories allow submissions of specific kinds of RSS feeds. Be sure to follow the guidelines of each site and choose categories wisely.
including this link may improve the site indexing by google.
<a href='http://www.autositemap.com/'> <input src='http://www.autositemap.com/autositemap.png' type="hidden"/></a>
So you've done it. It's taken many, many hours of work but your rankings are doing well. What you've created is a solid position that will stand the tests of time provided that you continually revisit the above noted steps and insure that your website is always one step ahead of your competition (who have noticed you climbing and succeeding as you would notice others climbing up around your ranking).
Our highest priority is to satisfy the customer through early and continuous delivery of valuable and working software.
Monday, April 30, 2007
Friday, April 27, 2007
Caching with PHP
PHP offers an extremely simple solution to dynamic caching in the form of output buffering. The front page of the site (which generates by far the most traffic) is now served from a cached copy if it has been cached within the last 5 minutes.
Best of all, you don’t have to edit any of your core application logic. You can just dropped in some extra code at the top and bottom of the index.php file. Here’s how it works:
It should work on practically any PHP application.
Also, you can find more information about output buffering at http://www.php.net/manual/en/ref.outcontrol.php
Best of all, you don’t have to edit any of your core application logic. You can just dropped in some extra code at the top and bottom of the index.php file. Here’s how it works:
<?php
$cachefile = 'cache/index-cached.html';
$cachetime = 5 * 60;
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);
echo "<!-- Cached copy, generated ".date('H:i', filemtime($cachefile))." -->\n";
exit;
}
ob_start(); // Start the output buffer
/* The code to dynamically generate the page goes here */
// Cache the output to a file
$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush(); // Send the output to the browser
?>
It should work on practically any PHP application.
Also, you can find more information about output buffering at http://www.php.net/manual/en/ref.outcontrol.php
Reset MySQL incase of LOST of Password
In case of MySQL password LOST...
(1)service mysql stop
# wait until MySQL shuts down. Then run
(2)mysqld_safe --skip-grant-tables &
# then you will be able to login as root with no password.
(3)mysql -uroot mysql
# In MySQL command line prompt issue the following command:
(4)
UPDATE user SET password=PASSWORD("abcd") WHERE user="root";
FLUSH PRIVILEGES;
# At this time your root password is reset to "abcd" and MySQL will now
know the privileges and you'll be able to login with your new password:
(5)mysql -uroot -pabcd mysql
(1)service mysql stop
# wait until MySQL shuts down. Then run
(2)mysqld_safe --skip-grant-tables &
# then you will be able to login as root with no password.
(3)mysql -uroot mysql
# In MySQL command line prompt issue the following command:
(4)
UPDATE user SET password=PASSWORD("abcd") WHERE user="root";
FLUSH PRIVILEGES;
# At this time your root password is reset to "abcd" and MySQL will now
know the privileges and you'll be able to login with your new password:
(5)mysql -uroot -pabcd mysql
Mysql Replication
Follow the steps if you want to do Mysql Replication.
Example:-
MySQL Server A and Server B
(1) Database should be same on both servers.
(2) Create Slave User on each of the 2 servers:-
USE mysql;
INSERT INTO user(User, Passsword, Select_priv, Reload_priv, Super_priv, Repl_slave_priv) VALUES
('USR','PASSWD','Y','Y','Y','Y');
FLUSH PRIVILEGES;
(3) Configuring the MySQL servers:-
- Know IP address of each servers.
- Edit my.cnf or my.ini
Server A
========
server-id = 1
replicate-same-server-id = 0
# Configuration variables that prevent key collisions.
# auto-increment-increment = N [N: No of servers in the replication setup]
# auto-increment-offset = 1
# auto-increment-offset and server-id should be integer, same and consecutive.
auto-increment-increment = 2
auto-increment-offset = 1
master-host = <IP of Server B>
master-user = <slave user>
master-password = <slave password>
master-connect-retry = 60
replicate-do-db = <DB Name>
log-bin = C:\mysql\log\log-bin/log # Change this path as per your system
binlog-do-db = <DB Name>
Server B
========
server-id = 2
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 2
master-host = <IP of Server A>
master-user = <slave user>
master-password = <slave password>
master-connect-retry = 60
replicate-do-db = <DB Name>
log-bin = C:\mysql\log\log-bin/log # Change this path as per your system
binlog-do-db = <DB Name>
- Restart the 2 servers.
(4) Syncronizing the servers.
slave stop;
show master status; # Use result of Server A to Server B
CHANGE MASTER TO MASTER_HOST='<master's IP>',
MASTER_USER='<slave user>',
MASTER_PASSWORD='<slave password>',
MASTER_LOG_FILE='<master's log file name>',
MASTER_LOG_POS=<master's log file position>;
start slave;
show slave status;
(5) Reseting Replication
- Shutdown both servers
- delete relay logs
- follow steps (1) to (4) again
(6) Testing
- Primary keys generated on Server A should be odd numbers
- Primary keys generated on Server B should be even numbers
Example:-
MySQL Server A and Server B
(1) Database should be same on both servers.
(2) Create Slave User on each of the 2 servers:-
USE mysql;
INSERT INTO user(User, Passsword, Select_priv, Reload_priv, Super_priv, Repl_slave_priv) VALUES
('USR','PASSWD','Y','Y','Y','Y');
FLUSH PRIVILEGES;
(3) Configuring the MySQL servers:-
- Know IP address of each servers.
- Edit my.cnf or my.ini
Server A
========
server-id = 1
replicate-same-server-id = 0
# Configuration variables that prevent key collisions.
# auto-increment-increment = N [N: No of servers in the replication setup]
# auto-increment-offset = 1
# auto-increment-offset and server-id should be integer, same and consecutive.
auto-increment-increment = 2
auto-increment-offset = 1
master-host = <IP of Server B>
master-user = <slave user>
master-password = <slave password>
master-connect-retry = 60
replicate-do-db = <DB Name>
log-bin = C:\mysql\log\log-bin/log # Change this path as per your system
binlog-do-db = <DB Name>
Server B
========
server-id = 2
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 2
master-host = <IP of Server A>
master-user = <slave user>
master-password = <slave password>
master-connect-retry = 60
replicate-do-db = <DB Name>
log-bin = C:\mysql\log\log-bin/log # Change this path as per your system
binlog-do-db = <DB Name>
- Restart the 2 servers.
(4) Syncronizing the servers.
slave stop;
show master status; # Use result of Server A to Server B
CHANGE MASTER TO MASTER_HOST='<master's IP>',
MASTER_USER='<slave user>',
MASTER_PASSWORD='<slave password>',
MASTER_LOG_FILE='<master's log file name>',
MASTER_LOG_POS=<master's log file position>;
start slave;
show slave status;
(5) Reseting Replication
- Shutdown both servers
- delete relay logs
- follow steps (1) to (4) again
(6) Testing
- Primary keys generated on Server A should be odd numbers
- Primary keys generated on Server B should be even numbers
Are you sure you want to navigate away from this page ?
Dynamically add and remove rows in a HTML table using Javascript
Add Row to Table
var Tbl, Tr, Td, data;
STEP:1
Tbl = document.getElementById('tbl_id');
STEP:2
Tr = Tbl.insertRow(Tbl.rows.length);
// if a table has already four rows, Tbl.rows.length = 4
// row 0, row 1, row 2, row 3
// so, new row index is 4 i.e. row 4
// you can set attributes runtime as follow.
// e.g. if you want to set "id" for newly created row.
Tr.setAttribute('id', 'some_id');
// you can apply style runtime as follow.
// e.g. if you want to set background color for newly created row.
Tr.style.backgroundColor = "#000000";
STEP:3
// next step is - to create TD
Td = Tr.insertCell(Tr.cells.length);
// initially Tr.cells.length=0; bcoz you have just new created row with no TD
// for TD also, u can set new attributes & apply styles run time; as done for row.
STEP:4
// next step is - to append data to TD for display.
// you can use either of the suggested options
// option #2 is preferable, as it will work fine on firefox and IE.
// In some case option #1 may be fail.
// option #1 e.g.
Td.innerHTML = "<input type='text' id='email' name='email' value='abc@xyz.com'>";
// option #2 e.g.
data = document.createElement('input');
data.setAttribute('type', 'text');
data.setAttribute('id', 'email');
data.setAttribute('name', 'email');
data.setAttribute('value', 'abc@xyz.com');
Td.appendChild(data);
// Repeat STEP 3 & 4 to add more columns to a row.
// Repeat STEPS 2, 3 & 4 to add more rows to table.
Remove Row from Table
var Tbl, Tr, Td, data;
STEP:1
Tbl = document.getElementById('tbl_id');
STEP:2
// this will delete last row.
Tbl.deleteRow(Tbl.rows.length - 1);
// you can pass index of you row, if you want to delete perticular row.
// e.g. if a table has four rows, Tbl.rows.length = 4
// and you want to remove 2rd row from your table.
// in this case your row index is 1
// Tbl.deleteRow(1); will remove 2nd row.
var Tbl, Tr, Td, data;
STEP:1
Tbl = document.getElementById('tbl_id');
STEP:2
Tr = Tbl.insertRow(Tbl.rows.length);
// if a table has already four rows, Tbl.rows.length = 4
// row 0, row 1, row 2, row 3
// so, new row index is 4 i.e. row 4
// you can set attributes runtime as follow.
// e.g. if you want to set "id" for newly created row.
Tr.setAttribute('id', 'some_id');
// you can apply style runtime as follow.
// e.g. if you want to set background color for newly created row.
Tr.style.backgroundColor = "#000000";
STEP:3
// next step is - to create TD
Td = Tr.insertCell(Tr.cells.length);
// initially Tr.cells.length=0; bcoz you have just new created row with no TD
// for TD also, u can set new attributes & apply styles run time; as done for row.
STEP:4
// next step is - to append data to TD for display.
// you can use either of the suggested options
// option #2 is preferable, as it will work fine on firefox and IE.
// In some case option #1 may be fail.
// option #1 e.g.
Td.innerHTML = "<input type='text' id='email' name='email' value='abc@xyz.com'>";
// option #2 e.g.
data = document.createElement('input');
data.setAttribute('type', 'text');
data.setAttribute('id', 'email');
data.setAttribute('name', 'email');
data.setAttribute('value', 'abc@xyz.com');
Td.appendChild(data);
// Repeat STEP 3 & 4 to add more columns to a row.
// Repeat STEPS 2, 3 & 4 to add more rows to table.
Remove Row from Table
var Tbl, Tr, Td, data;
STEP:1
Tbl = document.getElementById('tbl_id');
STEP:2
// this will delete last row.
Tbl.deleteRow(Tbl.rows.length - 1);
// you can pass index of you row, if you want to delete perticular row.
// e.g. if a table has four rows, Tbl.rows.length = 4
// and you want to remove 2rd row from your table.
// in this case your row index is 1
// Tbl.deleteRow(1); will remove 2nd row.
function recordSort() is approved by www.php.net
Hello Guys,
Function recordSort() is approved by www.php.net
Now it is part of PHP manual under comment section for asort() function.
Follow the link to see the comment.
http://us.php.net/manual/en/function.asort.php
Thursday, April 26, 2007
Sort two dimensional array in php
function recordSort()
It will sort 2d array. It is really helpful as most PHP sort functions provides facility for sorting 1d array & multi dimensional array sorting is not handy.
Normally this function will help u.. if u r displaying some records n u want sorting by clicking on some column. basically same is achieved by direct SQL changes like ORDER BY ASC/DESC.
but in case, if your records are not actual records, this function will help.
i.e. some table has following fields in DB.
name, email, telephone, are_you_married
are_you_married is either 0 / 1
now u r displaying N for 1 and Y for 0
and you want sorting on are_you_married on display. then ORDER BY ASC/DESC. will not work. So, try this…
It will sort 2d array. It is really helpful as most PHP sort functions provides facility for sorting 1d array & multi dimensional array sorting is not handy.
Normally this function will help u.. if u r displaying some records n u want sorting by clicking on some column. basically same is achieved by direct SQL changes like ORDER BY ASC/DESC.
but in case, if your records are not actual records, this function will help.
i.e. some table has following fields in DB.
name, email, telephone, are_you_married
are_you_married is either 0 / 1
now u r displaying N for 1 and Y for 0
and you want sorting on are_you_married on display. then ORDER BY ASC/DESC. will not work. So, try this…
/* function to sort 2d array, PHP sort functions i.e. sort(), ksort() etc provides facility for sorting only 1d array */
function recordSort($records, $field, $reverse, $defaultSortField = 0)
{
$uniqueSortId = 0;
$hash = array();
$sortedRecords = array();
$tempArr = array();
$indexedArray = array();
$recordArray = array();
foreach($records as $record) {
$uniqueSortId++;
$recordStr = implode("|", $record)."|".$uniqueSortId;
$recordArray[] = explode("|", $recordStr);
}
$primarySortIndex = count($record);
$records = $recordArray;
foreach($records as $record) {
$hash[$record[$primarySortIndex]] = $record[$field];
}
uasort($hash, "strnatcasecmp");
if($reverse)
$hash = array_reverse($hash, true);
$valueCount = array_count_values($hash);
foreach($hash as $primaryKey => $value) {
$indexedArray[] = $primaryKey;
}
$i = 0;
foreach($hash as $primaryKey => $value) {
$i++;
if($valueCount[$value] > 1) {
foreach($records as $record) {
if($primaryKey == $record[$primarySortIndex]) {
$tempArr[$record[$defaultSortField]."__".$i] = $record;
break;
}
}
$index = array_search($primaryKey, $indexedArray);
if(($i == count($records))||($value != hash[$indexedArray[$index+1]])) {
uksort($tempArr, "strnatcasecmp");
if($reverse)
$tempArr = array_reverse($tempArr);
foreach($tempArr as $newRecs) {
$sortedRecords [] = $newRecs;
}
$tempArr = array();
}
}
else {
foreach($records as $record) {
if($primaryKey == $record[$primarySortIndex]) {
$sortedRecords[] = $record;
break;
}
}
}
}
return $sortedRecords;
}
$array[0][0] = 'nilesh'; // sort_index = 0
$array[0][1] = 'yogesh'; // sort_index = 1
$array[0][2] = 'aakash'; // sort_index = 2
$array[0][3] = '100'; // sort_index = 3
$array[0][4] = 'nilesh'; // sort_index = 4
$array[0][5] = 'Nil100'; // sort_index = 5
$array[0][6] = 'Y'; // sort_index = 6
$array[1][0] = 'Nil100';
$array[1][1] = '1001';
$array[1][2] = 'nilesh';
$array[1][3] = 'nilesh';
$array[1][4] = 'nilesh';
$array[1][5] = 'yogesh';
$array[1][6] = 'Nil100';
$array[2][0] = 'Nil100';
$array[2][1] = 'Y';
$array[2][2] = '100';
$array[2][3] = '10nilesh';
$array[2][4] = 'aakash';
$array[2][5] = '_aakash';
$array[2][6] = 'aakash_';
echo "array before sorting..."
print_r($array);
/* $sortedList = recordSort(2d_array, sort_index, reverse, second_level_sort_index_if_duplicates_found_default_is_0 = '0'); */
$sortedList = recordSort($array, 4, 0, 5);
echo "array after sorting..."
print_r($sortedList);
Subscribe to:
Posts (Atom)