Basic Database Design tips for Relational Database

Database is one of the biggest bottleneck of a Web App performance now a days.

A poorly designed database can make your life hell as a dev while optimizing an app.

On the other hand, A good design can speedup your development process along with the performance of the app.

I’m also learning the basics of database design, in that process here listing some basic tips.

  • Actually draw the design on a big paper.
  • List down all columns you may need.
  • If you have confusion about a column (you may need or not), list it down.
  • Now break those into multiple tables.
  • Don’t keep any irrelevant data on a table, better use additional table.
  • As it’s a relational database design, check your relations properly.
  • For MySQL advanced engines like InnoDB supports relations inside database end, use them, This way you’ll have to write less code and less query.
  • Now run your design through Normalization Form (NF) rules.

As I always say, Database design is almost 30% of whole development process for me. With a solid design I can write code very confidently.
So think before the design, don’t be upset later.

If you have any other point, please let me know via comment. I’m eagerly waiting to learn something new.

Goodbye, welcome

Yesterday got a brand new called
I was searching for a own name domain from a long back. Specially after getting my MacMini. People started irritating me as i derived from iOS of ibabar. :P
Unfortunately for Babar The Elephant, it was very hard to get domains for me!

Day before yesterday, even thought of the domain name and posted it on facebook!

Someone suggested me, liked it.
Whoished from terminal, it said it’s free yet!

Went to NameCheap, they says it’s not free! Damn.

Later yesterday morning, went to, and they said it’s free! Only then I noticed NameCheap actually doesn’t sell .im domain, they showed me result for!

And yeah, I bought it from and it’s live now.

So, site is from now on

Farewell, thanks for your service mate. :)

And warm welcome to

Determine MySQL Database Size

Simple tips.
Sometimes we want a summery of size consumed by our databases in MySQL engine.
Here is a simple SQL snippet for that.
This will list all databases that current MySQL user can access and list their size in megabyte.

Tested it on MySQL, on other databases, may also work.
Hope it helps you.

Why my WP_AJAX returning Zero (0) with my response?

Wrote a start up post on WP_Ajax last time.

Some of you may still surprise, why the callback function for WP_Ajax returning an additional 0 or something else which is very unwanted at the end of your own response.

It’s annoying and at first you may get caught confused.

Actually the thing happened for a little different nature of WP_Ajax.

We usually use a return to end a function, but for callback function of WP_Ajax you are doing this wrong.
You’ll have to use die() or exit at the end of your code instead of return for a clean output.

Only this way you can have a clean output without any 0 or something else.

How to properly work with AJAX on WordPress (WP_AJAX)

Hi there.

This time I’m back with WP AJAX.
Simple to use and easy to code.

Actually using Ajax directly into your plugin or theme is a little immature way. Cause you’ll have to keep track of your files to make it work, which sometime become difficult. That’s where WP_Ajax make things comfortable.

I’ll share sample codes with you and will try to explain how it works.

To follow this tutorial you need to have basic understanding of AJAX, WP Plugins, WP Hooks and some other things.

To initialize AJAX let’s write a sample Ajax code.

jQuery('#ajax-button').on('click', function() {
action: 'our_ajax_action',
myname: 'Babar'
function( response ) {

We’re binding our click action on a button with id ajax-button. “ajaxurl” is defined by WP which is actually <?php admin_url().’/wp-ajax.php'; ?>. And notice the action parameter. We’ll use that later.

Now filter it into the footer.

function our_footer_js_for_ajax() {
<script type="text/javascript">
jQuery('#ajax-button').on('click', function() {
action: 'our_ajax_action',
myname: 'Babar'
function( response ) {
<?php }
add_filter('wp_footer', 'our_footer_js_for_ajax');

If you want it onto admin area, filter it in admin footer.

add_filter('admin_footer', 'our_footer_js_for_ajax');

Now time for our AJAX handler.

function our_ajax_handler_callback() {
echo $_POST['myname'];

Always remember to die() or exit at the very end of the handler function.
Hoot it into Ajax action. Remember our Ajax action we wrote in our JS code? We’ll use it here.
add_acton('wp_ajax_our_ajax_action', 'our_ajax_handler_callback');

So it’s actually Concatenate of wp_ajax_ prefix and your action data in Ajax code.

If you want to activate Ajax for non-logged in users another hook needed.

add_action( 'wp_ajax_nopriv_our_ajax_action', 'our_ajax_handler_callback' );

Just prefeix with wp_ajax_noprov_ instead of wp_ajax_.

And that’s it.