Thursday, April 29, 2010

Difference Between URI and URL

URI- Uniform resource Identifier is a superset of URL and URN
e.g.- products/books/detail.html
    It is not a URL because it does not specify how to retrieve the resource.

URL – http://www.xyz.com/products/books/detail.html
is a URL because it specifies how to retrieve the resource

URN- e.g. ISBN:1-9211009-59 is a URN because it uniquely identifies this book.

We can get this to use following code :

System.out.println(“URI : “+ httpRequestObj.getRequestURI());
System.out.println(“URL : “+ httpRequestObj.getRequestURL());

IN vs Exists

IN:

Returns true if a specified value matches any value in a subquery or a list.

Exists:

Returns true if a subquery contains any rows.

What is INDEX ?

Index is created on existing table to retrieve row quickly.

For e.g. There are thousands of records in a table, retrieving information will take long time. Therefore Index has created on column which are accessed frequently. So that the information able to retrieve quickly. Index can be created on a single column or group of columns. When index is created, it first sort the data and then it assigns RowId for each row.

Syntax :
CREATE INDEX index_name
ON table_name (column_name1,column_name2...);

There are two type of index available in sql namely like
1.Clustered Indexes
2.Non clustered Index

Clustered Index :
            It can be created using "create index ..." syntax.
Non Clustered Indexes :
            They are created when a column is explicitly defined with PRIMARY KEY, UNIQUE KEY Constraint which is not based on sorted record but on a bookmark.

Note:
1) Even though sql indexes are created to access the rows in the table quickly, they slow down DML operations like INSERT, UPDATE, DELETE on the table, because the indexes and tables both are updated along when a DML operation is performed. So use indexes only on columns which are used to search the table frequently.
2) If we have less data, not required to create indexes.
3) In oracle database you can define up to sixteen (16) columns in an INDEX.

Monday, April 5, 2010

10 Deadly Sins of Negative Thinking

Life could be so much better for many people, if they would just spot their negative thinking habits and replace them with positive ones.

Negative thinking, in all its many-splendored forms, has a way of creeping into conversations and our thinking without our noticing them. The key to success, in my humble opinion, is learning to spot these thoughts and squash them like little bugs. Then replace them with positive ones. You’ll notice a huge difference in everything you do.

Let’s take a look at 10 common ways that negative thinking emerges — get good at spotting these patterns, and practice replacing them with positive thinking patterns. It has made all the difference in the world for me.

10 Deadly Sins of Negative Thinking

1. I will be happy once I have _____ (or once I earn X).

Problem: If you think you can’t be happy until you reach a certain point, or until you reach a certain income, or have a certain type of house or car or computer setup, you’ll never be happy. That elusive goal is always just out of reach. Once we reach those goals, we are not satisfied — we want more.

Solution: Learn to be happy with what you have, where you are, and who you are, right at this moment. Happiness doesn’t have to be some state that we want to get to eventually — it can be found right now. Learn to count your blessings, and see the positive in your situation. This might sound simplistic, but it works.
2. I wish I were as ____ as (a celebrity, friend, co-worker).

Problem: We’ll never be as pretty, as talented, as rich, as sculpted, as cool, as everyone else. There will always be someone better, if you look hard enough. Therefore, if we compare ourselves to others like this, we will always pale, and will always fail, and will always feel bad about ourselves. This is no way to be happy.

Solution: Stop comparing yourself to others, and look instead at yourself — what are your strengths, your accomplishments, your successes, however small? What do you love about yourself? Learn to love who you are, right now, not who you want to become. There is good in each of us, love in each of us, and a wonderful human spirit in every one of us.

3. Seeing others becoming successful makes me jealous and resentful.

Problem: First, this assumes that only a small number of people can be successful. In truth, many, many people can be successful — in different ways.

Solution: Learn to admire the success of others, and learn from it, and be happy for them, by empathizing with them and understanding what it must be like to be them. And then turn away from them, and look at yourself — you can be successful too, in whatever you choose to do. And even more, you already are successful. Look not at those above you in the social ladder, but those below you — there are always millions of people worse off than you, people who couldn’t even read this article or afford a computer. In that light, you are a huge success.

4. I am a miserable failure — I can’t seem to do anything right.

Problem: Everyone is a failure, if you look at it in certain ways. Everyone has failed, many times, at different things. I have certainly failed so many times I cannot count them — and I continue to fail, daily. However, looking at your failures as failures only makes you feel bad about yourself. By thinking in this way, we will have a negative self-image and never move on from here.

Solution: See your successes and ignore your failures. Look back on your life, in the last month, or year, or 5 years. And try to remember your successes. If you have trouble with this, start documenting them — keep a success journal, either in a notebook or online. Document your success each day, or each week. When you look back at what you’ve accomplished, over a year, you will be amazed. It’s an incredibly positive feeling.

5. I’m going to beat so-and-so no matter what — I’m better than him. And there’s no way I’ll help him succeed — he might beat me.

Problem: Competitiveness assumes that there is a small amount of gold to be had, and I need to get it before he does. It makes us into greedy, back-stabbing, hurtful people. We try to claw our way over people to get to success, because of our competitive feelings. For example, if a blogger wants to have more subscribers than another blogger, he may never link to or mention that other blogger. However, who is to say that my subscribers can’t also be yours? People can read and subscribe to more than one blog.

Solution: Learn to see success as something that can be shared, and learn that if we help each other out, we can each have a better chance to be successful. Two people working towards a common goal are better than two people trying to beat each other up to get to that goal. There is more than enough success to go around. Learn to think in terms of abundance rather than scarcity.

6. Dammit! Why do these bad things always happen to me?

Problem: Bad things happen to everybody. If we dwell on them, they will frustrate us and bring us down.

Solution: See bad things as a part of the ebb and flow of life. Suffering is a part of the human condition — but it passes. All pain goes away, eventually. Meanwhile, don’t let it hold you back. Don’t dwell on bad things, but look forward towards something good in your future. And learn to take the bad things in stride, and learn from them. Bad things are actually opportunities to grow and learn and get stronger, in disguise.

7. You can’t do anything right! Why can’t you be like ____ ?

Problem: This can be said to your child or your subordinate or your sibling. The problem? Comparing two people, first of all, is always a fallacy. People are different, with different ways of doing things, different strengths and weaknesses, different human characteristics. If we were all the same, we’d be robots. Second, saying negative things like this to another person never helps the situation. It might make you feel better, and more powerful, but in truth, it hurts your relationship, it will actually make you feel negative, and it will certainly make the other person feel negative and more likely to continue negative behavior. Everyone loses.

Solution: Take the mistakes or bad behavior of others as an opportunity to teach. Show them how to do something. Second, praise them for their positive behavior, and encourage their success. Last, and most important, love them for who they are, and celebrate their differences.

8. Your work sucks. It’s super lame. You are a moron and I hope you never reproduce.

Problem: I’ve actually gotten this comment before. It feels wonderful. However, let’s look at it not from the perspective of the person receiving this kind of comment but from the perspective of the person giving it. How does saying something negative like this help you? I guess it might feel good to vent if you feel like your time has been wasted. But really, how much of your time has been wasted? A few minutes? And whose fault is that? The bloggers or yours? In truth, making negative comments just keeps you in a negative mindset. It’s also not a good way to make friends.

Solution: Learn to offer constructive solutions, first of all. Instead of telling someone their blog sucks, or that a post is lame, offer some specific suggestions for improvement. Help them get better. If you are going to take the time to make a comment, make it worth your time. Second, learn to interact with people in a more positive way — it makes others feel good and it makes you feel better about yourself. And you can make some great friends this way. That’s a good thing.

9. Insulting People Back

Problem: If someone insults you or angers you in some way, insulting them back and continuing your anger only transfers their problem to you. This person was probably having a bad day (or a bad year) and took it out on you for some reason. If you reciprocate, you are now having a bad day too. His problem has become yours. Not only that, but the cycle of insults can get worse and worse until it results in violence or other negative consequences — for both of you.

Solution: Let the insults or negative comments of others slide off you like Teflon. Don’t let their problem become yours. In fact, try to understand their problem more — why would someone say something like that? What problems are they going through? Having a little empathy for someone not only makes you understand that their comment is not about you, but it can make you feel and act in a positive manner towards them — and make you feel better about yourself in the process.

10. I don’t think I can do this — I don’t have enough discipline. Maybe some other time.

Problem: If you don’t think you can do something, you probably won’t. Especially for the big stuff. Discipline has nothing to do with it — motivation and focus has everything to do with it. And if you put stuff off for “some other time”, you’ll never get it done. Negative thinking like this inhibits us from accomplishing anything.

Solution: Turn your thinking around: you can do this! You don’t need discipline. Find ways to make yourself a success at your goal. If you fail, learn from your mistakes, and try again. Instead of putting a goal off for later, start now. And focus on one goal at a time, putting all of your energy into it, and getting as much help from others as you can. You can really move mountains if you start with positive thinking.

How to Exercise Your Eyes

We all know how important it is to keep our bodies fit by doing things like going to the gym, jogging, and swimming. But, did you know that you can exercise your eyes as well?

Eye exercising will keep your eyes healthy and help minimize eyestrain. Here are some easy to follow steps and tips to exercise your eyes and keep them healthy!

  • Palming Exercise - Sit comfortably on a chair. Rub your hands together until they feel warm. Close your eyes and cover them lightly with your cupped palms. Avoid applying pressure on your eyeballs. Place your palms so that the nose remains uncovered, and the eyes remain behind the slight hollow of the palms. Make sure that no light rays enter the eyes, and leave no gaps between fingers or between the edge of the palms and the nose. You may still see other lingering traces of colors. Imagine deep blackness and focus on the blackness. Take deep breaths slowly and evenly, while thinking of some happy incident; or visualize a distant scene. After your eyes see nothing but blackness, remove your palms from your eyes. Repeat the palming for 3 minutes or more.
  • Close your eyes tightly for 3-5 seconds, then open them for 3-5 seconds. Repeat this 7 or 8 times.
  • Close your eyes and massage them with circular movements of your fingers for 1-2 minutes. Make sure you press very lightly; otherwise, you could hurt your eyes.
  • Press three fingers of each hand against your upper eyelids, and hold them there for 1-2 seconds, then release. Repeat 5 times.
  • Sit and relax. Roll your eyes clockwise, then counter-clockwise. Repeat 5 times, and blink in between each time.
  • Focusing Exercises – Sit about 6 inches (150 mm) from the window. Make a mark on the glass at your eye level (a small sticker, black or red, would be perfect). Look through this mark and focus on something far away for 10-15 seconds; then focus on the mark again.
  • Hold a pencil in front of you at arm’s length. Move your arm slowly to your nose, and follow the pencil with your eyes until you can keep it in focus. Repeat 10 times.
  • Look in front of you at the opposite wall and pretend that you are writing with your eyes, without turning your head. It may seem difficult at first, but with a bit of practice it is really fun. The bigger the letters, the better the effect.
  • Imagine that you are standing in front of a really big clock. Look at the middle of the clock. Then look at any hour mark, without turning your head. Look back at the center. Then look at another hour mark. Do this at least 12 times. You can also do this exercise with your eyes closed.
  • Focus on a distant object (over 150 feet or 50 m away) for several seconds and slowly refocus your eyes on a nearby object (less than 30 feet or 10 m away) that’s in the same direction. Focus for several seconds and go back to the distant object. Do this 5 times.
  • Focus on an object in the distance (as far as possible) with a low contrasting background. Do this for a few minutes every half hour or so. This does not improve your vision, nor does any other technique. It can, however, maintain your best eyesight level during the day and prevent significant further vision deterioration.
  • Make up and down eye movements starting from up to to down. Do this 8 times. Then do the side to side eye movement, starting from left to right. Repeat this 8 times. Make sure not to add pressure to your eyes! It only worsen your vision!

Tips

  • It’s more important to do the exercises regularly than to do them for a long time. Even 30-60 seconds of eye movement every hour is very helpful. For example, when your computer takes its sweet time to do something, most people just stare at the poor thing and waste the time, but you can make a few circles with your eyes. Even the first day you do this, you should notice that, when you finish working, your eyes aren’t as tired as usual.
  • Taking short breaks from near work (e.g. staring at a computer monitor) to stare out to the distance also relieves some strain.
  • Palming is a good method to help your eyes feel better. You close your eyes and put your palms over them, this will rest your eyes.
  • Blink the eyes many times.
  • Splash your eyes with cold water repeatedly when feasible, and especially when your eyes are strained.

What is the Difference Between Http and Https?

HTTP is hyper text transfer protocol which is responsible for transmitting and receiving information across the Internet. Default port for HTTP is 80.

HTTPS is secure http which is used exchanging confidential information with a server in order to prevent unauthorized access. HTTPS is Hypertext transfer protocol over secure socket layer. Default port for HTTPS is 443.