Prasanna Says

Saturday, August 30, 2008

Mp3 Ring Tones

Tamil Mp3 Ringtones

Hi,

I use to create ring tones by cutting and editing mp3 songs for using it in my mobile. Now I am posting it for the benefit of all and its totally free. You can download and use it in your mobile phones.

Wednesday, August 20, 2008

Improve your English


Are you bad at English writing and speaking?

Do you want to improve your English?

Do you want your accent sound like the native speakers?


Then I am one of you who is a non native English speaker and desperately wanted to improve the English skills. Now through numerous methods I've changed my accent and my writing skills from "very bad" level to acceptable level. Now I can understand the native speakers, English movies and English music. I also want everyone to know the methods that I've used to improve my skills. So that you can also improve, you’re writing, reading, speaking and listening skills in English. You can also help your children to improve their English Skills.

The reasons for my poor English skills are

1. The school I studied was bad in English teaching. Though it was an English Medium, teachers use to teach all subjects, including English subject, in my mother tongue.
2. I didn't get chance to speak with any body in English until I join College.
3. No one helped me to correct my speaking errors even now.
4. Even few people whom I use to have conversation in English were worse than I was.
5. And off course, I am not a native speaker to speak fluently and pronounce correctly.

All these things ruined my English skills. It could also be the reason for your poor English.
Four important skills in learning a language are Reading, Writing, Listening and Speaking.


Reading


It is the process of recognizing the words and sentences of the language thereby understand the meaning in it. For this you need to have good vocabulary to understand words and good grammatical skills to understand the meaning of the sentences. Only way to improve your vocabulary is Reading English Paper, books.

Vocabulary - To understand Words

Take a highlighter, pencil or pen and read the book. As and when you encounter a new vocabulary mark it with highlighter and continue reading. By this time don't worry about the meaning of the sentence. At the end of the chapter find out the meaning of highlighted words and write it down in the book itself. After finding meanings of all the highlighted words, read the chapter again. Now you can almost get the meaning of every sentence in the chapter. If the chapter is so long, then there must be a logical separation in the pages. It would be so much boring when you start doing it. Reading a single book may even take about 6 months time. However, it doesn't matter when you consider the amount of vocabulary your gaining.

Initially read the books of single author. Because the authors use to write with set of vocabulary, they knew. So when you read the book of the same author again, then you can possibly finish the book so quickly then you did first time. When I started reading the Sidney Sheldon fiction books, I took 3 months to finish the first book (400 pages). However, the fourth book took just one week of time to finish.

Get one of the Following books and start doing above steps

Fiction
1. If tomorrow comes, Sidney Sheldon
2. Rage of Angels, Sidney Sheldon
3. Are you afraid of Dark? Sidney Sheldon
4. Naked Face, Sidney Sheldon
5. Not a penny more Not a penny less, Jeffery Archer
6. False impression, Jeffery Archer
7. Digital Fortress, Dan Brown
8. Angels and Demons, Dan Brown

Personality Development
1. Monk who sold his Ferrari
2. Who moved my cheese?
3. One minute manager
4. Seven Habits of highly effective people

I read these books to improve my knowledge. However, choice of the book is off-course yours.

Subscribe to a daily newspaper and read at least single page with the use of dictionary. Choose any interesting section in the newspaper for reading. Someone like sports, someone like business and someone like international. Whatever you like, just have the habit of reading newspaper everyday. This is so easy since you don’t have to spend much time in vocabulary improvement and simultaneously you can get the general knowledge.

Grammar - To understand Sentence

You must know English grammar to understand the sentences. Even if you read many fiction books and newspaper, only learning grammar makes you understand the proper meaning of sentences. Therefore, you have to use a self-Study grammar book with answers for exercises. The book I am using is "Advanced Grammar in Use (with answers) - Martin Hewings - Cambridge University". I haven't completed this book yet and that’s why you could find lot of mistakes in my writing.


Listening


Listening is second level of complexity in English. Unlike reading here you can't go back to read the sentence again or look up the words in dictionary. In addition, you have to understand the accent of the person your listening. Things would become too difficult if you supposed to speak with native speakers. If you do have, mp3 player then put some audio books in it and listen it with hard copy in your hand. You can get free audio books in http://librivox.org/. You can also find good material in the following websites. You can listen to English radio like NPR (American news) or English Dramas like "Friends" with subtitle. That will improve your listening skills to greater extent

http://www.manythings.org/ : Contains Almost Everything

http://www.gutenberg.org/browse/categories/1 : Free Audio Books.


Writing


Writing is third level of complexity in English. Because in reading you just need to recognize the words and sentences. However, in writing you have to remember the words and sentence to reproduce it over the paper or email without any mistakes. Again, read the grammar book and improve the vocabulary in the same way you did for reading. However, in writing you need someone to correct your mistakes. You may verify it with your close friends. To some extent, Microsoft Word will check minor errors in sentences. You can also use following site to do spell and grammar check.

http://www.spellchecker.net/spellcheck/


Speaking


This is highest level of complexity in English. Here you need to recall the vocabulary, grammar instantaneously to form the sentence. If you have a companion then you can speak in English with him, you can select a topic and do group discussion. Even if you don’t have any companion, you just imagine that your doing a presentation or your in a group discussion and speak out loud in your house. You can records your voice in the mp3 player or computer to hear it again.

First, download an audio book with soft copy hear it. Then you read the book and record your voice. Find out the difference between native reader and you. This will help you to correct your accent. You can also get some American Accent training course to improve your English. The course I've used is"Improve Your American English Accent - Charlsie Childs” with audio CDs. Everyday I used to hear this course for at least 30 minutes. You can either buy it legally or get it from torrents. However, I recommend you to buy it.

There are different techniques you need to learn when speaking. You can learn it only through Accent training course. However, the most effective way to improve your accent could be joining the accent-training institute. Nowadays lots of accent training centers are available to train the BPO employees. However, this is a bit costly which could be around 15000 Rupees.

Useful Websites

You can visit following websites to improve your speaking and writing skills.

http://www.manythings.org/ : Contains Almost Everything
http://www.gutenberg.org/browse/categories/1 : Free Audio Books.
http://www.eflnet.com/grammar/index.php : Improve your Grammar skills
http://www.truly-free.org/ : Free Books
http://www.thefreedictionary.com/fleece : Online Dictionary
http://www.princetonreview.com/vocabminute/default.asp : Pod cast to improve your vocabulary


Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

Saturday, May 24, 2008

Mandriva on Vostro

Mandriva on Vostro

Hi all,
       Last month I bought Dell vostro laptop loaded with Windows XP home. Honestly I didn't want to buy the laptop preloaded with Windows OS. But when I compared the prices of free dos laptop and windows xp laptop in the dell.com, the cost of Windows laptop is equal to free dos even when the configuration remains same. Actually the laptop loaded with free dos should be cheaper than Windows since it cuts the cost of Operating System. And laptops loaded with free dos or ubuntu has very limited hardware options to choose. Hence I bought Dell Vostro 1400 loaded with Windows XP with following configurations.
  • Intel Core 2 Duo Processor 1.6Ghz
  • 2 GB ram
  • 160 GB Hard disk

      Being a big fan of Linux I wanted to try Linux in my laptop. Before that, the biggest part in installing linux is choosing the best distribution for you. I have used ubuntu, openSuse, Mandriva and fedora in the past. Among them I would say Mandriva linux is the best because of the following reasons.

  1. Supports all media types out of box
  2. Recognized video driver in Vostro laptop (which is very important)
  3. Very easy to use
  4. Configures hard disk mount points and mounts it automatically.
  5. Sound drivers are recognized well.

     I didn't use fedora because it not as flexible as mandriva and we have to do painful configuration to make mp3 and DVD formats work. I tried ubuntu but I don't like the gnome interface of ubuntu and it had same mp3 problem as fedora and the ubuntu crashed my windows partition which I recovered later. I gone through the openSuse website it is amazing. They provided options to build and download packages for various versions of their distribution. But unfortunately It couldn't recognize my video card.

     Mandriva linux 2008 worked well with my laptop. Nowadays mandriva linux offers only live CD as free download and there is no option to download whole package in DVD which was previously available in their website. If anybody knows how to download the whole collection please update the blog with your information.

     However, Mandriva Linux 2008 did gave some problems which I fixed by searching solutions in the internet. Later I found the problems that I faced are not just with mandriva but it may apply to almost all distributions. Ubuntu forums helped me a lot since ubuntu has got lot of users and ubuntu forums are very active. These solutions would be helpful for you if you're planning to try linux on your Dell Vostro Laptop.


The problems that I have faced are
  • Sound did not work after installation
  • Unable to see video when 3D desktop is enable
  • Speed of USB device was very low 80KBps instead of 7Mbps
  • Problem with evilwm desktop

How to make the sound work


After installing mandriva linux on my laptop, the sound driver did not work. I made the sound driver work through following settings

Steps:
1. Goto /etc/ in konsole
2. login as root "su root" and give password
3. vi modprobe.conf
4.  You can find the line "options snd-ac97-codec power_save=1". Comment the line and a new line ("options snd-hda-intel model=5stack") as follows.

# options snd-ac97-codec power_save=1
options snd-hda-intel model=5stack

3. Save the file ":wq" and restart the system.

Now the sound driver should work. Don't disable the kmix from startup items otherwise sound will not work. Even after doing all this I am still facing a problem with sound. Initially after I boot the system sound is not working. Only when I adjust the master sound mixer in kmix I could here the sound again. If some one finds solution for this problem please post it here.


How to make Video work with 3D desktop

When I installed linux I choosed no desktop effects, so the videos were played in kaffeine player. But after enabling 3D desktop I could not see the picture, I could only here the sound. Form Ubuntu forums I read that "it can be fixed by changing video driver in the kaffeine player". Hence I did following setting in the kaffeine player.

  1. Open kaffeine player
  2. Goto Settings->xine engine parameters
  3. Select the video tab
  4. Select Beginner Options tab
  5. Change the default video driver to xshm.
  6. Apply and Ok
  7. Restart the kaffeine player

I don't know what is xshm video driver is, but it worked very well for me. If it didn't work for you try different drivers available in the combo box.

How to increase speed of USB

I found this issue when I tried to copy a file from my linux machine to USB device. The transfer happened at the rate of 8 Kbps which supposed to be 7 Mbps. But the reading speed was around 7Mbps which is pretty normal. After I gone through different forums I found the fix in Ubuntu forums. Later I found that its the most common problem with all linux machines.

And the solution to increase the writing speed is very simple

1. Goto /etc/ in konsole
2. login as root "su root" and give password
3. vi fstab
4. you can find entry for usb as (sdb1 or sdb2 ). If you could not find it, plugin the USB device and open the USB folder. The konqueror window would display the USB device name.
5. remove the "sync" option in the line as follows.

/dev/sdb1 /media/hd3 vfat umask=0022,users,iocharset=utf8,sync,noauto,exec 0 0
to
/dev/sdb1 /media/hd3 vfat umask=0022,users,iocharset=utf8,noauto,exec 0 0

6. Save the file ":wq" and restart the system

Now your USB will read and write at 7Mbps.

Problem with evilwm

One fine day when I tried using different desktops provided with mandriva linux, I came across evilwm desktop. When I selected evilwm and logged in, I could not see any thing in the desktop and I was not able to logout as well. Unfortunately autologin is enabled in mandriva linux by default and that made the problem even worse. Because when restarted the machine, the linux automatically started login into the evilwm desktop and I was not able to do any thing with my system. I gone through different forums and queried different sites in google, but nothing helped me.

I listed different processes running in the system. And fortunately I found the process "evilwm". I took the process number and killed it using kill -9 command. And it killed the hanging desktop and restored the login screen. (Note: To access the konsole press Ctr + Alt + F1 and login as root)

#> ps -ax

1837 0 ---    evilwm
...
..

#> kill -9 18370
1 process killed


Hence it is always advisable to disable autologin options in linux(only if you want to try different desktops).

Some useful free softwares for mandriva linux

Since mandriva one doesn't include all the software with it. You need to download and install some of the software by yourself.

Please visit the following site for installing other useful applications.
http://www.howtoforge.com/the-perfect-desktop-mandriva-one-2008-spring-kde


Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

Saturday, March 15, 2008

Sql Part II

Sql Part II

Lets see some of the frequently asked queries in the interview.


1. To find The Nth Maximum Salary.


SELECT DISTINCT SAL
FROM EMP A
WHERE &N=(SELECT COUNT (DISTINCT B.SAL) FROM EMP B WHERE A.SAL<=B.SAL);


2. To use Exists Clause. Correlated subquery

SELECT DNAME, DEPTNO
FROM DEPT
WHERE EXISTS (SELECT * FROM EMP WHERE
DEPT.DEPTNO = EMP.DEPTNO)


3. To Find The Not Null Column Alone In A Table.

SELECT COLUMN_NAME
FROM USER_TAB_COLUMNS
WHERE NULLABLE = 'N'
AND TABLE_NAME = 'COUNTRY'


4.To delete The Duplicate Rows Alone in A Table. (frequently asked question)

DELETE DEPT WHERE ROWID NOT IN (SELECT MAX (ROWID)
FROM DEPT GROUP BY DEPTNO HAVING COUNT (*) >=1)


5.To find The Max Salary without MAX Function.

1. SELECT DISTINCT SAL
FROM EMP1 WHERE SAL NOT IN
(SELECT SAL FROM EMP1 WHERE SAL < ANY (SELECT SAL FROM EMP1))


2. SELECT SAL FROM EMP WHERE SAL >= ALL (SELECT SAL FROM EMP)



6. To find the database name

select name from v$database;


7. To convert the given number to word

SELECT TO_CHAR (TO_DATE (&NUM,'J'),'JSP') FROM DUAL;

8. What is the difference between unique and distinct keyword in Oracle.

To summarise:

True:
* Only one primary key is allowed per table (any number of unique keys are allowed).
* Primary key columns automatically become NOT NULL (unique keys can contain nulls).
* UNIQUE and DISTINCT are synonymous in a SELECT list.

Not true:
* A unique key cannot be referenced in a foreign key definition (it can)
* A primary key will have a unique index (it might not)
* DISTINCT and UNIQUE handle LOBs differently (they do not)
* UNIQUE is Oracle syntax while DISTINCT is ANSI (both appear to be ANSI-compliant according to the SQL*Plus flagger option, although I couldn't find this standard documented. Oracle did not support SELECT UNIQUE until 8.1.5.)



9. What is the difference between union and union all

UNION
1. returns all distinct rows selected by either query
2. does the multi level sorting on data starting from first column
3. due to sorting query performance goes down dramatically.

UNION ALL
1. returns all the rows selected by either query including all duplicates.
2. No sorting is applied on the data.
3. No performance issue in this set operation. And it is advisable to use union all instead of union where ever applicable.


Also visit : Sql Part 1

Saturday, March 8, 2008

Battery Life

Seven Ways to Improve Cell phone Battery Life


  1. Turn the phone off. This is probably the most effective and
    simplest way of conserving your battery’s power. If you don't plan on
    answering the phone while you're sleeping or after business hours, just
    turn it off. Do the same if you are in an area with no reception (such
    as a subway or remote area) or in a roaming area, since constantly
    searching for service depletes the battery fairly quickly. Some phones
    have an automatic power save feature, but it takes about 30 minutes
    with no service to kick in. By then, much battery power has been used.

  2. Stop searching for a signal. When you are in an area with poor or
    no signal, your phone will constantly look for a better connection, and
    will use up all your power doing so. This is easily understood if you
    have ever forgotten to turn off your phone on a flight or train. The
    best way to ensure longer battery life is to make sure you have a great
    signal where you use your phone.


  3. Get the most out of your battery. Switch off the vibrate function
    on your phone, and use just the ring tone instead. The vibrate function
    uses up a lot of battery power. Keep the ring tone volume as low as
    possible.

  4. Turn off your phone's back light. The back light is what makes
    the phone easier to read in bright light or outside. However, the light
    also uses battery power. If you can get by without it, your battery
    will last longer. If you have to use the back light, many phones will
    let you set the amount of time to leave the back light on. Shorten that
    amount of time. Usually, one or two seconds will be sufficient. Some
    phones have an ambient light sensor, which can turn off the back light
    in bright conditions and enable it in darker ones.

  5. Avoid using unnecessary features. If you know it will be a while
    before your phone’s next charge, don’t use the camera or connect to the
    Internet. Flash photography can drain your battery especially quickly.
    If your phone has bluetooth capability, disable it when not in use.

  6. Keep calls short. This is obvious, but how many times have you
    heard someone on their cell phone say, "I think my battery’s dying,"
    and then continue their conversation for several minutes? Sometimes,
    the dying battery is just an excuse to get off the phone (and a good
    one, at that), but if you really need to conserve the battery, limit
    your talk time.

  7. Don't keep the animated background picture. That will reduce your
    battery life by 25 percent.


Obesity

Obesity Can Cause Cancer


Obesity is on its way to being deadlier than smoking as a cause of cancer, a leading researcher said.

Being obese is currently associated with about 14 percent of cancer deaths in men and 20 percent in women, compared with about 30 percent each for smoking, Dr. Walter C. Willett of the Harvard School of Public Health, told the annual meeting of the American Association for the Advancement of Science.

"As smoking goes down and obesity goes up it won't be long before obesity is the No. 1 cancer killer," Willett said at a symposium on cancer prevention.

Added Dr. Douglas R. Lowy of the National Cancer Institute: "Cancer prevention begins at home. ... Not all of us always act in our own best interest."

Willett said research is producing increasing evidence associating obesity with a variety of cancers, including breast, colorectal, liver, pancreas and gallbladder. Alcohol is also associated with certain cancers, he said.

In the 1980s, researchers focused on the amount of fat people ate as a probable cause of cancer, but studies did not strongly support that. Later they turned to diets high in fruits and vegetables as a way to reduce cancer, but again, Willett said, they struggled to find convincing evidence in studies.

Now attention has turned to obesity, and more and more research is providing evidence that indict that as a cancer cause.

That does not mean people should stop eating fruit and vegetables and go to a high-fat diet, he quickly added. "We do see evidence of a benefit for heart disease, I think that's pretty real," he said.

And, he noted, studies have indicated some benefit from a high fruit and vegetable diet in some cancers, he added, including mouth, esophagus, lung and stomach.

Overall, Willett estimated 30 percent to 35 percent of cancers are due to nutritional factors, much of it to obesity.

For More Information visit the following sites

http://www.obesityfocused.com/


http://www.obesityfocused.com/articles/obesity-and-cancer/index.php

Tuesday, February 19, 2008

Soft skills

Soft Skills that every IT Professionals must have

A career in the field of information technology (IT) is one of the most sought these days. Most engineering college graduates land up in the IT industry. While, a job as a software engineer looks very lucrative at first glance, once you get into the industry, you realise that it is not just your technical skills that will keep you in the race.

You need something more to ensure that you are able to do a good job. In other words, you need some extra skills to ensure that you are able to keep the job after you land it. These extra skills are called 'soft skills'.

What are the advantages of soft skills?

Your soft skills or people skills decide how fast and well you climb the ladder of success. Here are some of the advantages that your soft skills can reap for you:
  • They help you grow in your career
  • They give you an eye to identify and create opportunities
  • They help develop relationships with your colleagues and clients
  • They develop good communication and leadership qualities in you
  • They help you think beyond dollars.

After reading the advantages your soft skills can get you, you would want to know what is it that you need as a technical person to grow as a professional and climb the ladder of success.

Here are some soft skills which will help you grow not just as a professional but also as a person:

A never-say-die attitude

Any task that comes to you or your team, undertake with a can-do attitude. Slowly you will observe that you and your team have become the favourite of the management. Every accomplished task boosts your self confidence and pushes you one step closer to success.

Communication

This includes verbal, non-verbal and written communication. Be sure that you are able to put across your point clearly and confidently. As an IT professional you will need to work with colleagues and clients of various nationalities and backgrounds. Ensure that you are able communicate clearly with them. This applies to teleconferencing as well.

Learn to listen

Listening is an essential part of communication. Ensure that you listen attentively. This will help make the other party feel comfortable while interacting with you and improve your communications.

Be a team player

Help your team members help themselves. Be friendly and approachable. If your team is stuck somewhere look out for ideas to overcome the obstacle together.

Learn to delegate

Chances are you will have junior members on the team. Recognise their strengths and delegate them the right work.

Give credit to those who deserve it

Do not all the credit for a job well done. Pass on praise or recognition from superiors to team members who deserve it. Doing it publicly or in front of your boss will further instill a feeling of confidence among your team.

Motivate yourself and others

As you look ahead to grow in your career you will need to deal with various people under you. You can not expect quality results from a team whose motivational level is too low. So, stay motivated and keep others motivated.


Develop leadership qualities

A leader is a person whom people are ready to follow. Develop qualities that will make people follow you not because they are required to but because they want to. Even while operating in a team, take a role to lead and facilitate the work for other members.

Control your sense of humour

When you are working with people from various cultures you need to be extra careful with your sense of humour and gestures. Behaviour that is acceptable among Indian colleagues might be considered obscene or disrespectful by people from other cultures. Stay away from controversial topics or ideas in the office.

Mentoring

This is a quality one needs to develop in order to grow. If you want to grow in the hierarchy, you need to help sub-ordinates grow. Be a good mentor. Help them understand things better. This not only improves the work environment but also improves your work relationships.


Handling criticism

When you are working with people, at times you will be criticised while at others you will be required to criticise your colleagues or sub-ordinates. Ensure that you take the criticism constructively and look at it as an opportunity to grow. Similarly, while criticising others shoose your words carefully and keep it professional. Destructive criticism will lead to loss of respect and trust. Let your criticism help the other person grow.

IT-preneur

Like an entrepreneur, have a risk-taking attitude. Learn to take responsibility for failures and pride in a job well done.

Managing spoil sports

While working in a team there will always be one or two people with a negative attitude. This attitude can be contagious. Employ tactics to deal with such people and improve motivation.

E-tiquette

Keep an eye on your e-mails for proper language. Open up the e-mail with a suitable address and end with a thanking note. Your words should convey the correct meaning and invoke the desired action.

Multitasking

As you climb the ladder of success, you will need to handle work from various fields. For example, you will have to interact with your technical team on project success, with the HR department for team appraisal and recruitment, with clients on project requirements or problems etc. Organise and plan to fit in all the required activities into your schedule.

Once you have developed these soft skills along with your technical skills you will find that you are a lot more confident about your capabilities.


Note: This Article is taken from rediff.com

Monday, February 4, 2008

SQL Tips

Also Vist: Sql Part II


1. Multiple row generation from DUAL

select rownum i from dual connect by level <= 16

Above query works only in 10g

select rownum from dual a, dual b connect by level <>

This query works on both 9i and 10g


2. Lock Query

SELECT s.username dbuser,
owner || '.' || object_name "Object",
s.osuser,
s.PROGRAM,
lk.sid,
lk.type lock_type,
decode(lk.lmode, 0, 'None', 1, 'Null', 2, 'Row-S', 3, 'Row-X', 4, 'Share', 5, 'S/Row-X', 6, 'Exclusive', to_char(lk.lmode)) lockmode,
decode(request, 0, 'None', 1, 'Null', 2, 'Row-S', 3, 'Row-X', 4, 'Share', 5, 'S/Row-X', 6, 'Exclusive', to_char(lk.request)) requestmode
FROM v$lock lk,
v$session s,
dba_objects ao
WHERE lk.lmode > 1
AND object_name LIKE 'JAI%'
AND s.username IS NOT NULL
AND lk.sid = s.sid
AND ao.object_id(+) = lk.id1

To find and kill the locking program..

select session_id from dba_dml_locks where name = 'JAI_RCV_HEADERS' ;

select sid, serial# from v$session where sid in ( );

alter system kill session ',';

repeat alter stmt for all sids obt. in 2nd query

3. Desc query

In oracle, you would have used desc to describe the table. Now let us see, how to generate DESC output through sql query.

SELECT column_name || ' ' || decode(nullable, 'N', 'not null', ' ') || ' ' || data_type ||
decode(data_type, 'NUMBER', decode('' || nvl(data_precision, -1), '-1', '', '(' || data_precision || ',' || data_scale || ')'),
'(' || data_length || ')') fields
FROM all_tab_columns
WHERE TABLE_NAME = 'PO_VENDORS';


4. How to disable a not null constraint.

In case you have created a database column as 'not null'. And you don't want it to be 'Not null' then how will you change it?

eg:
create table temp_temp ( a number not null, b number not null)
And your want to remove "Not null" constraint for columns A.


Ans:

sql> desc temp_temp:
Name Null? Type
------------------------------- -------- ----
A NOT NULL NUMBER
B NOT NULL NUMBER


Get the Not null Constraint name from the database.


SQL> select constraint_name, search_condition from all_constraints where table_name='TEMP_TEMP';

CONSTRAINT_NAME SEARCH_CONDITION
----------------- ---------------------
SYS_C00258673 "A" IS NOT NULL
SYS_C00258674 "B" IS NOT NULL


In the results look for the row with name of the column(like "A" is not null) in the search condition. Take the corresponding constraint_name


SQL> alter table temp_temp drop constraint SYS_C00258673;

Table altered.

SQL> desc temp_temp
Name Null? Type
------------------------------- -------- ----
A NUMBER
B NOT NULL NUMBER

Not null constraint is dropped from the Table.


5. How to convert row values into columns. or how to perform multi dimensional query?

For Eg
Dept Year Amount
A 2005 100
B 2005 500
C 2005 344
A 2006 400
B 2006 122

Here you need to display the report in following format. That is comparative sales analysis of each department between 2005 and 2006.

Dept 2005 2006
A 100 400
B 500 122
C 344 0

The challenge is to bring the row values into columns. And here is the solution.

SELECT dept, sum(decode(year,'2005',amount,0)) "2005",
sum(decode(year,'2006',amount,0)) "2006"
from temp_temp
group by dept;



6. How do give if condition within the column.

This is so simple problem, you can use Case when clause to do that.

select ename, eid,case when salary <=1000 then 'A'
when salary <=2000 then 'B'
when salary <=3000 then 'C'
when salary <=4000 then 'D'
when salary <=5000 then 'E'
else 'F'
end from emp;


But how will you do switch-case without use when clause?

Here is the query to do the same stuff.

select ename, eid,decode(greatest(salary,0),least(salary,1000),'A',decode(greatest(salary,1001)
,least(salary,2000),'B',decode(greatest(salary,2001),least(salary,3000),'C',decode(greatest
(salary,3001),least(salary,4000),'D',decode(greatest(salary,4001),least(salary,5000),'E','F')))))
from emp order by 3;



7. How would you select the range of rows from the table?

Say for example, you wanted to select the rows from 2 to 5.

Solution:

select dept, no
from (select dept, rownum no from temp_temp)
where no between 2 and 5;


8. How can one dump/ examine the exact content of a database column?

SELECT DUMP (col1) FROM tab1 WHERE cond1 = val1;

DUMP (COL1)
----------------
Typ=96 Len=4: 65,66,67,32


For this example the type is 96, indicating CHAR, and the last byte in the column is 32, which is the ASCII code for a space. This tells us that this column is blank-padded.


9. Find out foreign constraints refering your table

select table_name, constraint_name from user_constraints
where r_constraint_name IN (select constraint_name from user_constraints where table_name = 'XML_DOCUMENT' and constraint_type = 'P')
and constraint_type = 'R' ;




Also Vist: Sql Part II

Saturday, February 2, 2008

VIM Quick Reference

Basic movement
h l k j . . . . . . . . . . . . character left, right; line up, down
b w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . word/token left, right
ge e . . . . . . . . . . . . . . . . . . . . . end of word/token left, right
{ } . . . . . . . . . . . . . beginning of previous, next paragraph
( ). . . . . . . . . . . . . . .beginning of previous, next sentence
0 gm . . . . . . . . . . . . . . . . . . . . . . . . . beginning, middle of line
^ $ . . . . . . . . . . . . . . . . . . . . . . . . . first, last character of line
nG ngg . . . . . . . . . . . . . . . . . . . line n, default the last, first
n%. . . . . . . .percentage n of the file (n must be provided)
n . . . . . . . . . . . . . . . . . . . . . . . . . . . . column n of current line
%. . . . .match of next brace, bracket, comment, #define
nH nL . . . . . . . . . . . . line n from start, bottom of window
M . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . middle line of window

Insertion & replace ! insert mode
i a . . . . . . . . . . . . . . . . . . . . . . . . . insert before, after cursor
I A . . . . . . . . . . . . . . . . . . . . insert at beginning, end of line
gI . . . . . . . . . . . . . . . . . . . . . . . . . . insert text in first column
o O. . . . . .open a new line below, above the current line
rc . . . . . . . . . . . . . . . replace character under cursor with c
grc . . . . . . . . . . . . . . . . like r, but without affecting layout
R . . . . . . . . . . . . . replace characters starting at the cursor
gR . . . . . . . . . . . . . . . . . like R, but without affecting layout
cm. . . . . . . . . . . . . change text of movement command m
cc or S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . change current line
C . . . . . . . . . . . . . . . . . . . . . . . . . . . . change to the end of line
s . . . . . . . . . . . . . . . . . . . . . change one character and insert
~ . . . . . . . . . . . . . . . . . . . . . . switch case and advance cursor
g~m . . . . . . . . . . . . switch case of movement command m
gum gUm. . . lowercase, uppercase text of movement m
m . . . . . . . . . . shift left, right text of movement m
n<<>>. . . . . . . . . . . . . . . . . . . . . . . shift n lines left, right
Deletion
x X . . . . . . . . . . . . . . delete character under, before cursor
dm. . . . . . . . . . . . . . delete text of movement command m
dd D . . . . . . . . . . . . . delete current line, to the end of line
J gJ . . . . . . . . join current line with next, without space
:rd - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . delete range r lines
:rdx - . . . . . . . . . . . . . delete range r lines into register x

Insert mode
ˆVc ˆVn . . . . . . . . . insert char c literally, decimal value n
ˆA . . . . . . . . . . . . . . . . . . . . . . insert previously inserted text
ˆ@. . . . . . .same as ˆA and stop insert ! command mode
ˆRx ˆRˆRx . . . . . . . . . insert content of register x, literally
ˆN ˆP. . . . . . . . . . . . . . text completion before, after cursor
ˆW . . . . . . . . . . . . . . . . . . . . . . . . . . . delete word before cursor
ˆU . . . . . . . . . . delete all inserted character in current line
ˆD ˆT. . . . . . . . . . . . . . . . . . . shift left, right one shift width
ˆKc1c2 or c1 c2 . . . . . . . . . . . . . . . . . . enter digraph {c1, c2}

ˆOc . . . . . . . . . . . . execute c in temporary command mode
ˆXˆE ˆXˆY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . scroll up, down
hesci or ˆ[ . . . . . . . . . abandon edition ! command mode

Copying
"x . . . . . . . . . . . . use register x for next delete, yank, put
:reg - . . . . . . . . . . . . . . . show the content of all registers
:reg x - . . . . . . . . . . . . . . show the content of registers x
ym . . . . . . . . . . . yank the text of movement command m
yy or Y. . . . . . . . . . . . . . . . . . .yank current line into register
p P . . . . . . . . . . . put register after, before cursor position
]p [p . . . . . . . . . . . . . . . . . . . like p, P with indent adjusted
gp gP . . . . . . . . . . . like p, P leaving cursor after new text

Advanced insertion
g?m. . . . . . . . . . perform rot13 encoding on movement m
nˆA nˆX . . . . . . . . . . . . . . +n, −n to number under cursor
gqm . . . . . . . format lines of movement m to fixed width
:rce w - . . . . . . . . . . . center lines in range r to width w
:rle i - . . . . . . . left align lines in range r with indent i
:rri w - . . . . . . right align lines in range r to width w
!mc - . filter lines of movement m through command c
n!!c - . . . . . . . . . . . . . . filter n lines through command c
:r!c - . . . . . . . . . filter range r lines through command c

Visual mode
v V ˆV . . start/stop highlighting characters, lines, block
o . . . exchange cursor position with start of highlighting
gv . . . . . . . . . . . start highlighting on previous visual area
aw as ap . . . . . . . select a word, a sentence, a paragraph
ab aB . . . . . . . . . . . . . . . . . . . select a block ( ), a block { }
Undoing, repeating & registers
u U . . . . . . undo last command, restore last changed line
. ˆR. . . . . . . . . . . . . . . .repeat last changes, redo last undo
n. . . . . . . repeat last changes with count replaced by n
qc qC. . . .record, append typed characters in register c
q. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . stop recording
@c . . . . . . . . . . . . . . . . . . . . execute the content of register c
@@ . . . . . . . . . . . . . . . . . . . . . . . . repeat previous @ command
:@c - . . . . . . . . . . . execute register c as an Ex command
:rg/p/c - . . . . . . . . . .execute Ex command c on range r
b where pattern p matches

Complex movement
- + . . . . . . . . . line up, down on first non-blank character
B W . . . . . . . . . . . . . . . . . . . space-separated word left, right
gE E . . . . . . . . . . . end of space-separated word left, right
n . . . . . . . . down n − 1 line on first non-blank character
g0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . beginning of screen line
g^ g$. . . . . . . . . . . . . . . .first, last character of screen line
gk gj . . . . . . . . . . . . . . . . . . . . . . . . . . . . screen line up, down
fc Fc . . . . . . . . . . next, previous occurence of character c
tc Tc . . . . . . . . . . . . . before next, previous occurence of c
; , . . . . . . . . . . . . . repeat last fFtT, in opposite direction
[[ ]] . . . . . . . . . . . . . . start of section backward, forward
[] ][ . . . . . . . . . . . . . . . end of section backward, forward
[( ]) . . . . . . . . . . . . . . . . . unclosed (, ) backward, forward
[{ ]} . . . . . . . . . . . . . . . . unclosed {, } backward, forward
[m ]m . . . . . . . . start of backward, forward Java method
[# ]#.unclosed #if, #else, #endif backward, forward
[* ]* . . . . . . . . . . start, end of /* */ backward, forward

Search & substitution
/s - ?s - . . . . . . . . . . . . . search forward, backward for s
/s/o - ?s?o - . . . . . search fwd, bwd for s with offset o
n or / - . . . . . . . . . . . . . . . . . . . . . repeat forward last search
N or ? - . . . . . . . . . . . . . . . . . . . repeat backward last search
# * . . . search backward, forward for word under cursor
g# g* . . . . . . . . . . . . . same, but also find partial matches
gd gD . . . local, global definition of symbol under cursor
:rs/f/t/x - . . . . . . . . . . . . . . substitute f by t in range r
b x : g—all occurrences, c—confirm changes
:rs x - . . . . . . . . . . . repeat substitution with new r & x

Special characters in search patterns
. ˆ $ . . . . . . . . . . . any single character, start, end of line
\< \> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . start, end of word
[c1-c2] . . . . . . . . . . . . . . a single character in range c1..c2
[ˆc1-c2]. . . . . . . . . . . . . . . .a single character not in range
\i \k \I \K . . . . . . . an identifier, keyword; excl. digits
\f \p \F \P . . a file name, printable char.; excl. digits
\s \S . . . . . . . . . . . . . . . . a white space, a non-white space
\e \t \r \b . . . . . . . . . . . . . . . . . . . hesci, htabi, h -i, h i

\= * \+ . . . . match 0..1, 0..1, 1..1 of preceding atoms
\ . . . . . . . . . . . . . . . . . . . . . . . separate two branches ( or)
\( \) . . . . . . . . . . . . . . . . . . . . group patterns into an atom
\& \n . . . . . . . the whole matched pattern, nth () group
\u \l . . . . . . . . . . . next character made upper, lowercase
\c \C. . . . . . . . . . . . . .ignore, match case on next pattern

Offsets in search commands
n or +n . . . . . . . . . . . . . . . . . . . n line downward in column 1
-n . . . . . . . . . . . . . . . . . . . . . . . . . n line upward in column 1
e+n e-n . . . . . . . n characters right, left to end of match
s+n s-n. . . . . .n characters right, left to start of match
;sc . . . . . . . . . . . . . . . . . . execute search command sc next

Marks and motions
mc . . . . . . . . . mark current position with mark c 2 [a..Z]
‘c ‘C . . . . . . . . . . . go to mark c in current, C in any file
‘0..9 . . . . . . . . . . . . . . . . . . . . . . . . . . . go to last exit position
‘‘ ‘" . . . . . . . . . . go to position before jump, at last edit
‘[ ‘] . . . . . go to start, end of previously operated text
:marks - . . . . . . . . . . . . . . . . . . . print the active marks list
:jumps - . . . . . . . . . . . . . . . . . . . . . . . . . . print the jump list
nˆO . . . . . . . . . . . . . . . go to nth older position in jump list
nˆI . . . . . . . . . . . . . . go to nth newer position in jump list

Key mapping & abbreviations
:map c e - . . . . . . .map c 7! e in normal & visual mode
:map! c e - . . . . map c 7! e in insert & cmd-line mode
:unmap c - :unmap! c - . . . . . . . . . . remove mapping c
:mk f - . . . write current mappings, settings... to file f
:ab c e - . . . . . . . . . . . . . . . . . add abbreviation for c 7! e
:ab c - . . . . . . . . . . . . show abbreviations starting with c
:una c - . . . . . . . . . . . . . . . . . . . . . . . remove abbreviation c
Tags
:ta t - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . jump to tag t
:nta - . . . . . . . . . . . . . . . . . . jump to nth newer tag in list
ˆ] ˆT . . . jump to the tag under cursor, return from tag
:ts t - . . . . list matching tags and select one for jump
:tj t - . .jump to tag or select one if multiple matches
:tags - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . print tag list
:npo - :nˆT - . . . . . . jump back from, to nth older tag
:tl - . . . . . . . . . . . . . . . . . . . . . . jump to last matching tag
ˆW} :pt t - . . . . . . . . . . . preview tag under cursor, tag t
ˆW] . . . . . . . . . . . split window and show tag under cursor
ˆWz or :pc - . . . . . . . . . . . . . . . . . close tag preview window

Scrolling & multi-windowing
ˆE ˆY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . scroll line up, down
ˆD ˆU . . . . . . . . . . . . . . . . . . . . . . scroll half a page up, down
ˆF ˆB . . . . . . . . . . . . . . . . . . . . . . . . . . . . scroll page up, down
zt or z - . . . . . . . . . . . . . set current line at top of window
zz or z. . . . . . . . . . . . set current line at center of window
zb or z-. . . . . . . . . . .set current line at bottom of window
zh zl . . . . . . . . . . . . scroll one character to the right, left
zH zL . . . . . . . . . . . . . scroll half a screen to the right, left
ˆWs or :split - . . . . . . . . . . . . . . . . . . . split window in two
ˆWn or :new - . . . . . . . . . . . . . . . .create new empty window
ˆWo or :on - . . . . . . . make current window one on screen
ˆWj ˆWk . . . . . . . . . . . . . . . . .move to window below, above
ˆWw ˆWˆW. . . . . . . . .move to window below, above (wrap)

Ex commands ( -)
:e f . . . . . . . edit file f, unless changes have been made
:e! f . . . . edit file f always (by default reload current)
:wn :wN . . . . . . . . . write file and edit next, previous one
:n :N. . . . . . . . . . . . . . . . . . . . edit next, previous file in list
:rw . . . . . . . . . . . . . . . . . . . . . . . write range r to current file
:rw f . . . . . . . . . . . . . . . . . . . . . . . . . . .write range r to file f
:rw>>f . . . . . . . . . . . . . . . . . . . . . . .append range r to file f
:q :q!. . . . .quit and confirm, quit and discard changes
:wq or :x or ZZ . . . . . . . . . . . . . write to current file and exit
hupi hdowni. . . . recall commands starting with current
:r f . . . . . . . . . . . . . . insert content of file f below cursor
:r! c . . . . . . . . insert output of command c below cursor
:all . . open a window for each file in the argument list
:args . . . . . . . . . . . . . . . . . . . . . . . display the argument list

Ex ranges
, ; . . . . . . separates two lines numbers, set to first line
n. . . . . . . . . . . . . . . . . . . . . . . . . . . an absolute line number n
. $ . . . . . . . . . . . . . . . . the current line, the last line in file
% * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . entire file, visual area
’t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . position of mark t
/p/ ?p?. . . . . . .the next, previous line where p matches
+n -n . . . . . . . . . . .+n, −n to the preceding line number

Folding
zfm . . . . . . . . . . . . . . . . . . . . . . . create fold of movement m
:rfo. . . . . . . . . . . . . . . . . . . . . . . . . . . .create fold for range r
zd zE . . . . . . . . . . . . . . delete fold at cursor, all in window
zo zc zO zC . . . . . . . . . . open, close one fold; recursively
[z ]z. . . . . . . . . .move to start, end of current open fold
zj zk . . . . . . . . move down, up to start, end of next fold

Miscellaneous
:sh - :!c - . . . start shell, execute command c in shell
K. . . . . . . . . . . . . . . lookup keyword under cursor with man
:make - . . . . . . start make, read errors and jump to first
:cn - :cp - . . . . . . . . . . display the next, previous error
:cl - :cf - . . . . . . . list all errors, read errors from file
ˆL ˆG . . . . . . . redraw screen, show filename and position
gˆG . . . show cursor column, line, and character position
ga . . . . . . . . . show ASCII value of character under cursor
gf. . . . . . . . . . . . .open file which filename is under cursor
:redir>f - . . . . . . . . . . . . . . . . . . redirect output to file f
:mkview [f] . . . . . . . . . save view configuration [to file f]
:loadview [f] . . . . load view configuration [from file f]
ˆ@ ˆK ˆ \ Fn ˆFn. . . . . . . . . . . . . . . . . . . .unmapped keys