Posts

Strategies for effective problem solving

1. Always have a PlanYou should have a plan how you are going to find solutionThe plan may be altered along the journey or you may abandon your original plan and make another onePlanning allows you to set intermediate goals and achieve them.Without a plan you have only one goal, solve the whole problem. Until you have the entire problem solved you will feel frustrated.So create a plan with series of minor goals, then you will make measurable progress towards a solution and feel that your time been spent usefully.At the end of each work session, you'll be able to check off items from your plan and gain confidence that you will find a solution instead of getting increasingly frustrated. 2. Restate the ProblemIn some cases, a problem that looks very difficult may seem very easy when restated using different terms.Restating a problem allows you to check out the problem from every angle to see if there is an easy solution.Restatement sometimes shows us the goal was not what we thought…

How to install and use JsonCpp library on Ubuntu Linux OS?

About JsonCpp JsonCpp is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs.

Step 1: Install using apt-get You can easily install JsonCpp library on Ubuntu or another flavor of Debian Linux simply by running the following command:
sudo apt-get install libjsoncpp-dev It will install the compatible JsonCpp library on your system.

Step 2: Example program and compiler flag To compile a C++ program that uses JsonCpp library use the compiler flag:

-ljsoncpp Create a Json file called profile.json with the following content:
{ "firstname":"Amritpal", "lastname": "Singh", "ss": 12345678910 }
Within the same directory create a profile.cpp file with the following source code:
#include <iostream> #include <fstream> #include <jsoncpp/json/json.h> using namespace std; int main() { ifstream ifs("profile.json"); Json…