Links

   Quran Explorer - Interactive Audio Recitations & Translations

Thursday, June 13, 2013

Oracle isNumeric function



AFAIK there is no in-built function to do such but there are lots of ways to achieve the same using the functions already available.

Here is a list of some;

Option 1: Using to_number()
Attempt to convert the input/variable to a anumber.. if it succeeds then isNumeric is true otherwise false

CREATE OR REPLACE FUNCTION isNumeric (var in varchar) return char is
   dummy number;
begin
     select to_number(trim(var)) into dummy from dual; 
   if (dummy is null) then
      return '0';
   else
      return '1';
  end if;  
exception
   when others then
       return '0';
end;
/

Option 2: Using regex

What is exponential growth ?



According to legend, the game of chess was invented by the Brahmin Sissa to amuse and teach his king.

Asked by the grateful monarch what he wanted in return, the wise
man requested that the king to place one grain of rice in the first square of the chessboard, two in the second, four in the third, and so on, doubling the amount of rice up to the 64th square.

The king agreed on the spot, and as a result he was the first person to learn the valuable (albeit humbling) lesson of exponential growth.

Sissa’s request amounted to 264 −1 = 18,446,744,073,709,551,615 grains of rice, enough rice to pave all of India several times over !

Tuesday, June 11, 2013

Qualities of Truly Confident People

This is it.... (*bare knuckles*)

Confidence is NOT bravado, or swagger, or an overt pretence of bravery. Confidence is NOT some bold or brash air of self-belief directed at others.
Confidence is quiet: It’s a natural expression of ability, expertise, and self-regard.



The above summary captures it all.. 
If not enough you can continue reading.....

1. They take a stand not because they think they are always right… but because they are not afraid to be wrong.
Cocky and conceited people tend to take a position and then proclaim, bluster, and totally disregard differing opinions or points of view. They know they’re right – and they want (actually they need) you to know it too.
Their behavior isn’t a sign of confidence, though; it’s the hallmark of an intellectual bully.
Truly confident people don’t mind being proven wrong. They feel finding out what is right is a lot more important than being right. And when they’re wrong, they’re secure enough to back down graciously.
Truly confident people often admit they’re wrong or don’t have all the answers; intellectual bullies never do.

2. They listen ten times more than they speak.
Bragging is a mask for insecurity. Truly confident people are quiet and unassuming. They already know what they think; they want to know what you think.
So they ask open-ended questions that give other people the freedom to be thoughtful and introspective: They ask what you do, how you do it, what you like about it, what you learned from it… and what they should do if they find themselves in a similar situation.
Truly confident people realize they know a lot, but they wish they knew more… and they know the only way to learn more is to listen more.

3. They duck the spotlight so it shines on others.
Perhaps it’s true they did the bulk of the work. Perhaps they really did overcome the major obstacles. Perhaps it’s true they turned a collection of disparate individuals into an incredibly high performance team.
Truly confident people don’t care – at least they don’t show it. (Inside they’re proud, as well they should be.) Truly confident people don’t need the glory; they know what they’ve achieved.
They don’t need the validation of others, because true validation comes from within.
So they stand back and celebrate their accomplishments through others. They stand back and let others shine – a confidence boost that helps those people become truly confident, too.

4. They freely ask for help.
Many people feel asking for help is a sign of weakness; implicit in the request is a lack of knowledge, skill, or experience.
Confident people are secure enough to admit a weakness. So they often ask others for help, not only because they are secure enough to admit they need help but also because they know that when they seek help they pay the person they ask a huge compliment.
Saying, “Can you help me?” shows tremendous respect for that individual’s expertise and judgment. Otherwise you wouldn't ask.

5. They think, “Why not me?”
Many people feel they have to wait: To be promoted, to be hired, to be selected, to be chosen... like the old Hollywood cliché, to somehow be discovered.
Truly confident people know that access is almost universal. They can connect with almost anyone through social media. (Everyone you know knows someone you should know.) They know they can attract their own funding, create their own products, build their own relationships and networks, choose their own path – they can choose to follow whatever course they wish.
And very quietly, without calling attention to themselves, they go out and do it.

6. They don't put down other people.
Generally speaking, the people who like to gossip, who like to speak badly of others, do so because they hope by comparison to make themselves look better.
The only comparison a truly confident person makes is to the person she was yesterday – and to the person she hopes to someday become.

7. They aren’t afraid to look silly…
Running around in your underwear is certainly taking it to extremes… but when you’re truly confident, you don’t mind occasionally being in a situation where you aren't at your best.
(And oddly enough, people tend to respect you more when you do – not less).

8. … And they own their mistakes.
Insecurity tends to breed artificiality; confidence breeds sincerity and honesty.
That’s why truly confident people admit their mistakes. They dine out on their screw-ups. They don’t mind serving as a cautionary tale. They don’t mind being a source of laughter – for others and for themselves.
When you’re truly confident, you don’t mind occasionally “looking bad.” You realize that that when you’re genuine and unpretentious, people don’t laugh at you.
They laugh with you.

9. They only seek approval from the people who really matter.
You say you have 10k Twitter followers? Swell. 20k Facebook friends? Cool. A professional and social network of hundreds or even thousands? That’s great.
But that also pales in comparison to earning the trust and respect of the few people in your life that truly matter.
When we earn their trust and respect, no matter where we go or what we try, we do it with true confidence – because we know the people who truly matter the most are truly behind us.


Read this from Dharmesh Shah's update

Monday, June 10, 2013

Find foreign table using a given CONSTRAINT NAME


Ever tried to delete a record only to be told get ORA-02292
"integrity constraint (CONSTRAINT_NAME) violated - child record found"

How do you identify the table that is related to the constraint mentioned above. Of course if you explicitly name ur FK constraints(very unlikely) you have no problem.

ORACLE




SELECT owner, table_name
  FROM dba_constraints
 WHERE constraint_name = 'SYS_C0011582'


Friday, June 7, 2013

Periodicaly restart dead process in Linux



The following is (one way of ) how to automaticaly check for and restart a dead process running in a linux host

Part A

/bin/netstat -ln | /bin/grep ":80 " | /usr/bin/wc -l | /bin/awk '{if ($1 == 0) system("/sbin/service httpd restart") }'

This checks if there is any service running on port 80, if not it runs the command to start the service (apache httpd in this example)

Part B
Create a cron job to periodicaly do the above

#monitors the service every 10 minutes
*/10 * * * * /usr/sesame/bash/service_monitor.sh> /dev/null 2>&1


NB: please note the trailing space after the port number


Tested in Redhat|Fedora|CentOS

Monday, June 3, 2013

DO NOT make products for Everyone


If your response to the title above is  

"Well, I’m really making it for everyone."....
Well, just stop because you’ve already lost. 
“Everyone” isn’t an audience. “Everyone” is a by product of an incredibly successful thing that was made for a far more specific bunch of people.

Don’t ever make something for “Everyone” make it for someone. And make that person love it.

Facebook was not originaly designed for “Everyone,” it started by targeting Harvard students, then Ivy League students, then more and more and more.
Go ask Google Plus how well building for “Everyone” from the start went.

When you begin with “Everyone” you’re just stuck: How do you make any honest decisions? How do you solve any real problems? You don’t.

You start to invent people and you start to invent their problems and it’s amazing because those people and those problems line up almost exactly with what you’re building and how you’re thinking about it—imagine that. Lying to yourself is amazing for productivity.

Real audience is hard. Solving real problems is coding madness. But it’s the only way you make something that lasts, because you made something that someone actually cared about.


Inspired by: http://tinyurl.com/m4h9n2j