top ad

Saturday, November 7, 2015

पुनःनिर्माण विधेयक संसदद्वारा स्विकृत, अागामी बैठकमा विधेयकमाथि छलफल

Read more →

Friday, June 20, 2014

Oracle

Oracle Lab Questions
1.            Create the table Dept based on following information.
Column Name
Datatype
Length
Constraint
ID
Number
5
Primary Key
Dept_name
Varchar2
50
Not Null
CREATE TABLE `Dept` (
  `Id` int(5) NOT NULL,
  `Dept_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`Id`)
)

2.            Insert the values in Dept table as follows.
ID
Dept_name
10
IT
20
Account
30
HR
40
Marketing
50
Manufacturing
INSERT INTO dept (`ID`,`Dept_name`) VALUES ( '10','IT');
INSERT INTO dept (`ID`,`Dept_name`) VALUES ( '20','Account');
INSERT INTO dept (`ID`,`Dept_name`) VALUES ( '30','HR');
INSERT INTO dept (`ID`,`Dept_name`) VALUES ( '40','Marketing');
INSERT INTO dept (`ID`,`Dept_name`) VALUES ( '50','Manufacturing');


3.            Create the table Emp based on following information.
Column Name
Datatype
Length
Constraint
ID
Number
5
Primary Key
Emp_name
Varchar2
50

Address
Varchar2
50

DateOfBirth
Date


Gender
Char
1
Check (M or F) only
Post
Varchar2
50
Not Null
Email
Varchar2
20
Unique
Salary
Number
10,2
Not Null
Dept_id
Number
5
Foreign Key References with Dept_id of Dept table.
CREATE TABLE `emp` (
  `ID` int(5) NOT NULL,
  `Emp_name` varchar(50) DEFAULT NULL,
  `Address` varchar(50) DEFAULT NULL,
  `DateOfBirth` date DEFAULT NULL,
  `Gender` enum('M','F') DEFAULT NULL,
  `Post` varchar(50) NOT NULL,
  `Email` varchar(20) NOT NULL,
  `Salary` double(10,2) NOT NULL,
  `Dept_id` int(5) DEFAULT NULL,
  PRIMARY KEY (`ID`,`Email`),
  KEY `FK_emp` (`Dept_id`),
  CONSTRAINT `FK_emp` FOREIGN KEY (`Dept_id`) REFERENCES `dept` (`ID`)
)

4.            Describe the Structure of the above created table DEPT and EMP.
5.            Insert about 10 values in Emp table.
INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp1',  'address1',  '2014-06-19',  'M',  'post1',  'email1@email.com',  '10,000',  '10'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp2',  'address2',  '2014-06-19',  'M',  'post2',  'email2@email.com',  '20,000',  '20'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp3',  'address3',  '2014-06-19',  'M',  'post3',  'email3@email.com',  '30,000',  '30'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp4',  'address4',  '2014-06-19',  'M',  'post4',  'email4@email.com',  '40,000',  '40'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp5',  'address5',  '2014-06-19',  'M',  'post5',  'email5@email.com',  '50,000',  '50'
);



INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp6',  'address6',  '2014-06-19',  'M',  'post6',  'email6@email.com',  '60,000',  '10'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp7',  'address7',  '2014-06-19',  'F',  'post7',  'email7@email.com',  '70,000',  '20'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp8',  'address8',  '2014-06-19',  'M',  'post8',  'email8@email.com',  '80,000',  '30'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp9',  'address9',  '2014-06-19',  'F',  'post9',  'email9@email.com',  '90,000',  '40'
);

INSERT INTO  emp (
ID ,Emp_name ,Address ,DateOfBirth ,Gender ,Post ,Email ,Salary ,Dept_id
)
VALUES (
'',  'emp10',  'address10',  '2014-06-19',  'M',  'post10',  'email10@email.com',  '100,000',  '50'
);



6.            Modify the Data type of email to varchar2(50).

ALTER TABLE `emp` CHANGE `Email` `Email` VARCHAR2( 50 ) 

7.            Change the datatype of Gender of Emp table to Varchar2(10).
ALTER TABLE `emp` CHANGE `Gender` `Gender` VARCHAR2( 10 ) 

8.            Increase the salary of Employees who works in IT department by 25%.
update `emp` SET `Salary`=salary+(salary*0.25) WHERE `Dept_id`=10

9.            Add the Not Null constraint to Emp table on Emp_name column.
ALTER TABLE `emp` CHANGE `Emp_name` `Emp_name` VARCHAR( 50 )  NOT NULL

10.        Drop the column Address from the table Emp.
ALTER TABLE `emp` DROP `Address`

11.        List all the Employees who works in the IT department.
SELECT * FROM `emp` WHERE `Dept_id`=10

12.        List all the Employees name, email and salary whose name starts with "a". Sort data in descending order based on Salary paid.
SELECT `Emp_name`,`Email`,`Salary` FROM `emp` ORDER BY `Salary` DESC

13.        List the Average salary of each Department.
SELECT AVG(Salary) as average_salry,Dept_name
FROM `emp` JOIN dept
ON
dept.ID=emp.Dept_id

GROUP BY `Dept_id`
Read more →

Monday, June 16, 2014

linux method to write practical

Aim of the Experiment
Create a user Student and assign the password to P@ssw0rd.
Objective
The main objective of the experiment is to create a user and assign password. We need to use ‘useradd’ command, which is responsible for creating a new user or update default new user information.
The ‘useradd’ command creates a new user account using the values specified on the command line and the values from the system. The new user account will be entered into the system files (/etc/passwd) as needed, the home directory (/home/username) will be created, and initial files copied, depending on the command line options.
System Requirements
Hardware Requirement:
PIV Computer
512 MB RAM
40 GB Hard Disk
Software Requirement:
Linux OS
Aim of the Experiment
Create a user Student and assign the password to P@ssw0rd.
Objective
The main objective of the experiment is to create a user and assign password. We need to use ‘useradd’ command, which is responsible for creating a new user or update default new user information.
The ‘useradd’ command creates a new user account using the values specified on the command line and the values from the system. The new user account will be entered into the system files (/etc/passwd) as needed, the home directory (/home/username) will be created, and initial files copied, depending on the command line options.
System Requirements
Hardware Requirement:
PIV Computer
512 MB RAM
40 GB Hard Disk
Software Requirement:
Linux OS
Algorithm
Syntax:
Syntax is as follows for useradd command:
useradd <username>
By default the user account is locked, you need to setup a new password:
Passwd <username>
Code:

# adduser Student
# passwd Student   

Output
# adduser Student
# passwd Student
Changing password for user Student.
New password: P@ssw0rd
Retype new password: P@ssw0rd
Passwd: all authentication tokens updated successfully.
Conclusion
In this way, a user Student with the password P@ssw0rd is created successfully.


Aim of the Experiment
Display the name of current working directory.
Objective
The main objective of the experiment is to display the name of the current working directory. The current directly is the directory in which a user is working at a given time. Even user is always working within a directly. There are several ways of determining what the current directly is. One is by looking at the command prompt. The ‘pwd’ command displays the absolute pathname of the current working directory to the computer screen.
System Requirements
Hardware Requirement:
PIV Computer
512 MB RAM
40 GB Hard Disk
Software Requirement:
Linux OS
Algorithm
Syntax:
Syntax is as follows:
pwd
Code:

# pwd   

Output
# pwd
Output: /root/user
Conclusion
In this way, the name of the currently working directory is displayed.

Aim of the Experiment
List all the files and directories in /etc file system.
Objective
The main objective of the experiment is to list all the files and directories in /etc file system. The ‘ls’ command lists all the files and directories in  /etc file system.
System Requirements
Hardware Requirement:
PIV Computer
512 MB RAM
40 GB Hard Disk
Software Requirement:
Linux OS
Algorithm
Syntax:
Syntax is as follows:
ls [/directory_name]
Code:

# ls /etc   

Output
# ls /etc
Output:
acpi        fstab        magic        rc.local    adduser.conf
fstab.d        magic.mime            mail.rc    report    apm        group-    rmt
Conclusion
In this way, the files and direcotries in /etc file system is listed.


Syntax:
Syntax is as follows for useradd command:
useradd <username>
By default the user account is locked, you need to setup a new password:
Passwd <username>
Code:

# adduser Student
# passwd Student   

Output
# adduser Student
# passwd Student
Changing password for user Student.
New password: P@ssw0rd
Retype new password: P@ssw0rd
Passwd: all authentication tokens updated successfully.
Conclusion
In this way, a user Student with the password P@ssw0rd is created successfully.


Aim of the Experiment
Display the name of current working directory.
Objective
The main objective of the experiment is to display the name of the current working directory. The current directly is the directory in which a user is working at a given time. Even user is always working within a directly. There are several ways of determining what the current directly is. One is by looking at the command prompt. The ‘pwd’ command displays the absolute pathname of the current working directory to the computer screen.
System Requirements
Hardware Requirement:
PIV Computer
512 MB RAM
40 GB Hard Disk
Software Requirement:
Linux OS
Algorithm
Syntax:
Syntax is as follows:
pwd
Code:

# pwd   

Output
# pwd
Output: /root/user
Conclusion
In this way, the name of the currently working directory is displayed.

Aim of the Experiment
List all the files and directories in /etc file system.
Objective
The main objective of the experiment is to list all the files and directories in /etc file system. The ‘ls’ command lists all the files and directories in  /etc file system.
System Requirements
Hardware Requirement:
PIV Computer
512 MB RAM
40 GB Hard Disk
Software Requirement:
Linux OS
Algorithm
Syntax:
Syntax is as follows:
ls [/directory_name]
Code:

# ls /etc   

Output
# ls /etc
Output:
acpi        fstab        magic        rc.local    adduser.conf
fstab.d        magic.mime            mail.rc    report    apm        group-    rmt
Conclusion
In this way, the files and direcotries in /etc file system is listed.

Read more →

Linux Practical

Linux Lab Questions
Create a user Student and assign the password to P@ssw0rd.
Open terminal
Switch user to root
    # su
    password: <root password>
Synax: useradd <username>
passwd <username>
solution:
 # useradd Student
# passwd Student
new unix password : P@ssw0rd
retype new unix password : P@ssw0rd

Display the name of current working directory.
Syntax : pwd
# pwd
/home/student


List all the files and directories in /etc file system.
Syntax : ls <dir name>
# ls /etc

List all the hidden files and directories in your home directory.
Syntax : ls –a <dir name>
# ls –a  ~

Write a command that displays only directory in your home directory.
Syntax: ls –d */
# cd ~
# ls –d */
Write a command to see the list of recent command used.
Syntax: history
# history
1 cd ~
2 ls –d */
Create a directory 'test' on your home directory.
Syntax : mkdir <directory name>
# cd ~
# mkdir test
Create a file 'myFile' on your home directory using vi editor.
Syntax : vi <file name>
# vi myFile
File will create and open
Press i  for insert mode
Write following text
“this is test file”
Press “ESC” to switch command mode
Then press “shift + : ”
:w + Enter (to save)
:wq + Enter (to save and exit)
:wq! + Enter (to save and exit force fully)
:x + Enter (to save and exit)



Create a Symbolic Link of ‘myFile’ in the currenct directory.
Syntax : ln –s <source file path>  <destination file path>
# ln –s /home/student/myFile   softfile
Rename the ‘test’ directory to ‘NewTest’ directory.
Syntax : mv <old dir> <new dir>
# mv test NewTest

Delete the ‘myFile’ file from the home directory.
Syntax : rm <fille name>
# cd ~
# rm myFile
Write the symbolic representation (eg: rwx-wx—x) of each of the following numeric permissions.
644 ………………….. : rw-r--r--
755 …………………..
600 …………………..
000 …………………..
137 …………………..
124 …………………..
You have given a file with permissions 755, write a command that would change the permissions to r-xr—rwx ?
Syntas : chmod <permission> <file/dir>
# chmod 547 myFile
Change the permission of a file ‘myFile’ such that owner gets full permission, group member get read , write permission & other gets read only permission.
Syntas : chmod <permission> <file/dir>
# chmod 761 myFile

Change the permission of the file so that all category of the user gets full permission.
Syntax : chmod <permission> <file/dir>
# chmod 777 myFile

Write a command that search ‘passwd’ file in /etc directory.
Syntax :find <file name>
# cd /etc
# find passwd

Redirect the above search result to the ‘result.out’ file.
Syntax : find <search result> > <output file name>
# find passwd > result.out
# cat result.out


Redirect the error message to the ‘error.out’ file.

Write a command that counts words, lines, bytes and characters of the ‘result.out’ file.
syntax: wc <option>  <filename>
e.g.
# wc –w result.out  //words
# wc –l result.out  //lines
# wc –c result.out  //bytes
# wc –m result.out  //characters

Sort the ‘error.out’ file.

Sort the content of /etc/passwd in dictionary word and save the sorted result in another file named sorted_passwd.
Syntax: sort <filename> > <result filename>
# sort /etc/passwd   > sorted_password


Display the /etc/passwd line for any account that starts with the letter ‘a’.
Syntax: grep “search text/letter” <filename>
# grep “^a” /etc/passwd

Find all the configuration files inside  /etc directory that have .conf  as the file extension.
Syntax:find <folder path> *.extension
# find /etc/*.conf

Find all the empty files inside the current directory.
Syntax: find <directory name>  -type  <type> -empty
#find –type f -empty

Find all the files and directories that belongs to a user and that have 777 permission.


Display the number of lines in /etc/passwd file.
Write a shell script that displays “Hello World” .
Write a shell script that prompts for age and displays it to screen.
Write a shell script that guess root password. If password match displays the message “you are right”, other wise displays “try again”.
Write a shell script that calculate simple interest for 3 sets of P,N,R values.
Write a shell script that takes a command –line argument and reports on whether it is directry, a file, or something else.
Write a shell script that computes the gross salary of a employee according to the following.
a) if basic salary is <5000 then Allowance 10% of the basic salary.
b) if basic salary is >5000 then Allowance 25% of the basic salary.
The basic salary is entered interactively through the key board
Write a shell script that displays a list of all files in the current directory to which the user has read write and execute permissions .
Develop an interactive script that asks for a word and file name and then tells how many times that word occurred in the file.
Write a shell script which receives two files names as arguments. It should check whether the two file contents are same or not. If they are same then second file should be deleted.
Read more →

Thursday, June 12, 2014

Monday, December 30, 2013

C Programming Tutorial | 1. Introduction

C Programming is a compiled programming language which means it needs a compiler to check the syntax error/s. We use CodeBlocks or Dev C++ or any easy programs for code editing, debugging and compiling.

Note:

  • A C-file should be saved with an extension .c
  • It can be saved anywhere but needs to be compiled.
  • You can edit the source code but cannot edit the executable files (.exe) or object file (.obj/.o)
Example:

#include<stdio.h>
#include<conio.h>
#include my_header.h

These are the linking files or header files generally seen at the top of any c-programmed code. By # sign you give command to the preprocessor.
The angle brackets lets the preprocessor to find the file specified at the standard location.
The files within the double quotes means that it is located in the current directory where the file is saved or in the standard directory.

printf("some text");

Here printf is a standard builtin function that expects a string as value to output to the standard device.
Each statement should ed with a semi-colon.
The strings can be either in single quotes or in double quotes.

Data Types in C-program


Read more →

Friday, December 13, 2013

Nepal Telecom: Discounts on Saturday Calls


Read more →

Wednesday, December 11, 2013

Google starts Translation in Nepali Language too

PROBLEM TRANSLATOR?? Now, there is no problem for translating any language to nepali language via google translate. Yes, google translate has launched the new language translate to nepali language. Enjoy the service.
Read more →

Friday, November 29, 2013

Wednesday, November 27, 2013

ICC T20 Qualifiers 2013 | Nepal VS Hongkong Live

Read more →

Sunday, November 24, 2013

Start Working in Microworkers: Step by Step Guide 1


Before you begin working for microworkers, you need to create accounts in different websites like cuzo, pinterest, friendfeed, facebook, google, yahoo, twitter, Tumblr, etc. Most of you think that you already have an account in most of these websites, but you need to keep in mind that you need a fresh account to work in microworkers because there are certain limitations and conditions. You will know about it when you start working.
Now, lets start creating accounts in the following websites:

1. GOOGLE

In oder to make an account in google, you need to go to a website http://www.gmail.com. Click on Create an account. You will see a form that helps you to create your google account. Just fill in the required information and go to the next step and follow the instructions. Please note that your google account is one for all which means your single account is used in youtube, gmail, google plus, google maps, google play and other services provided by google. After your account is created, you need to update your google profile. Go to www.plus.google.com and login using your created google account. Follow the instructions as directed and remember that your google profile should look natural which means everything should be filled properly (not correctly) including your profile picture (can be anything but not blank). Next thing is that your posts should be visible to everybody which means your posts should always be public and even your google profile should be public. Whenever your are sharing any websites or links or posts in google plus it is called g+. If possible you need to create more than one google accounts because there are certain limitations in microworkers like you can post maximum 2 post in the last 12 hours and all your google posts should not more than 20. If your google account has more than 20 posts in it then that account cannot be used in microworkers.

Rules: For working in microworkers there are some rules and criteria that you need to follow. Your google account should look natural. You can not post more than 2 posts in the last 12 hours. Your google account should not exceed more than 20 all time posts. Less than 65% of the total posts should be on behalf of microworkers.


2. CUZO 

Cuzu is a micro blogging website. In order to create a new account in cuzo, you need to go to http://www.cuzo.com/. In the cuzo homepage click on Signup. A Sign up form appears as shown in the figure:
Fill up the form as instructed in the site and now your cuzo account is created. Do not forget to confirm your cuzo account.

3. Pinterest

Pinterest is a pin board style based photo sharing website. This website is used just to share (pin) photos of websites in the pinboard. Basically when we submit a website to pin, pinterest searches for all the given images from the submitted website and the user can choose any relevant photo from the website and pin it. Pinning means sharing in this website. For easy sharing pinterest has brought a Pin It Button button which can be bookmarked in your browser. Open a website and when the website is loaded, you can just click on the Pin It Button and pin the pictures from the website. To get a Pin It button for your website you can go to http://about.pinterest.com/goodies/#browser and install it in your browser.

To create an account in pinterest go to https://www.pinterest.com/ and click join Pinterest. Signup using an email address not using facebook account. Fill in the signup form correctly and click signup. You will be logged in to you acount and some tutorials will be shown. Click next untitl you get finish button. Your pinterest account is created. Do not forget to confirm your email address by logging in to your account with which pinterest account was created. For example: if you created an account in pinterest using google account then you need to login to your gmail account and search for the confirmation mail sent from pinterest and confirm your account. You are done.

4. Friendfeed

Friendfeed is an online sharing website where you can bookmark websites, micro blogging, etc. It is a social networking website. To create an account in friendfeed, go to http://friendfeed.com/ and click on signup using email address. Fill in the form and your friendfeed acoount is created.

5. Facebook

All of you are familiar with the facebook and what it is used for. You can create an account in facebook by going to the website, www.facebook.com. Sign up for the new account and you account is ready. Please note that your facebook profile should be natural which means every details should be filled properly (not correctly). It is not important to fill all the details correctly. Next thing is that your profile and your posts should be visible to public



6. Yahoo

Most of you know how to create an account in yahoo. In  microworkers, yahoo account is used for answering questions in Yahoo Answers. For creating an account in Yahoo visit https://login.yahoo.com/ and sign up clicking in Create a New Account. Follow the instructions as directed and your yahoo account is created.


7. Twitter

Twitter is another social networking site just as facebook. We post statuses in facebook but we tweet in twitter. To create an account in twitter visit http://www.twitter.com and signup for twitter. You are done. To perform task in Microworkers related to twitter, your account should have a minimum of 200 followers and you should be following half the number of followers.

8. Tumblr

Tumblr is a personal blogging website.


your posts should be visible to public
Read more →

ShareThis

Total Pageviews