Skip to main content

Posts

Showing posts from January, 2016

POSTGRES COMMANDS

1. Create your own database on provided server. Name it DB_yourname.    postgres=# create user db_rahul with password 'abcd'; CREATE ROLE postgres=# postgres=# postgres=# create database db_rahul with owner db_rahul; CREATE DATABASE postgres=#   2. Create table, where you have 3 columns: 'ID', 'Name', 'Organization', 'department' Fill in this table with data - create 3 records.      postgres=# \c db_rahul You are now connected to database "db_rahul" as user "postgres". db_rahul=# create table customer ( id int not null, db_rahul(# name text not null, db_rahul(# organization text not null, db_rahul(# department text not null ); CREATE TABLE db_rahul=# insert into customer (id,name,organization,department) values (1,'rahul','datacom','Cloud'); INSERT 0 1 db_rahul=# insert into customer (id,name,organization,department) values (2,'vishnu','datacom','Cloud'); INSERT 0 1

Budget calculator in Python

Today we friends have faced trouble when making tally of  the amount we have paid for the new flat advance, the amount company provided, the money given to broker. So planned to make a budget calculator names=[] def fun(numbers):            while True:                      x=raw_input("if done enter stop:   ")                      numbers.append(x)                      if x == 'stop':                                    break            return numbers def func_sum(a,b,c):                   for i in range(0,b):                                              x=a[i]                                              print "Enter the calculation of %s" % x                                              y=eval(raw_input("Enter  "))                                              z = c - float(y)                                              print "The amount to be paid by /should be paid to if negative.... %s is %r" % (x,z)                            

Create a custom linux shell with limited customized commands

Here is a c Program I have tried to create  a custom shell in linux with limited commands #include #include #include #include #include using namespace std; int main(int argc, char * argv[]) {   string command; cout << "\t This is a custom developed shell \n\n"; while (command != "myexit") { if ( command == "myexit") system("exit"); else if ( command == "myfinger" ) { char username[40]; char buf[32]; printf ("Enter the username:\n"); scanf ("%s",&username); sprintf(buf, "finger %s", username); system (buf); } else if ( command == "mydel" ) { char filename[40]; char cmd1[40]; printf ("Enter the filename to delete:\n"); scanf ("%s",&filename); sprintf(cmd1, "rm -rf %s", filename); system (cmd1); printf ("The file %s deleted \n", filename); } else if ( command == "mywhich" ) { char cmmnd[40]; char cmd2[40]; printf ("Enter the c