January 2012

Linux/Unix FACL - File Access Control List

To get the file access control list of particular file in Linux / Unix, use the command getfacl.

For example:

-bash$ getfacl myproject

# file: myproject
# owner: sasikala
# group: adms
user::rwx
group::r-x #effective:r-x
mask:r-x
other:--x

CVS web - Error: Failed to spawn GNU rlog

While setting up the cvs web, if you get the error like below

Error: Failed to spawn GNU rlog on "/dev/cvsdata/myproject/exclusions,v".

Did you set the @command_path in your configuration file correctly? (Currently: "/usr/gnubin/bin:/bin:/usr/cvs/bin:/usr/rcs/bin:/usr/bin:/usr/local/bin:/usr/enscript/bin")

If the rcs not exists or the path is incorrect then you will get this error.

1. Check rcs exists. Download the gnu and you can get the rcs from /gnu/rcs sub directory and place it appropriate path.

2. Check whether the rcs path specified correctly in the command_path.

MySQL Limit equivalent in oracle

In MySQL , we use limit clause to get the range of records from query. For example to get 11 th to 20th records.

select * from projects limit 11,20;

The rownum is the oracle equivalent of limit in the MySQL.

select * from projects where rownum>10 and rownum<=20;

DB2 Interview Question part IV

1)My SQL statement: SELECT AVG(SALARY) FROM EMP yields inaccurate results. What could be the problem?

Ans: Probably SALARY is not declared to have NULLs and the employees for whom the salary is not known are also counted.

2)How do you retrieve the first 5 characters of FIRSTNAME column of EMP table?

Ans: SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;

3)How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a complete name?

Ans: SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP;

4)What is the use of VALUE function?

Ans: 1. Avoid NEGATIVE SQLCODEs by handling nulls and zeroes in computations

2. Substitute a numeric value for any nulls used in computation

5)What is UNION,UNION ALL?

Ans: UNION => eliminates duplicates
UNION ALL => retains duplicates
Both these are used to combine the results of different SELECT statements.

6)Suppose I have five SQL SELECT statements connected by UNION/UNION ALL, how many times should I specify UNION to eliminate the duplicate rows?

Ans: Once.

7)What is the restriction on using UNION in embedded SQL?

Ans: It has to be in a CURSOR.

8)In the WHERE clause what is the difference BETWEEN and IN?

Ans: BETWEEN => supplies a range of values
IN => supplies a list of values.

9)Is BETWEEN inclusive of the range values specified?

Ans: Yes.

10)How is 'LIKE' used in WHERE clause? What are the wildcard characters?

Ans: LIKE is used for partial string matches.
‘%’ => for a string of any character;
‘_’ => for a single character

11)When do you use a LIKE statement?

Ans: To do partial search e.g. to search employee by name, you need not specify the complete name; using LIKE, you can search for partial string matches.

12)What is the meaning of underscore (‘_’) in the LIKE statement?

Ans: Match for any single character.

13)What do you accomplish by GROUP BY ... HAVING clause?

Ans: GROUP BY partitions the selected rows on the distinct values of the column on which you group by.
HAVING selects GROUPs which match the criteria specified

14)Consider the employee table with column PROJECT nullable. How can you get a list of employees who are not assigned to any project?

Ans: SELECT EMPNO
FROM EMP
WHERE PROJECT IS NULL;

15)What is the result of this query if no rows are selected?

Ans: SELECT SUM(SALARY)
FROM EMP
WHERE QUAL=‘MSC’;
NULL

DB2 Interview Questions - part V

1. How would you find out total number of rows in a table?

Use Select Count(*)

2.How do you eliminate duplicate values in SELECT?

Use SELECT DISTINCT

Oracle - SQL Developer : unable to find the java virtual machine

I have installed oracle 11g (win64_11gR2_client) in windows 7 (64 bit machine). I could able to use sqlplus and connect to database.

But the sql developer was not working. While investigated find that SQL developer won't work with 64 bit version of jdk and it throws unable to find the java virtual machine.

To solve the issue install 32bit/x86 jdk and change ORACLE_HOME\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf file SetJavaHome point to 32 bit jdk.

Note: make sure you install 32 bit/ x86 jdk1.6.X or jdk1.5.x

Oracle - SQL Developer: msvcr100.dll is missing from your computer

I have installed 11g in Windows 7 (64 bit machine). Since the SQL developer wont work with 64 bit jdk.

Installed the 32 bit jdk1.7.0
and changed the ORACLE_HOME\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf file SetJavaHome point to 32 bit jdk1.7.0.

Again started the SQL developer, but it throws msvcr100.dll missing. Find that the SQL Developer3.x supports at max jdk1.6.X.

These information is specified in ORACLE_HOME\sqldeveloper\releasenotes. So install the jdk1.6 and make the sqldeveloper.conf SetJavaHome point to this.

other workaround is go to jdk1.7.0 installed path jdk1.7.0\jre\bin copy msvcr100.dll and paste it into ORACLE_HOME\sqldeveloper\sqldeveloper\bin and again try start SQL Developer. It will start.

How to remove files permanently from hard disk?

Normally we remove files / directory using the delete option/ delete button. So it go and sit in recycle bin. If we want to restore from recycle bin, just using the restore option we can retrieve the files.

Sometimes we want to remove the unnecessary files for space requirements. In this case, if you are sure you don't want the file then you can use the Shift+Delete button together to remove the file permanently from the hard disk to create space for other activities.

Spam mails are sent from your email account to your contacts?

We always hear that don't click the links from unknown user. But sometimes unknowingly or due to curiosity clicked the link? Now what to do?

Once you click those spam mail links, those unknown sender take over the control of your account that is stealing the password and contacts in your account.

They sent mail from your account to your contacts with links to take control of their accounts also. Once you have suspect this then do the following immediately

1. Change the password.
2. Clear cookies and temporary files.
3. Run antivirus in your system.
4. Send mail to your contacts stating that don't click any link which sent from your account.

Further Security steps

1. Don't use the same password for more than one account across or same mail services.

2. Don't use the same passwords in facebook kind of social sites.

3. Never ever use same passwords of the bank account in mail and social networking sites.

Precaution is better than cure. So be careful before clicking any links.

Answers of a brilliant student

Q: In which battle did napoleon died?

Ans: His Last Battle.

Q: Where was the declaration of independence signed?

Ans: At the bottom of the page

Q: River Ravi flows in which state?

Ans: Liquid State

Q: What's the main reason for divorce?

Ans: Marriage

Q: What's the main reason for failure?

Ans: Exams

More Number Series

1. 18,20,10,12,4,6 ?
Show the Answer

2. 7,6,8,5,3,7,?
Show the Answer

3. 9,18,21,25,20,?
Show the Answer

4. 3,3,4,8,10,36,?
Show the Answer

5. 30,28,25,20,34,28,?
Show the Answer

6. 4,8,16,32,64,128,?

Show the Answer

7. 8,16,24,32,40,48,?
Show the Answer

8. 13,11,14,12,15,13,?

Show the Answer

9. 6,18,36,108,216,648,?
Show the Answer

10. 4,4,8,8,16,16,?

Show the Answer

11. 2,6,18,54,162,486,?

Show the Answer

12. 4,20,35,49,62,74,?

Show the Answer

13. 10,18,15,23,20,28,?

Show the Answer

14. 4,10,8,14,12,18,?

Show the Answer

15. 10,15,12,17,14,10,?

Show the Answer

Too Tough Letter Series

1. A C BDEFGI - I H K J L Show the Answer

2. AIZBEYCIXDI - GENJW Show the Answer

3. ADGJMP - RWTS Show the Answer

4. XWEFGVUHIJK - PNSRT Show the Answer

5. ABFGKLPQ - TSVUW Show the Answer

Don't have hot items using Paper cups

Recent years, we use paper cups to have juice,tea, coffee in shops and mainly in office pantry. We are thinking it is hygiene. No harm to health. It is recyclable, so we are environmental friendly. Even i am thinking the same and use paper cups to have hot water and hot items like coffee, tea, soups.

Recently i read article about the paper cup, it was a shock to me, so want to share.