Thursday, December 13, 2007

Trust in Relationships

Well i have read this short story in a child's note and found it worth sharing with everyone.Here the story goes like.

A little girl and her father were crossing a bridge. The father was kind of scared so he asked his little daughter, "Sweetheart, please hold my hand so that you don't fall into the river." The little girl said, "No, Dad. You hold my hand." "What's the difference?" Asked the puzzled father…

"There's a big difference," replied the little girl. "If I hold your hand and something happens to me, chances are that I may let your hand go. But if you hold my hand, I know for sure that no matter what happens, you will never let my hand go."

In any relationship, the essence of trust is not in its bind, but in its bond.

So hold the hand of the person whom you love rather than expecting them to hold yours.

Wednesday, December 12, 2007

Vikram Pandit named CEO of Citi Group

Vikram Pandit, a Nagpur-born NRI and a Citigroup neophyte who wowed Wall Street before intense flames began licking the financial world, was on Tuesday named CEO of the world's largest bank in what many see as a rescue mission.

Pandit, whose elevation had been in the air for several days, replaces the charismatic Charles O.

On Tuesday, the Citigroup board led by its chairman, former Treasury Secretary Robert Rubin fulfilled Wall Street expectation by picking Pandit as CEO, while naming Win Bischoff, who was functioning as interim CEO after Prince left, as chairman. Rubin, also a stand-in, returns to his previous duties as Citi director and chairman of the executive committee of the board.

Pandit, who is 50, is the first person of Indian origin to scale such stratospheric heights in the financial world, which has many well-regarded Indian executives. Citigroup has operations in more than 100 countries, with 300,000 employees and $ 2 trillion in assets

If anything, Pandit edged out another Indian, Ajay Banga, who runs Citigroup's international-consumer group, for the plum job or the poisoned chalice, depending on one view. Others in the running included former Citigroup President Robert Willumstad and Michael Neal, who runs General Electric Co.'s (GE) commercial-finance business.


Vikram Shankar Pandit, the son of a pharma representative and businessman, came to the United States when he was only 16 for undergraduate studies at Columbia University, home to several prominent Indian academics including the economist Jagdish Bhagwati$, and alma mater of Dr B R Ambedkar.

He earned a bachelor's degree and a master's degree in electrical engineering before switching to finance and earning a Ph.D Mentors cited in a recent profile described him as a relentlessly hardworking student, the kind who relished challenges.

Pandit is seen as a cautious, conservative banker.

Many experts say the new CEO will need not just punditry but also some wizardry to extricate the bank from the mess.

n a statement following his elevation, Pandit said he would "undertake an objective and dispassionate review of all the businesses, individually and in aggregate, to make sure we are properly positioned for the future."

He also promised simplify the company's organizational structure, align businesses and resources with appropriate goals, with economic realities being among our initial priorities, a sure sign that there will be some soul-searching and cleansing.

Courtesy: timesofindia.

Saturday, December 8, 2007

Markita Andrews. #1 Sales woman

The greatest saleswoman in the wold today doesnt mind if you call her a girl. thats because Markita Andrews has generated more than eighty thousand dollars selling Girl Scout cookies since she was seven years old.

Andrews learned early that knocking on doors wasn't worth her time. At age 6 when she and her mother moved to New York after a marital separation, she joined a Brownie troop to meet other girls her age. It was during the Girl Scout cookie sales period.

She started out by knocking on doors in the Lincoln Towers apartment complex where she lives with her mother, aunt and uncle. "One of the doormen said, 'If I get any complaints about you knocking on doors, I'm going to bring you down to the lobby,'" Andrews recalls. Sure enough, there was a complaint, and she was demoted to the lobby. But it turned out to be a boon. "It just happened to be when people were coming home from the office," she says. "I sold to 45 people that afternoon." She adopted this strategy and has used it ever since.

Andrews likes to find her customers all in one place. "I sell in lobbies at a lot of companies, and I try to find new companies every year," she says. Dubbed as the top Girl Scout cookie seller of all time, Andrews last year sold 8,006 boxes--$16,000--not bad for a little over three weeks of work. And the girl, who is described by her aunt, Meredith McSherry, as "shy to a certain extent," has sold well over 30,000 boxes of cookies in the past eight years, with sales increasing around 30 percent each year.

By comparison, in 1984, Girl Scouts sold 130,250,000 boxes of cookies, mostly in the United States. Excluding volunteer adults who sold cookies, that averages out to somewhat less than 100 boxes of cookies per Girl Scout.

Some of the big guys have taken notice of Markita Andrews' astonishing sales figures. Companies like International Business Machines Corporation, Lotus Development Corporation and Pacific Telephone have flown her to conventions to speak about her sales techniques.

In 1982, Walt Disney Productions made a 12-minute sales motivation film that featured Andrews. Businesses throughout the country have purchased the film to educate their sales forces. And Andrews, with the help of writer Cheryl Merser, has written a book for Random House, detailing her basic steps of successful selling. The book is aimed at both the youth market and salespeople and is scheduled for release in March.

The first step in selling, she says, is setting short- and long-term goals. Andrews tries to take 100 orders a day after school during the three-week selling period. "If I don't reach my goal of 100 on one day, I'll work harder the next day, and I'll try to think of new places to go."

Andrews also stresses the importance of keeping good records. Sometimes, if customers say they have paid for an order and Andrews has doubts, she checks her spiral notebook of all the people she has sold to, what they bought and what order form they are on.

Wearing her uniform helps attract attention when Andrews is selling in an office. "People will see me and wonder, 'Who's going to be wearing a uniform like that? What is this girl doing?'" she says. "Then they'll think, 'It looks like she's trying to sell something. I wonder what she's selling?' So they'll come up to me part way, and I'll meet them the other part of the way and try to sell them some cookies."

Perhaps the real secret of her success is charm. "A lot of people have bought from Markita just because she's Markita," says her aunt. "People like her and they'll buy one box." Andrews says, "I try to be very kind to people because then they'll tell other people."

Last year Andrews, an honorary member of the National Association of Professional Saleswomen, charmed members of the Million Dollar Roundtable into buying 5,000 boxes of cookies when she was a featured guest at their convention at Radio City Music Hall. Andrews has also appeared twice on "Late Night With David Letterman" and "Good Morning America."

But Andrews does not rest on her laurels--she wants to go to college to polish her sales techniques. Yet for now, with only a couple of years left in Girl Scouts, she wants to reach her goal of selling 40,000 boxes of cookies. This should not be an impossible task for Andrews because she's motivated by a strong belief in her product and organization. "Girl Scouts are a great cause. I sell cookies to help them out--helping kids who don't have enough money to go to camp and helping buy office supplies." Andrews' troop receives 25 cents for every box the troop sells. With the money, she says, "we go to dude ranches in upstate New York."

However, selling does have its ups and downs. When people don't want to buy any cookies, says Andrews, "I will try to convince them what a good cause Girl Scouts are." But it they still refuse to buy and don't wish to make a contribution, Andrews politely thanks them. "I know there are people who don't want to buy, but there are a lot of people who do, and I look forward to the people who do want to buy."

Once on live TV, the producer decided to give Markita her toughtest selling challenge. Markita was asked to sell Girls scout cookies to another guest on the show. "Would you like to invest in one dozen or two dozen boxes of Girl Scout cookies " she asked.

"Girl scout cookies" I dont buy any Girl scout cookies he replied. I am a Federal Penitentiary warden. I put 2,000 rapists, robbers, criminals, muggers and child abusers to bed every night.

Unruffled, Markita quickly countered, "Mister, if you take some of these cookies, maybe you wont be so mean and angry and evil. And , Mister , I think it would be a good idea for you to take some of these cookies back for every one of your 2,000 prisoners, too"

Markita asked.
The warden wrote a check.

Friday, December 7, 2007

Decorator Design Pattern

Decorator is always one of the most complicated Design Patterns.. until today. :) Nice and easy definition to remember.

The Decorator Pattern is used for adding additional functionality to a particular object as opposed to a class of objects. It is easy to add functionality to an entire class of objects by subclassing an object, but it is impossible to extend a single object this way. With the Decorator Pattern, you can add functionality to a single object and leave others like it unmodified.

A Decorator, also known as a Wrapper, is an object that has an interface identical to an object that it contains. Any calls that the decorator gets, it relays to the object that it contains, and adds its own functionality along the way, either before or after the call. This gives you a lot of flexibility, since you can change what the decorator does at runtime, as opposed to having the change be static and determined at compile time by subclassing. Since a Decorator complies with the interface that the object that it contains, the Decorator is indistinguishable from the object that it contains. That is, a Decorator is a concrete instance of the abstract class, and thus is indistinguishable from any other concrete instance, including other decorators. This can be used to great advantage, as you can recursively nest decorators without any other objects being able to tell the difference, allowing a near infinite amount of customization.

Decorators add the ability to dynamically alter the behavior of an object because a decorator can be added or removed from an object without the client realizing that anything changed. It is a good idea to use a Decorator in a situation where you want to change the behaviour of an object repeatedly (by adding and subtracting functionality) during runtime.

The dynamic behavior modification capability also means that decorators are useful for adapting objects to new situations without re-writing the original object's code.


More examples next time..

Friday, November 30, 2007

Bad Bad Girls

I was listening to my ipod .. and this song caught my attention.. sounds very differnt from the regular girly songs in Indian Cinema. And also reminds me of how I used to tease my mom, when I am a kid. :). Here is the lyrics..

Turn ur ipod wheel to Chak de India and sing along......

Album: Chak de India
Song: Bad Bad Girls

--------------------------------------------------------------------------------

BAD BAD GIRLS:

Music: Salim – Sulaiman
Lyrics: Jaideep Sahni
Singer: Anushka Manchanda

Bad bad girls
Na rotiyaan khilayegi na choti banayegi
She won’t feed you rotis (bread), she won’t braid hair
Na palkein jhukayegi chalako
And neither will she lower her gaze
Na chat pe bulayegi na nange pair aayegi na sar pe bithayegi chalako
She won’t call you up on the terrace, she won’t come barefoot, and she won’t put you on a pedestal
Bad bad girls (4)
1,2,3,4,5,6,7,8

na beemar hai, na bukhar hai
We are not sick, no fever
khud se thoda humko pyar hai
We are a little in love with ourselves
na beemar hai, na bukhar hai oh oh oh
tu lohar to hum sonar hain
If you’re a blacksmith then we are goldsmiths
kar denge jo karna vaar hai
We’ll unleash our power
tu lohar to hum sonar hain oh oh oh
Bad bad girls (4)

Na chudi hai na chandi hai, na udti paigaani hai
No bangles, no silver, no flying scarves
Na kisi ki yeh baani hai chalako
She’s no goddess
Na kisi ki saheli hai na kisi ki paheli hai
She’s no one’s friend, nor is she a puzzle
Pasine ki tareli hai.chalako
She’s a mass of sweat
Bad bad girls (4)

Akhiyan na dikha, gazalein na suna
Don’t try to flatter or quote poetry to us
Duniya kya hai humko hai pata
We know what the world is like
Akhiyan na dikha, gazalein na suna oh oh oh
Kya yahan bhala, kya yahan bura
We know what’s good and what’s bad
Karna kya hai humko hai pata
And we know how to take care of ourselves
Kya yahan bhala, kya yahan bura oh oh oh
Bad bad girls (4)

Na akhiyan milayegi, na sakhiyan bulayegi
She won’t flirt, she won’t spend time with her friends
Na nakhrein uthayegi chalako
She won’t put up with airs
Na gori hoke aayegi na chori se manayegi
She won’t try to please, she won’t appease
Na bori mein samayegi chalako
She won’t hide herself
Bad bad girls (4)

Remote Access

When you are in a network, to access ur application on other developer's machine, you can directly use, their ip address.
Ex: instead of http://localhost:7001/console/ etc

just replace the localhost:7001 with their ip address.

ex:
http://10.27.135.105/console/

so cool =)

Thursday, November 29, 2007

Session time out in J2EE application

Hmmm.. kind of forgot this one. :)

Session time out can be set from web.xml's session config in mins
here is the snippet

2

Things You Didn't Know About You

1) Your Skin Has Four Colors
All skin, without coloring, would appear creamy white. Near-surface blood vessels add a blush of red. A yellow pigment also tints the canvas. Lastly, sepia-toned melanin, created in response to ultraviolet rays, appears black in large amounts. These four hues mix in different proportions to create the skin colors of all the peoples of Earth.


2) The World Laughs with You

Just as watching someone yawn can induce the behavior in yourself, recent evidence suggests that laughter is a social cue for mimicry. Hearing a laugh actually stimulates the brain region associated with facial movements. Mimicry plays an important role in social interaction. Cues like sneezing, laughing, crying and yawning may be ways of creating strong social bonds within a group.

3)Big Brains Cause Cramped Mouths
Evolution isn't perfect. If it were, we might have wings instead of wisdom teeth. Sometimes useless features stick around in a species simply because they're not doing much harm. But wisdom teeth weren't always a cash crop for oral surgeons. Long ago, they served as a useful third set of meat-mashing molars. But as our brains grew our jawbone structure changed, leaving us with expensively overcrowded mouths.


4) Cell Hairs Move Mucus
Most cells in our bodies sport hair-like organelles called cilia that help out with a variety of functions, from digestion to hearing. In the nose, cilia help to drain mucus from the nasal cavity down to the throat. Cold weather slows down the draining process, causing a mucus backup that can leave you with snotty sleeves. Swollen nasal membranes or condensation can also cause a stuffed schnozzle.

5) Much of a Meal is Food For Thought
Though it makes up only 2 percent of our total body weight, the brain demands 20 percent of the body's oxygen and calories. To keep our noggin well-stocked with resources, three major cerebral arteries are constantly pumping in oxygen. A blockage or break in one of them starves brain cells of the energy they require to function, impairing the functions controlled by that region. This is a stroke.


6)Bones Break (Down) to Balance Minerals
In addition to supporting the bag of organs and muscles that is our body, bones help regulate our calcium levels. Bones contain both phosphorus and calcium, the latter of which is needed by muscles and nerves. If the element is in short supply, certain hormones will cause bones to break downeupping calcium levels in the bodyeuntil the appropriate extracellular concentration is reached.

7) Body Position Affects Your Memory
Can't remember your anniversary, hubby? Try getting down on one knee. Memories are highly embodied in our senses. A scent or sound may evoke a distant episode from one's childhood. The connections can be obvious (a bicycle bell makes you remember your old paper route) or inscrutable. A recent study helps decipher some of this embodiment. An article in the January 2007 issue of Cognition reports that episodes from your past are remembered faster and better while in a body position similar to the pose struck during the event.

8) Your Stomach Secretes Corrosive Acid
There's one dangerous liquid no airport security can confiscate from you: It's in your gut. Your stomach cells secrete hydrochloric acid, a corrosive compound used to treat metals in the industrial world. It can pickle steel, but mucous lining the stomach wall keeps this poisonous liquid safely in the digestive system, breaking down lunch.

Tuesday, November 20, 2007

Breakthur in Stem Cells Research

Very interesting breakthru in Stem cell research

Researchers have transformed ordinary human skin cells into batches of cells that look and act like embryonic stem cells -- but without using cloning technology and without making embryos.

Their breakthroughs, reported on Tuesday, could make possible the long-sought goal of tailor-made medicine, but without the political, scientific and ethical roadblock of using human eggs or embryos.

The White House immediately welcomed the development, given President George W. Bush's long opposition to embryo research, even as scientists said the finding should not be the end of such research.

"This work represents a tremendous scientific milestone -- the biological equivalent of the Wright Brothers' first airplane," said Dr. Robert Lanza of Advanced Cell Technology, a Massachusetts company working in the same field.

"It's not practical to use right now, but it might be in a few years. This is truly the Holy Grail -- to be able to take a few cells from a patient -- say a cheek swab or few skin cells -- and turn them into stem cells in the laboratory."


FOUR GENES

Both teams used just four genes to transform ordinary skin cells called fibroblasts into induced pluripotent stem cells -- iPS cells for short.

Both teams said the new cells are not ready to use in people yet because they used a type of virus called a retrovirus to carry the new genes into the skin cells. It is not clear whether this virus might cause genetic mutations that could cause cancer or other side effects.

"Scientists may yet find that embryonic stem cells are more powerful," Harkin said in a statement. "We need to continue to pursue all alternatives as we search for treatments for diabetes, Parkinson's, and spinal cord injuries."

More info: http://www.reuters.com/article/newsOne/idUSN2058175020071121?pageNumber=1&virtualBrandChannel=0

Monday, November 19, 2007

Learning Annex NYC Expo

I read a lot about Learning Annex and all the big shots speaking in their seminars. Never thought I will attend one..until today.. Thanks to Metro, free local newspaper, I read everyday in my 5 min subway ride to office, gave me a coupon code to attend the seminar for free in NYC(Jacob Javits Center) this weekend. I was glad I was able to enroll on Thursday evening.

We reached there around 4PM. Actually the expo was running for the whole wk end, but I was only interested in the Trump's. Came to know that Trump will speak at 7 PM in room 3-D4.

So went into one of the on going real estate seminars by Robert Shemin
. Very few seats were left in the end. learned how ppl make money in real estate(totally new to us). His speech was very interesting and interactive.

Then went into another room, where Monthly Mentor, Robert Aron was speaking... hmm was't very interesting.. I almost got a head ache... I wish I cud grab his mike and throw him out. hehehehe... I cudn't wait to see MR. Trump.

Finally the moment is here.. Bill Zanker, CEO of Learning Annex introduced Donald Trump... while hes walking on to stage..Money Money Money Moooooooooooney.. apprentice music started playing.. and the golden confetti was blown on to him.. yeah he lived upto his hype. I can't believe I am seeing Trump on the stage. I was soo happy.. He spoke for nearly 2 hrs and the time just flew.. :) He talked abt so many things from being successful to living on the edge of bankruptcy etc.,

Q & A session began and ppl started asking all sorts of questions.. both funny and serious. Every one were amazed when an Indian kid, hardly 7 yrs old posed Trump a question. He was surprised too.. asked him to get onto the stage....Trump asked him what would he want to become when he grew up...the guy said, wants to be a 1) Real Estate Investor 2) Software Engineer and a Base Ball Player. And Trump was sooooooo impressed that he offered the guy his first job. How nice...this is America kids get such a good exposure to become what ever they love to.

I wish I was there on Saturday also.., it was a good experience to be treasured. So there you read on my blog.

Friday, November 16, 2007

Leadeship Quotes

The best example of leadership, is leadership by example.
- Jerry McClain of Seattle, WA

If it's a good idea, go ahead and do it. It is much easier to apologize than it is to get permission.
- Admiral Grace Hopper

You gain strength, courage and confidence by every experience in which you really stop to look fear in the face. You must do the thing you think you cannot do.
- Eleanor Roosevelt

If you obey all the rules, you miss all the fun.
- Katharine Hepburn

Whoever is careless with the truth in small matters cannot be trusted with the important matters.
- Albert Einstein

The first responsibility of a leader is to define reality. The last is to say thank you.
- Max DePree

Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity
- George Patton

A leader is a dealer in hope.
Napoleon Bonaparte

..tune in for more quotes

5 P's of leadership

The Five Ps of Leadership
There are whole libraries full of things that tell you what to do about leadership and how to remember what’s important. Here’s another short edition to that library – the 5 P’s of leadership. They are:

Pay Attention to What’s Important
Praise What You Want to Continue
Punish What You Want to Stop
Pay for the Results You Want
Promote the People Who Deliver Those Results



Pay Attention To What’s Important

Time management courses, strategy books, and management gurus all will tell you that there’s not a lot that’s really important. Your job as a leader is to concentrate on what’s most important so that it gets taken care of. Then let the rest of the stuff take care of itself.

Now if you’re a perfectionist, that’s going to be hard for you to do. But there’s not P for perfectionism in this scheme of things. No, we recognize that there are limited resources of time, energy, people, and money. Because those resources are limited, you want to go for the big stuff first.

What you’re after is the 20% of stuff that gives you the biggest bang for the buck. What underlies all of this is something called Pareto’s Law. Vilfredo Pareto was an Italian Economist and Sociologist in the late 19th century. He formulated something he called "The Law of the Unequal Distribution of Results." You probably know it as the 80/20 rule.

All the 80/20 rules says is that there’s 20% of the stuff you do that gets you 80% of the results. The trick is finding that 20%. Once you’ve found it you then have to pay attention to it.

Pay attention to it in your written and oral communications. Restate the key themes over and over. Don’t undervalue repetition, repetition makes for memory and memory makes for action.

Pay attention to it in your casual contacts. John Kotter, in his book to general managers, pointed out that effective general managers make great use of the random contacts they have with people. Those contacts could be in the hallway, at the water cooler, in the elevator, or walking down the street. The seize on those moments to talk about the things and ask the questions that are important to their leadership agenda. You should do that too.

Organize you day, your communications, your organizational structures, your reward systems and everything else to pay attention to what’s important and then do that with unremitting diligence.

Praise What You Want to Continue

Praise is your best training tool. In technical terms, praise is a positive consequence that follows a positive action. It’s a reward for something done right. Use praise to get people to continue to do things or to take positive action. That’s where it’s best used.

Remember, too, that praise is a tool that is most effective when it’s used inconsistently. Used consistently, praise tends to loose its force. So, don’t worry so much about praising everything that people do right, but do worry about praising.

That’s important, because most of us came up in a world where we didn’t praise enough. Seek out opportunities to praise but don’t get anal retentive about it.



Punish What You Want to Stop

Punishment is the mirror image of praise. It’s a negative consequence that follows negative behavior. It follows a principle stated almost in biblical terms by one of my past trainees. She said: "the good shall be rewarded and the unjust shall be punished in proportion to their deeds."

Punishment – negative consequences – are the tool you use to get people to stop stuff. If you figure out what’s most important for people to quit doing in your organization, rig up some kind of negative consequence for them if they do it. Be careful though, because you may fall prey to the hot stove guideline. It was Mark Twain (or if it wasn’t it should have been) who said, "A cat who sits on a hot stove will never sit on a hot stove again. But he won’t sit on a cold stove either.

The management lesson here is that if you zap people too much with negative consequences, they don’t just quit doing the stuff that you don’t want them to do. They quit doing pretty much everything. That’s why "rule by fear" and "controlled ferocity" cultures have a devil of a time getting people to take initiative. They’ve been zapped so often they’re just not willing to risk it.

Pay For the Results You Want

Years ago when I was managing distribution and customer service centers I happened to compliment one of the customer service reps. She immediately turned around to me and said, "Don’t just tell me, show me, payday is Friday."

Pay is one of the tangible ways you can reward people for doing good stuff. It’s another form of praise in visible, tangible form. Don’t limit your thinking about pay to just money, though. Pay people with time off, recognition, choice assignments, small gifts, and special bonuses to encourage the behavior you want.

One of my clients used to carry around a pocket-full of restaurant gift certificates as he wandered around his trucking company. When he found somebody doing something that he wanted to encourage he was likely to whip out a gift certificate and hand it to them on the spot. It created the kind of event and drama that makes for good communication, and it encouraged positive behavior.

Another client of mine, a police chief this time, did something similar. She was a police chief in Texas, and, as you might expect, she talked like a Texan. She had little slips made up with one of her favorite phrases on them. It was, "’preciate ya."

When she heard something about one of her officers that was positive, she sent them one of her ‘preciate ya slips. When she caught somebody done something she wanted to encourage she handed one out. Officers collected the slips and when they got enough, they got recognition in the department newsletter and some extra time off.

Look for ways to pay for the results you want. Pay and praise are the things that get the engine of progress going.



Promote People Who Deliver The Results You Want

This one just makes sense. The problem is that lots of organizations forget about it. They maintain reward and promotion systems that reward the old behavior, even while they’re trumpeting the new behavior in memo’s, meetings, and executive retreats.

When I was just starting out in consulting, a much more experienced and wiser consultant said to me, "When you first go into an organization, pay attention to who it is they promote. Listen to the stories that folks tell you about who gets promoted and rewarded and why. That will tell you just about everything you need to know about what the real organizational priorities are."

What are the stories that your people tell in your organization? What are the stories they tell about their bosses? You want those stories to be positive about great things their bosses have done. If all the stories are negatives, buddy you’ve got a problem.

What do your folks say about the folks who are promoted? Do they feel they got promoted on merit because of their performance or because they just happened to "know somebody" or worse.

The five P’s of leadership will help you stay on track to positive organizational change. Remember to pay attention to what’s important, praise what you want to continue, punish what you want to stop, pay for the results you want, and promote the people who deliver those results and you’ll help your organization be the very best that it can become.

More info:http://management.about.com/od/leadership/Leadership.htm

Thursday, October 18, 2007

One liners..

A collection of One Liners ....

"Great spirits have always encountered violent opposition from mediocre minds"

"I do not know with what weapons World War 3 will be fought, but World War 4 will be fought with sticks and stones."

"Science without religion is lame, religion without science is blind."

"God does not play dice with the universe."

"Common sense is the collection of prejudices acquired by age 18."

"Nothing will benefit human health and increase the chances for survival of life on Earth
as much as the evolution to a vegetarian diet"

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."

"Problems cannot be solved at the same level of awareness that created them."

"Few are those who see with their own eyes and feel with their own hearts."

"Peace cannot be achieved through violence, it can only be attained through understanding."

"When the solution is simple, God is answering."

"Where the world ceases to be the scene of our personal hopes and wishes, where we face it as free beings admiring, asking and observing, there we enter the realm of Art and Science"

"Watch the stars, and from them learn.
To the Master's honor all must turn, each in its track, without a sound, forever tracing Newton's ground."

"Things should be made as simple as possible, but not any simpler."

"Put your hand on a hot stove for a minute, and it seems like an hour.
Sit with a pretty girl for an hour, and it seems like a minute.
THAT's relativity."

"Gravitation can not be held resposible for people falling in love"

Tuesday, October 16, 2007

autonomous transaction

Autonomous transactions are commonly used by error logging routines, where the error messages must be preserved, regardless of the the commit/rollback status of the transaction. For example, the following table holds basic error messages.

CREATE TABLE error_logs (
id NUMBER(10) NOT NULL,
log_timestamp TIMESTAMP NOT NULL,
error_message VARCHAR2(4000),
CONSTRAINT error_logs_pk PRIMARY KEY (id)
);

CREATE SEQUENCE error_logs_seq;
We define a procedure to log error messages as an autonomous transaction.

CREATE OR REPLACE PROCEDURE log_errors (p_error_message IN VARCHAR2) AS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO error_logs (id, log_timestamp, error_message)
VALUES (error_logs_seq.NEXTVAL, SYSTIMESTAMP, p_error_message);
COMMIT;
END;
/

For more info:
http://orafaq.com/node/1915

http://www.oracle-base.com/articles/misc/AutonomousTransactions.php

Friday, October 12, 2007

Going Green

courtesy:www.coned.com



Overview

1. Americans spend more than $160 billion a year to heat, cool, light, and live in their residences.

2. Heating and cooling use more energy and drain more energy dollars than any other systems in your home.

3. Typically, 45% of your utility bill goes for heating and cooling.

4. Heating and cooling systems in the United States emit 150 million tons of carbon dioxide into the atmosphere each year, adding to global climate change.

5. Heating and cooling systems generate about 12% of the nation's sulfur dioxide and 4% of the nitrogen oxides, the chief ingredients in acid rain.

6. Save 20% to 30% on energy bills with energy-efficiency improvements.

7. Cut your energy use and reduce emissions from 20% to 50% with proper insulation, air sealing, and thermostat settings.





Appliances

8. Many appliances continue to draw a small amount of power even when they are switched off. Unplug appliances after use.

9. The lower the wattage or amperage, the less energy consumed.

10. Replace older appliances with Energy Star-qualified appliances; they use less energy and can save you money.

11. Appliances account for about 20% of your household's energy consumption.

12. Learn more about Energy Star-qualified appliances at www.energystar.gov.

13. Use energy-saving settings on all appliances.

14. Electric kettles use less energy than stovetop kettles.

15. Run the dishwasher only when it's full.

16. 60% to 80% of the power used by a dishwasher just heats water.

17. Run your clothes washer only with a full load of laundry.

18. An Energy Star washer can save more water than one person drinks in a lifetime.

19. Wash your laundry with cold water to save energy and money.

20. U.S. households spend up to $135 per year in energy costs drying clothes.

21. Gas dryers are more efficient than electric ones.

22. Overloading the dryer makes it work harder.

23. Front loaders generally conserve water and are more efficient.

24. Dryers with cool-down or perm-press cycles use cool air during the last few minutes; this saves energy.

25. Refrigerators, clothes washers, and clothes dryers are at the top of the energy-consumption list.

26. A dirty lint filter can use 30% more energy.



Air Conditioners

27. Air conditioning accounts for about 56% of your energy use.

28. Set your AC to 78 degrees. 75 degrees costs 18% more, and 72 degrees costs 39% more.

29. Keep air-conditioner filters clean.

30. Air-conditioner capacity should be the right amount for the size of the room.

31. Look for an air conditioner with built-in timers and thermostats.

32. In winter, close the air-conditioning unit, unplug, and cover.

33. For air conditioners, look for a high Seasonal Energy-Efficiency Ratio (SEER). The current minimum is 13 SEER for central air conditioners. Energy Star models are 13 SEER or more.



General Home Care

34. Energy-efficient homes are less costly to own, operate, and maintain, and they are more comfortable.

35. In the winter, set your thermostat at 68 degrees during the day and 60 degrees at night.

36. Inspect your cooling system in the spring and heating system in the fall.

37. Regularly clean or replace your furnace, air conditioner, and heat-pump filters.

38. Close curtains during hot summer months to block the sun.

39. Every year, more than $13 billion worth of energy leaks from homes through small holes and cracks. That’s more than $150 per family.

40. Seal drafty windows, doors, and holes around plumbing fixtures.

41. Water heaters consume 85% to 90% of the energy used to wash your clothes.

42. Turn down your water heater to the "warm" setting (120 degrees).

43. Turn off kitchen, bath, and other exhaust fans within 20 minutes after cooking or bathing.

44. Replace older exhaust fans with high-efficiency, low-noise models.

45. One thousand watt-hours equals 1 kilowatt-hour, or 1 kWh.

46. The average residential rate is 8.3 cents per kWh.

47. A typical U.S. household consumes about 11,000 kWh per year, costing an average of $900 annually.

48. A refrigerator uses almost five times more electricity than a television.

49. Across America, home refrigerators use the electricity generated by 25 large power plants every year.

50. Every time you open the refrigerator door, up to 30% of cold air escapes.

51. Position refrigerators away from direct sunlight and heat sources.

52. Pack items tightly in freezer.

53. Make sure rubber gaskets on refrigerator doors provide a tight seal.

54. Clean coils and remove dust from behind the refrigerator.

55. Recycling one aluminum can save enough energy to watch television for three hours.



Lighting

56. If we changed an incandescent light bulb for every child in America, it would prevent more than 30 billion pounds of greenhouse gas emissions and save enough money to light more than 15 million homes for an entire year.

57. Making improvements to your lighting is one of the fastest ways to cut your energy bills.

58. Look for the Energy Star label when purchasing lighting products.

59. Turn off lights when not home and buy a timer to turn them on 1/2 hour before returning home.

60. Lighting accounts for about 20% of the average home’s electric bill.

61. The average home has about 30 light fixtures.

62. Keep fixtures clean.

63. By using new lighting technologies, you can reduce lighting energy use in your home by 50% to 75%.

64. Replace your incandescent light bulbs with compact fluorescents (CFLs). They use 75% less energy and last 10 times longer.

65. Exterior lighting is one of the best places to use CFLs because of their long life.

66. Use brighter bulbs for reading and work areas; use 25- to 40-watt bulbs where only some light is needed.

67. Consider using 4-watt minifluorescent or electro-luminescent night lights.

68. Use dimmers.

69. Turn off the lights in any room you're not using, or consider installing timers, photo cells, or sensors to save money.

70. Instead of brightly lighting an entire room, focus the light where you need it.

71. Use fluorescent under-cabinet lighting for kitchen sinks and countertops.

72. Three-way lamps make it easier to keep lighting low when brighter light is not necessary.

73. Use four-foot fluorescent fixtures with reflective backing and electronic ballasts for your workroom, garage, and laundry areas.

74. You can save about $35 annually if you replace four standard incandescent lamps with CFLs.

75. Properly recessed down lights or high hats can now be used in retrofits or new construction with CFLs.

76. Take advantage of daylight by using light-colored, loose-weave curtains on your windows to allow daylight to penetrate the room while preserving privacy.

77. Decorate with lighter colors that reflect daylight.

78. Replace torchiere fixtures with halogen lamps with compact fluorescent torchieres.

79. Compact fluorescent torchieres use 60% to 80% less energy. They produce more light and produce less heat.



Outdoor Lighting

80. Use outdoor lights with a photocell unit or a motion sensor so they go on only at night or when someone is present.

81. A combined photocell and motion sensor will increase your energy savings even more.

82. Turn off decorative outdoor natural gas lamps; just eight such lamps burning year round use as much natural gas as it takes to heat an average-size home all winter.

83. Try outdoor solar lighting systems. They convert sunlight into electricity.

84. If you live in a cold climate, buy a lamp with cold-weather ballast, since standard CFLs may not work well below 40 degrees.

85. Consider high-intensity discharge (also called HID) or low-pressure sodium lights.



Computers

86. Turn off your computer monitor when not in use for more than 20 minutes.

87. Turn off your computer when not in use for more than two hours.

88. Unplug your cell phone and blackberry chargers when they're not being used.

89. A laptop uses half the energy of a desktop computer.

90. Use a power strip/surge protector for your computer, monitor, printer, and other computer accessories.

91. To maximize savings with a laptop, put the AC adapter on a power strip that can be turned off or that will turn off automatically.

92. Turn off the switch on the power surge strip when the equipment is not in use.

93. Using rechargeable batteries for products like cordless phones and PDAs is more cost effective than throwaway batteries.

94. An Energy Star computer uses 70% less electricity.

95. If left inactive, Energy Star computers enter a low-power mode and use 15 watts or less.

96. Working in low-power mode saves energy, and helps equipment run cooler and last longer.

97. Screen savers on monitors do not reduce energy.

98. Switch to the sleep mode or manually turn monitors off to save energy.

99. Inkjet printers consume less electricity than laser printers.



Visit

100. Visit the following sites for more information:

Thursday, October 11, 2007

Eclipse Java Home set up

While compiling the new project you'll have to set up class path variables,

You do so by rt click on the project --> properties

here is the screen shot

Setting up Eclipse workspace

1) SVN checkout to the folder..
2) step 1 will create all the reqd folders for your project
3) EX: if its an Enterprise proj, will create app, app-ejb, app-web
4) In your eclipse switch to the new workspace point to the directory just created
5) Create a new project in Eclipse (If its an enterprise proj, select enterprise project or just select java project)
6) Enterprise project will ask you to create 3 folders, appname, appejb and appweb
7) Name these projects same as the folders checked out from svn, (doing so will import all ur files and folder structures from the directory)

Setting Class path:

Rt click on the webproject and properties, in the build path and libraries, copy all the jar's from your webroot/web-inf/lib to here.

Also copy JRE jars from the apt location, usually from the server (so that ur server and ur eclipse use the same version of java)

In source tab make sure you have the project--> Src directory there. Or you will see complation errors (in eclipse) for all import stmts in ur java files


Some screen shots:




Create a folder in ur local machine, where you want to set up the workspace

Wednesday, October 10, 2007

eclipse filter on error window

Filter is found as an small iconon the error window

Click on the icon and

unchcek the defualt check box

1) Set the radio button to On selected elements and its childern

Uncheck the following
1) JSF config problems
2) JSP schematic problems
3) Validation message
4) XML schema problems

doing so will reduce errors in ur eclipse error window :)

FTP to server from Command prompt

Learning to FTP a file to your server from command prompt

From start--> run --> cmd

cd to the folder where you have the file to transfer from (from your local)

type in ftp

here ftp cmc452432

type in user id and pwd

cd to the folder where you want to copy

type bin <>

type put

you are done.. =)

FTP is complete

Screen shot

Wednesday, October 3, 2007

Wanna know traffic to your website..

sooo cool.. just type in any web address and u can see the # of hits in last 3 mo to 1 yr

http://www.alexa.com/data/details/traffic_details

Enter : listentosonu.blogspot.com

Tuesday, September 11, 2007

Struts Html Drop Downs n JS

Long time for me make the struts drop down work..

I basicaly need 3 standard values in my drop down..
1) select ""
2) long term
3) short term


Here is the html code:


Select...
Short Term - less than or equal to 180 days
Long Term - more than 180 days


Value from the form(sArcfacilityGradeForm.facilityTenorValue) is preselected in the dropdown

Here is the JS Function:

function tenorChange(tenroObj){
var tenor=tenroObj.value;
alert('Changing tenor on screen');
alert('tenor value read from screen is :'+tenor);
//document.forms[0].tenor.value=tenor;
//alert('display tenor value from form'+tenorScrenn);
if (tenor == "") {
alert('Please select a valid tenor');
tenroObj.value=document.forms[0].facilityTenorValue.value;
return false;
}
document.forms[0].tenorScreenValue.value=tenor;

//document.forms[0].facilityTenorValue=tenorScrenn;
document.forms[0].action.value = "changeTenor";
document.forms[0].submit();
}

Input: tenroObj is dropdown object used to display on the screen.
var tenor=tenroObj.value; ==> will contain the value selected
ex: From Short Term - less than or equal to 180 days
if short term -less than or equal to 180 days is selected on the screen, this value contains: 179.


You can only set String values from JS to Form. So here,
tenorScreenValue: Has to be a String value in the Facility Grade Form.

document.forms[0].tenorScreenValue.value=tenor;

Very Important Note: Form values you are trying to set from Java Script must be defined as hidden variables in the JSP or JS wont be able to read them

Ex:

Tuesday, August 28, 2007

Setting Focus to Apt section of the page

DG page has the following:
CI
SI
RI
DG
When user changes a value in RI user shud be brought back to RI, instead of the beginning of the page where he will have to scroll into the apt section.
here is how we'll do id:

Declare div values for each section of your page and

Set the value in ur action class on pg submit

facilityGradeForm.setShowRegClass(true);
facilityGradeForm.setShowCI(false);
facilityGradeForm.setShowGuarantee(false);
facilityGradeForm.setshowOS(false);
facilityGradeForm.setShowDG(false);

Call a generic js fn on pg load to scroll into the div value on submit.
function setAptPageFocus(){

//alert("IN apt page focus");
//alert(document.forms[0].showGuarantee.value);
if (document.forms[0].showGuarantee.value=="true"){
//alert("In Show Guarantee");
divShowGuarantee.scrollIntoView();
}

if (document.forms[0].showOS.value=="true"){
//alert("In Show OS");
divShowOtherSupport.scrollIntoView();
}

if (document.forms[0].showRegClass.value=="true"){
//alert("In SHow Reg Class");
divShowRegClass.scrollIntoView();
}

if (document.forms[0].showCI.value=="true"){
//alert("In SHow CI");
divShowingCI.scrollIntoView();
}

}

Each page submit will take you to apt section of the page yay.!!

Friday, August 10, 2007

Opening a JAR, WAR or EAR file

I always wondered if I can see the contents in the mysteriously looking Jar, WAR and EAR Files. Now I know how to do the trick :))

Copy your war to a different directory, Simply rename it to war and double click it.. lol there you can see all the contents of your war file. hehe..

You can do the same trick to see EAR and WAR files.

yeppeee..!!!

Wednesday, August 8, 2007

Force Shut down your server

Had a problem today with my eclipse..where I had to close. My server continued to run though my eclipse is not open...

When I opened my eclipse. and tried to start the server, it said cannot acquire a lock on ldap etc, and was not starting.

In such cases, goto your console,

server--> control --> Force shutdown.

Exporting WAR File from Eclipse

An alternative to using Build.xml to create a war file..

RT click on the project --> export --> Java J2EE --> WAR

select your destination location

uhoooo witin like a minute you have your war file created at ur destination..and you can deploy it directly to your server...
Looks like you can also create an EAR file accordingly..Nice logic :))

ehhaaahaa

Monday, July 2, 2007

Build with Clean Up

Problem: When I did hotdeployment of my web application module.. I noticed that my class files in the output folder are not getting updated / changed.And I am not sure y. Tried many different cases.. restart server, redeploy app.. etc.. nothing worked.. then I called Vipul.. who magically did just one thing..

yes CLEAN UP

how do you clean up :

From the menu in ur eclipse on the top.. project --> clean up--> select teh apt proj to clean up.

Now when u clean up the porj it will clear all ur .class files.. so you will have to build them again..

project --> build

Hot Deployment

Hot deploying a web application module in My Eclipse..

Rt click on the Web application folder -- > MY Eclipse --> add or remove deployment--> select server name --> you are done..

but when I deploy it for the first time.. and restart the server, it doesnt get started well, so will have to got server console

webapplications --> its where you would see the upload directory to upload the war file..

there select applications -->




other screen too..

Sunday, July 1, 2007

Finding J2EE Applications Context

What is context:

A word used to access your application in the URL you use

ex: http://localhost:7001/srgt/actions/dashboard.do

Here srgt is ur application's context

Now how do change the contxt to srgt-arc..?

In weblogic.xml file.. here is how the context root is:

srgt

also actions from my standalone are not working..

problem is : in my web.xm;/ I have both my struts configs defined in on parameter and mistakenly I have also added the new app ctxt as a new parameter..so all my new appls are working..but when I call existing actions from v1.0 grrr they are not working.. the resolution is not take off the other parameter and keep the two of them in..
here is the snippet..


action

org.apache.struts.action.ActionServlet


config
/WEB-INF/struts-config.xml,/WEB-INF/srgt-arc-struts-config.xml


debug
3

Wednesday, June 20, 2007

Making an EAR with Ant Build Script

I got an error saying that ejb compiler was unable to load or its something like bytecode found but unable to find class.

Was due to the fact that my class files(which I got from svn) are compled with a different version of java than the version I am using in my local

resolution: deleted all class files got from svn and made my ant comple and create them again.

Boom: it started working. then hit by another error.

I am getting all sorts of compilation errors for all references in ejb file to the class file.

so the resolution is to inlucde the jar file created from the reference proj in class path. Here is how it looks like:










and it compiled yay..!!!

Tuesday, June 12, 2007

Java Script popup window

window.open("/srgt-arc/actions/validateResult.do", "ValidationResult", "width=700,height=400,SCROLLBARS");

and also

function viewFacPrevGR(submitType,proposalElementId)
{
// alert("Inside dgPopUp");
document.forms[0].action.value=submitType;
window.open("about:blank", "viewFacPrevGR", "width=900,height=600,SCROLLBARS,dependent,resizable");
//window.open("about:blank", "sArcViewPreviouGR", "location=0,toolbar=0,menubar=0,resizable=1,modal=yes");

document.forms[0].target = "viewFacPrevGR";
document.forms[0].selectedProposalElementId.value = proposalElementId;
document.forms[0].submit();
}

pop up windows in JS

WOrking with popup windows in JS

function submitMenu(submitType,proposalElementId,clientGradingStatus,proposalType){

if(submitType == "viewFacPrevGR"){
dgPopUp(submitType,proposalElementId);
}
}


//POPUP FUNCTION

function dgPopUp(submitType,proposalElementId)
{
// alert("Inside dgPopUp");
document.forms[0].action.value=submitType;
window.open("about:blank", "viewFacPrevGR", "width=900,height=600,SCROLLBARS,dependent,resizable");
//window.open("about:blank", "sArcViewPreviouGR", "location=0,toolbar=0,menubar=0,resizable=1,modal=yes");

document.forms[0].target = "viewFacPrevGR";
document.forms[0].selectedProposalElementId.value = proposalElementId;
document.forms[0].submit();
}


window.open("/srgt-arc/actions/validateResult.do", "ValidationResult", "width=700,height=400,SCROLLBARS");

Itsy bitsy ava Script

Working with PopUp windows.. :)

hey first time I ever created a popup window today.. I am so happy .. yay!!!

here is the code to create one..

function submitMenu(submitType,proposalElementId,clientGradingStatus,proposalType){

if(submitType == "viewFacPrevGR"){
dgPopUp(submitType,proposalElementId);
}

}


function dgPopUp(submitType,proposalElementId)
{
alert("Inside dgPopUp");
document.forms[0].action.value=submitType;
window.open("about:blank", "viewFacPrevGR", "width=900,height=600,SCROLLBARS,dependent,resizable");

document.forms[0].target = "viewFacPrevGR";
document.forms[0].selectedProposalElementId.value = proposalElementId;
document.forms[0].submit();
}



or you can directly call it from your JS as:


window.open("/srgt-arc/actions/validateResult.do", "ValidationResult", "width=700,height=400,SCROLLBARS");


learning is fun :)

Friday, June 8, 2007

trouble with tns :)

when I try to add a tns entry as I got from someone like:

TPBD.WORLD =
(DESCRIPTION =(LOAD_BALANCE = ON)
(FAILOVER = on)
(ADDRESS = (PROTOCOL = TCP)
(HOST = cittpbd2.ny.jpmorgan.com)
(PORT = 16830))(ADDRESS = (PROTOCOL = TCP)(HOST = cittpbd3.ny.jpmorgan.com)(PORT = 16830))(CONNECT_DATA =(SERVICE_NAME = TPBD.WORLD)))


its always gives me an error when I try to do a tnsping... and I thought it only happens with me..

I found an alternative.. you just have to rearrange things a little bit.:) and everything is fine :)


TPBD.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cittpbd2.ny.jpmorgan.com)(PORT = 16830))
(ADDRESS = (PROTOCOL = TCP)(HOST = cittpbd3.ny.jpmorgan.com)(PORT = 16830))
(LOAD_BALANCE = ON)
(FAILOVER = on)
(CONNECT_DATA =
(SERVICE_NAME = TPBD.WORLD)
)
)

have fun :)

Wednesday, June 6, 2007

compiled jsp files in weblogic

are located at
since I am using edploded war,

C:\bea\user_projects\domains\mydomain1\myserver\.wlnotdelete\extract\myserver_srgt_srgt\jsp_servlet\_pages\_sarc

Monday, June 4, 2007

Int Q's

1) Version of Struts,Spring,App server ur using

Ans:

2)Dispatch Action

Ans: Parameter in Struts-config.xml

3) Example of how you do dispatch action

Ans:

4) Calling sp from jdbc

Ans:

5)Steps in deploying app on weblogic server

Ans: 1)Compile code

2)Create war etc

Friday, May 25, 2007

Weblogic modes

You can start your weblogic server either in Run mode or in Debug mode.

Debug mode will allow you to stop at the debug points and will also help you in getting to the debug variables. So here is how you can change the mode

First of all stop your weblogic server... you cannot change its mode when its on.

2)in the Servers tab... rt click on the weblogic server and select debug from the options.

3)Now start your server and you are good to go :)).. its that easy.. but took a while to understand.. so its worth it post into the blog. haha

for further reference got to:

http://dev2dev.bea.com/pub/a/2006/01/eclipse-plugin.html?page=2

-sonu

Wednesday, May 23, 2007

Java Compiler in Eclipse

Okay I had an issue with running the Java files again :(

go to : Project --> Properties --> Java Compiler -->set it to 1.4

It was perviously set to 1.5 and I am unable to run my app.

Thanks to Vipul he figured it out for me.

here is the screen shot.

Friday, May 18, 2007

Installing new Plugins in Eclipse(subclipse)

Installing Subclipse from Eclipse:

In you eclipse go to help -->software updates -->find and install

search for new updates --> select remote site --> will prompt you for a name and url to install an application from --> enter both and --> select the name and click finish

subclipse is installed yeppee!!!!

now goto eclipse --> perspective --> svn repository

rt click to create a new repository location

yay thats it you are done installing eclipse svn plug in

For more info goto-->http://subclipse.tigris.org/install.html

--Learn new thing a day yeppe..!!!

Friday, May 11, 2007

Testing Marque







more pics

















Thursday, May 10, 2007

Explain Plan in Oracle

Easiest way to SQL Tuning

Here is the sample format:

explain plan for your-precious-sql-statement;

select * from table(dbms_xplan.display);

Sample Query:

explain plan for
select * from srgt_guarantee where srgt_facility_grading_id=1882


select * from table(dbms_xplan.display);

Here is the Results:

-------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 |
| 1 | SORT AGGREGATE | | 1 | |
| 2 | INDEX FAST FULL SCAN| PK_SRGT_GUARANTEE | 763 | 2 |
-------------------------------------------------------------------

Note
-----
- 'PLAN_TABLE' is old version

You can also create your own plan table in ur schema. Howevery it shud be in the following format:

CREATE TABLE SRGT_PLAN_TABLE (
STATEMENT_ID VARCHAR2(30),
TIMESTAMP DATE,
REMARKS VARCHAR2(80),
OPERATION VARCHAR2(30),
OPTIONS VARCHAR2(30),
OBJECT_NODE VARCHAR2(128),
OBJECT_OWNER VARCHAR2(30),
OBJECT_NAME VARCHAR2(30),
OBJECT_INSTANCE NUMBER(38),
OBJECT_TYPE VARCHAR2(30),
OPTIMIZER VARCHAR2(255),
SEARCH_COLUMNS NUMBER,
ID NUMBER(38),
PARENT_ID NUMBER(38),
POSITION NUMBER(38),
COST NUMBER(38),
CARDINALITY NUMBER(38),
BYTES NUMBER(38),
OTHER_TAG VARCHAR2(255),
PARTITION_START VARCHAR2(255),
PARTITION_STOP VARCHAR2(255),
PARTITION_ID NUMBER(38),
OTHER LONG,
DISTRIBUTION VARCHAR2(30)
);

and you can explain plan the query into the table:

explain plan into SRGT_PLAN_TABLE for (select context_id,EFF_TIMESTAMP from srgt_ref_client_info
where srgt_ref_client_id=(select srgt_ref_client_id from srgt_client_grading_info where
srgt_client_grading_id=(select srgt_client_grading_id from srgt_v_facility_grading_info
where srgt_ref_facility_id=2113)))


SELECT * FROM SRGT_PLAN_TABLE


Deafult way of doing it is:

explain plan FOR (select context_id,EFF_TIMESTAMP from srgt_ref_client_info
where srgt_ref_client_id=(select srgt_ref_client_id from srgt_client_grading_info where
srgt_client_grading_id=(select srgt_client_grading_id from srgt_v_facility_grading_info
where srgt_ref_facility_id=2113)))


select * from table(dbms_xplan.display);

will display the results of the query just executed =)



---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 14 | 13 |
| 1 | TABLE ACCESS BY INDEX ROWID | SRGT_REF_CLIENT_INFO | 1 | 14 | 2 |
| 2 | INDEX UNIQUE SCAN | PK_SRGT_REF_CLIENT_INFO | 1 | | 1 |
| 3 | TABLE ACCESS BY INDEX ROWID| SRGT_CLIENT_GRADING_INFO | 1 | 8 | 2 |
| 4 | INDEX UNIQUE SCAN | PK_SRGT_CLIENT_GRADING_INFO | 1 | | 1 |
| 5 | NESTED LOOPS OUTER | | 1 | 22 | 9 |
| 6 | NESTED LOOPS OUTER | | 1 | 18 | 9 |
| 7 | TABLE ACCESS FULL | SRGT_FACILITY_GRADING_INFO | 1 | 14 | 9 |
| 8 | INDEX UNIQUE SCAN | PK_SRGT_REF_FACILITY_INFO | 1 | 4 | 0 |
| 9 | INDEX UNIQUE SCAN | PK_SRGT_TEMP_FACILITY_INFO | 1 | 4 | 0 |
---------------------------------------------------------------------------------------------

Note
-----
- 'PLAN_TABLE' is old version


Setting and using a Statement Id in Explain Plan:

explain plan SET STATEMENT_ID = 'srgt context' FOR (select context_id,EFF_TIMESTAMP from srgt_ref_client_info
where srgt_ref_client_id=(select srgt_ref_client_id from srgt_client_grading_info where
srgt_client_grading_id=(select srgt_client_grading_id from srgt_v_facility_grading_info
where srgt_ref_facility_id=2113)))


Form Plan table execute this query to get the values:

SELECT operation, options, object_name, id, parent_id, position, cost, cardinality,
other_tag, optimizer
FROM plan_table
WHERE statement_id = 'srgt context'
ORDER BY id;

More Details see: http://www.csee.umbc.edu/help/oracle8/server.815/a67775/ch13_exp.htm


Now I know abt explain plan in Oracle..!! yay !!

-Sunita

Rownum in Oracle --Something cool..!!!

Here is how you retrieve the first row which meets the crieteria from amoung a set of rows.. =)


select * from srgt_guarantee where srgt_facility_grading_id=1882

will return multiple rows like:
Gid
2408 1882 on 1 50 -1 455 [NULL] YES NO 40
2409 1882 on 23 20 -1 100 [NULL] YES NO 50
2410 1882 [NULL] 24 100 -1 190 [NULL] YES NO 40
2414 1882 [NULL] 1000 100 -1 100 [NULL] YES NO 52
2411 1882 [NULL] 68 100 -1 100 [NULL] YES NO 40
2412 1882 [NULL] 20 100 -1 100 [NULL] YES NO 50
2413 1882 [NULL] 900 100 -1 100 [NULL] NO NO 50

now if you do this will return just a single row =)

select * from srgt_guarantee where srgt_facility_grading_id=1882 and rownum=1;

Will return just a singl row. =)

2408 1882 on 1 50 -1 455 [NULL] YES NO 40


This cool to explore
enjoy
sunita

Wednesday, May 9, 2007

JDK JRE problem surfaced again

My weblogic is running on a 4.8 version on jdk/jre

and my ant is using 5.11 to compile so my deployment is failing.

So the solution is:

got: C:\bea\weblogic81\server\bin --> open startWLS.cmd

check where your JAVA_HOME is pointing to : its this variable

set JAVA_HOME=C:\bea\jrockit81sp5_142_08

Make everything else in your system point to here..

change ur env variable to point to here C:\bea\jrockit81sp5_142_08

1) my computer--> properties --> advanced-->environment variables-->edit JAVA_HOME

2) In Eclipse window-->preferences-->Ant -->Runtime --> GlobalEntries --> get tools.jar from C:\bea\jrockit81sp5_142_08\jdk\tools.jar

3) In Eclipse window-->preferences-->Java-->BuildPath-->edit JAVA_HOME to point to C:\bea\jrockit81sp5_142_08

4) In Eclipse window-->preferences-->MyEclipse-->ApplicationServers-->Weblogic8-->
JDK -->wls JDK make it point to C:\bea\jrockit81sp5_142_08

5) In Eclipse Project-->Properties-->JavaBuildPath-->Libraries(tab) make your jre point to C:\bea\jrockit81sp5_142_08


Now you are good to go.. all your JAVA_HOME are pointing to one single place =)

--Had fun with Vipul trying to figure this out. =) Finally I learnt a new thing :)

--Suneetha.

DBMS_UTILITY.GET_TIME()

Sample code to test if dbms_utility is working

SELECT name
FROM dba_dependencies
WHERE referenced_name = 'DBMS_UTILITY'
UNION
SELECT referenced_name
FROM dba_dependencies
WHERE name = 'DBMS_UTILITY';

o/p:
ALL_OBJECTS
etc.,

once u successfully execute this w/o exceptions..ur ready to use the dbms_utility.get_time() in the stored procs

dbms_output.put_line('time: ' || ROUND((dbms_utility.get_time() - nStart)/100, 3) || ' s');

Know More: http://thinkoracle.blogspot.com/2006_08_01_archive.html

Cool function..to estimat ur sql times

Ant cannot compile java files

[javac] BUILD FAILED: [build file location here]
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK


You get this err in Eclipse when trying to compile it with ANT

Its really cool to resolve this issue =)

Go to Window --> Preferences -->Ant-->Runtime-->Global Entries --> Add External Jars

Add the following Jar from your java home,

In my case its C:\Program Files\Java\jdk1.5.0_11\lib\tools.jar

yeppee..!!! and it all worked magically when I hit build again.. cool I love ant..!!!!

To Learn More go to: http://www.dynamicobjects.com/d2r/archives/002591.html


--Sonu

Tuesday, May 8, 2007

Detectin applications which load on startup in windows xp.
here is the path where you look for..

C:\Documents and Settings\All Users\Start Menu\Programs\Startup
C:\Documents and Settings\{Username}\Start Menu\Programs\Startup

hehe I didnt know this bfr =)

Thursday, May 3, 2007

Substr,Length of Str in Oracle

This is the trickest I think I have ever been thru... hmm I kind of hated it as the string in Oracle starts from 1 and not from 0.

here is an example:

l_s_mystring varchar2(20):='suneetha';

l_s_firstString:=substr(l_s_mystring,1,1);

l_s_firstString1:=substr(l_s_mystring,3,1);

l_s_firstString2:=substr(l_s_mystring,5,1);

will print s,n,e etc

here is how it processes

S U N E E T H A
1 2 3 4 5 6 7 8

So when u ask for substr(l_s_mystring,1,1) will print s

when u ask for substr(l_s_mystring,1,3) will print SUN (1 AND 3 INCLUDED)

this sucks and I totally hate it grrrrr!!!!!

So dont forget this from next time onwards :)


Function to get the length of the string. This is soo different than in Java
so had to make a note :)

select length(to_char('suneetha')) from dual;

syntax: length()

Friday, April 27, 2007

Creating a DB Link in Oracle

Its wierd.. I tried to create a dbLink from the regurlar whizard from the dbLinks tab in toad.. but it didnt work.. so tried to find and alternative from the SQL Editor and surprisingly it worked.. yayyy..!!!!

create database link SAMPLE_DEV
connect to fdrdbo2
identified by fdrdbo2
using '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = ada8asff2)(PORT = 3104)))(CONNECT_DATA =(SERVICE_NAME = SONU)))'

You can get this description from your TNSnames.ora file n copy it over here.

this is cool..!!! I can test my sp with real time data connected to the right db. =)

Some Classic SQL's:

SQL to get Second Max form a column:

select * from EMPLOYEE where SALARY = (
select
max(SALARY)
from
EMPLOYEE
where
SALARY < (select max(SALARY) from EMPLOYEE)

--In the condition we are trying to select max from a list which would contain values less than max(salary) and it works =)

-------------------------------------------------------------------------------------

FINDING DUPLICATE ROWS IN A TABLE

-------------------------------------------------------------------------------------

select FAC_OID, count(*) from v_XYX_TABLE group by FAC_OID HAVING count(*) > 1;

will retrieve all values of fac_oid from the table where the fac_oid is repeating. :)



-------------------------------------------------------------------------------------
DELETE AND RENAME A COLUMN FROM ORACLE TABLE

-------------------------------------------------------------------------------------


alter table srgt_path_prelim_lgd drop column PRELIM_LGD_PCT

alter table srgt_path_prelim_lgd rename COLUMN PRELIM_LGD_PCT TO PRELIM_LGD_PCT1

-Sunny

Wednesday, April 25, 2007

Executing Dynamic SQL with Ref Cursors

Here is the SP to execute Dynamic SQL built at Runtime:

CREATE OR REPLACE procedure SP_TEST_REF_CURSOR(i_n_proposalId number)as


TYPE FacilityDetails IS REF CURSOR;

facilities_data FacilityDetails;

l_s_facQuery varchar2(10000);

lengthOfString integer;

l_s_status_code varchar2(20);
l_n_edit_code number;

l_n_counter number:=0;
begin

dbms_output.put_line('hello world');


l_s_facQuery:='SELECT FACILITY_STATUS_CODE,FACILITY_ID
FROM
fdrdbo.v_credit_facility@RODR_DEV.NY.SONU.COM
WHERE
(facility_id=198000589 and
facility_version_no =2 and
facility_edit_no=0 and
facility_edit_session_no=0) or (facility_id=299074678 and
facility_version_no =1 and
facility_edit_no=0 and
facility_edit_session_no=0) ';

lengthOfString:=length(l_s_facQuery);

--dbms_output.put_line(lengthOfString);

--put_line(l_s_facQuery,lengthOfString);
--l_s_facQuery:='select proposal_element_id from srgt_proposal_element where proposal_id=489';

OPEN facilities_data FOR l_s_facQuery;

LOOP

FETCH facilities_data into l_s_status_code,l_n_edit_code;

EXIT WHEN facilities_data%NOTFOUND;
l_n_counter:=l_n_counter+1;


dbms_output.put_line('FacilityStatus Code is : ' || l_s_status_code || 'facilityId is :' || l_n_edit_code);


--DBMS_OUTPUT.PUT_LINE('hello world');
--DBMS_OUTPUT.PUT_LINE(l_s_status_code || ' ' || l_n_edit_code);
END LOOP;

CLOSE facilities_data;

DBMS_OUTPUT.PUT_LINE('hello world' || l_n_counter);

end;
/

Monday, April 23, 2007

dbArtisan tips and tricks

Importing data from an external file, csv,or tab separated etc.

Create a table from an existing table

in the tables rt click on the table and do Create Like






Importing data from a file to table:

Rt click on the table

do Import data from





and walk thru the whizard here is the pics







Sybase Client and dbArtisan

Here is the steps to import Sybase Open client

1) Import open client

2) Put your ini file into the following directory. ( C:\Program Files\Sybase Open Client 12\ini )

Sample ini file:

[CR_HUB_DEV]
master=TCP,10.19.9.90,3325
query=TCP,10.19.9.90,3325

[CR_HUB_UAT]
master=TCP,10.19.9.92,3325
query=TCP,10.19.9.92,3325

[CR_HUB_PDS]
master=TCP,10.19.9.91,3325
query=TCP,10.19.9.91,3325


==================DO NOT ADD BELOW THIS LINE=======================

Testing connection from command prompt:

GOTO the following directory:

1) C:\>cd %sybase%\%sybase_ocs%\bin

2)C:\Program Files\Sybase Open Client 12\OCS-12_0\bin>isql -S CR_HUB_DEV -U rogc
-P j2002


issql <-- Command Name

-S <-- Server Name. In this case CR_HUB_DEV from ini file

-U <-- User Id to connect to server in -S

-P <-- Password to connect to the server in -S

If its connected you shud see the following at the command prompt

1>




Once this test is done,

Open your dbArtisan

Will ask you a question if you want dbArtisan to automatically configure the Data Sources for you.

Click Yes

it will configure it for you and you will see the following screen




And then click on SQL server you shud see all your servers configured in ini file.

Friday, April 20, 2007

TNS Ping & SQLPLUS

tnsping is a utility to test your various oracle connections in tnsnames.ora.

it comes with your oracle.

Run the following tests once u install Oracle:

1)Start --> Run --> cmd

2) at the command prompt type in

tnsping

ex: if your tns entry is :

SRGTDEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = cmc8asff2.ny.jpmorgan.com)(PORT = 10005))
)
(CONNECT_DATA =
(SERVICE_NAME = APPRDEV)
)
)

type in :

tnsping SRGTDEV

YOU SHUD SEE THE FOLLOWING SCREEN




ALSO YOU CAN TYPE IN sqlplus at the command prompt to make sure ur oracle is properly installed. In that case you will see the following:

Saturday, April 14, 2007

JDK and JRE Big lesson learnt

JDK: Java Development tool kit also includes JRE (Java Runtime Environment)

JRE: Java Runtime Environment need not be installed separately. I comes along with JDK. Just make sure if its installed properly

Also biggest mistake made today:

JDK and JRE are of separate versions.And code compiled with a different version of JDK cannot be run on separate version of JRE.

So Ant is showing the following error

class file has wrong version 49.0, should be 48.0

To read more abt this goto: http://forum.java.sun.com/thread.jspa?threadID=517933&tstart=0


Resolution: What I did is uninstall both JDK and JRE and reinstall the same verison from http://java.sun.com/javase/downloads/index_jdk5.jsp

Everything went well and my Build is successful.

Setting Class Path Variables in Windows



Setting Class Path variables in windows:

Rt click on My Computer

2) Advanced

3) Environment Variables

4) New

5) JAVA_HOME

6) C:\j2sdk1.4.2_08.

Also see the attachments:

Strting WebLogic From Eclipse My experience


After you start your weblogic from outside for the first time.. and custom set up of weblogic Admin user Id and Password,Here is the steps to proceed further:

1)Open my eclipse

2)Window-->Preferences -->My Eclipse --> Application Server -->Weblogic 8

3) open + on weblogic 8.

4) Open JDK and set up the path as follows: C:\bea\jdk142_08

5) This will import a set of jdk files needed for starting the server including JRE

6) Now go to Weblogic tab and enter the following:


BEA Home Directory: C:\BEA

Choose enable weblogic Radio button on the top of this panel.

and enter the following:

Weblogic Installation Directory: C:\bea\weblogic81

Admin userName: weblogic (PS: ITs the uid and pwd u set up while starting ur server)

Admin password: weblogic (PS: ITs the uid and pwd u set up while starting ur server)

Execution Domain Root: C:\bea\weblogic81\server\bin

Execution Domain Name: mydomain

Execution Server Name: myserver

Host:portNumber: localhost:7001

Thats it its that easy you are all set to start weblogic server from your Eclipse.





Enjoy,
Suneetha.

Installing and Starting Weblogic Server

After default installing the weblogic server in the folder c:\bea

You can start your server from the following:

C:\bea\weblogic81\server\bin

In the bin folder click on the following: startWLS.cmd

And will ask you for the user id and pwd.

Since this is the first time setup, just give any user id and password. But remember it for future use

Then after running a couple of checks it will ask you if you want to install a custom build for this startup. (Something like that with a question Y/N).

Type in Y

Now will prompt u to re-enter your password

re-enter your pwd

Thats it ur set up is complet and now you have your Weblogic server running.

To confirm GOTO:

http://localhost:7001/console

Will prompt you for a user id and pwd just enter the one that u used for your set up. And you are all set.. console is open for use. =)

YEPPEEEEE

Thursday, April 12, 2007

Installing Eclipse

Installing Eclipse:

Goto eclipse.org and get the latest version of eclipse.

Download it to a folder.

Extract the zip file to a separate folder. Now you will see the eclipse icon in the extracted folder.

Double click on the icon.. your eclipse is ready to use.

You dont have to install eclipse separately.Just double clicking on the icon is enough.

You will get an error if you dont have JVM installed.


Before using eclipse make sure you have java virtual machine (JVM) installed on ur machine.

Wednesday, April 11, 2007

starting weblogic from eclipse

--------------------------------------------------------------------------------

Navigate to 'Preferences' from the 'Window' menu
Select the 'WebLogic' node and set the following parameters
Version of WebLogic Server
BEA Home Directory
WebLogic Home Directory
Domain Name
Domain Directory
Server Name
User Name (the name of a user with privileges to boot this server)
Password
Hostname (the hostname used by weblogic.Admin)
Port (the port number used by weblogic.Admin)
Select the 'WebLogic->Classpath' node and set the following parameters
Classpath before the WebLogic libraries
Classpath after the WebLogic libraries
Select the 'WebLogic->Project' node and set the following parameter
Project added to the end of the classpath
Select the 'WebLogic->JavaVM Options' node and set the following parameters
JavaVM (JDK used to launch WebLogic Server)
JavaVM Options (arguments to pass the JavaVM)
JNI library path (paths to search when loading libraries)

Starting WebLogic Server

--------------------------------------------------------------------------------

Navigate to 'Start WebLogic Server...' from the 'Run' menu
or Click the 'Start WebLogic Server...' button
Stopping WebLogic Server

--------------------------------------------------------------------------------

Navigate to 'Stop WebLogic Server...' from the 'Run' menu
or Click the 'Stop WebLogic Server...' button

Friday, February 23, 2007

direct JDBC connection in java

Direct JDBC Connection to the database.

java.sql.Statement stmt = null;
ResultSet rs = null;
PreparedStatement ps = null;
List result = null;
try {

Class.forName("oracle.jdbc.OracleDriver");
String url = "jdbc:oracle:thin:@mfn2asff4:10005:APPRDEV";
java.sql.Connection conn = DriverManager.getConnection(url,
"sgrtdbo", "sgrt123dbo");
stmt = conn.createStatement();
// TODO Auto-generated method stub
String maxDateInfo="select (max(To_Date(dateinfo,'DD MON YYYY HH24:MI:SS'))) as maxdate from srgt_metrics";
ResultSet resultSet=stmt.executeQuery(maxDateInfo);
while(resultSet.next()){
String maxDateFromDB=resultSet.getString(1);
System.out.println("Max date retrieved from the database is :"+maxDateFromDB);
}
}catch(Exception e){

System.out.println("IN Excepiton e");
e.printStackTrace();
}

Date Formattin in Java.

Things to remember for Simple Date FOrmatting


Letter Date or Time Component Presentation Examples
G Era designator Text AD
y Year Year 1996; 96
M Month in year Month July; Jul; 07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day in week Text Tuesday; Tue
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
z Time zone General time zone Pacific Standard Time; PST; GMT-08:00
Z Time zone RFC 822 time zone -0800


For Addtional Processing use the following:
Date and Time Pattern Result
"yyyy.MM.dd G 'at' HH:mm:ss z" 2001.07.04 AD at 12:08:56 PDT
"EEE, MMM d, ''yy" Wed, Jul 4, '01
"h:mm a" 12:08 PM
"hh 'o''clock' a, zzzz" 12 o'clock PM, Pacific Daylight Time
"K:mm a, z" 0:08 PM, PDT
"yyyyy.MMMMM.dd GGG hh:mm aaa" 02001.July.04 AD 12:08 PM
"EEE, d MMM yyyy HH:mm:ss Z" Wed, 4 Jul 2001 12:08:56 -0700
"yyMMddHHmmssZ" 010704120856-0700



Sample Code for conversion:

String datefromTable="2/22/2007 6:46:15 PM";
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy KK:mm:ss aaa");

SimpleDateFormat sdf2= new SimpleDateFormat("dd MMM yyyy hh:mm:ss");

String fromFile="23 Feb 2007 12:21:12";

java.util.Date d=null;
java.util.Date d2=null;
try{
d=sdf.parse(datefromTable);
d2=sdf2.parse(fromFile);
}catch(Exception e){

e.printStackTrace();
}


System.out.println("Compare Dates : "+d.compareTo(d2));