Tuesday, February 19, 2013

Create a Internal Network within VirtualBox Ubuntu Machines

 How to set Up Network within VirtualBox  Ubuntu

First install four virtual machines on your virtual box. As shown in the picture.

Then , To Make the internal network follow the following step 
Select First (ubuntu) machine and go to its settings
Now Go to the network->Adoptor2 the do the following setting.

Follow the same procedure for all four machines.
Make sure that the Name field in the adopter section remains the same (intnet).The name of our network in intent.

Now start the Machines all together. and go to the Network->wired->options the machines as shown below.
Now go to IP4 Settings->Manual and fill the new Addresses setting according to your requirement. And click save

Follow the same procedure for all the machines. Give each machine a different IP according to your network.

Now open the terminal and ping the machine to check they are in network.

If you can ping the other machines successfully then your network is done.

Sunday, February 17, 2013

Visual C++ Windows Form Application Mysql Connection

1.Create a new C++ Windows Form Application.

2.Go to Project > Project Name Properties > Add New Reference > Select the Tab .NET

3. Scroll down till you see MySQL.Data then Double Click it or Click it and Press OK then Press OK again (If you don't see it then you cant have the MySQL Connector Installed).

4. Double Click on the Form then Scroll the code till you see using namespace System::Drawing;

5. Below that type using namespace MySql::Data::MySqlClient;

6.Go back to the Form Design and Add a Button to do the connection.So when we click the button , the button will establish the connection to MySQL.

Button means your item!

7.Double click on the Button to go to code section and add the following Code:

Fill in the Port, Username, Password and Hostname with your MySQL Information.

String^ constring = L"datasource=localhost;port=3306;username=root;password=root"; 
MySqlConnection^ conDataBase = gcnew MySqlConnection( constring ); 
MySqlCommand ^cmdDataBase = gcnew MySqlCommand("select * from `database`.`edata` where password='" + this->password->Text +"' ;", conDataBase ); 
MySqlDataReader ^myReader; 
myReader = cmdDataBase->ExecuteReader(); 
int count=0;
while (myReader->Read()) {
      // username->Text  +=(myReader->GetInt32(0) + ", " + myReader->GetString(1)+", "+myReader->GetString(2) + ", " + myReader->GetInt32(3)+ "\r\n");

catch (Exception^ ex)

8.Now run the program and see the response in the message box .

Visual C++ Tutorial 2 -Windows Forms Application: 

Mysql Connection Part 1 

Visual C++ Tutorial 3 -Windows Forms Application: Mysql Connection Part 2 

C++ Windows Form Application Mysql Connection
Using Visual C++ Windows Forms with MySQL
C++ Windows Form Application Mysql Connection
Mysql And Visual C++ 2010 Windows Form Application
MySQL :: Connecting to MySQL with a WindowsForm application
C++ Form textbox string into SQL Database
visual c++ CLR windows form application and mysql

Thursday, February 14, 2013

How to Run and install the mongo c++ drivers (MongoDB) On Ubuntu Linux

Getting Started with the MongoDB C++ Driver

Follow the following steps to install mongo c++ drivers

1. First install python

First install some dependencies:
$ sudo apt-get install build-essential

$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Then download using the following command:
$ cd Downloads/

$ wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz

Extract and go to the directory
$ tar -xvf Python-2.7.2.tgz && cd Python-2.7.2/
Now install using the command you just tried:
$ ./configure
$ make
$ sudo make altinstall

2. Install boost library by following command

$ sudo apt-get install libboost-all-dev

3. Then download the mongo c++ library and from

To download the mongo c++ drivers open the link http://dl.mongodb.org/dl/cxx-driver/ and download cxx-driver/mongodb-linux-x86_64-latest.tgz and then extract it into your home folder .
Then follow the following terminal command

$ cd mongo-cxx-driver-nightly/

$  scons

If it says to install scons then install scons by the command given below and proceed .

$ sudo apt-get install scons 

When the scons build is successful then do scons install by following step 

$ sudo scons install 

That's all 

4. Now to run the sample mongo c++ tutorial.cpp program follow the following commands

 $ cd /home/mongo-cxx-driver-nightly/src/mongo/client/examples

$ g++ tutorial.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system -o tutorial 

$ ./tutorial
connected OK