Welcome to my blog. GeekAndPirate is all about the web programming tricks,tools and techniques that I will be sharing with you. I will be also sharing all the tricks and techniques of hacking stuff(yeah that's true!!) I would be also interested in talking about the latest developments about the world of the WEB. So stick with me!

Monthly Archives: December 2010

SEO – Best Practices

There are some basic rules for SEO which if followed, can assure your site a good rank in a search engine. These are very basic and easy to follow.

Relevant keywords – Use a keyowrds in <meta> tag that are only relevant to your site. The keywords in meta tag must appear anywhere on that page. Giving link to those keywords provides added advantage. Also use keyword rich meta descriptions.

You can also use analytical tools which gives you idea about for what keywords, the search engine are sending the traffic to your site. You can rearrange your keywords using these tools.

Title Tag – Use of title tag is very essential in SEO. Title tags describes what the page is all about and is a major factor for search engine to decide whether to show your site in search result or not for a particular keyword. Use a meaningful title for a page which clearly describes what the page is all about. Use a keyword for title which comes frequently in the page. You can have a title as Brand name | primary Keyword vice versa.

One important thing to consider for title tag is that it should be less than 70 character in length. This limitation is imposed by search engines.

Use <h1> Tags – Use <h1> tags for the content title on the page. Search engine bots will crawl this more easily and it will act as a keyword for the page
Use alt attribute – Many web developers don’t use the alt attribute for <img> tags present on the page. ‘alt’  attribute acts as a keyword for the page and search engine spiders uses this attribute while crawling the page. It will also improve the your site ranking for the Image search.

Use HTML Sitemaps – Sitemaps acts like anchor to the site where user can easily learn and access the whole site. Sitemaps contains links to the various section for the site. One should use HTML site maps in the site for SEO. Search engine Spiders crawls the pages and if they encounter any link (that is <a> tag) , that link is added to the list of links to be crawled. So ultimately cross-linking your site improves your SEO score.

URL –  Optimized url for SEO should have following things

–  They shoud use hyphens instead of spaces and underscores
–  Ideally, they should not use any parameter, but this is not practically possible in many cases. Try to keep the parameters to one to two.

Ideally, URL should look like this –

URL shows the site and a web page to a visitor. So they should be relevant and  ‘describe’ what the site and page is all about. If site’s structure has several levels of navigations, then url should reflect this with folder/subfolder structure. A meaningful URL improves semantics and relevance of the page

Site design – Use w3c xhtml validator to check for the design errors in your site.  Avoid design of your site using <table>. Instead, use <div>.

Author and Robots tag – Author tag contains the name of your company, which will help you in getting number 1 position for your company while  Eg. searching. Eg. <meta name=’author’ content=’Adroitcoders’ />

Robots tag instruct the search engine robots to crawl the page
<meta name=’robots’ content=’index,follow’ />

XML sitemap – XML sitemaps are used by search engine in order to index through the site. Many site provides the tool to generate the xml sitemap for free. You can then submit this sitemap to search engine through their webmaster tools.

Use of Social Media –  Use social media to advertise your site as much as possible. Use sites like facebook, twitter, LinkdIn and social bookmarking tools like diggm delicious to advertise your site or blog. If you are having quality content, your posts will receive high votes and soon your site will become popular.



missing ) in parenthetical

Today, while working on one of my project, I got this javascript error .

missing ) in parenthetical

This error comes due to incorrectly formatted json string.

I was trying out an ajax based image upload jquery based lib. I was using json as a response type from my server. I also noted that this error was coming while uploading only one specific image, the rest of images were working quite nicely.
I was quite confused about this error and was wondering what is wrong with this specific image. What I found out is that the image was corrupted, so my server (php) script was throwing some php errors. As I was using json as my response type, it was not properly formatting the json response, creating some invalid json string, which in return was causing error on client side (js) .
My solution was to remove any php error so that json will be formated properly. My solution was like
$data = array( “status” => “error”);
echo json_encode($data);
The php ob_clean() function cleans the output buffer. So any potential php error which might have occurred during  file resizing will get clean out and the json format will remain valid and intact.
So remember. If you see this missing ) in parenthetical error in your firebug, this is due to you got some badly formatted json string!

Hello world!

Welcome to This is your first post. Edit or delete it and start blogging!