Friday, December 5, 2014

Install Setup tools on python

Go to this link and download the ez_setup.py file.
       LINK
     Note:- Sometimes this will load as the web page. Then press Ctrl+A and copy it.
     Then open a python 3 file and paste the content in that file.

     Then Save it in C:\\Python33 folder.

    After that double click on it.(Internet connection is needed).

   You can see some download messages in the black screen.

   After successful You have to install pipi.

   Go to below link and get the file.
                              LINK

    Put it in to the python33 folder.

   Now take the command prompt and chnge directory by typing
                  cd C:\\Python33

  Then type python get-pip.py

   Now it will also download and install some files.

  Now you can use pip command to get most of the component.

Now type set %PATH% c://python33/Scripts in command panel

It will give you an success message.







 

Friday, November 28, 2014

Connect python with mongoDB

1.)   Go to folowing ur
                       PYMONGO DOWNLOAD

2.)   And download the relavant .exe which is compatible with your python version. fro the table in                     the below the page.

3.) Then run it with default settings.  If you choose the right exe file you will see the "python                           detected in registry"  in second window.
4.) Go to next and finish the installation.

5.) Then open the python IDLE and type
                         from pymongo import Connection
 
          If it execute without errors that means your installation is success.




import data from CSV file

1.) Do the step 8 in this post.

2.) Download the .csv file from here.

3.) save it in the c://mongodb/bin

4.) and type command in the following image in another terminal
            mongoimport -d ABC -c airports --type csv --file countrylist.csv --headerline

      ABC :- database name
      airports :- Name of the document (table) where the imported data saves.
      countrylist.csv  :- file in the bin folder
  Note:-maybe you get 3 errors due to some eerors in the csv file.

5.) Now type use ABC
6.) then type db.airports.find()
7.) You will see the data in the airports document.
8.) I here you will see only few data at a time.
9.) To see other type it and press ENTER.

First Activity in mongoDB (INSERT VIEW)

1.) Do the step 8-15 in the this post.

    Skip above if mongodb terminals are activated.

2.) Type j={name:"myname",age:20}  in 2nd terminal

3.)and aganin type  k={x:3}

4.) We make two objects
                 1st one :- create objects with attribute name and its value.
                  2nd one :- create a attribute with value

5.)  Now type db.testData.insert(j)
and also type db.testData.insert(k)

6.) In here you will create testdata document (As i think something like table) and insert above 2 objects to that document.

7.) type show collections.

8.) You can see testData document in the resulting list.

9.)Type db.testData.find()  This is something like Select * from testData.

10.) Ylu can see above two object in the result.




INSTALL MONGODB

Go to below link and download MONGODB  (DOWNLOAD THE .MSI FILE)

link to download

Then run the downloaded file.

And install it with default configurations.(Configuration selected by default.)

After that check your ProgramFiles OR ProgramFiles(x86) for MongoDB standard.. folder.

Copy it and paste in the C drive.

Rename it as mongodb

After the open a command promt and type  cd c:\\mongodb\bin

Then type mongod and press ENTER.



then you will see the following things print on the window.
NOW YOUR MONGODB SERVER IS ACTIVE.  DON'T CLOSE THIS TERMINAL

IF MONGO SERVER DIDN'T START AND SAY ERROR FOR SOME MISSING DIRECTORY,
THEN MAKE FOLDER NAME data in the C drive.
IN SIDE THAT FOLDER MAKE FOLDER CALLED db

NOW DO THE ABOVE TASK AGAIN.

Take anothe window and type the cd c:\\mongodb\bin

Type mongo

you will receive connecting to: test  message.

The type db for get the current database.

Normally Your default database is test.(you will result as test)

Change it by enter the use <yourdbname>      Ex:- use ABC

switched to db ABC will print in the terminal