Values to be Successful 

No Comments

What are the qualities of a successful person ? 

To frame it for in other way what qualities a person should posses to make him successful? 

Surprisingly these qualities are very very simple but makes the person very very great. The values are taught to us as value education in our primilimary knowledge centers. These values are:

  • Honesty
  • Forgiveness
  • Patience 
  • Punctuality
  • Discipline
  • Consistency
  • Hardwork
  • Kindness

The Great Indian Marriage !

No Comments

Indian Marriages are a state of art in the world !! Everyman behaves as a ‘dulha’ and the dulha is the godfather of everyone.Not the same scenario with the dulhan though she is as afraid as a goat being taken to ritual a volcano ! Not to mention the huge drama when the final vidaai scene of the goat separation from her owner.And then comes the Dance the floor contest ‘The baraat’

Dancing crazily in a Marriage procession is literally like getting drunk… You know your path to get home but no-one cares which steps you take to get it there !

You should well know that 80% of marriages in India are still arranged and of them only 5% get apart a nice figure in comparison to developed countries.But the romanticism of the arranged couples is worth watching curiously if you are bored listening to drainy music of ‘shehnai’ which is normally played in the Indian Marriage.The couple produces a coupling force on every unknowing touch like a repellent magnet poles.

Its one of the auspicious moment so as usual carried by a bhatji which is the superstar playback singer of this musical event who lures others by his Sanskrit songs which only he would be able to understand ! that too I am saying this with certain amount of doubt.Other people I mean all except bride and groom just want him to finish it soon and have a run for their food the most authentic part of the Indian Marriages with a wide variety of cusines.

In an altogether joyful day its a great reason for long long families to get united, meet each other have a long gossip and spend the entire day jubilantly and a day out of your daily chores to get a long lasting refreshment !

Sorry Microsoft ive Abused u many times !

No Comments

I always abused microsoft but some of answers which CEO Systenics gave to me were really uncovering the shadow of the sins of Silicon Valley.

The BIG WAR :: Why Proprietary..? Why not use free why not open-source

Ans: firstly no one in this world goes for doing ‘seva’ of his livelihood the code on which they live.So nothing in this world is free if u talk abt php when it comes to acclelrator framework like Zend where is it free then…if u talk about linux we use Redhat where is it free then..?
Secondly Open Source ! u tell me whether do u understand even a line of it >>?? what has been written ? so wats d point in talking about it.


if he did not had agreed that i wud have loved to hate him ^_^ but the answer which he gave made me to love him ^_^

He said agreed today there is nothing as efficient as compiling on the machine or fighint nd gaining that megabytes of mem or saving some clockcycles ,b ut now we dont have to save hardware resources its way back 10-20 years ago wen we did that now the ratio has turned to such a scenario that this law has inversed.Now we have to save development time not resources…we cant waste time to save 2MB memory working over it for 2hours ! dats inefficient.

Visual Studio and Other tools does not give the idea of what real programming is they write most of code for us so how wil a programmer switch to other language if suppose he does not only know what happens in background?

Whatervery happens in background is the ‘dirty work’ U should always concentrate on business logic nd ur ideas nd should not be concerned about all low level details nd obviously these are going to be changed soooner or later as technology changes !!! So its better to write dry code(dry code is dnt repeat urself principle).

Netiquettes | Email etiquettes : Rules to guide you how to behave on the Internet

No Comments

Netiquette is the civilization on the internet, its like many people live in this world but don’t know how to behave; Netiquette teaches how to narrow the communication gap on the internet if it happens due to any miscommunication in typing, reading or writing for example you cannot type a request email as you text your friend this is a common email etiquette yet uncommon !

These are some rigid practical rules to organize the unorganized world of the internet.To demonstrate I have used it practically how email etiquettes work in reality.

  2. Typingg repeatteddly likkke thisss looooks as ifff youuuu areeee yelllinggg at meeeee?????? pleasssse avoidddd ittttt.thankkkk youuuuu.
  3. Writing in BOLD is emaphasising a point may grab unnecessary attention like this.Dont use it everywhere.
  4. Use proper. punctualtion, marks ! typing error free punctuations is a matter of just looking at the content the second time but it prevents misconception about the meaning of your conversation.
  5. Shrtning wrds in a txt msg mght save bndwdth dnt evr save it on ta intrnt evn if ure usin a 56k modem.
  6. The simplest thing is to write it thinking as if you would have written the same content on a letter.
  7. Use smileys  to make reader  understand your feelings elaborately  but use it sparingly.
  8. When commenting on blogs and forums or replying to an email, wait overnight to send emotional or unhealthy responses.
  9. Be Human and so be careful what you say to others it should not hurt them publically.
  10. When posting on social networks do remember that your posts are going to be read across by large network which includes your Boss, primary teacher or your well known relatives.

Creating a local clone of Mysql Database

No Comments

Times when you want to work with the local copy of the website or application you might want to take the real database and replicate it to provide you with a local copy of the live mysql database.

To do this just execute the following command 

mysqldump -h [server] -u [user] ‘-p[password]’ db1 | mysql -h [server] -u [user] ‘-p[password]’ db2

Garpeeth and Government

No Comments

Year 2014, the unfornate farmers have faced another consequence of a fiercy nature who have lost their yield.Many farmers are committing suicide they think this is the only way left for them as they have already been in debt and now this !

Survival of the fittest.

Mr. Darwin would say his law holds right in 2014 also and man who has made enormous progress in science and technology must not be overwhelmed to challenge the breadth of nature, the laws of nature even holds today.In the olden times was there any government whi would have given compensation ? what is the role of governwment. Yes they collect tax but farmers are by and large exemptedfrom the taxes also.The hype created by media and journalists is worth watching how they can  defame anyone.

Overloading in PHP with Example

No Comments

Function overloading or method overloading is a feature that allows creating several methods with the same name which differ from each other in the type of the input parameters. It is simply defined as the ability of one function to perform different tasks. For example, doTask() and doTask(object O) are overloaded methods. To call the latter, an object must be passed as a parameter, whereas the former does not require a parameter, and is called with an empty parameter field. It is a form of static polymorphism which .The decision to call an implementation or another is taken at coding time.

Lets take the famous area example which will calculate the area depending on the number of inputs given:

 * Don't try this at home, will be fatal !!

class Shape {
 function area(){
  return 0 ;
 function area($radius){
  return PI * $radius * $radius ;
 function area($length,$breadth){
  return $length * $breadth ;

$circle = new Shape();

$rect = new Shape();


This is erroneous  since php will say you have declared this method twice . Other languages says its fine and calls it static polymorphic i.e method overloading. You have to use PHP’s magic methods to achieve method overloading in PHP.


class Shape {
const PI = 3.142 ;

function __call($name,$arg){
	if($name == 'area')
			case 0 : return 0 ;
			case 1 : return self::PI * $arg[0] ;
			case 2 : return $arg[0] * $arg[1];
$circle = new Shape();
echo $circle->area(5);

$rect = new Shape();
echo $rect->area(5,10);


Deny folder and all the subfolders in Apache with .Htaccess

No Comments

You have a folder inside which there are library files which you don’t want to show it to the end-users.

RewriteRule ^subfolder/ - [R=404,L,NC]

You can send any type of HTTP status code with this. If you want to show a Forbidden error you can show R=403.

L tells that this is the last rule and discard any rule after this.

NC is used for Case Insensitive.

Move website from root directory to subdirectory by .htaccess

No Comments

Well known web hosts like hostgator does not allow moving your primary domain to a different subdirectory. The problem is that you will have cluttered all the primary domain’s file onto the public_html  and you are searching for a solution which will move the root to a subdirectory without visibility of the foldername in url.

This is a very common scenario and can be done by modifying .htaccess of public_html.If it doesn’t exists create it !

RewriteEngine on
RewriteBase /

RewriteRule  ^$ subfolder/    [L]
RewriteRule  (.*) subfolder/$1 [L]

This is a very very generic approach.A more productional approach is to use this.

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteCond %{REQUEST_URI} !^/subdir/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?$ 
RewriteRule ^(/)?$ subdir/index.php [L]

Line by line more specifically,

RewriteCond %{HTTP_HOST} ^(www.)?$  tells that only domain to use is this with your domain name.

RewriteCond %{REQUEST_URI} !^/subdir/ tells that if the rule does not apply if the request has a subdirectory specifically mentioned.

RewriteCond %{REQUEST_FILENAME} !-d  RewriteCond %{REQUEST_FILENAME} !-f  are pitty common which tells do not apply if the file directory exists do not apply this rule.

RewriteRule ^(.*)$ /subdir/$1  Every condition that matched the rule now apply this,  starting with anything will be forwarded to subdir.

RewriteCond %{HTTP_HOST} ^(www.)?$  Check for the condition that the request is for only domain name.

RewriteRule ^(/)?$ subdir/index.php [L]  Forward the request to index.php page in subdirectory.

Simplest chat example in node.js and socket io

No Comments

Simplest Chat Server in Node.js implemented with

I’ll directly start since you guys don’t need introduction to node.js.I would like to comment on the feature exposed in this example of Nodejs and power of javascript running in both client and server side, it can use the event emitters  – event production and consumption design pattern elegantly.

I’ll give you some brief about is a clean library with simple api calls to make possible socket level communication in node.js. It uses websocket feature in html5 but gracefully falls back to other techniques with older browsers.

Methods of

  • socket.emit(‘message’,’the message to be transmitted’); //simple transmission
  • io.sockets.emit(‘message’,”the message to be transmitted”); //send to all clients
  • socket.broadcast.emit(‘message’,”this is a test”); //send to all except sender

Let’s start creating a single room minimal chat

In this we have the following use – cases

  1. User when join the chat room, he is greeted.
  2. All Users are notified who enters the chat room.
  3. User can broadcast the message to the chat room.

Create a node module chat_server.js to achieve the above objectives.

var socketio = require('');
var io;
var guestNumber = 1;
var nickNames = {};
var namesUsed = [];

exports.listen = function(server) {
	io = socketio.listen(server);
	io.set('log level', 1);
	io.sockets.on('connection', function (socket) {
		guestNumber = assignGuestName(socket, guestNumber,nickNames, namesUsed);
		handleMessageBroadcasting(socket, nickNames);
		handleClientDisconnection(socket, nickNames, namesUsed);

function handleMessageBroadcasting(socket,nickNames){
		socket.broadcast.emit('message',{ text : nickNames[] + ':' + message.text });

function handleClientDisconnection(socket,nickNames,namesUsed){
		var nameIndex = namesUsed.indexOf(nickNames[]);
			text : namesUsed[nameIndex] + " left the chat room "
		delete namesUsed[nameIndex];
		delete nickNames[];

function assignGuestName(socket,guestNumber,nickNames,namesUsed){
	var name = "Guest " + guestNumber ;
	nickNames[] = name ;
	socket.emit('message', { text : "Welcome " + name});
		text : name + " has joined us. "
	return guestNumber + 1 ;

A static file server which listens on port 80.

var http = require('http');
var fs = require('fs');
var path = require('path');
var mime = require('mime');
function send404(response) {
	response.writeHead(404, {'Content-Type': 'text/plain'});
	response.write('Error 404: resource not found.');

function sendFile(response, filePath, fileContents) {
		200, {"content-type": mime.lookup(path.basename(filePath))}

function serveStatic(response, absPath) {
fs.exists(absPath, function(exists) {
if (exists) {
		fs.readFile(absPath, function(err, data) {
			if (err) {
			} else {
				sendFile(response, absPath, data);
	} else {

var server = http.createServer(function(request, response) {
	var filePath = false;
	if (request.url == '/') {
		filePath = 'public/index.html';
	else {
		filePath = 'public' + request.url;
	var absPath = './' + filePath;
	serveStatic(response, absPath);

server.listen(80, function() {
	console.log("Server listening on port.");

var chatServer = require('./lib/chat_server');

Now the client code

<!doctype html>
<html lang='en'>
<link rel='stylesheet' href='/css/style.css'></link>
<div id='content'>
	<h1> My Chat Room</h1>
	<div id='messages'></div>
	<form id='send-form'>
		<input id='send-message' /><input id='send-button' type='submit' value='Send'/>
<script src='/' type='text/javascript'></script>
<script src='' type='text/javascript'></script>
<script type='text/javascript'>
var socket = io.connect();
var Chat = function(socket){
	this.socket = socket ;
Chat.prototype.sendMessage = function(msg){
	this.socket.emit('message',{ text : msg });

	var chatApp = new Chat(socket);
		var newElement = $('<div  class="histext"></div>').text(message.text);
		var msg = $('#send-message').val() ;
		$('#messages').append($('<div class="mytext"></div>').text("Myself : " + msg));
	return false ;