Can you choose your personality?

CS140, 03/18/2012
From a lecture by Professor John Ousterhout.

For today’s thought for the weekend, I thought I’d come full circle and talk about the idea that made me think of doing these thoughts for the weekend in the first place. The idea I want to close with is, can you choose your own personality? I propose that both as a question and a challenge to you as students. Do we actually have any control over our personalities?

There’s a pretty good argument that we don’t. For example, a lot of personalities are undoubtedly genetic in nature and so depend on however the genes mixed up when you were born. But then for the first part of your life, you’re just not able to control your personality. You’re being programmed continuously the whole time you’re growing up, by your parents, your friends and the people that are around you. Everybody subconsciously imitates what they see, so your personality is being programmed and you have no control over that. I learned that up through high school and maybe even early in college, most people are not well-enough developed to really think about what kind of personality they would like to have. You’re too busy just trying to become a basic human being, to learn how to understand and manipulate the world around you, that the idea of manipulating your own fundamental essence, who you are and how you feel–you’re just not mature enough to do that. You just can’t reason it out yourself or step out of yourself and reason it out from the outside. Many people never acquire that ability their whole lives. On the other hand, by the time you get to your mid or late twenties, it’s too late. Most people’s personalities are pretty fixed by then. For some of you, I’m afraid, it’s already too late–you might already be frozen. There are probably a few of you who are really lucky: your personalities will remain flexible for thirty or forty more years, until late in your life. You’re the enviable ones and you’ll be able to do really great things with your personality. But for most of you, you don’t have much time. If you’re going to control your personality, it has to happen pretty much right away: you’ve only got a few years to do it.

I have no scientific basis for what I’m going to say next, but personally, I like to believe that most people have some control. […] If I go to Amazon, can I just buy the extravert personality workout video? Cynicism in twelve easy steps? Of course, no. (Actually, there’s probably someone out there who has written such a book […]) The best I can say is, borrow and steal. Look around you in the people you interact with and when you see someone who has a really interesting, enviable personality characteristic, just take it. People are really good at emulating, so just find the things around you that you like. Be constantly thinking, do I like that characteristic and do I want that for myself? I’ve done that several times in my life–I don’t know if it’s because I grew up without a father figure around to tell me stuff, but there are perhaps half a dozen times in my life when I saw something I really liked and I decided, I’m going to try and be like that. I probably never did any of those things as good as any of the people I was trying to emulate, but I can say that I did skew myself a little bit.

I want to tell you one probably funny story about a situation like this. When I was a graduate student at Carnegie Mellon University, I was TA’ing one of the intro programming classes and I had a disagreement with the professor about something. I don’t even remember what it was anymore, but somewhere, I thought he wasn’t being fair to the students in the class. I was kind of passionate and hot-headed in those days and so I went to tell the professor about it and suggested that we make a change to fix the problem. He listened very carefully and said, “No, I’m not going to do that.” That kind of bugged me, so I explained again why this was really important. He said again, “No, I don’t think I’m going to do that.” Then, I decided I would resort to some stronger arguments. I began to insult him and talked about how he wasn’t a very good professor if he didn’t do this–it wasn’t fair to the students. He was completely unflappable. He didn’t get mad at me for insulting him, so then I decided I would find out how far I could go with this. Plus, the harder it was to get him angry, the angrier I was myself. I became more and more insulting to the professor and yet, it all completely washed off of him.

Now, you’re probably thinking, what a mature move: thank you for sharing with us the reasonable person principle in action here. I think I actually knew the reasonable person principle back then, but I hadn’t quite fully assimilated it. I just got so mad that I ended up storming out of his office. I stayed mad–I kept thinking about it and got madder and madder until it suddenly hit me and realized that I needed to be that way. This is actually an incredibly powerful personality trait, that you don’t take insults: people can’t make you mad. And so I decided to try and become that way. Over time, I realized that there’s actually a pretty deep thought behind all of this, which is, an insult isn’t something that happens to you: it’s not like getting hit by lightning or catching the flu or something that you have no control over. An insult is something you have to agree to. If you don’t agree to be insulted, nobody can insult you. And that, to me, was just a really powerful idea. You think about the world today, where there are so many people who are just desperate to be insulted. They’re so eager to find something they can take insult with so they can take out some horrible vengeance back on it. And this idea is that you just don’t have to be insulted. These days, it’s pretty hard to say things to get me mad. You just realize, I don’t have to feel insulted–call me whatever you want. That’s an example from my life. There are probably other examples that are less juvenile in origin than that one was.

I’d say, think about that: find traits that you like and emulate them. Just to summarize, I have put up all the thoughts for the weekend and I’d like to remind you what they are again:

  • A little bit of slope makes up for a lot of Y-intercept
  • Fear is more dangerous than evil
  • Simplicity
  • Scar tissue makes relationships wear out
  • The most important component of evolution is death
  • The reasonable person principle
  • Do your disasters make you weaker or stronger?
  • Mental agility
  • For major (non-technical) decisions, trust your gut

Can you choose your personality?

To close out the class, I’d just like to say, I know you all worked really really hard in this class–sorry how hard you had to work. If I had it my way, it wouldn’t be quite as much work. But hopefully, at the end of the day, you will have learned enough to at least mostly compensate you for all the time you put in. In fact, I’ll stop, wish you a good weekend and see you at the exam on Monday morning.

Fear is more dangerous than evil

CS140, 01/18/2012
From a lecture by Professor John Ousterhout.

Last week’s thought for the weekend was, a little bit of slope makes up for a lot of y-intercept.  This week’s thought for the week is, fear is more dangerous than evil.

First of all, maybe I’m an optimist, but I think there aren’t many truly evil people in the world.  Maybe there are some and they get their fair share of publicity.  I think much more damage is caused by people who are afraid.  This is a much bigger problem I think for society in general.

Let me give you an example.  People who are afraid will do things that they know are wrong.  For example, when people cheat on assignments, in most cases, it’s when people are up late the night before an assignment is due and they get desperate and afraid and made a silly decision to steal somebody else’s work.  In industry, CEO’s are afraid to announce that their company had a bad quarter, so they allow their salespeople to report sales from the next quarter.  Then in the next quarter, they have to cheat even more and eventually it all comes tumbling down.

When people are afraid, they often behave irrationally because they’re desperate.  They try things that can’t possibly work but they do anyway because they’re desperate.  That makes them unpredictable and really dangerous to be around.

But at an even simpler level, fear makes people underachieve in all sorts of ways and this may be the biggest problem of all.  For example, people are afraid to try something new, so they get stuck in a rut doing something they know is not right for them.  People might have a really bad relationship or a couple of bad relationships and they become so afraid of having another one and become so distrustful that they can’t form a good relationship anymore.  They are basically damaged by their fear.

Or in another example, people are afraid to look bad.  This is often true about leaders: you think you have to be invincible, that you’re not a good leader if you appear to make a mistake.  So, you never admit a mistake to look strong.  But if you never admit a mistake, then you don’t learn from it.  If you don’t learn from it, you keep making more mistakes, which makes you more afraid, causing you to lie more and more and the whole thing just cycles on itself.  And if you’re a leader, eventually people realize you don’t know what you’re talking about, even though you’re pretending everything’s alright.

Ironically, the people who sound the most confident and arrogant, I think, are often the most afraid.  That arrogance is just a shell they build around their fear underneath.  Furthermore, when really evil things happen, fear is often closely involved.  If you take sociopathic criminals, these people are often motivated by fear, typically the fear of losing control.  They commit violent crimes like murder and rape because that’s the only way they feel they can take and exert control over other people.  It all comes from inner fear.

When evil’s carried out in a really large scale–take your favorite large-scale evil action, most of the work is done by people who are afraid.  You have the evil person at the top who scares all the other people into doing the really nasty stuff.  So it’s the fear that actually did most of the damage.

In general, I think fear is much more pervasive.  It happens at all levels and it damages everyone to some degree.  There are certainly times in my life where I did the wrong thing because I was afraid.  On the other hand, fear does serve a fairly good biological purpose.  Life without fear would probably be fairly short.  An animal is about to attack you or a car is about to hit you and you’re standing on the edge of a cliff–these are good occasions to feel fear.  And I think sometimes fear is unavoidable.  With stage fright, if you’ve never given a talk before, you’re going to feel fear.  Or if you take risks and try new things, it’ll be scary.  But fear, I think, also occurs in many cases that are not constructive and helpful and just damages.

The question is, how are you going to keep fear from damaging your life?  You’re not going to eliminate fear–you might not even want to do that: life is pretty dull if you have no fear at all.  A couple of things to think about:

The first one is the red flag approach.  Ask yourself, am I making a decision out of fear?  The best way you can tell is if you’re running away from something instead of running towards something.  Am I doing something because I’m afraid of something, not in spite of the fear, but because of the fear?  If so, you should think about making changes.  Change the decision or change the situation.  If you’re fighting self constantly, being afraid a car is going to run you over, maybe you should be more careful when you walk out into the street.  Or change yourself.  Figure out how to get yourself in a situation where you’re not going to feel as much fear.  I think the most important thing is to understand, see what is happening.  If you do that, I think you’ll figure out a way to help yourself.

What do you do about fear?  To me, the solution to fear is power.  The opposite of fear is confidence and what gives you confidence is power.  This is the superman kind of power, not the ability to manipulate and control other people, the Stalin kind of power.  The way I think to have a fear-free life is to continually be developing skills so you don’t feel afraid anymore.  My single most important strategy when bringing up our kids was to try and make our kids self-confident by teaching them lots and lots of skills.  If they know how to do a lot of stuff, they’ll be confident and live lives without fear–that’s probably the best way to live a happy life.  So develop your powers.

The third approach is to learn how to harness the fear.  In some cases, it’s inevitable.  For example, with stage fright, I still get scared when I make presentations to a large audience, but I realized that stage fright is an amazing natural drug.  The adrenaline rush when you’re really scared wakes up your whole mind.  I suddenly realize that I’m at my most alert, my best, just after I’m scared out of mind for ten seconds with a burst of adrenaline.  This is an enormous source of power–I have all this adrenaline on my side and I didn’t even have to take a pill.  So learn how to harness it.

Overall, I would say, just don’t let your life be damaged by fear.  And furthermore, not just for yourself, but also for the people around you.  Get them to a place where they’re not afraid and they can work through fear.  My opinion is, if you want a world of peace, you need have a world without fear.

The Most Important Component of Evolution is Death

CS140, 01/20/2012
From a lecture by Professor John Ousterhout.

Today’s thought for the weekend is: the most important component of evolution is death.  So I want to address that first at a biological level and then let’s pop up and talk about it at a societal level, Silicon Valley, and computer software.  So, first, from an underlying biological standpoint, it’s sort of fundamental that for some reason it’s really hard for an existing organism to change in fundamental ways.  How many of you have been able to grow a third leg?  Most people can’t even change their mind let alone change something fundamental about themselves.

People try.  You make your hair look a different color, but it’s really the same color underneath.  In fact you have this whole thing called your autoimmune system whose goal is basically to prevent change.  You’ve got these white blood cells running around looking for anything that looks different or the slightest bit unfamiliar and as soon as they find it they kill it.  So it’s very hard for any organism to change itself, but when we make new organisms it’s actually fairly easy to make them different from the old ones.  So for example gene mutations seem to happen pretty commonly.  They can be good or bad, but they do change the system.  Or, with sexual reproduction, it’s even easier because you take genes from two parents and you mix and match them and who knows you’re going to end up with as a result.

So the bottom line is it’s a lot easier to build a new organism than it is to change an existing one.  And, in order for that to work, you have to get rid of all the existing ones.  So death is really fundamental.  If it wasn’t for death there’d be no way to bring in new organisms and create change.

I would argue this same concept applies at a societal level.  In fact, if you look at social structures, any structure that’s been around a really long time, it’s almost certainly out of date.  Because, they just can’t change.  Human organizations, companies, political systems, religions, they all have tremendous difficulty changing.

So, let me talk about companies in particular.  We’re hearing these days about various companies in trouble.  Is Yahoo going to make it?  And Kodak filing for Chapter 11.  People seem to think: those guys must have been bozos.  They blew it.  How could you fumble the internet when you’re Yahoo?

My opinion is this is just the circle of life.  That’s all.  That fundamentally companies can’t change.  You come in with a particular technology, something you do very well, but if the underlying technology changes, companies can’t adapt.  So they actually need to die.

I view this as a good thing.  This is the way we clear out the old and make room for the new.  And in Silicon Valley everyone kind of accepts that.  The death of a company is not a big deal.  In fact, what’s interesting is that the death of the company isn’t necessarily bad for the people at all.  They just go on to the next company.

And I was talking to a venture capitalist once and she told me she actually liked funding entrepreneurs who had been in failed startups because they were really hungry yet still had experience. People in successful startups weren’t as hungry and didn’t succeed as often when they got funded.  So death is actually a good thing in Silicon Valley.

Now let’s talk about computer software.  This is kind of ironic because software is a very malleable medium, very easy to change.  Much easier to change than most things.  And I actually consider that to be a problem because, in fact, people don’t have to throw it away and start again.

Software lives on and on and on.  You know we’re still working on versions of Windows 20 years old right now.  And as a result the software gets messier and kludgier and harder and harder to change.  And yet people keep struggling.  They won’t throw it away and start again.

And so what’s funny is that this incredibly malleable medium gets to a point where we can’t make fundamental changes in it because people aren’t willing to throw it away and start again.  I sometimes think the world would be a better place if somehow there could be a time limit on software where it expired.  You had to throw it away and start again.

So this is actually one of the things I like about California and Silicon Valley.  It’s that we have a culture where people like change and aren’t afraid of that.  And we’re not afraid of the death of an idea or a company because it means that something even new and better is coming along next.

So that’s my thought for the weekend…

A little bit of slope makes up for a lot of y-intercept

CS140, 01/13/2012
From a lecture by Professor John Ousterhout.

Here’s today’s thought for the weekend. A little bit of slope makes up for a lot of Y-intercept..

So at a mathematical level this is an obvious truism. You know if you have two lines, the red line and the blue line and the red line has a lower Y-intercept but a greater slope then eventually the red line will cross the blue line.

And if the Y-axis is something good, depending on your definition of something good, then I think most people would pick the red trajectory over the blue trajectory (..unless you think you’re going to die before you get to the crossing point).


So in a mathematical sense it’s kind of obvious. But I didn’t really mean in a mathematical sense, I think this is a pretty good guideline for life also. What I mean is that how fast you learn is a lot more important than how much you know to begin with. So in general I say that people emphasize too much how much they know and not how fast they’re learning.

That’s good news for all of you people because you’re in Stanford and that means you learn really, really fast. This is a great advantage for you. Now let me give you some examples. The first example is: you shouldn’t be afraid to try new things even if you’re completely clueless about the area you’re going into. No need to be afraid about that. As long as you learn fast you’ll catch up and you’ll be fine.

For example I often hear conversations the first week of class where somebody will be bemoaning, “Oh so-and-so knows blah-blah-blah, how am I ever going to catch up to them?” Well, if you’re one of the people who knows blah-blah-blah it’s bad news for you because honestly everyone is going to catch up really quickly. Before you know it that advantage is going to be gone and if you aren’t learning too you’re going to be behind.

Another example is that a lot of people get stuck in ruts in their lives. They realize they’re in the wrong job for them. I have the wrong job or the wrong spouse or whatever…

And they’re afraid to go off and try something new. Often they’re worried, I’m going to really look bad if I go..

I’m kidding about the spouse. But, seriously people will be afraid to try some new thing because they’re worried they’ll look bad or will make a lot of rookie mistakes. But, I say, just go do it and focus on learning.

Let me take the spouse out of the equation for now.

Focus on the job.

Another example is hiring. Before I came back to academia a couple of years ago I was out doing startups. What I noticed is that when people hire they are almost always hire based on experience. They’re looking for somebody’s resume trying to find the person who has already done the job they want them to do three times over. That’s basically hiring based on Y-intercept.

Personally I don’t think that’s a very good way to hire. The people who are doing the same thing over and over again often get burnt out and typically the reason they’re doing the same thing over and over again is they’ve maxed out. They can’t do anything more than that. And, in fact, typically what happens when you level off is you level off slightly above your level of competence. So in fact you’re not actually doing the current job all that well.

So what I would always hire on is based on aptitude, not on experience. You know, is this person ready to do the job? They may never have done it before and have no experience in this area, but are they a smart person who can figure things out? Are they a quick learner? And I’ve found that’s a much better way to get really effective people.

So I think this is a really interesting concept you can apply in a lot of different ways. And the key thing here I think is that slow and steady is great. You don’t have to do anything heroic. You know the difference in slopes doesn’t have to be that great if you just every day think about learning a little bit more and getting a little bit better, lots of small steps, its amazing how quickly you can catch up and become a real expert in the field.

I often ask myself: have I learned one new thing today? Now you guys are younger and, you know, your slope is a little bit higher than mine and so you can learn 2 or 3 or 4 new things a day. But if you just think about your slope and don’t worry about where you start out you’ll end up some place nice.

Ok, that’s my weekend thought.

Change Context Root for xmlpserver on 11g BI Publisher

I have been researching on how to change the context root for xmlpserver on 11g BI Publisher. Since our application could not use xmlpserver as the context root extension, I would love to come up an approach with the deployment of the same application but with a new context root. This topic is an open question. I have worked out one solution explained in the current article. But I still have not figured out the best approach for the question. Let me know if anyone has any idea for the questions I asked in the article.

As far as I have touched this topic, I tried changing the context root on the fly by modifying the xmlpserver deployment configuration as below:

Login to Application console, and click on the Deployments. You should be able see a list of deployments on the weblogic server. Find the one with name bipublisher, expand the deployment, there is a web application named xmlpserver. Click on that, it will navigate to the settings page of xmlpserver showed in the picture below: (Click on Configuration Tab and navigate to the bottom)


This Context Root is editable and was previously set to be xmlpserver. So I changed it to newContextRoot and save the configuration. However the settings didn’t get picked up during the server restart and it was not working.

I would expect to access http://domain-name:9704/newContextRoot  instead of http://domain-name:9704/xmlpserver

  Anyone knows why this straightforward approach is not functioning as expected?

My working approach:

Here is what I do for the rest of the steps. I will firstly undeploy the current bipublisher application in enterprise manager and then duplicate a copy of existing xmlpserver.ear with the new name btmreport.ear. Later I modified a few files in btmreport.ear and deploy btmreport.ear with the same name bipublisher under the same target. (This involves a few tricks I found out during the trials and errors. I would explain them in the corresponding steps)

 Step 1. Undeploy the current bipublisher application.

 Access enterprise manger as below. By default you could access the link: http://Domain-Name:7001/em

Now on the navigation panel find bipublisher and click on Undeploy as below.

Continue the undeployment.

If you run into the same error with me as below, it means the configuration of bifoundation has been locked and you need to go to applicaiton console to release the configuration.

How to release the configuration? Simple! Go to application console. By default you access the link: http://Domain-Name:7001/console

Once login, you should be able to see that there are changes that need to be taken actions in order to unlock the configure on bifoundation domain. I have been trying out other deployments on console. So I just wanted to undo the changes to release the configuration.

After this change,  I could proceed on undeploying the application back to enterprise manager.

Now we would need to duplicate a copy from xmlpserver.ear with the name btmreport.ear. And modify two files within the ear file.

xmlpserver.ear location: <BI_middleware_home>/Oracle_BI1/bifoundation/jee/xmlpserver.ear

Now duplicate another ear under the same location: <BI_middleware_home>/Oracle_BI1/bifoundation/jee/btmreport.ear

There are two files to be modified in btmreport.ear:

   (MODIFY 1)btmreport.ear\META-INF\application.xml

 Change From Change To
<display-name>xmlpserver</display-name>  <display-name>btmreport</display-name> 
<context-root>xmlpserver</context-root> <context-root>btmreport</context-root>

  (MODIFY 2)btmreport.ear\xmlpserver.war\WEB-INF\weblogic.xml

 Change From Change To
<cookie-path>/xmlpserver</cookie-path> <cookie-path>/btmreport</cookie-path>
<context-root>xmlpserver</context-root> <context-root>btmreport</context-root>

The reason for changes of these two files could be related to the oracle document : Read More on Web Applications from Oracle Doc

Step 2 Deploy the application under the same name bipublisher. Go to enterprise manager and deploy the application as below:

Input the location of the btmreport.ear. (This could be found in the previous step)

Deploy the application under the same target bi_cluster -> bi_server1

 Now we come to the deployment page.

The trick here is to put the name as bipublisher. That is why we have to undeploy bipublisher application firstly. Since it will not allow the same application name being created twice. And the consequence of not using bipulisher as the application deployment name is that you would not be able to have a complete xmlpserver login page(It showed as a blank blue page). I would assume in the BIP software, it is hardcoded somewhere to use bipulisher as the name.

Wait until the deployment finishes successfully, and then validate the new context root(In our case, it should be btmreport)

In order to validate the link, we could go back to application console and take a look at the new deployment details:

Go under the configuration of the deployment btmreport and go to testing to view all the links:

(By default the xmlpserver port should be 9704. In my envrionment, I set it to 9500)

Anyone knows how to keep xmlpserver undeployed but deploy a new btmreport application under bipublisher?

Export a table to csv file and import csv file into database as a table

Today, I would be talking about exporting a table to csv file. This method is especially useful for advanced data manipulation within the csv file and I would also talk about how to import the csv data back into the database as a table. I will be showing Java code snippet to explain importing the csv data and the tradeoff for using sql developer. My environment is based on oracle database and so that all the utility I would be using here is targeting oracle database.

Export a table to csv file:

Method 1. Use oracle sql developer. Please take a look at the video below:

Note: This is good for small table with not much data. However, if you are dealing with a large table, I would recommend you try method 2.

Method 2. Generate the csv file from command line. Here is a sample sql file I used to generate the  csv file.

set pause off
set echo off
set verify off
set heading off
set linesize 5000
set feedback off
set termout off
set term off spool FY11_276.csv
set colsep ','
set pagesize 0

spool off 

Note: You could notice that the highlighted select statement has a last column called: DEL_COL.This column is used to fill in the space after the column separator coma.Otherwise the csv file generated from the command line would have a huge last column filled with spaces.You might need to manually delete the column if you would use oracle sql developer to import the csv file back into database later on.

To be continued…

How to back up a table and import data from dump file

There are two approaches to back up a table:

1: Back up a table under the exsiting schema by creating a new table with tablename_bck nameing convention.

   Simply run the following query under the current schema :

   Creat table tablename_bck as select * from <tablename>;

2: Export the table to a dump file.

    Open a command line tool .Use Oracle utility tool expdp

expdp sample/samplepwd@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log

3: Import the dump file into database.

impdp sample/samplepwd@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log

More thoughts:

    I would also like to note about the old utility tool exp and imp.

    The syntax is slightly different. Without creating a reusable directory, in exp and imp, you have to specify explicitly of the directory where your dump file is saved to.

exp sample/samplepwd@db10g tables=EMP,DEPT file="C:\EMP_DEPT.dmp" log="C:\impdpEMP_DEPT.log"
imp sample/samplepwd@db10g tables=EMP,DEPT file="C:\EMP_DEPT.dmp" log="C:\impdpEMP_DEPT.log"

  Error: ORA-39143: dump file “M:\SAMPLE.dmp” may be an original export dump file


     The above problem happened whenever you try to use the Import Data Pump client (impdp) to import a dumpfile that was created with the original Export client (exp).