New Year, New Server and a New Theme

Hello Everyone,

I wish I could have finished this task by 1st January, but nevertheless it’s finally done. Finally I have a new self designed wordpress theme named “Jhantu”. Also I have moved my blog from a shared hosting to my VPS due to increasing traffic.

Transition from one server to another is always painful. Here are the steps which I followed to make my server move smooth:

  • I took a dump of my blog last week and started developing new theme locally on my windows system
  • Yesterday before moving to VPS, I took the latest dump of wordpress blog (click export and download the xml file which guarantees for a smooth move)
  • However the database restoration wasn’t smooth. I found one of my previously published blog has been imported as a draft with no content inside and all comments lost. WTF
  • I had to republish it by extracting the blog content from the downloaded xml (If you are planning to move your blog, check out)
  • Then I changed the DNS settings in Godaddy, so that my domain now points to my VPS (something I discussed here before)
  • However it takes sometime before this new lookup (domain name => IP Address) is propagated worldwide. Infact even though you change the settings at Godaddy, you might continue seeing your old blog
  • I did 3 things, so that I can atleast setup the blog. Cleared browser cache, flushed my DNS lookups (run ipconfig /flushdns on command line), went to C:WINDOWSsystem32driversetchosts and made a new entry which reads: 74.86.123.245 abhinavsingh.com
  • This last entry will force your system to lookup at 74.86.123.245 for abhinavsingh.com

I guess these steps might help you if ever you plan to take the pain of server move.

Finally a bit about plugin’s powering “Jhantu”:

  • Akismet as always is guarding and saving us from spam
  • WP-Toolbar , a custom made plugin for showing a toolbar for outgoing links from my blogpost
  • My Adsense Manager a self written plug-in to embed adsense codes in between the blog posts. Will open source after some testing
  • Show your stats , yet another custom plugin to display my weekly stats on right tabs. Data derived from wordpress stats database using a cron job.
  • All in one SEO Pack, which automatically generates meta description and keyword for each blog post
  • With increasing number of visitors from european and south american citizens, I decided to have a language translator. Thanks to Global Translator for providing such an excellent plugin for translation
  • Google XML Sitemaps plugin for generating instant sitemaps as soon as I publish a new post
  • Thanks to MCEComments which will now allow you to format your comments 🙂
  • Sociable, which you will be using the most to share, print and email these posts if required. However I have customized it to also display tinyurl for the blog post and the RSS/Mail subscription links.
  • Subscribe To Comments will help you to keep upto date with an ongoing discussion
  • Get Recent Comments for keeping you in the know of latest discussions
  • WordPress Related Posts for feeding you with something similar to your taste 😉
  • WP-PageNavi for showing pagination instead of plain previous and next blog links
  • WP-Cache to handle increasing traffic
  • Syntax Highlighter making it easy for you to read through my code snippets
  • Finally WordPress.com Stats to keep a track of incoming traffic 🙂

In future “Jhantu” will be made open source, so that you can run your blog using it. Do let me know your feedbacks about the new theme inspired from Google Code.

What happens before you finally viewed this page?

Since past 1 week or so I am trying to make a small tiny light weight web server of my own, and for the same I have been referring to dozens of papers, websites, people and what not. I still haven’t finished making one, I am still toggling between Java and Python, since both seems to satisfy my needs and unfortunately I am master in none. While I was digging deep into the theory of how can I make a web server, I cleared many other concepts of mine, which finally leads to this post.

“What happens before you finally viewed this page/post of mine ?” – Many of you might know behind the scene stories and many like me might have a vague idea. But for the good of all those who don’t know and for people like me who needs a reference, I thought of better penning it down.

Lets see what possibly is going in the background:

  1. Suppose you type in http://www.yahoo.com in your web browser or clicked this link on some other page.
  2. Your browser see’s the above URL, and identifies it as a HTTP protocol.
  3. Then it breaks the URL into Protocol, Domain Name, File Name (in above case no file name is specified)
  4. Browser contacts its default DNS (Domain Name Server), which helps it with an IP Address. DNS is a huge distributed database which contains mapping of URL’s to IP Address. Your browser’s default DNS might or might not have the required mapping of URL to IPAddress.
  5. If it don’t have the IPAddress corresponding to http://www.yahoo.com , it will try to contact other root name servers for the required IPAddress.
  6. If it already have the IPAddress corresponding to http://www.yahoo.com (which is possible if a similar request has already been made recently) it will provide the required IPAddress to your browser.

And finally your browser then connects to the IPAddress it received and servers you the page returned back by Yahoo!. If you are still not clear about the process, following practical example might help you.

  1. I thought of starting a website and decided to name it as http://gtalkbots.com
  2. Firstly, I needed to register domain name with a registrant. For e.g. In my case I blocked the domain name gtalkbots.com with godaddy.com.
  3. Secondly, I needed to have a machine i.e. a place where I can have all my HTML, PHP files. So I bought a VPS (Virtual Private Server)
  4. Thirdly, I had to link the above two i.e. when someone types in http://gtalkbots.com in his browser, it should come to my VPS where I have my HTML files.
  5. For linking the domain name and my VPS, I simply make an ARecord entry at godaddy, telling it the IPAddress of my VPS. In turn when you type in http://gtalkbots.com in your browser, GoDaddy redirects you to my VPS. (Google for ARecord and CNAME for more details)
  6. Last 4 entries in the image above are for linking my gtalkbots.com domain with my google apps account, so that I can send and receive my gtalkbots.com email on google apps.

There is a lot more to it, however the info above is more than sufficient to understand the basics of
“What happens before you finally viewed this page/post of mine ?”

How to get started with web development?

Many of my friends have asked me on how to start with web development. I am not expert but here in this post I would like to describe a few steps that might help one climb the ladder of web development fast. Kindly feel free to add to this blog post if you think some other methodology might be better off.

  1. Where do I start web development? Well the first and best place to start web development is your own system. Yes your very own personal computer. You don’t need a server on internet to start with. Infact I worked locally on my computer for about a month before I went for free hostings, shared hosting and finally VPS. Once you feel that you are comfortable enough with the tid-bits of web development, then you can move to one of them.
  2. How to configure my local computer for that? You have a number of options to start with. I personally started on Tomcat Server after my initial training at Oracle. Tomcat is suited if you are starting with JSP (Java Server/Servlet Pages) . I started by making a few basic pages like creating a login/registration system. I made a few and then hosted on my office computer. Distributed the links to a few around to get the much needed boost. (Yes if you are into web development you need a lot of encouragement and appreciation from others, else your enthusiasm can soon die out). However I soon realized that in todays world of web 2.0 Tomcat is not the thing. So I shifted to Apache.

    Next option you have is to go for Apache (which I use currently for all my developments). I have written 2 posts on how to configure your local system for the same. Read it here: Web Development Part 1 Apache MySQL PHP . If you are interested in starting on a unix machine (which is always the best thing to do) here is the post where I described: How to configure Ubuntu and LAMP on Windows.

  3. Things to concentrate upon initially? Before you go for any big big applications its better to get your basics right. I sucked for long while working with out dated styles and methodology. Here is a bunch of things which you should initially look to:
    • Choose the <div> style to create your HTML pages. I didn’t knew about this methodology and even went ahead to release Altertunes with <table> structure HTML pages.
    • While looking around on internet you will find loads and lot of framework offerings. They really make your work sooo simple. Takes all the burden away from you. Solves all cross browser compatibility for your application and what not. Find a list of frameworks I have tried before here: Essential Frameworks for web development
    • However one thing which you lose by using such frameworks is the insight. You never get to know what cross browser compatibility issues comes and how are they solved. They provide you easy ajax requests but you never get to know the methodology behind it. The biggest drawback which I find is that even for a simplest of application you always need to include whole bunch of files from framework hence making your application heavy for no reason.
    • Hence I finally went ahead coding everything from scratch and never ever used any framework for any of my works.
    • You need to learn how to prevent XSS (Cross browser scripting) and SQL Injection in your applications. Something very important for all your applications.

  4. Getting to a free hosting server: After initial play at your PC, its time to get to a free hosting server which brings in more knowledge and experience. I am lucky in the fact that I moved to X10 Hosting for the very first time. In my opinion they are one of the best in providing free hosts. The amount of features and largely the amount of support at their forums make them the best free hosting services around. I started with http://imoracle.x10hosting.com as my first ever site. Few applications which I build on that were:
    • User login and registration system, where user was authenticated by an link sent to him through email.
    • Inside I had a few basic applications including contact form, multiple picture uploads etc etc.
    • One of the finest feature I had in that was Gmail Contact Import script, which I made using PHP Curl application.
    • Last but not the least I built a chat application similar to browser based chat applications in google and yahoo mails. (Though not that efficient). That was first and the last time I used a framework for any of my application. It was built using Prototype Windows Class framework.

    I told you about these features as these were the applications which got me started initially. Helped me learn the tid bits of web development. May be you too can give a try to a few of them as your first few applications.

  5. Altertunes: Must be wondering why is this name up here again. Well I agree Altertunes fails as a full time product on web but then actually this self initiated project helped me learn all and everything about web development. It was hugely an ajax dominated website with ajax requests flowing in and out of everything you do inside. Basically the social networking aspect inside altertunes helped me learn most of the things. Key things inside altertunes which helped me develop my web dev skills are:
    • Social networking aspects like adding friends, sending personal messages, dedicating a song to your friends etc etc.
    • Importing Gmail, Yahoo and other email contacts. I initially used self made gmail address book import script. But then probably Gmail changed the ways on their mail and my script started failing. However I was lucky to find various services which helps you import mail contacts.
    • Creating of search bots for mp3. This was one of the things done in PERL instead of PHP. Read my blog on how to create an html parser using PERL here. This search bot was similar to any other search bot but it only used to index mp3 files in the database.
    • Use of various web services API’s like Artist Recommendation API by last.fm, Video API by YouTube, Pictures API by Google.
    • Features like creating your custom playlists, bookmarking artists, creation of analytic backend engine to provide users with the best recommended songs based on users listen history.
    • Finally, I learnt to make custom web players. Alterplayer which I made using OpenLaszlo, was something which I did out of PHP, MySQL, Apache.
    • Being at Oracle at that point in time, helped me in maintaining such a relational database with ease.
    • Auto suggest feature which is similar to google auto suggest. Altertunes used to offer you artist names as you typed in the name of the artist.
    • News from Google and Yahoo news. As there were no API’s available for this, I scrapped the google and yahoo news using PERL scripts and showed them to the users. (Illegal it was though) 😉

    However I must say that your website is not complete till you have all the look and feel and User Interface to lure the users. Initially I thought that the UI is coming up good but then as the features which I wanted to offer increased and with my sucking <table> structured HTML pages everything got screwed. However Altertunes helped me develop my web dev skills a hell lot and helped me understanding the right way of doing things. Probably picking up a small project for yourself is always the best idea, as then only you will always try to make your application look more professional.

  6. Time for a shared host : As the traffic increased on Altertunes I had to quickly shift to a shared hosting. I again went for a shared hosting at X10, where I bought a hosting server for around 80$ a year with 99% uptime till date. All my websites including Altertunes, My personal website and a few other under ground works of mine are hosted on the same shared host. Basically shared host assures you of more % uptime, more bandwidth and more forum support from X10. Those guys just go out of their ways at times to help you out.

    However you always have few drawbacks of a shared host:

    • First of all its a shared host i.e. a single CPU with many document roots (one root for each client) in it. At times hosting service providers over shoot the maximum allowed roots on a single CPU, which makes your CPU share low. And hence sucking performances.
    • Your site can go down even without a single error from your side. Yes this is the case which happened with me, when one of the other user on the same CPU set up a cron job (an automated job which runs every X hours) to take a backup of his server every 1 hour. Well in that case every single hour he used to consume maximum CPU cycles and hence all other users their started experiencing major downtimes. However X10 forum moderators are kind enough. They take immediate actions in such cases and ensure everything is fine.
    • You can’t have all PHP PEAR and Perl modules installed. I wanted to have a PHP PERL module installed for me by which I can write perl codes inside my PHP script. But as its a shared host and a package installed effects everyone on the CPU, I was denied by the X10 hosting admins.
    • Similarly for creating a upload meter application you need to have APC (Alternate PHP Cache) module enabled on your server. And I was again denied this package by the X10 hosting as they will cache all other users file which they might not want to.
    • Finally the biggest drawback is that you don’t have access to the httpd.conf i.e you apache server configuration file and your php.ini your php configuration file. Which at times you may want to change to meet your applications demand.

  7. Finally time for a VPS (Virtual Private Server) : When you start feeling you want a total control on your server and applications, its time to switch to a VPS. However they will cost you more than expected. I started with VPS at VPSFarm which I must say totally sucks. Doesn’t go well for me atleast with Zero support (‘Zero’ means zero). I took the Xen 1024 plan which costs around 40$ per month. However by the time my 1st month got over X10 started offering VPS too and with my experience and relations with them I immediately shifted to a VPS at X10. It too costs me same, around 35$ per month with more RAM and more Disk Space.

    However do not move to a VPS because you want to. It takes a lot of hard work to set it up and maintain it further. You basically have no support what so ever. Your mails not going, file not loading, server down, database not working. No one is accountable for that except you. But then you get all the controls on various configuration files which means you can fine tune the system to meet your needs.

    However one thing which I miss is the comfort of CPanel which used to come in by default with free host and shared hostings. I got so used to it in last 1 year.  Plus being from ECE background doesn’t helps me a great deal either. Anyways I suppose I am here to stay on VPS for long. I am slowly migrating all my websites to VPS. 

I guess this is all I had to share here in this post. If I have missed out on anything which many of you have asked me on chat and mails kindly feel free to ask it here. If I feel I need to add anything, will do so.

For experienced developers who accidentally read till here, feel free to add anything you want to. If you feel anything was wrong in my methodology and approach do let us all know. I am still learning.

All the best for all those starting out there.

Patience is the Key I will say finally.

——————————————————————————-
Other Posts you may want to read:
——————————————————————————-