Wednesday, May 28, 2008

Warning Signs You Can't Ignore

A very interesting piece of reading.
Taken from : Here

Buying a home? Selecting a surgeon? Trying to tell if she's true? The FBI's best profilers are standing by to help you spot, and avoid, big trouble.

Before John Douglas became one of the FBI's most legendary crime stalkers, he wanted to be a veterinarian, so he spent a lot of time working on farms. "I always wondered how cows got out of those barbed-wire fences," he recounts. "But then I realized what a cow does all day. He stands around chewing his cud and looking at the fence. Eventually, if you look at something long enough, you see weakness. Trouble is, most people don't spend much time looking."

You could say that Douglas's farm experience became a metaphor for his 25 years at the Bureau. He has a knack for spotting holes, weaknesses, and clues that other investigators miss. In professional parlance, he is a profiler -- an agent specially trained in observation, investigation, and interpretation. By studying the facts of a case, inspecting forensic evidence, and reviewing law-enforcement witness interviews, profilers can often predict things about an offender long before he's apprehended. At times, good profilers can appear almost clairvoyant, but it's actually their highly evolved sense of awareness and deductive reasoning that's at work.

Douglas and other adept profilers are about to teach you the same skills they honed at the acclaimed behavioral science unit of the FBI Academy in Quantico, Virginia. You don't have to be a crime victim to take advantage of this knowledge. Most of their techniques can be used to minimize risks that arise in all sorts of everyday situations.

Indeed, in a world that seems more threatening and filled with more people trying to take advantage of you every day, there's no better time to learn a new way of protecting yourself.

What follows are descriptions of eight situations you may eventually find yourself facing. For each, our team has assembled a checklist of things to look for to minimize your vulnerability or risk.

Good luck with your investigation.

Find out if she's cheating

You have a creeping suspicion she's seeing some creep. Here's how to conduct an interview that'll make her divulge the truth.

Work from a "zero behavioral baseline," advises Mark Safarik, a 23-year veteran of the Bureau who now runs FBSI, a Virginia-based company dedicated to crime-scene analysis and threat assessment. In other words, look for sudden deviations in her usual conduct: a new hairstyle and clothes, more concern with hygiene and fitness, prolonged absences, less interest in sex.

If enough signs exist, set a trap. Buy two romantic cards that are exactly the same. Send one to her at work, unsigned. If she's having an affair, she won't mention it, because she won't know who sent it.

Now "play" the second card. Tell her you need to talk. "Make sure it's after dark," says Douglas, "because it'll make her feel more relaxed." Sit at a table on which you previously placed the second card. Don't make it too obvious, but be sure she notices it.

This is called "introducing a stressor."

Don't confront her with the card. Instead, look in her eyes and ask, "Are you having an affair?" Study what she does next. If she repeats the question, drops her eyes, looks away, folds her arms, licks her lips, crosses her legs, or picks some invisible lint off her clothing, she's stalling and is probably guilty. It's time to go in stronger.

Ask the question again, this time glancing at the card but still not fully acknowledging it. If she truly has something to hide, she'll become increasingly agitated.

Finally, to spark a confession, provide what FBI interrogators call a "face-saving scenario." Say this: "I know we've been having problems, and I don't blame you if you did this, but I just want the truth." "If she's being perceived as a victim," says Douglas, who has used this technique to crack many criminals, "she'll be more likely to talk."

Don't be misled by... her denials. "I've had people pass polygraph tests and still turn out to be lying," says Douglas. "Those with a history of lying, like O.J. and Bill Clinton, are good at it. Other people besides criminals are chronic liars. Don't make the mistake of thinking everyone is honest."

See if your potential boss is a psycho

The company is booming and the benefits package is great, but will you really enjoy working for the guy behind the desk?

Case the company as you would a crime scene. How is it organized? What's its mission? What's the competition? "It's a no-lose effort," says Douglas. "The knowledge you acquire will positively shape the interview."

When you arrive, notice if the boss's door is open or closed. If it and others are shut, it's a tense work atmosphere.

Be on the lookout for superiority cues (he keeps you waiting, he doesn't rise to greet you, your chair is set lower than his). Sure, he's the boss, but he doesn't have to rub it in.

Look for the "Love-Me Wall" covered with diplomas, awards, and autographed celebrity photos. Robert Ressler, a 20-year FBI man who coined the term "serial killer," says it's basically a shrine that screams, "It's all about me." And if it's about him, that means it won't be about your needs or success.

Most important, ask yourself a few questions. Does he give me his full attention during an interview? Does he push aside the demands of the day, stop glancing at e-mail, and listen? If he does now, he'll do the same later.

Don't be misled by... family photos. "They don't mean anything," says Douglas. "I've seen pictures on desks of men with their wives, and they're divorced the next week. Sometimes it means he's trying to impress everyone by showing he's a family man. This is called 'staging the office.' He's trying to project something he's not."

Discover if it's a dream neighborhood or a nightmare on Elm Street

A house is only as great as its location. Here's how to spot a troublesome neighborhood before you hand over the down payment.

When Douglas goes to a mall and sees children performing onstage, he watches the crowd, not the kids. "Good profilers learn to look away from the focal point," he says. In this case, shift your focus from the property to what surrounds it.

Ask the local police about criminal activity. Some departments have online databases that are searchable using zip codes.

Beyond the physical appearance of the surrounding properties, look at the cars parked in driveways. Are they upscale brands or candidates for Pimp My Ride? Also look at the condition of the lawns. "Yards and cars mirror personality," says Ressler.

Talk to the neighbors. See if they own or rent. Ask them about the best and worst aspects of living there.

Observe the real-estate agent as he's showing the place. Is he in a hurry? Does he make eye contact when answering questions? Ask to see certain parts of the property again, but this time watch where he's looking. (People often self-consciously glance at trouble spots.)

Stake out the area on a Saturday night. Sit in your car, roll down the window, have a snack, and observe. A neighborhood's personality can change dramatically on weekends. (If someone calls the cops on you, it's a good sign.)

Don't be misled by... the owners or the agent. Remember, they want to sell. "Always work from a constellation of behaviors and observations," says Safarik. "Don't put too much importance on any one person or attribute."

Look into the job candidate's soul

He's polite, professional, and highly qualified. But how will he perform on the job?

Employees are 15 times more likely to steal than customers are. So set up an integrity test. Leave a file marked "confidential" on the waiting-room table or a $50 bill under a magazine. Then ask the receptionist to watch if he bites.

Call human resources at his previous workplaces. Ask one telling question: Is he eligible for rehire?

Search him on all the usual Internet sites (Google, MySpace, Facebook). They may yield clues about his personality that he'd never volunteer.

Fifty percent of people lie on their résumés. If you notice discrepancies, give your prospective employee the chance to correct them. "Most people embellish. If you give them an opportunity to come clean, they will," says Clint Van Zandt, a 25-year FBI veteran who now operates his own risk-assessment company. "If he doesn't come clean, then he'll probably exhibit that same behavior on the job."

Find what FBI investigators call "spin-off." "This is a person who's not one of your target's drinking buddies, who knows something about him and is willing to share it," says Van Zandt. Ask if there's someone at his previous company he didn't get along with. Ask his references the same question. "You want to find at least one person who isn't going to paint this guy with a smiley-face brush," he adds.

Don't be misled by... secondhand information. "People naturally filter information in a way that's positive for them," says Safarik. "This could bias you. Take note of what others say, but always draw your own conclusions."

Decide if she's the one

You think you're in love. You think she'd make a great wife and mother. But don't buy the ring until you observe her in these six situations.

Dinner with your family: They know you almost as well as you know yourself. Value their opinion.

Dinner with her family: Watch how her parents treat each other. Their relationship is her role model.

An evening of babysitting: Do you see any motherly instincts emerge? Is she patient? Does she have fun? Afterward, ask if she'd like to have kids one day. Does she reply directly and comfortably, or is she evasive?

Breakfast at a diner: Observe her interaction with the waitresses. "How she handles service staff is a good indication of how she treats others," says Van Zandt.

Drinks with other women: Take her to a bar where some of your attractive female friends hang out. Is she jealous?

Hanging at her place: It's filled with clues to her true personality — books, magazines, DVDs, art. Remember that reality mimics fantasy. Also, is she living within her means? "Financial issues are a major cause of divorce," says Safarik.

Don't be misled by... your unchecked emotions. Good profilers are able to detach themselves from circumstances in order to make an honest appraisal.

Cut open the surgeon's record

You need a good one, but is the surgeon who cut out Uncle Tony's gallbladder really qualified?

Google him. You'll get a snapshot of his career accomplishments, community involvement, and any controversy that may surround him.

Give his waiting room the once-over. Is it clean and organized? Do the nurses appear in control, or harried? Are other patients growing restless? What does the man next to you think of him?

Give the doctor the once-over. Is he in good health for his age? Is he professional in presentation and demeanor?

Evaluate his time with you. Is he punctual? Is his first question about your medical insurance, or about your medical problem? Does he listen? Is he sincere? Does he profess to be able to cure anything, or does he recommend seeking other opinions?

Grill him. Most people are too trustful of doctors. Be sure to ask how long he's been practicing, how many times he's done this surgery, and what his success rate is.

Back in the parking lot, look for his car. Peek inside. If it's in shambles, he may leave your innards looking the same way.

Find out which floor of the hospital he operates on, and visit it. Casually ask the nurses for their opinions of him.

Don't be misled by... appearance. "What do bad people look like?" says Douglas. "They look like you and me. Ted Bundy was a good-looking guy, and he killed more than 20 people."
Decide whether to go to bed with her

She's been coming on to you all night. Is she another "fatal attraction"?

Measure her actions against the "zero behavioral baseline" you already have for such situations. Compared with other women, is she far from the norm in appearance, dress, and aggressiveness? If so, beware.

Try to find out if she's on the rebound. If so, she's vulnerable and more likely to latch onto you.

Is she already talking about the long term, such as vacations together? If so, that's a sign of possessiveness.

Start talking to another woman and see how woman number one reacts. If she acts jealous even though she hardly knows you, her reaction will be even stronger after you've become intimate with her.

When in doubt, ask the bartender. Chances are, he'll know her.

Don't be misled by... her sudden interest in you. "Since when did you become Brad Pitt?" asks Douglas. "Great profilers consider motive — they walk in the shoes of whoever they're trying to understand."

See if the employee is a time bomb before he blows

He's always bitching and moaning, and sometimes he even acts slightly threatening. Could he go postal?

"People are always leaking information," says Safarik, "but others never pick up on it until after the fact. You see this at school shootings all the time. Profilers learn to stop and say, 'What does he mean by that?' "
Look around his cubicle. If his walls are plastered with family photographs and shots of him fishing, he's probably not a risk. On the other hand, if the walls are blank or push-pinned with complaints, or if everything appears obsessively neat, he bears watching.

Take him to lunch and listen to his complaints. Are they reasonable? Is he upset about one thing, or everything? Is it a situation, or a person? Does he obsess about what this person has done to him? (If so, pick up the tab to get on his good side.)

Note whether he's speaking in the active or passive voice. For instance, if he says, "Someone ought to take care of that guy," it's passive. But if he says, "I'm going to get him," that's active, which elevates the level of threat.

Don't be misled by... gut instinct. Note how you feel about the situation initially, but then put those feelings aside and objectively and thoroughly gather as much information as possible. Then return to your instinct to see how it fits in.

As Sherlock Holmes, the most famous profiler of all, said, "It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts."

Thursday, May 8, 2008

Replacing Turkish characters in a string in Oracle

Simple, yet, effective.

SELECT TRANSLATE(string, 'ĞÜŞİÖÇğüşıöç', 'GUSIOCgusioc') FROM dual;

Useful for especially on data transfers.

Friday, November 16, 2007

The Cinematics

A Scottish band named The Cinematics. They have a great album, A Strange Education.

I have been listening it since it was first released and never got bored of it.
Every time I listen, I got a different taste. Just try it, I am sure you will like that if you love alternative or indie rock.

www.thecinematics.com

Tuesday, November 13, 2007

How To Avoid duplicate SQL (multiple parsing) on Oracle

It is a common mistake to write SQL statements like:


//Assuming rCURSOR is declared as REF CURSOR
PROCEDURE Q_GETRESULTS(sPARAM1 VARCHAR2, iPARAM2 NUMBER, dPARAM3 DATE, cCursor OUT rCURSOR) IS
sSQL VARCHAR2(500);
BEGIN
sSQL := ' SELECT COL1, COL2, COL3 ';
sSQL := sSQL || ' FROM TABLE1'
sSQL := sSQL || ' WHERE COL1 = ''' || sPARAM1 || '''';
sSQL := sSQL || ' AND COL2 = ' || iPARAM2;
sSQL := sSQL || ' AND COL3 = ''' || dPARAM2 || '''';
OPEN cCURSOR FOR sSQL
END Q_GETRESULTS;



What happens when the procedure runs; is that it parsed for the parameters and then it is executed. When one of the parameters changes, it is a different SQL string, hence hard parsed and executed again. Hard parsing is a very CPU intensive process, which also tries to obtain latches on important shared memory area.
This is a bad habit and should be avoided at all costs. It is also subject to SQL Injection.

So, how to avoid it then? There are a few methods for it.

If all the parameters are required from the client application, then a sweet method is to use;

sSQL := 'SELECT COL1, COL2, COL3 ';
sSQL := sSQL || ' FROM TABLE1'
sSQL := sSQL || ' WHERE COL1 = :B1';
sSQL := sSQL || ' AND COL2 = :B2';
sSQL := sSQL || ' AND COL3 = :B2';

OPEN cCURSOR FOR sSQL USING sPARAM1, iPARAM2, dPARAM3;



If the one or more of the parameters of the procedure is optional (is NULL) then SYS_CONTEXT is our friend. This is a function that returns a string. So we can use it anywhere.
It requires "CREATE ANY CONTEXT" privilege.


CREATE OR REPLACE CONTEXT CTX_MYCONTEXT USING Q_GETRESULTS;

PROCEDURE Q_GETRESULTS(sPARAM1 VARCHAR2, iPARAM2 NUMBER, dPARAM3 DATE, cCursor OUT rCURSOR) IS
sSQL VARCHAR2(500);
BEGIN
sSQL := ' SELECT COL1, COL2, COL3 ';
sSQL := sSQL || ' FROM TABLE1'
sSQL := sSQL || ' WHERE 1=1';
IF sPARAM1 IS NOT NULL THEN
DBMS_SESSION.SET_CONTEXT('CTX_MYCONTEXT', 'sPARAM1_VAL', sPARAM1);
sSQL := sSQL || ' AND COL1 = SYS_CONTEXT(''CTX_MYCONTEXT'', ''sPARAM1_VAL'')';
END IF;

IF iPARAM2 IS NOT NULL THEN
DBMS_SESSION.SET_CONTEXT('CTX_MYCONTEXT', 'iPARAM2_VAL', iPARAM2);
sSQL := sSQL || ' AND COL2 = TO_NUMBER(SYS_CONTEXT(''CTX_MYCONTEXT'',''iPARAM2_VAL''))';
END IF;

IF dPARAM3 IS NOT NULL THEN
DBMS_SESSION.SET_CONTEXT('CTX_MYCONTEXT', 'dPARAM3_VAL', TO_CHAR(dPARAM3, 'DDMMYYYHH24MISS');
sSQL := sSQL || ' AND COL3 = TO_DATE(SYS_CONTEXT(''CTX_MYCONTEXT'',''dPARAM3_VAL''), ''DDMMYYYHH24MISS'')';
END IF;
OPEN cCURSOR FOR sSQL;
END Q_GETRESULTS;




This is an elegant and very easy to implement solution. Existing procedures can be converted to this method very easily.
More info about this can be found HERE!. Tom Kyte explains it briefly.

This ensures that SQL is parsed once and executed multiple times with the same plan. It increases performance more than expected.

There we go!

Here we start :)
I always wanted to have a blog and I think now is the time to start one. Lets see how I am going to manage to fill it up with some information.

I want it to be different, totally.

Well, it will still be mostly about computer world, but hey, I cannot be blamed for it, can I ?