Thursday, November 24, 2016

Installing packages (Python, R and Scala) with Anaconda.

Anaconda makes the package management of Python, R and Scala very easy. For this you need to have Anaconda-navigator package installed in your computer.



1. Open Command prompt
2. Enter conda install anaconda-navigator
3. Press Enter key to proceed.

Now open anaconda navigator application. Below is the Home screen of Anaconda navigator.
1. Home Screen


Click on Environments, as shown below
2. Environment screen


Change the Installed option to All option Select
3. Change "Installed" to "All" option

4. Differentiate "Installed", "Not installed" and "Upgradable " packages.

Now Type the required package in the Search box.
Lets install "pandasql" package . So type pandasql in the search box. Now you can see the search result.

5. Search required package


Now right click on the checkbox in the respective search result. From the options , select "Mark for installation"

6. Installation option


Click on "Apply" button.
Now click on "Ok" button.
7. Final steps.


Its finish. Repeat the same process for installing other packages.




Installing Anaconda in Windows OS.


Step 1: Download
First step is to download the latest version of Anaconda for Windows OS.

For Windows 64bit (Python 3.5): https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exe
For Windows 32bit (Python 3.5):  https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86.exe

For Windows 64bit (Python 2.7): https://repo.continuum.io/archive/Anaconda2-4.2.0-Windows-x86_64.exe
For Windows 32bit (Python 2.7):  https://repo.continuum.io/archive/Anaconda2-4.2.0-Windows-x86.exe

You can also download from official link https://www.continuum.io/downloads.

Step 2 : Install
Install Anaconda 3.5 (Python 3.5)
  1. Double click on the downloaded file.
  2. Follow the wizard.
  3. Select "Just me..." option, and click on "Next" button.
  4. In the "Advanced Installation Options", please make sure that "Add Anaconda to my PATH...." and "Register Anaconda....."  options are checked.
  5. now just follow the wizard and finish the installation process.

Step 3: Verify the installation
Open command prompt
Enter following command
 conda --version

Monday, October 31, 2016

Installing and running the docker daemon remotely.

Step-1: Installing the Docker
         sudo apt-get install docker.io
After installing, docker will start running automatically.
Step -2: Stoping the docker
         sudo service docker stop

Step-3: configuring the docker
  
sudo docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -d &
This will make the docker daemon to listen through unix socket and the TCP port


Now access the docker daemon 
example-1
  docker -H=tcp://120.126.17.39:2375 run ubuntu


example-2
   docker run ubuntu

example-3
  docker -H=tcp://120.126.17.39:2375 ps -a


example-4
    docker ps -a


For uninstalling use following command
  sudo apt-get purge --auto-remove docker.io
 



When docker-engine is install, I found the command is slightly different from the previous one.
To install docker-engine:  [src]
        sudo apt-get install docker-engine
Stop the docker:
        sudo service docker stop
Following command will enable the docker to listen using both Linux socket and tcp:
          sudo dockerd -H unix:///var/run/docker.sock H tcp://0.0.0.0:2375
Now to access docker daemon:
          sudo docker -H tcp://0.0.0.0:2375 
                 or 
          sudo docker -H tcp://120.126.16.34:2375

tcp://120.126.16.34:2375 is the IP of the daemon host. The IP of daemon host can be different based on your configuration.

Thursday, October 27, 2016

Which port is opened in my Linux system ?

netstat command can be used to know all ports opened currently.

command 

netstat  <option>

option:
-a                              short form of '--all'
-t or --tcp                  for tcp connection
-u or --udp                for udp connection
-n                              for numeric presentation

Example

netstat -atn                     for all tcp connection
netstat -aun                    for all udp connection

netstat -ltn                     for all ACTIVE tcp connections
netstat -lun                     for all ACTIVE udp connections

Friday, October 21, 2016

Uninstalling Docker-engine from Ubuntu 14.04

Completely Uninstalling Docker-engine including Configuration data and other dependencies

        sudo apt-get purge --auto-remove docker-engine

Uninstalling Docker and its dependencies

        sudo apt-get remove --auto-remove docker-engine

Uninstalling Docker and its configuration data

        sudo apt-get purge docker-engine

Uninstalling only Docker

        sudo apt-get remove docker-engine

Thursday, October 20, 2016

Accessing remote printer [Fuji Xerox DocuPrint m215b]

In this post we will see, how to access a shared remote printer. Below picture describes the concern environment.


Let's say you as the user want to access the printer attached to another computer which is connected to internet. Its assume that the printer is already shared. So this post is all about configuring the user's computer to access the remote printer.

Environment :

OS: Windows 8 (The steps may vary slightly in other versions of Windows)
Printer Driver: In this demonstration Fuji Xerox DocuPrint m215b is used.
                           Driver for Windows 64bit  OS
                            (Compatible OS: Windows 7, Windows 10, Windows Server 2003, Windows Server 2003 64bit, Windows Vista, Windows Vista 64bit, Windows Server 2008, Windows Server 2008 64bit, Windows Server 2008 R2, Windows 7 64bit, Windows 8, Windows 8 64bit, Windows 8.1, Windows 8.1 64bit, Windows Server 2012, Windows Server 2012 R2, Windows 10 64bit )
                             (Click here to download the driver from official website)



 Driver Installation steps



Step1:  Download the Printer driver
Step 2: Now extract the content of the downloaded driver. Open the newly created Folder.

Step 3: Right click on the application and click on "Run As Administrator"

Step 4: Click on Unzip

Step 5: Now you will see another folder. Now close the dialog box and open the newly created folder.

Step 6 :  Now run the "install" application by double clicking on it.

Step 7:  Select "Personal installation" radio button and click on next button.

Step 8:  Click on "next" button after accepting the license agreement.

Step 9: Now wait for few mins

Step 10 : Click on "Finish" button to finish the installation process.




Adding Remote printer



Step 1: Open the control panel, and click on "Devices and Printers"

Step 2:  Click on "Add a printer"

Step 3:  Wait for auto search. Or you can click on "The printer that I want isn't listed"

Step 4:  Give the printer name (including computer name) and click on "Next" button.

Step 5:  You must see the printer name. Click on "Next" button.

Step 6: Click on "Print a test page" to check the accessibility of the printer. click "Finish" button to finish the configuration process.


That's all for now...Please comment if you encounter any problem.

-Thank you





Thursday, October 6, 2016

Installing OpenCV and Python in Windows


1. Download and install Python 2.7.x in windows
             windows install : http://python.org/ftp/python/2.7.5/python-2.7.5.msi
2.  The default installation directory C:\Python27


3. Download and install python package manager pip if NOT installed
                  A. Download get-pip.py script from  https://bootstrap.pypa.io/get-pip.py
                  B. Open command prompt
                  C. Enter following command to run the downloaded script
                                    python <path to get-pip.py file>

4.  Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/ to download and install python packages

5.  Now, Download Numpy python package (choose the .whl file based on your requirement)
                  A. Open command prompt
                  B. Go to the local directory where numpy-1.11.2+mkl*.whl file is present
                  C. Enter following command to Install Numpy
                                    pip install numpy-1.11.2*.whl
6. You can repeat Step-5 to install other required packages


7. Download and install OpenCV
                  A. Folllow the link to download OpenCV-3.1.0
                  B. Open the .exe file to install (in C drive)
                  C. Goto C:\opencv\build\python
                  D. Copy cv2.d to C:\Python27\Lib\site-packages

Please comment if you encounter any error....

-Thank you 

Tuesday, September 13, 2016

How to install TexStudio with Miktex ?

In order to work with Latex,  texStudio is one of the best solutions as TeX editor.
See the comparison of TexStudio with other other text editor.

Download the following software.

  1. Latex editor: TeXstudio 
    1. Select according to your OS environment.
  2. Repository: miktex repository 
    •  
      select the version according your OS environment
    •  Save the installer file, such as "setup-2.9.6050.exe"
    • If you have very good internet connection, better you download 'net install' which allow you to download the complete MikTeX repository.
So, now you must have the following software packages

Downloading and Installing MikTeX repository

1.  Open the miktex installer file. Here it is "Setup-2.9.6050.exe"
2.  Click on 'Next' button....

3.  Select 'Download MiKTeX' option to keep the repository for future purpose. <4.JPG>
4.  Select "Complete MiKTeX" option to install all packages.

5.  Now the choose the download source and click on 'Next' button.

6.  Give the location, where you want to keep the downloaded repository.

7.  Now the final step to download the repository. Click on "Start" button.

8. Now you need to wait until the download finish.
9. Once the download is finished, click on "Next" button.

10. Click on "Close" button.

      Here we finish downloading the MiKTeX repository. Now we perform the installation process.
11. Open the same miktex installer file again and follow step 2. Here it is "Setup-2.9.6050.exe"
12. Now Select "Install MiKTeX" option and click on "Next" button.

13. Now select "Complete MiKTeX" option and click on "Next" button.
14. Select the user based on your requirement and click on "Next" option.

15. Now you need to specify the path of already downloaded MikTeX repository. Click on "Next" button.

16. Now click on "Next" button, leaving the default installation directory.
17. Leave the default setting, and press "Next" button.
18. Click on "Start" button after reviewing the settings.
19. After the installation process finish, click on "Next" button and then click on "Close" button.

Installing TeXstudio   
Now install TeXstudio editor. Installing TeXstudio is quite easy. Just follow the installation wizard and leave all the setting as default. Below are some screenshot given for reference.
1
2

3

4

5

6

7










Thursday, September 8, 2016

Golang and Shell Script : Execute sh file from Go file and vice-versa.

We will see here today, executing a Go file from Shell script file and vice-versa.

Don't know, how to create and run a shell script file ?
Shell script file name : hello_sh.sh
Content of hello_sh.sh :

echo "Hello, I am inside 'hello_sh.sh' file."
echo "Now, I am going to call 'hello_go.go' file. The output: "
go run hello_go.go


Hello world ! program in Golang.
Go file name : hello_go.go
Content of hello_go.go :


package main
import (
        "bytes"
        "fmt"
        "log"
        "os/exec"
        "strings"
)
func main() {
        fmt.Printf("Hello, I am from 'hello_go.go' file.");
        fmt.Printf("\nNow, I am going to execute 'hello_sh.sh' file\n");
        cmd := exec.Command("bash", "hello_sh.sh");
        cmd.Stdin = strings.NewReader("");
        var out bytes.Buffer;
        cmd.Stdout = &out;
        err := cmd.Run();
        if err != nil {
                log.Fatal(err);
        }
        fmt.Printf("Output \n",out.String());
}


*For beginner change the file name "hello_sh.sh" and  "hello_go.go" according to your requirement.
*For advanced programmer, try this recursion and you can comment your output below.


-Thank you




Wednesday, August 3, 2016

Find My Phone : The best hidden feature of Android

Find My Phone

1.    Open any internet browser
2.    Go to Google search
3.    Search for “find my phone”.
               [[ Don’t forgot to sign-in to google before you search. ]]


4.    Now Click On “Ring” to locate your phone, if it is somewhere near to you but unable to find.

If you lost your phone, you can locate your phone and can select “Enable Lock & Erase” option.


5.     Access your phone from another phone
you can have the access to your own phone another phone by login as guest user in your friend’s phone.

** Major drawback : This option will not work if the phone is not connected to internet.

-Thank you

Monday, July 25, 2016

Shell Script :generating random numbers

Generating random numbers is bit easier as compare to generating random numbers in other languages.

To generate a random number in shell script use below command
$RANDOM

The above command is case sensitive and hence $random will not give you desire result.

Generating  random number with in a range
lr=100 # lower range
ur=600 # upper range
r=`expr $ur - $lr`
echo "The random number of `expr $RANDOM % $r + $lr`"


-Thank you

Sunday, July 24, 2016

Shell Script : Reading a file Line by Line in shell script

Reading the file using loop statement

File name : job.txt
File Content :
   Data
   RAM:256 MB
   Bandwidth:1 gbps

Command 1:
        
              while read line
              do
                echo $line
              done <job.txt 
Output :
 
   Data
   RAM:256 MB
   Bandwidth:1 gbps


Command 2:
        
              for line in $(cat job.txt)
              do
                echo $line
              done <job.txt 
Output :
  
   Data
   RAM:256
   MB
   Bandwidth:1
   gbps

Saturday, July 23, 2016

Shell Script : Creating and Running a shell script file

OS : Ubuntu 14.04
Steps are as follows:

Step 1: Open Terminal by pressing ctrl+alt+T

Step 2: Use any editor to create a shell script file. 
       
         Sample 1:  sudo gedit firstShell.sh 
         Sample 2:  sudo vim firstShell.sh 
         Sample 3:  sudo vi firstShell.sh 

Step 3: Enter the following line
        
          echo "I am from firstShell.sh file !!!"  
 
Now save the file according to the editor you are using.
Step 4: Modify the attribute of the file as executable file
        

         Sample:  sudo chmod +x firstShell.sh  
 
Step 5: Now RUN the shell script file by entering following command in the terminal

         ./firstShell.sh

VirtualBox from command line

Different VirtualBox operation from command line :

To know the Version of the VirtualBox
Command :
                vboxmanage -v
Sample Output:


To show the list of VMs:
Command :
                vboxmanage list vms
Sample Output :


To show the list of currently running VMs:
Command :
                vboxmanage list runningvms


To display the details of a specific VM
Command :
                vboxmanage showvminfo VM1
Sample Output :
* "VM1" is the name the VM
* The screenshot of Sample Output is NOT containing all the information.


To create a Virtual machine :
Command 1:
                vboxmanage createvm --name "VM2"
Sample Output :

After creating the VM, follow the below step to showed up in the "Oracle VM virtualBox manager"
Step 1- Select "Machine" menu.
Step 2- Click "Add" option.
Step 3- Browse to path of setting file
Step 4- Double click on "VM2.vbox" file
Now you can see the detail of VM2 as follows:


Command 2:
                vboxmanage createvm --name "VM2" --register
* --register option will register the VM with VirtualBox and hence this will enable us to display the recently created VM in "Oracle VM virtualbox manager" window.


To modify the settings of an already created VM
Command 1: [To modify the memory]
                vboxmanage modifyvm VM2 --memory 512
Command 2: [To assign the OS type]
                vboxmanage modify VM2 --ostype Ubuntu
Command 3:[To attach the SATA controller ]
                vboxmanage storagectl VM3 --name SATA -add sata --controller IntelAhci --bootable on
Command 4: [To attach the SATA (.vdi file)]
                vboxmanage storageattach  VM3 --storagestl SATA --port 0 --device 0 --type hdd --medium <path of the .vdi file>


To clone a Virtual machine :
Command 1 : 
                vboxmanage clonevm VM1_CPU --name VM1_IO --register
Sample Output :



 To control the network bandwidth 
Command :
                1. vboxmanage bandwidthctl VM1 add Limit --type network --limit 100k
                2. vboxmanage bandwidthctl VM1 set Limit --type network --limit 100k