Friday, September 21, 2012

Jain Library and Pravchan

http://library.jain.org/

Know Why to Oppose FDI in retail

http://www.bhaskar.com/article/NAT-pros-and-cons-of-fdi-in-retail-3809347-NOR.html?seq=8&HT1a=


For Entrepreneurs

For Entrepreneurs

 
  • Take Owner ship of whatsoever Happens done by whatever in your Company.
  • Business Plan. define what success means.

  • good strategy.. well executed is excellent.
  • Good  strategy.. Not executed is worst.
  • high level approach.. don't be afraid to get advice.




Motivation

1.    Don’t allow any negative thought At least for 21 Day
2.    Don’t let other define your Goal.
3.    Make your Body Language Positive.
4.    Not to waste your time.
5.    Each moment is costly. Be Alert.
6.    Be Expressive.
7.    Luck is meeting point of alertness of your mind and the Opportunities Passing by.

Thanks to Mr. Rajesh for Motivation.

http://www.rajeshaggarwal.in/index.php



SUCCESS IS NEVER FINAL......




SUCCESS IS NEVER FINAL......
FAILURE IS NEVER FATAL!

Don't miss last 2 Questions...


Some, rather most organizations reject his CV today because he has changed jobs frequently (10 in 14 years). My friend, the ˜job hopper™ (referred here as Mr. JH), does not mind it. well he does not need to mind it at all. Having worked full-time with 10 employer companies in just 14 years gives Mr. JH the relaxing edge that most of the ˜company loyal™ employees are struggling for today. Today, Mr. JH too is laid off like some other 14-15 year experienced guys “ the difference being the latter have just worked in 2-3 organizations in the same number of years. Here are the excerpts of an interview with Mr. JH:

Q: Why have you changed 10 jobs in 14 years?


A: To get financially sound and stable before getting laid off the second time.

Q: So you knew you would be laid off in the year 2009?


A: Well I was laid off first in the year 2002 due to the first global economic slowdown. I had not got a full-time job before January 2003 when the economy started looking up; so I had struggled for almost a year without job and with compromises.

Q: Which number of job was that?

A: That was my third job.

Q: So from Jan 2003 to Jan 2009, in 6 years, you have changed 8 jobs to make the count as 10 jobs in 14 years?


A: I had no other option. In my first 8 years of professional life, I had worked only for 2 organizations thinking that jobs are deserved after lot of hard work and one should stay with an employer company to justify the saying ˜employer loyalty™. But I was an idiot.

Q: Why do you say so?


A: My salary in the first 8 years went up only marginally. I could not save enough and also, I had thought that I had a ˜permanent™ job, so I need not worry about ˜what will I do if I lose my job™. I could never imagine losing a job because of economic slowdown and not because of my performance. That was January 2002.

Q: Can you brief on what happened between January 2003 and 2009.


A: Well, I had learnt my lessons of being ˜company loyal™ and not ˜money earning and saving loyal™. But then you can save enough only when you earn enough. So I shifted my loyalty towards money making and saving “ I changed 8 jobs in 6 years assuring all my interviewers about my stability.

Q: So you lied to your interviewers; you had already planned to change the job for which you were being interviewed on a particular day?


A: Yes, you can change jobs only when the market is up and companies are hiring. You tell me “ can I get a job now because of the slowdown? No. So one should change jobs for higher salaries only when the market is up because that is the only time when companies hire and can afford the expected salaries.

Q: What have you gained by doing such things?


A: That's the question I was waiting for. In Jan 2003, I had a fixed salary (without variables) of say Rs. X p.a. In January 2009, my salary was 8X. So assuming my salary was Rs.3 lakh p.a. in Jan 2003, my last drawn salary in Jan 2009 was Rs.24 lakh p.a. (without variable). I never bothered about variable as I had no intention to stay for 1 year and go through the appraisal process to wait for the company to give me a hike.

Q: So you decided on your own hike?


A: Yes, in 2003, I could see the slowdown coming again in future like it had happened in 2001-02. Though I was not sure by when the next slowdown would come, I was pretty sure I wanted a ˜debt-free™ life before being laid off again. So I planned my hike targets on a yearly basis without waiting for the year to complete.

Q: So are you debt-free now?


A: Yes, I earned so much by virtue of job changes for money and spent so little that today I have a loan free 2 BR flat (1200 sq.. feet) plus a loan free big car without bothering about any EMIs. I am laid off too but I do not complain at all. If I have laid off companies for money, it is OK if a company lays me off because of lack of money.

Q: Who is complaining?


A: All those guys who are not getting a job to pay their EMIs off are complaining. They had made fun of me saying I am a job hopper and do not have any company loyalty. Now I ask them what they gained by their company loyalty; they too are laid off like me and pass comments to me “ why will you bother about us, you are already debt-free. They were still in the bracket of 12-14 lakh p.a. when they were laid off.

Q: What is your advice to professionals?

A: Like Narayan Murthy had said “ love your job and not your company because you never know when your company will stop loving you. In the same lines, love yourself and your family needs more than the company's needs. Companies can keep coming and going; family will always remain the same.
Make money for yourself first and simultaneously make money for the company, not the other way around.

Q: What is your biggest pain point with companies?

A: When a company does well, its CEO will address the entire company saying, ˜well done guys, it is YOUR company, keep up the hard work, I am with you. But when the slowdown happens and the company does not do so well, the same CEO will say, It is MY company and to save the company, I have to take tough decisions including asking people to go. So think about your financial stability first; when you get laid off, your kids will complain to you and not your boss.





 

Friday, September 14, 2012

Unix Shell Interview question part-1

Unix Shell Interview question part-1

In shell scripting How to indentify that the previous command was run successfully?
•    How will you write a shell script to connect to SQL database?
•    What does UID and GID signify?
•    What are the different security mechanisms available in UNIX?


Unix is having 3 ways of Security Mechanism:

1. By granting or revoking File permissions. Owner or Admin can change permissions to be given to group or others by using chmod command in Unix.

2. Login is restricted using login credentials (User name and Password).

3. Password is kept in encrypted format in the file /etc/passwd


•    What are the different types of shells available in UNIX?
•    How many users have logged in and logged out in last five or 10 minutes.  Last command gives last logins of user.

•    How do you search the string for vowel's occurrence and number of occurrences of each vowel
•    What is make used for? How is it different from a shell script?
•    How to compare floating point number in shell scripting .
•    How to delete a word from a file using shell scripting???
•    How to extract the second row of a text-file?
•    How to compare two floating point numbers?
•    How to compress files by using shell scripting
•    What are the steps to take files from unix server to windows?
•    How to find see the file which is created today,s date with time after 10 a.m to 5 p.m?
•    What is the basic difference u find between a shell script and perl.I mean the advantages of one over

•    What is use of "cut" command ? Give some examples. Can we use "awk" or "sed"
•    How Connect to a Database in Shell Programming? Please tell me Step by Step?


•    What is this line in the shell script do #!/bin/ksh?
•    Write a shell script to identify the given string is palindrome or not?
•    What is the difference between writing code in shell and editor?
•    What is INODE?
•     What is the difference between a 'thread' and a 'process'?   Process uses its own own state information, use their own address spaces, and only interact with each other via interprocess communication mechanisms (generally managed by the operating system).

Process contains threads.

A single process might contains multiple threads; all threads within a process share the same state and same memory space, and can communicate with each other directly, because they share the same variables.


•    What does $# stand for? –total number of parameteres
•    What is $*? – All Arguments
•    If you have a string "one two three", Which shell command would you use to extract the strings?
•    What is the difference between a shell variable that is exported and the one that is not exported?
•     How will you list only the empty lines in a file (using grep)?   Grep “^$” file_name

Count the number of empty lines:
grep -c '^$' list.txt


•    How do you schedule a command to run at 4:00 every morning?
By Cron 

0 4 * * *

Syntax

min hour DayOfMonth Month dayOfWeek Command

{MHDMD C} shortcut to remember

1.0    Format
Field name    Mandatory?    Allowed values    Allowed special characters
Minutes    Yes    0-59    * / , -
Hours    Yes    0-23    * / , -
Day of month    Yes    1-31    * / , - ? L W
Month    Yes    1-12 or JAN-DEC    * / , -
Day of week    Yes    0-6 or SUN-SAT    * / , - ? L #
Year    No    1970–2099    * / , -



•    How do u open a read only file in Unix?
•    What are the different kinds of loops available in shell script? – For, While, Until,

Name                                 ID Number

/dev/stdin                          0
/dev/stdout                       1
/dev/stderr                        2



W    whoami    Who    Finger  [ Or f]
•    Tells Idle Time
•    who is logged in, and what are they doing

    •    display your username    •    identifies the users currently logged in    •    Tells Idle Time
•    display information about users

Difference.

Soft link    Hard Link
•    Symbolic link ‘is’ a file that only contains the pathname of another file or directory. it is created with ln –s

•    Operation on the symbolic link is directed to the file pointed by the it


•    A softlink fills the same role as a Windows shortcut

•    ln -s [target] [link name]


•    Creating a softlink is creating a new file, and will consume a small amount (usually 4KB) of space on your filesystem.

•    If the original file is deleted, then all softlinks to it become invalid
    •    when you create a hardlink, you are creating another pointer to the data location on disk, not a pointer to the existing file.

•    That means that editing a hard link of a file is equivalent to editing the original instance of the file.

•    You can’t use a hardlink to link to a directory.

Because a hardlink is a direct reference to the underlying filesystem, you can’t hardlink across filesystems.

•    With a hardlink, you can delete any of the instances, including the original, and as long as at least one instance exists the file will remain on the system.

•   
 
http://techthrob.com/2010/09/26/softlinks-vs-hardlinks-a-quick-explanation/

SQL Interview Question part-1



SQL Interview Question part-1

1. What do you understand by SQL?

2. What are different phases of normalization?

3. Explain different kinds of keys used in Database?

4. What is the difference between primary and unique key?

Answer:

Primary key and Unique key enforce Uniqueness of the column on which they are defined.

But by default PK creates Clustered index on Col and Unique creates Non-Clustered index.

PK does not allow Null, whereas Unique Key allows one NULL only.

5. What are constraints?

6. Explain different types of constraints with an example?

1.0             DELETE

The DELETE command is used to remove rows from a table. A WHERE clause can be used to only remove some rows .  If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to COMMIT or ROLLBACK the transaction to make the change permanent or to undo it.

 Note that this operation will cause all DELETE triggers on the table to fire.

2.0             TRUNCATE

TRUNCATE removes all rows from a table. The operation cannot be rolled back and no triggers will be fired. As such, TRUNCATE is faster and doesn't use as much undo space as a DELETE.

3.0             DROP

The DROP command removes a table from the database. All the tables' rows, indexes and privileges will also be removed. No DML triggers will be fired. The operation cannot be rolled back.

DELETE
  

TRUNCATE
  

DROP

you need to COMMIT or ROLLBACK

few Rows also can be delete

the table structure remains the same,
  

The operation cannot be rolled back

TRUNCATE is faster than Delete

Used to remove whole table

the table structure remains the same,

  

The operation cannot be rolled back.

the table structure is also deleted.

JOINS

    JOIN: Return rows when there is at least one match in both tables
    LEFT JOIN: Return all rows from the left table, even if there are no matches in the right table
    RIGHT JOIN: Return all rows from the right table, even if there are no matches in the left table
    FULL JOIN: Return rows when there is a match in one of the tables

SQL INNER JOIN Keyword

The INNER JOIN keyword return rows when there is at least one match in both tables.

SQL INNER JOIN Syntax

SELECT column_name(s)

FROM table_name1

INNER JOIN table_name2

ON table_name1.column_name=table_name2.column_name

Example:

1
  

SELECT selection_list

2
  

FROM table_A

3
  

INNER JOIN table_B ON join_condition

4
  

WHERE row_conditions.

We can simplify the inner join as

  

1 SELECT productID,productName,categoryName

2
  

FROM products, categories

  

  

  

3
  

WHERE products.categoryID = categories.categoryID

SQL LEFT JOIN  (LEFT OUTER JOIN) Keyword

The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).

SQL LEFT JOIN Syntax

          SELECT column_name(s)

FROM table_name1

LEFT JOIN table_name2

ON table_name1.column_name=table_name2.column_name

PS: In some databases LEFT JOIN is called LEFT OUTER JOIN.

SQL RIGHT JOIN Keyword

PS: In some databases RIGHT JOIN is called RIGHT OUTER JOIN.

The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no matches in the left table (table_name1).

SQL RIGHT JOIN Syntax

SELECT column_name(s)

FROM table_name1

RIGHT JOIN table_name2

ON table_name1.column_name=table_name2.column_name

SQL FULL JOIN Keyword

The FULL JOIN keyword return rows when there is a match in one of the tables.

SQL FULL JOIN Syntax

SELECT column_name(s)

FROM table_name1

FULL JOIN table_name2

ON table_name1.column_name=table_name2.column_name

4.0         The SQL UNION Operator

The UNION operator is used to combine the result-set of two or more SELECT statements.

Notice that each SELECT statement within the UNION must have the same number of columns. The columns must also have similar data types. Also, the columns in each SELECT statement must be in the same order.

       i.            SQL UNION Syntax

SELECT column_name(s) FROM table_name1
UNION
SELECT column_name(s) FROM table_name2

Note: The UNION operator selects only distinct values by default.  To allow duplicate values, use UNION ALL.  That’s why union is slower than UNION ALL.

     ii.            SQL UNION ALL Syntax

SELECT column_name(s) FROM table_name1
UNION ALL
SELECT column_name(s) FROM table_name2

PS: The column names in the result-set of a UNION are always equal to the column names in the first SELECT statement in the UNION.

5.0    Oracle/PLSQL: Oracle System Tables

Below is an alphabetical listing of the Oracle system tables that are commonly used.

System Table
  

Description

ALL_ARGUMENTS
  

Arguments in object accessible to the user

ALL_CATALOG
  

All tables, views, synonyms, sequences accessible to the user

ALL_COL_COMMENTS
  

Comments on columns of accessible tables and views

ALL_CONSTRAINTS
  

Constraint definitions on accessible tables

ALL_CONS_COLUMNS
  

Information about accessible columns in constraint definitions

ALL_DB_LINKS
  

Database links accessible to the user

ALL_ERRORS
  

Current errors on stored objects that user is allowed to create

ALL_INDEXES
  

Descriptions of indexes on tables accessible to the user

ALL_IND_COLUMNS
  

COLUMNs comprising INDEXes on accessible TABLES

ALL_LOBS
  

Description of LOBs contained in tables accessible to the user

ALL_OBJECTS
  

Objects accessible to the user

ALL_OBJECT_TABLES
  

Description of all object tables accessible to the user

ALL_SEQUENCES
  

Description of SEQUENCEs accessible to the user

ALL_SNAPSHOTS
  

Snapshots the user can access

ALL_SOURCE
  

Current source on stored objects that user is allowed to create

ALL_SYNONYMS
  

All synonyms accessible to the user

ALL_TABLES
  

Description of relational tables accessible to the user  -- It list the percentage of Used space as well.

ALL_TAB_COLUMNS
  

Columns of user's tables, views and clusters

ALL_TAB_COL_STATISTICS
  

Columns of user's tables, views and clusters

ALL_TAB_COMMENTS
  

Comments on tables and views accessible to the user

ALL_TRIGGERS
  

Triggers accessible to the current user

ALL_TRIGGER_COLS
  

Column usage in user's triggers or in triggers on user's tables

ALL_TYPES
  

Description of types accessible to the user

ALL_UPDATABLE_COLUMNS
  

Description of all updatable columns

ALL_USERS
  

Information about all users of the database

ALL_VIEWS
  

Description of views accessible to the user

DATABASE_COMPATIBLE_LEVEL
  

Database compatible parameter set via init.ora

DBA_DB_LINKS
  

All database links in the database

DBA_ERRORS
  

Current errors on all stored objects in the database

DBA_OBJECTS
  

All objects in the database

DBA_ROLES
  

All Roles which exist in the database

DBA_ROLE_PRIVS
  

Roles granted to users and roles

DBA_SOURCE
  

Source of all stored objects in the database

DBA_TABLESPACES
  

Description of all tablespaces

DBA_TAB_PRIVS
  

All grants on objects in the database

DBA_TRIGGERS
  

All triggers in the database

DBA_TS_QUOTAS
  

Tablespace quotas for all users

DBA_USERS
  

Information about all users of the database

DBA_VIEWS
  

Description of all views in the database

DICTIONARY
  

Description of data dictionary tables and views

DICT_COLUMNS
  

Description of columns in data dictionary tables and views

GLOBAL_NAME
  

global database name

NLS_DATABASE_PARAMETERS
  

Permanent NLS parameters of the database

NLS_INSTANCE_PARAMETERS
  

NLS parameters of the instance

NLS_SESSION_PARAMETERS
  

NLS parameters of the user session

PRODUCT_COMPONENT_VERSION
  

version and status information for component products

ROLE_TAB_PRIVS
  

Table privileges granted to roles

SESSION_PRIVS
  

Privileges which the user currently has set

SESSION_ROLES
  

Roles which the user currently has enabled.

SYSTEM_PRIVILEGE_MAP
  

Description table for privilege type codes. Maps privilege type numbers to type names

TABLE_PRIVILEGES
  

Grants on objects for which the user is the grantor, grantee, owner, or an enabled role or PUBLIC is the grantee

TABLE_PRIVILEGE_MAP
  

Description table for privilege (auditing option) type codes. Maps privilege (auditing option) type numbers to type names

COMMAND TYPE
  

Command names

Data Definition Language (DDL) Statements

  

·  Create, alter, and drop schema objects

·  Grant and revoke privileges and roles

[CAD GR]

These are AUTOCOMMIT

6.0             Data Manipulation Language (DML) Statements

  

·         CALL

·         DELETE

·         EXPLAIN PLAN

·         INSERT

·         LOCK TABLE

·         MERGE

·         SELECT

·         UPDATE

[UDI-SM]

NOT AUTOCOMMIT

7.0             Transaction Control Statements  (TCL)

  

·         COMMIT

·         ROLLBACK

·         SAVEPOINT

·         SET TRANSACTION

Used to manage changes done by DML command

8.0             Session Control Statements

  

·         ALTER SESSION

·         SET ROLE

9.0              Data Control Language (DCL)
  

GRANT

REVOKE

  

  

  

  

What are the predefined oracle exceptions?

Following is the predefined oracle exceptions

No_data_found
Too_many_rows
Zero_divide
Login_denied
Program_error
Timeout_on_resource
Invalid_cursor
Cursor_already_open
Dup_val_on_index

Explain user defined exceptions in oracle.

User defined exception in oracle are defined by the user. They need to be explicitly raised by the user using the RAISE statement. Oracle is not aware of these exceptions unless declared.

Example:
DECLARE
        Trans EXCEPTION;
BEGIN
IF TO_CHAR(SYSDATE, ‘DY’)= ‘SUN’ THEN
RAISE Trans;
END IF
EXCEPTION
WHEN trans THEN
DBMS_OUTPUT.PUT_LINE(‘No transactions today’);
END;

What are SQL functions in oracle?

There are two types of functions –

Single row that operates row by row . Functions that fall under single functions are Date, Numeric, Character, Conversion and miscellaneous function


Group function operates on multiple rows. Functions that fall under group functions are avg, max, min, count, and sum.

CURSOR

A cursor is a variable that runs through the tuples of some relation. This relation can be a stored table, or it can be the answer to some query.

There are different types of cursors but broadly classified into two :

 Implicit cursor

 Explicit cursor.

 Every query that we issue on a database is an implicit cursor for  eg. a select, an update, a delete etc.

  On the other hand explicit cursor is a user defined cursor eg: cursor explicit_cur.