Installing MongoDB Driver (with MongoDB extension) on Ubuntu and other Linux distro.

Previously “Mongo” was the extension used for MongoDB (Legacy) driver for PHP. Now that is depreciated. Now “MongoDB” Pecl extension is used instead of  “Mongo” Pecl extension. And MongoDB Driver is PHP’s official driver for MongoDB. Here is detail of this driver on php.net: http://php.net/manual/en/set.mongodb.php . It supports PHP as well as HHVM.

To have this MongoDB driver working, you need to install pecl “MongoDB” extension.

To install PHP MongoDB on Linux, follow below mentioned steps:

  1. Run this command:
    sudo pecl install mongodb
  2. Then add following line to php.ini
    extension=mongodb.so
  3. Then you need to restart your apache or nginx . If you are using apache then use following command to reload it.
  1. service apache2 reload

    To test your installation try instantiating “MongoDB\Driver\Client” by using code similar to this one:

    $client = new MongoDB\Driver\Client("mongodb://localhost:27017");

    If it says that MongoDB\Driver\Client not found or not defined then there is chance that MongoDB driver is not properly installed. However parameters to this constructor can be changed depends on your MongoDB URL.

    In case of any problem, feel free to let me know in comments section.

API Testing : Why to write Test Cases and use Automated Testing Tools?

This entry is part 1 of 3 in the series API Testing

Why to write Test Cases and use Automated Testing Tools?

Books written by some leading programmers often told us the importance of TDD (Test Driven Development) and BDD(Behaviour Driven Development) or they emphasize on at least writing Test Cases and doing Automated Testing. So why many programmers don’t write tests? Is that all not practical or all just too bookish, or your project life time is too small, or is it very much time consuming to write test cases? Here are few questions you will have in mind if you aren’t familiar with test cases benefits. So following are those questions answered.

Question: Obviously writing Test Cases take time and it still don’t replace manual testing, then what is the point in writing test cases. You have a QA person for that who can manually test each page then why Test Cases and this Automated Testing?

Answer: Problem is that if your QA person need to test 10 entities and 3 cases for each entity then these are simply 30 Test cases. So with every addition or modification in system, your QA person will need to test all these 30 test cases almost every day which can’t be efficiently done without automated testing.

Question: What if QA team is very efficient and can easily test lot of different scenarios, then why there should be automated testing?

Answer: Even if your QA team is very efficient, testing same things again and again is not a good use of your QA team time. QA team should design more test cases and from different perspective. And they will spend lot more time if there are different users in system are present. QA team will need to test system with different perspective by login with different accounts.

Question: Alright but it will be time consuming to write Test cases and configuring testing frameworks, so why should I not save time instead of writing Test Cases?

Answer: In long run, Test Cases will even save your time, Test Cases you have written once can be used later, and probably you will need to run tests every day after completing a feature or fixing a bug. So testing 30 Test cases is even more time consuming. If you have GUI of system then it will probably take a little less time but if  you only have APIs then it is much more difficult and error prone to test lot of APIs endpoint manually. So it is much better to spend some time on writing Test Cases instead of testing all Test Cases every day manually, so Automated Testing is lot more time saver in long run.

So it is lot better to Test system in a way where all test cases are written , can be tested under same circumstances every day, without manual dependencies once all test cases are written.

So is writing Test Cases really much time consuming?

Yes it is but it still save time. If you will need to Test something manually, you will need to perform same steps again and again for two different cases but while writing Test Cases for automated testing, you are doing all this in code. And in Code you can avoid writing same steps again by utilizing OOP  concepts and reusing code, that will definitely save time. So never be afraid of writing Test Cases. Specially when you are working on APIs then in many opinions writing Test Cases is your only option and if you will try to test APIs manually and these are not just few API calls then you will be in trouble.

So which type of Automated Testing I must use when writing API?

If you have time then better is to use Testing at every level. Do Unit, functional, Acceptance and API testing that would be helpful for debugging things. But if you don’t have as much time and you are working on APIs then you must at least do API Testing. So that if at day end some thing has gone wrong then you can test it by executing single command and know it before shipping buggy code. So it all depend on your need but if you are writing APIs then you must do API Testing other wise it will be really difficult to test different cases on different API calls manually.
To know about Automated Testing Tools selection you can find more information in my next post.

Charlie hebdo popularity on abusing religions and on few dead bodies

In the name of ALLAH who is most Beneficent and the most merciful.

A magazine that was founded around 44 years ago, was once ceased and then again relaunched after 11 years in 1992. During all that time it was making fun of beliefs (religions) of millions of people and it wasn’t widely distributed magazine. But now by more abusing the beliefs of millions of people this magazine has become much more popular and going to be distributed around the globe. Its demand is increased. But this time their publicity stunt wasn’t enough reason to make it popular. This time some people attacked on this magazine and around 12 people were killed. So this magazine who didn’t have guts to be as much popular became popular with 12 deaths attached with it on one side and Muslims as attackers on other side. So now it is enjoying popularity in the name of freedom of speech. While it should be remembered that one of the police officers killed on duty was also a Muslim.

So such a magazine who earn by making fun of religions of others can how be questioned on enjoying popularity over few dead bodies. But here the Muslims should think that what they are doing is not going to make things better. They are just making a magazine popular in whole world which was hardly known before. And what is better for a magazine than to be popular in whole world no matter if cost if hurting millions of people and few dead bodies while they know that how to gain sympathy in the name of Freedom of speech.

I don’t think this magazine deserve any sympathy. People who are running that magazine know that there are many battles in world fought for religion that mean they know that how people are touchy about their religions and beliefs even more than love of their countries, their lives and lives of their loved ones. Then hurting people by abusing their religions mean abusing them violently and getting them involved in violent activity. So if someone is responsible for all that killing, then it is this magazine named Charlie Hebdo. So if some one call himself charlie or supporting charlie hebdo should understand that (s)he actually is supporting violence, hatred, anger and killing without holding a gun in hand. Because if attackers had guns in hand then this magazine was the reason. And after all abusing millions of people’s emotions and beliefs just for fun is pointless. So anyone who is in support of charlie hebdo should think twice the reason of supporting it because this neither stand against terrorism by abusing and making fun of millions nor it is in favor of freedom of speech because freedom of abuse and speech are always different and should be differentiated.

However I was sad to see some responses at this time. Really disappointed by Mr. Mark Zuckerburg who call this act of Charlie Hebdo which was actually ruthless, as freedom of speech and he don’t even understand the difference between freedom of abuse and freedom of speech. On the other hand I want to ask Muslims to calm down and invest their time in something better because I have seen the cover of magazine at huffingtonpost website and sure that either Charlie Hebdo people are mistaken or spreading wrong words because the image they are showing on cover is not image of Prophet Muhammad (P.B.U.H) and nothing even similar to be called as his cartoon because they are not capable of drawing that. And if Muslims are still panic then they should do something to promote their religion not to promote this evil magazine which is hidden behind the banner of freedom of speech.

On the other hand every one should know that any terrorism act will not be surely by Muslims because at such times terrorists or some agencies use the name of religious parties to do something of their own. After all this is the game of monopoly.

If someone is not not agree with anything I have written then if you are a Muslim then don’t comment right now, comment after at least 5-7 days because then you will be able to see situation more clearly and if you are someone who are in support of Charlie then I can say you criminal , ruthless, terrorism creator or …. whatever and you shouldn’t mind , because you should respect my freedom of speech.

Decide your way

Life is not a bed of roses
Neither full of thorns

We all know and understand this well, so we try to make our lives by working hard first in school, then some of us moved to college, some can’t afford it, some go to university while some have responsibilities to fulfill. It is not always us who can do what ever we want, when we want. But we always have is, the right to make decision, God has given us this right. Our these decisions can change our lives.

Some of us, in fact many of us who don’t want to waste our lives, run fast and faster nowadays towards earn money. While actually money and all that materialistic stuff doesn’t matter. What matters is our decisions, our courage to make decisions. Our decisions make our times, good , better, awesome and sometime very harsh. Still what important is to take decision, take responsibility of your life, take risk and move forward unless you don’t need to sacrifice Morality, self-respect and something other than you. Good and bad time can come to anyone, what matters is how well you live that time, that can make your upcoming time better.

What matters is what you want to do. Whether you are proceeding in life, or just wandering for earning more and more optional things which are not only things that matter. Nowadays when we go further we sacrifice what matters over just materialistic things. Even in business, what matters is your step towards your goals, not only money. In life you need to proceed. Need to cover milestones of life. Otherwise you will be standing where you are and time will not wait. However, milestones should be something that you like, it should be something that actually satisfy you. Because what make you successful is to fulfill your purpose of life. It is the way you want to live which gives you inner joy and peace because this decide who you really are.

These were some of my thoughts I shared here and I would like to see how others think. So let me know in comments, what you think?

Is haath de us haath le

Duniya ajaab bazaar hai, kuch jinsiyan ki sath le,
Neki ka badla nek hai , bad se badi ki baat le,
mewa khila, mewa mile, Phal phool le, phal path le,
Aaram de araam le, Dukh dard dey, aafat le

Khaljug nahi, karjug hai ye yan din ko dey aur raat le
kya khoob sauda naqdh hai is haath dey us haath le

jo chahe le chal is ghadi, sab jinsiyan taiyaar hai
aaraam mein aaraam hai, azaaar mein azaar hai
duniya na jaan isko miya darya ki ye majdaar hai
Auraon ka bedaa paar kar, tera bhi bedaa paar hai

Khaljug nahi, karjug hai ye yan din ko dey aur raat le
kya khoob sauda naqdh hai is haath dey us haath le

karjug jo kuch karna hai ab ye dam tou koi aan hai
nuksaan mein nuksaan hai ahsaan mein ahsaan hai
toumaath mein yahan taumath lagay toufan mein toufaan hai
Rahman ko Rahman hai Shaitaan ko shaitaan hai

Khaljug nahi, karjug hai ye yan din ko dey aur raat le
kya khoob sauda naqdh hai is haath dey us haath le

Apne nafey ke wastey mat aur ka nuksaan kar
tera bhi nuksaan hoyega is baat upar diyaan kar
khana jo kha tou dekh kar pani piye tou chaan kar
yan paun ko rak poonkh kar aur khauf se quzraan kar

Khaljug nahi, karjug hai ye yan din ko dey aur raat le
kya khoob sauda naqdh hai is haath dey us haath le

Ghaflaat ki ye jaagir nahi yan sahib-e-idraak reh
dilshad rak, dil shaad reh gham nak rak, gham nak reh
har haal mein tu bhi Nazeer ab har khadaam ki khaq reh
ye wo maakhaam hai O miyan…. yan pak reh be-baq reh

Khaljug nahi, karjug hai ye yan din ko dey aur raat le
kya khoob sauda naqdh hai is haath dey us haath le