Monday, 25 September 2017

JAVA: Program to check working of OPERATORS

Programming languages typically support a set of operators: constructs which behave generally like functions, but which differ syntactically or semantically from usual functions. Common simple examples include arithmetic (addition with +), comparison (with >), and logical operations (such as AND or &&). More involved examples include assignment (usually = or :=), field access in a record or object (usually .), and the scope resolution operator (often ::). Languages usually define a set of built-in operators, and in some cases allow user-defined operators.
ref. google

Thursday, 21 September 2017

JAVA: program to calculate Factorial

the product of an integer and all the integers below it; e.g., factorial four ( 4! ) is equal to 24.

JAVA: Program to print FIBONACCI Sequence

a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.

Sunday, 17 April 2016

How to transfer and received file beagle bone to FTP server in fedora

 How to transfer and received file beagle bone to FTP server in        fedora

Server Side:
Step 1:In vsftpd.conf file (/etc/vsftpd/vsftpd.conf) editthis lines.


Step 2 : start service vsftpd (service vsftpd start)
Step 3: stop firewall (systemctl stop firewalld.service)
step 4: mount --bind /default directory/ /var/ftp

Client side: 

Step 1: stop firewall service

from ftplib import FTP

import os

flag = True


        os.system("ifconfig eth0")

        ftps = FTP('')


        print "Select an option for transfering files:\n1.Machine to BBB\n2. BBB to machine"

        print "3.FTP to BBB\n4.BBB to FTP\n5.Exit"

        choice = int(input())

        if choice == 1:

                mcip = raw_input("Enter the ip of machine from where the file is to be received: ")

                user = raw_input("Enter the user from  whom the file is to be received: ")

                filename = raw_input("Enter path of the file to be received: ")

                destpath = raw_input("Enter the path where the file is to be stored: ")

                os.system("scp "+user+"@"+mcip+":"+filename+" "+destpath)

                print "File received successfully"

        elif choice == 2:

                mcip = raw_input("Enter the ip of machine to send files to: ")

                user = raw_input("Enter the user to whom the file is to be sent: ")

                destpath = raw_input("Enter where the file should be stored on receiving machine: ")

                filename = raw_input("Enter the path to the file to be sent: ")

                os.system("scp "+filename+" "+user+"@"+mcip+":"+destpath)

                print "File successfully sent"

        elif choice == 3:


                filename = raw_input("Enter the filename to be downloaded: ")

                ftps.retrlines('RETR '+filename, open(filename,"wb").write)

                print "File successfully downloaded"

        elif choice == 4:

                filename = raw_input("Enter the filename which is to be sent: ")
        print filename
                #ftps.storlines("STOR " + os.path.basename(filename), open(filename))
        ftps.storlines('STOR '+os.path.basename(filename), open(os.path.basename(filename),w"/var/ftp"))

                print "File successfully uploaded"


                flag = False